Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bflad opened this issue Mar 31, 2021 · 0 comments
Open

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

bflad opened this issue Mar 31, 2021 · 0 comments
Labels
ast AST Handling check/resource Resource Check new-check New Lint Check

Comments

@bflad
Copy link
Owner

bflad commented Mar 31, 2021

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
@bflad bflad added ast AST Handling new-check New Lint Check check/resource Resource Check labels Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast AST Handling check/resource Resource Check new-check New Lint Check
Projects
None yet
Development

No branches or pull requests

1 participant