Skip to content

New Extra Check: Avoid fmt.Print(), fmt.Printf(), fmt.Println() Usage #235

Open
@bflad

Description

@bflad

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Providers that want to output information for informational or debugging purposes should use the log package or appropriate equivalent. Plugins that perform plaintext writing to stdout may have unexpected logging results. Sometimes this type of output is also only temporarily intended by the developer, making it extraneous for production usage.

We can report on this via code implementation of fmt.Print, fmt.Printf, and fmt.Println selectors or call expressions.

New Extra Checks

  • XR009, XR010, XR011

Flagged Provider Code

fmt.Print("got here")

fmt.Printf("input: %s", input)

fmt.Println("got here")

var fmtPrint = fmt.Print

fmtPrint("got here")

Passing Provider Code

// no usage

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions