Skip to content

Enable errcheck and staticcheck linters #1361

@tomqin93

Description

@tomqin93

Is your feature request related to a problem? Please describe.

During the Go 1.25.5 upgrade (#1360), golangci-lint was upgraded from v1.x to v2.x. The new version has stricter default linters enabled (errcheck and staticcheck) that were not enforced before, resulting in 52 new lint errors:

  • errcheck (36 issues): Unchecked error return values
  • staticcheck (16 issues): Various static analysis suggestions

These linters are currently disabled to keep the Go version upgrade PR focused.

Describe the solution you'd like

Enable errcheck and staticcheck linters by removing them from the disable list in .golangci.yml and fixing all 52 issues across the codebase.

Files affected:

  • cmd/httpstub/powershellstub/powershellstub.go
  • cmd/httpstub/sshstub/sshstub.go
  • pkg/deviceshifu/deviceshifubase/deviceshifubase.go
  • pkg/deviceshifu/deviceshifuhttp/deviceshifuhttp.go
  • pkg/deviceshifu/deviceshifulwm2m/deviceshifulwm2m.go
  • pkg/deviceshifu/deviceshifumqtt/deviceshifumqtt.go
  • pkg/deviceshifu/deviceshifusocket/deviceshifusocket.go
  • pkg/deviceshifu/deviceshifutcp/deviceshifutcp.go
  • pkg/gateway/lwm2m/client/lwm2m.go
  • pkg/telemetryservice/sql/mysql/mysql.go
  • pkg/telemetryservice/sql/sqlserver/sqlserver.go
  • pkg/telemetryservice/sql/tdengine/tdengine.go
  • Various test files

Describe alternatives you've considered

  • Excluding specific paths (examples/, test files) - partially implemented
  • Using nolint directives - too verbose

Additional context

Reference: .golangci.yml has a TODO comment pointing to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions