You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with v1.55.0 we are seeing an error in our gitlab CI jobs on feature branches. We run golangci-lint in pipeline jobs using an alpine 3.17 image and have it compare the diff from main. The error message is:
WARN [runner] Can't process result by diff processor: can't prepare diff by revgrep: could not read git repo: error executing git diff "origin/main" "": exit status 129
If we pin version 1.54.2 the error goes away.
The version of git installed is: 2.38.5 - we also tried with 2.36.6.
Version of golangci-lint
$ golangci-lint --versiongolangci-lint has version v1.55.0 built with go1.21.3 from (unknown, mod sum: "h1:ePpc6YhM1ZV8kHU8dwmHDHAdeedZHdK8cmTXlkkRdi8=") on (unknown)
Configuration
# This file contains all available configuration options
# with their default values.
# options for analysis runningrun: # some linters don't work with go generics, but since we don't use go generics # we can safely disable 1.18 for now and force golangci-lint to run with 1.17 go: '1.17' # default concurrency is a available CPU number # concurrency: 4 # timeout for analysis, e.g. 30s, 5m, default is 1m timeout: 30m # exit code when at least one issue was found, default is 1 issues-exit-code: 1 # include test files or not, default is true tests: false # list of build tags, all linters use it. Default is empty list. # build-tags: # - mytag # which dirs to skip: issues from them won't be reported; # can use regexp here: generated.*, regexp is applied on full path; # default value is empty list, but default dirs are skipped independently # from this option's value (see skip-dirs-use-default). # skip-dirs: # - src/external_libs # - autogenerated_by_my_lib skip-dirs: - ".*/mocks$" - ".*/tests$" # default is true. Enables skipping of directories: # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ skip-dirs-use-default: true # which files to skip: they will be analyzed, but issues from them # won't be reported. Default value is empty list, but there is # no need to include all autogenerated files, we confidently recognize # autogenerated files. If it's not please let us know. # skip-files: # - ".*\\.my\\.go$" # - lib/bad.go # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": # If invoked with -mod=readonly, the go command is disallowed from the implicit # automatic updating of go.mod described above. Instead, it fails when any changes # to go.mod are needed. This setting is most useful to check that go.mod does # not need updates, such as in a continuous integration and testing system. # If invoked with -mod=vendor, the go command assumes that the vendor # directory holds the correct copies of dependencies and ignores # the dependency descriptions in go.mod. # modules-download-mode: readonly|release|vendor
# output configuration optionsoutput: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" format: line-number # print lines of code with issue, default is true print-issued-lines: true # print linter name in the end of issue text, default is true print-linter-name: true
# all available settings of specific linterslinters-settings: errcheck: # report about not checking of errors in type assetions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. check-type-assertions: true # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; # default is false: such cases aren't reported by default. check-blank: false # [deprecated] comma-separated list of pairs of the form pkg:regex # the regex is used to ignore names within pkg. (default "fmt:.*"). # see https://github.com/kisielk/errcheck#the-deprecated-method for details # ignore: fmt:.*,io/ioutil:^Read.* # path to a file containing a list of functions to exclude from checking # see https://github.com/kisielk/errcheck#excluding-functions for details # exclude: /path/to/file.txt # Disable error checking, as errorcheck detects more errors and is more configurable. gosec: excludes: - G104 - G304 config: gobal: # allow users to add #nosec comments nosec: false funlen: lines: 80 statements: 40 # report about shadowed variables check-shadowing: true # settings per analyzer settings: printf: # analyzer name, run `go tool vet help` to see all analyzers funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf # enable or disable analyzers by name # enable: # - atomicalign # enable-all: false # disable: # - shadow # disable-all: false # golint: # # minimal confidence for issues, default is 0.8 # min-confidence: 0.8 gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true #goimports: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes # local-prefixes: github.com/org/project gocyclo: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 30 gocognit: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 30 maligned: # print struct with more effective memory layout or not, false by default suggest-new: true dupl: # tokens count to trigger issue, 150 by default threshold: 200 goconst: # minimal length of string constant, 3 by default min-len: 3 # minimal occurrences count to trigger, 3 by default min-occurrences: 3 # depguard: # list-type: blocklist # include-go-root: false # packages: # - github.com/sirupsen/logrus # packages-with-error-messages: # # specify an error message to output when a blocklisted package is used # github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" misspell: # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. # Setting locale to US will correct the British spelling of 'colour' to 'color'. locale: US ignore-words: - GitLab lll: # max line length, lines longer will be reported. Default is 120. # '\t' is counted as 1 character by default, and can be changed with the tab-width option line-length: 120 # tab width in spaces. Default to 1. tab-width: 1 unused: # treat code as a program (not a library) and report unused exported identifiers; default is false. # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find funcs usages. All text editor integrations # with golangci-lint call it on a directory with the changed file. check-exported: false unparam: # Inspect exported functions, default is false. Set to true if no external program/library imports your code. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find external interfaces. All text editor integrations # with golangci-lint call it on a directory with the changed file. check-exported: false nakedret: # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 max-func-lines: 30 prealloc: # XXX: we don't recommend using this linter before doing performance profiling. # For most programs usage of prealloc will be a premature optimization. # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. # True by default. simple: true range-loops: true # Report preallocation suggestions on range loops, true by default for-loops: false # Report preallocation suggestions on for loops, false by default gocritic: # Which checks should be enabled; can't be combined with 'disabled-checks'; # See https://go-critic.github.io/overview#checks-overview # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` # By default list of stable checks is used. # enabled-checks: # - rangeValCopy # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty # disabled-checks: # - regexpMust # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". # enabled-tags: # - performance settings: # settings passed to gocritic captLocal: # must be valid enabled check name paramsOnly: true # rangeValCopy: # sizeThreshold: 32 godox: # report any comments starting with keywords, this is useful for TODO or FIXME comments that # might be left in the code accidentally and should be resolved before merging keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting - BUG - FIXME - OPTIMIZE # marks code that should be optimized before merging - HACK # marks hack-arounds that should be removed before merging dogsled: # checks assignments with too many blank identifiers; default is 2 max-blank-identifiers: 2 whitespace: multi-if: false # Enforces newlines (or comments) after every multi-line if statement multi-func: false # Enforces newlines (or comments) after every multi-line function signature wsl: # If true append is only allowed to be cuddled if appending value is # matching variables, fields or types on line above. Default is true. strict-append: true # Allow calls and assignments to be cuddled as long as the lines have any # matching variables, fields or types. Default is true. allow-assign-and-call: true # Allow multiline assignments to be cuddled. Default is true. allow-multiline-assign: true # Allow declarations (var) to be cuddled. allow-cuddle-declarations: false # Allow trailing comments in ending of blocks allow-trailing-comment: false # Force newlines in end of case at this limit (0 = never). force-case-trailing-whitespace: 0linters: # please, do not use `enable-all`: it's deprecated and will be removed soon. # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint disable-all: true enable: # - bodyclose # - depguard # - dogsled #- dupl - errcheck # - funlen # - gocognit - goconst - gocritic # - godox # - golint - gosec # - gosimple - govet - ineffassign # - interfacer # - misspell # - nakedret # - scopelint - staticcheck # - stylecheck - unconvert - unparam - unused # - whitespace # - wsl # don't enable: # - gochecknoglobals # - gochecknoinits # - gocyclo # - lll # - maligned # - prealloc # seems to struggle with embedding # - typecheckissues: # List of regexps of issue texts to exclude, empty list by default. # But independently from this option we use default exclude patterns, # it can be disabled by `exclude-use-default: false`. To list all # excluded by default patterns execute `golangci-lint run --help` # exclude: # - abcdef # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: # Exclude some linters from running on tests files. - path: _test\.go linters: - gocyclo - errcheck # - scopelint - dupl - gosec - funlen - gochecknoglobals # Exclude known linters from partially hard-vendored code, # which is impossible to exclude via "nolint" comments. # - path: internal/hmac/ # text: "weak cryptographic primitive" # linters: # - gosec # Exclude some staticcheck messages # - linters: # - staticcheck # text: "SA9003:" # Exclude lll issues for long lines with go:generate - linters: - lll source: "^//go:generate " # Independently from option `exclude` we use default exclude patterns, # it can be disabled by this option. To list all # excluded by default patterns execute `golangci-lint run --help`. # Default value for this option is true. exclude-use-default: false # Maximum issues count per one linter. Set to 0 to disable. Default is 50. max-issues-per-linter: 0 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. max-same-issues: 0 # Show only new issues: if there are unstaged changes or untracked files, # only those changes are analyzed, else only changes in HEAD~ are analyzed. # It's a super-useful option for integration of golangci-lint into existing # large codebase. It's not practical to fix all existing issues at the moment # of integration: much better don't allow issues in new code. # Default is false. new: false # Show only new issues created after git revision `REV` # This should be passed as flag during individual CI jobs. new-from-rev: origin/main # Show only new issues created in git patch with set file path. # new-from-patch: path/to/patch/file
Go environment
$ go version && go envgo version go1.21.3 linux/amd64GO111MODULE=''GOARCH='amd64'GOBIN=''GOCACHE='/root/.cache/go-build'GOENV='/root/.config/go/env'GOEXE=''GOEXPERIMENT=''GOFLAGS=''GOHOSTARCH='amd64'GOHOSTOS='linux'GOINSECURE=''GOMODCACHE='/go/pkg/mod'GONOPROXY='none'GONOSUMDB='our-ns'GOOS='linux'GOPATH='/go'GOPRIVATE='go.our-ns'GOPROXY='goproxy.our-ns'GOROOT='/usr/local/go'GOSUMDB='sum.golang.org'GOTMPDIR=''GOTOOLCHAIN='local'GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'GOVCS=''GOVERSION='go1.21.3'GCCGO='gccgo'GOAMD64='v1'AR='ar'CC='gcc'CXX='g++'CGO_ENABLED='0'GOMOD='/src/go.mod'GOWORK=''CGO_CFLAGS='-O2 -g'CGO_CPPFLAGS=''CGO_CXXFLAGS='-O2 -g'CGO_FFLAGS='-O2 -g'CGO_LDFLAGS='-O2 -g'PKG_CONFIG='pkg-config'GOGCCFLAGS='-fPIC -m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3465590546=/tmp/go-build -gno-record-gcc-switches'
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -vINFO [config_reader] Config search paths: [./ /src / /root]INFO [config_reader] Used config file .golangci.ymlINFO [lintersdb] Active 19 linters: [bodyclose dogsled errcheck funlen gocognit goconst gocritic godox gosec gosimple govet ineffassign misspell nakedret staticcheck stylecheck unconvert unparam unused]INFO [loader] Go packages loading at mode 575 (compiled_files|deps|exports_file|types_sizes|files|imports|name) took 224.922748msINFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.809732msINFO [linters_context/goanalysis] analyzers took 23.138943874s with top 10 stages: buildir: 17.351685948s, inspect: 1.200145294s, buildssa: 855.026623ms, fact_deprecated: 674.754654ms, printf: 524.591813ms, ctrlflow: 437.515595ms, fact_purity: 387.460884ms, nilness: 285.590216ms, typedness: 216.073697ms, SA5012: 194.816906msWARN [runner] Can't process result by diff processor: can't prepare diff by revgrep: could not read git repo: error executing git diff "origin/main" "": exit status 129INFO [runner/skip_dirs] Skipped 12 issues from dir deckard/mocks by pattern .*/mocks$INFO [runner/skip_dirs] Skipped 46 issues from dir deckard/rootstockd/mocks by pattern .*/mocks$INFO [runner] Issues before processing: 105, after processing: 45INFO [runner] Processors filtering stat (out/in): filename_unadjuster: 105/105, skip_dirs: 47/105, max_per_file_from_linter: 45/45, path_shortener: 45/45, cgo: 105/105, autogenerated_exclude: 47/47, nolint: 46/47, source_code: 45/45, fixer: 45/45, exclude: 47/47, exclude-rules: 47/47, sort_results: 45/45, max_from_linter: 45/45, severity-rules: 45/45, path_prefixer: 45/45, path_prettifier: 105/105, skip_files: 105/105, identifier_marker: 47/47, uniq_by_line: 45/46, max_same_issues: 45/45INFO [runner] processing took 9.932698ms with stages: diff: 4.939422ms, nolint: 3.120585ms, identifier_marker: 772.228µs, source_code: 404.478µs, path_prettifier: 346.078µs, autogenerated_exclude: 181.093µs, skip_dirs: 120.101µs, uniq_by_line: 11.186µs, path_shortener: 10.241µs, max_per_file_from_linter: 7.122µs, cgo: 6.665µs, exclude-rules: 6.08µs, filename_unadjuster: 4.067µs, max_same_issues: 934ns, fixer: 701ns, skip_files: 509ns, sort_results: 305ns, severity-rules: 303ns, max_from_linter: 268ns, exclude: 222ns, path_prefixer: 110nsINFO [runner] linters took 7.693829535s with stages: goanalysis_metalinter: 7.683604245s... snip ...INFO File cache stats: 74 entries of total size 207.6KiBINFO Memory: 81 samples, avg is 379.5MB, max is 631.4MBINFO Execution took 7.931052149s
A minimal reproducible example or link to a public repository
// add your code here
Validation
Yes, I've included all information above (version, config, etc.).
The text was updated successfully, but these errors were encountered:
Welcome
Description of the problem
Starting with v1.55.0 we are seeing an error in our gitlab CI jobs on feature branches. We run golangci-lint in pipeline jobs using an alpine 3.17 image and have it compare the diff from main. The error message is:
If we pin version 1.54.2 the error goes away.
The version of git installed is:
2.38.5
- we also tried with2.36.6
.Version of golangci-lint
Configuration
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
// add your code here
Validation
The text was updated successfully, but these errors were encountered: