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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade golangci-lint in Makefile to support toolchain directive #1389

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hangpark
Copy link

What's changed?

  • The previous version (1.53.2) was behind the version (1.55.2) used in GitHub Actions.
  • This caused issues with parsing the toolchain directive in go.mod.
  • Additionally, correct the PHONY directive for make install.

Before & After

$ go version
go version go1.22.5 darwin/arm64

With version 1.53.2

$ make lint
--- lint all the things
level=info msg="[config_reader] Config search paths: [./ /app / /root]"
level=info msg="[config_reader] Used config file .golangci.yaml"
level=info msg="[lintersdb] Active 8 linters: [errcheck goimports gosimple govet ineffassign staticcheck typecheck unused]"
level=info msg="[loader] Go packages loading at mode 575 (imports|name|compiled_files|deps|exports_file|files|types_sizes) took 12.611667ms"
level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: errors parsing go.mod:\n/app/go.mod:3: invalid go version '1.21.0': must match format 1.23\n/app/go.mod:5: unknown directive: toolchain\n"
level=info msg="Memory: 2 samples, avg is 22.5MB, max is 22.6MB"
level=info msg="Execution took 14.768209ms"
make: *** [lint] Error 3

After upgrade version to 1.55.2

$ make lint
--- lint all the things
level=info msg="[config_reader] Config search paths: [./ /app / /root]"
level=info msg="[config_reader] Used config file .golangci.yaml"
level=info msg="[lintersdb] Active 7 linters: [errcheck goimports gosimple govet ineffassign staticcheck unused]"
level=info msg="[loader] Go packages loading at mode 575 (files|name|deps|exports_file|imports|types_sizes|compiled_files) took 13.42876934s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 16.938083ms"
level=info msg="[linters_context/goanalysis] analyzers took 11.461038284s with top 10 stages: buildir: 5.694025389s, goimports: 431.35729ms, inspect: 423.431545ms, fact_deprecated: 410.214001ms, ctrlflow: 255.992416ms, printf: 246.518339ms, isgenerated: 221.661997ms, S1038: 145.601414ms, ineffassign: 122.390001ms, errcheck: 120.113542ms"
level=info msg="[runner] Issues before processing: 52, after processing: 0"
level=info msg="[runner] Processors filtering stat (out/in): filename_unadjuster: 52/52, skip_files: 52/52, exclude: 50/50, path_prettifier: 52/52, autogenerated_exclude: 50/52, identifier_marker: 50/50, cgo: 52/52, skip_dirs: 52/52, exclude-rules: 0/50"
level=info msg="[runner] processing took 1.762294ms with stages: autogenerated_exclude: 1.334334ms, identifier_marker: 251.875µs, path_prettifier: 68.709µs, exclude-rules: 58.416µs, skip_dirs: 43.083µs, cgo: 1.875µs, filename_unadjuster: 791ns, nolint: 584ns, max_same_issues: 417ns, fixer: 417ns, exclude: 334ns, diff: 250ns, uniq_by_line: 209ns, skip_files: 167ns, source_code: 167ns, severity-rules: 166ns, sort_results: 166ns, max_from_linter: 125ns, path_prefixer: 84ns, max_per_file_from_linter: 83ns, path_shortener: 42ns"
level=info msg="[runner] linters took 2.521004917s with stages: goanalysis_metalinter: 2.519204125s"
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 161 samples, avg is 81.2MB, max is 490.0MB"
level=info msg="Execution took 15.969207298s"

The previous version (1.53.2) was behind the version (1.55.2) used in GitHub Actions.
This caused issues with parsing the `toolchain` directive in `go.mod`.

Additionally, correct the PHONY directive for `make install`.

**Before & After**

```sh
$ go version
go version go1.22.5 darwin/arm64
```

**With version 1.53.2**

```sh
$ make lint
--- lint all the things
level=info msg="[config_reader] Config search paths: [./ /app / /root]"
level=info msg="[config_reader] Used config file .golangci.yaml"
level=info msg="[lintersdb] Active 8 linters: [errcheck goimports gosimple govet ineffassign staticcheck typecheck unused]"
level=info msg="[loader] Go packages loading at mode 575 (imports|name|compiled_files|deps|exports_file|files|types_sizes) took 12.611667ms"
level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: errors parsing go.mod:\n/app/go.mod:3: invalid go version '1.21.0': must match format 1.23\n/app/go.mod:5: unknown directive: toolchain\n"
level=info msg="Memory: 2 samples, avg is 22.5MB, max is 22.6MB"
level=info msg="Execution took 14.768209ms"
make: *** [lint] Error 3
```

**After upgrade version to 1.55.2**

```sh
$ make lint
--- lint all the things
level=info msg="[config_reader] Config search paths: [./ /app / /root]"
level=info msg="[config_reader] Used config file .golangci.yaml"
level=info msg="[lintersdb] Active 7 linters: [errcheck goimports gosimple govet ineffassign staticcheck unused]"
level=info msg="[loader] Go packages loading at mode 575 (files|name|deps|exports_file|imports|types_sizes|compiled_files) took 13.42876934s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 16.938083ms"
level=info msg="[linters_context/goanalysis] analyzers took 11.461038284s with top 10 stages: buildir: 5.694025389s, goimports: 431.35729ms, inspect: 423.431545ms, fact_deprecated: 410.214001ms, ctrlflow: 255.992416ms, printf: 246.518339ms, isgenerated: 221.661997ms, S1038: 145.601414ms, ineffassign: 122.390001ms, errcheck: 120.113542ms"
level=info msg="[runner] Issues before processing: 52, after processing: 0"
level=info msg="[runner] Processors filtering stat (out/in): filename_unadjuster: 52/52, skip_files: 52/52, exclude: 50/50, path_prettifier: 52/52, autogenerated_exclude: 50/52, identifier_marker: 50/50, cgo: 52/52, skip_dirs: 52/52, exclude-rules: 0/50"
level=info msg="[runner] processing took 1.762294ms with stages: autogenerated_exclude: 1.334334ms, identifier_marker: 251.875µs, path_prettifier: 68.709µs, exclude-rules: 58.416µs, skip_dirs: 43.083µs, cgo: 1.875µs, filename_unadjuster: 791ns, nolint: 584ns, max_same_issues: 417ns, fixer: 417ns, exclude: 334ns, diff: 250ns, uniq_by_line: 209ns, skip_files: 167ns, source_code: 167ns, severity-rules: 166ns, sort_results: 166ns, max_from_linter: 125ns, path_prefixer: 84ns, max_per_file_from_linter: 83ns, path_shortener: 42ns"
level=info msg="[runner] linters took 2.521004917s with stages: goanalysis_metalinter: 2.519204125s"
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 161 samples, avg is 81.2MB, max is 490.0MB"
level=info msg="Execution took 15.969207298s"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant