Is it a bad convention to overwrite err variable?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • errcheck

    errcheck checks that you checked errors.

  • You should be using golangci-lint, because all serious Go programmers should. golangci-lint contains errcheck, which will detect if you overwrite an error without having done something with it in the meantime. I consider this one of the most important linters (this doesn't just detect things that may sorta kinda someday turn into bugs, this quite likely is a bug RIGHT NOW), and it helps you have the confidence you can overwrite errors as you go and don't need to keep allocating new ones.

  • golangci-lint

    Fast linters Runner for Go

  • You should be using golangci-lint, because all serious Go programmers should. golangci-lint contains errcheck, which will detect if you overwrite an error without having done something with it in the meantime. I consider this one of the most important linters (this doesn't just detect things that may sorta kinda someday turn into bugs, this quite likely is a bug RIGHT NOW), and it helps you have the confidence you can overwrite errors as you go and don't need to keep allocating new ones.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts