devspace icon indicating copy to clipboard operation
devspace copied to clipboard

Document how to correctly run golangci-lint locally

Open Andrioden opened this issue 1 year ago • 2 comments

Is your feature request related to a problem?

A PR lint workflow failed, i tried to reproduce it locally, but it did not work.

The following did not work

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
golangci-lint run --out-format=github-actions -v --config=.golangci.yml --max-same-issues=50

-> Output

PS C:\Projects\devspace> golangci-lint run --out-format=github-actions -v --config=.golangci.yml --max-same-issues=50
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 12 linters: [deadcode dupl errcheck gosimple govet ineffassign misspell nakedret staticcheck stylecheck unused varcheck]"
level=info msg="[loader] Go packages loading at mode 575 (files|imports|types_sizes|compiled_files|deps|exports_file|name) took 9.8366286s"
level=info msg="[linters_context/goanalysis] analyzers took 1m45.9672126s with top 10 stages: buildir: 51.7788415s, dupl: 4.1313428s, misspell: 1.4886116s, errcheck: 1.1631494s, S1038: 960.5159ms, directives: 945.1225ms, nilness: 844.5928ms, isgenerated: 825.3409ms, printf: 812.9065ms, fact_deprecated: 805.8216ms"
level=info msg="[runner/skip_dirs] Skipped 1 issues from dir docs\\hack\\cli by pattern hack\\\\"
level=info msg="[runner/skip_dirs] Skipped 8 issues from dir docs\\hack\\util by pattern hack\\\\"
level=info msg="[runner] Issues before processing: 680, after processing: 1"
level=info msg="[runner] Processors filtering stat (out/in): path_prefixer: 1/1, cgo: 680/680, path_prettifier: 680/680, identifier_marker: 665/665, uniq_by_line: 1/1, max_per_file_from_linter: 1/1, max_same_issues: 1/1, skip_files: 680/680, skip_dirs: 671/680, autogenerated_exclude: 665/671, exclude-rules: 3/665, max_from_linter: 1/1, path_shortener: 1/1, diff: 1/1, sort_results: 1/1, filename_unadjuster: 680/680, exclude: 665/665, nolint: 1/3, source_code: 1/1, severity-rules: 1/1, fixer: 1/1"
level=info msg="[runner] processing took 452.7028ms with stages: path_prettifier: 361.6131ms, autogenerated_exclude: 54.9658ms, exclude-rules: 14.9249ms, identifier_marker: 12.7095ms, skip_dirs: 6.3056ms, nolint: 2.1839ms, cgo: 0s, skip_files: 0s, fixer: 0s, uniq_by_line: 0s, max_same_issues: 0s, sort_results: 0s, filename_unadjuster: 0s, exclude: 0s, path_shortener: 0s, source_code: 0s, max_per_file_from_linter: 0s, diff: 0s, max_from_linter: 0s, severity-rules: 0s, path_prefixer: 0s"
level=info msg="[runner] linters took 12.3403525s with stages: goanalysis_metalinter: 11.8866484s"
::error file=pkg/devspace/plugin/installer.go,line=63,col=11::Error return value of `repo.Pull` is not checked (errcheck)
level=info msg="File cache stats: 257 entries of total size 1.5MiB"
level=info msg="Memory: 219 samples, avg is 691.4MB, max is 2501.2MB"
level=info msg="Execution took 22.5668368s

I would expect it to mention Error: Error return value of `repo.Pull` is not checked (errcheck)

Which solution do you suggest?

Update CONTRIBUTING.md

12. Format your code: `go fmt ./...`
13. Run lint
    1. Install linter: https://golangci-lint.run/usage/install/#local-installation
    2. ???
    3. Run `golangci-lint run --out-format=github-actions -v --config=.golangci.yml --max-same-issues=50`
14. Commit changes *([Please refer the commit message conventions](https://www.conventionalcommits.org/en/v1.0.0/))*

Andrioden avatar Feb 05 '24 09:02 Andrioden

Hey @Andrioden, thanks for opening this issue.

I would expect it to mention Error: Error return value of repo.Pull is not checked (errcheck)

But isn't it mentioned in the 4th last line from your output?

::error file=pkg/devspace/plugin/installer.go,line=63,col=11::Error return value of `repo.Pull` is not checked (errcheck)

Update CONTRIBUTING.md

That sounds great to me. Could you create a PR with this update?

ThomasK33 avatar Feb 05 '24 11:02 ThomasK33

Embarrassing, your right. I didnt notice it since it came out differently locally.

Sure I can create a PR later, just need to get a different PR from my current devspace fork (which is a mess) approved and merged, so i can recreate the fork.

Andrioden avatar Feb 05 '24 14:02 Andrioden