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

Improve golangci-lint usage #25157

Merged
merged 3 commits into from May 1, 2023
Merged

Improve golangci-lint usage #25157

merged 3 commits into from May 1, 2023

Conversation

joestringer
Copy link
Member

@joestringer joestringer commented Apr 27, 2023

  • .github: Add line output to golangci-lint
  • .github: Verbosely print golangci-lint output
  • .github: Use tree /vendor for golangci-lint

Related: #25155

This should help with debugging issues reported by golangci-lint by
printing the file and line number.

Signed-off-by: Joe Stringer <joe@cilium.io>
Allegedly this should give us tracing information in order to debug why
this action is taking so long.

Signed-off-by: Joe Stringer <joe@cilium.io>
@joestringer joestringer added the release-note/ci This PR makes changes to the CI. label Apr 27, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot added dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. and removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Apr 27, 2023
@joestringer joestringer added the dont-merge/preview-only Only for preview or testing, don't merge it. label Apr 27, 2023
@joestringer
Copy link
Member Author

OK, with 57b4a95 it seems to generate much more usable output now:

Running [/home/runner/golangci-lint-1.52.2-linux-amd64/golangci-lint run --out-format=github-actions --out-${NO_FUTURE}format colored-line-number --verbose] in [] ...
  Error: daemon/cmd/daemon.go:286:6: func `unusedFunction` is unused (unused)
  func unusedFunction() {
       ^
  
  level=info msg="[config_reader] Config search paths: [./ /home/runner/work/cilium/cilium /home/runner/work/cilium /home/runner/work /home/runner /home /]"
  level=info msg="[config_reader] Used config file .golangci.yaml"
  level=info msg="[lintersdb] Active 10 linters: [goerr113 gofmt goheader goimports gosec govet ineffassign misspell staticcheck unused]"
  level=info msg="[loader] Go packages loading at mode 575 (deps|name|types_sizes|compiled_files|exports_file|files|imports) took 5m36.265047123s"
  level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 549.86584ms"
  level=info msg="[linters_context/goanalysis] analyzers took 20m[19](https://github.com/cilium/cilium/actions/runs/4814957952/jobs/8573182801?pr=25157#step:4:21).0186168s with top 10 stages: buildir: 9m4.903047954s, buildssa: 3m49.413886833s, goheader: 3m2.576389326s, goimports: 58.287376638s, nilness: 19.379284378s, gofmt: 17.172725288s, unused: 12.043143062s, gosec: 11.106144502s, misspell: 10.043033797s, inspect: 9.292417646s"
  level=info msg="[runner] Issues before processing: 3396, after processing: 1"
  level=info msg="[runner] Processors filtering stat (out/in): path_prefixer: 1/1, sort_results: 1/1, identifier_marker: 1924/1924, max_same_issues: 1/1, source_code: 1/1, severity-rules: 1/1, max_from_linter: 1/1, skip_files: 3364/3364, skip_dirs: 3364/3364, nolint: 1/5, uniq_by_line: 1/1, exclude-rules: 5/1924, max_per_file_from_linter: 1/1, fixer: 1/1, cgo: 3364/3396, filename_unadjuster: 3364/3364, path_prettifier: 3364/3364, autogenerated_exclude: 1924/3364, exclude: 1924/1924, diff: 1/1, path_shortener: 1/1"
  level=info msg="[runner] processing took 338.08251ms with stages: autogenerated_exclude: 217.856269ms, identifier_marker: 49.009213ms, exclude-rules: 32.223477ms, path_prettifier: 31.398181ms, skip_dirs: 3.769085ms, nolint: 3.209588ms, cgo: 285.499µs, filename_unadjuster: 210.099µs, source_code: 108.099µs, uniq_by_line: 4.4µs, max_same_issues: 2.4µs, max_from_linter: 1.1µs, path_shortener: 1.1µs, skip_files: 1µs, exclude: 900ns, fixer: 500ns, max_per_file_from_linter: 500ns, diff: 300ns, sort_results: 300ns, severity-rules: 300ns, path_prefixer: 200ns"
  level=info msg="[runner] linters took 3m9.50643171s with stages: goanalysis_metalinter: 3m9.1681977s"
  level=info msg="File cache stats: 2630 entries of total size 15.9MiB"
  level=info msg="Memory: 4573 samples, avg is 796.8MB, max is 4704.7MB"
  level=info msg="Execution took 8m46.333588747s"
  
  Error: issues found
  Ran golangci-lint in 5[26](https://github.com/cilium/cilium/actions/runs/4814957952/jobs/8573182801?pr=25157#step:4:28)681ms

Suggested-by: Casey Callendrello <cdc@isovalent.com>
Signed-off-by: Joe Stringer <joe@cilium.io>
@joestringer joestringer marked this pull request as ready for review April 27, 2023 17:34
@joestringer joestringer requested review from a team as code owners April 27, 2023 17:34
@joestringer joestringer removed the dont-merge/preview-only Only for preview or testing, don't merge it. label Apr 27, 2023
@joestringer joestringer merged commit 9f2b72c into main May 1, 2023
43 checks passed
@joestringer joestringer deleted the pr/joe/improve-golangci-lint branch May 1, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/ci This PR makes changes to the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants