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

v1.47.0 regression with gci linter #2982

Closed
4 tasks done
invidian opened this issue Jul 18, 2022 · 7 comments · Fixed by #2984
Closed
4 tasks done

v1.47.0 regression with gci linter #2982

invidian opened this issue Jul 18, 2022 · 7 comments · Fixed by #2984
Labels
bug Something isn't working dependencies Relates to an upstream dependency

Comments

@invidian
Copy link
Contributor

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

It seem using v1.47.0 docker image in GitHub action now fails: https://github.com/flexkube/libflexkube/runs/7389828332?check_suite_focus=true

golangci-lint run ./...
level=warning msg="[runner] Can't run linter goanalysis_metalinter: gci: 1:1: expected 'package', found 'EOF'"
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: gci: 1:1: expected 'package', found 'EOF'\n\n"

Running locally and running gci linter independently works fine:

go run github.com/daixiang0/gci@v0.4.2 --section 'standard,default,prefix(github.com/flexkube/libflexkube)' diff $(find -name *.go | tr \\n ' '; echo)

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.47.0 built from b4154027 on 2022-07-18T11:32:14Z

Configuration file

$ cat .golangci.yml
output:
  sort-results: true

run:
  timeout: 10m
  build-tags:
    - e2e
    - integration

issues:
  exclude-use-default: false
  max-same-issues: 0
  max-issues-per-linter: 0
  exclude-rules:
    # False positive: https://github.com/kunwardeep/paralleltest/issues/8.
    - linters:
        - paralleltest
      text: "does not use range value in test Run"
    - linters:
        - godot
      source: "(front proxy CA certificate,|certificate, as recommended by)"
    # Allow packages to print output to the user until we introduce loggers.
    - linters:
        - forbidigo
      text: "use of `fmt.Printf` forbidden by pattern"
    - linters:
        - forbidigo
      text: "use of `fmt.Println` forbidden by pattern"
    # Allow some errors to be not wrapped, as it is not ambiguous where they come from.
    - linters:
        - wrapcheck
      text: "error returned from external package is unwrapped"
    # Allow wrapping function which return errors.
    - linters:
        - wrapcheck
      text: "error returned from interface method should be wrapped"
    # Allow certain abbreviations in JSON fields for better readability.
    - linters:
        - tagliatelle
      text: "(CIDR|CA|DNS|API|CN|SSH).+(Cidr|Ca|Dns|Api|Cn|Ssh)"
    # Allow shadowing 'err' variables as this is convention. Other shadowing should still be avoided.
    - linters:
        - govet
      text: "shadow: declaration of \"err\" shadows declaration at line"
    # Allow using snake case for test and example names for better readability, as those functions are not called
    # directly by anyone anyway.
    - linters:
        - nosnakecase
      text: "^(Test_|Example)"

linters-settings:
  errcheck:
    check-type-assertions: true
    check-blank: true
  gci:
    sections:
      - standard
      - default
      - prefix(github.com/flexkube/libflexkube)
  godot:
    capital: true
  gofumpt:
    extra-rules: true
  govet:
    enable-all: true
    disable:
      - fieldalignment
  nolintlint:
    allow-leading-space: false
    require-explanation: true
    require-specific: true
  wsl:
    force-err-cuddling: true

linters:
  disable:
    # Triggers on TODOs in the code, which is fine to put.
    - godox
    # Disabled until tests are split and moved to the right file names.
    - testpackage
    # Disabled until we implement some error types and migrate to use them.
    - goerr113
    # To be able to make use of Go zero-value feature.
    - exhaustivestruct
    - exhaustruct
    # To allow defensive approach when initializing structs.
    - ireturn
    # Panics in v1.46.1
    - execinquery
    # This linter has been deprecated.
    - golint
    - interfacer
    - maligned
  enable:
    - asasalint
    - asciicheck
    - bidichk
    - bodyclose
    - containedctx
    - contextcheck
    - cyclop
    - deadcode
    - decorder
    - depguard
    - dogsled
    - dupl
    - durationcheck
    - errcheck
    - errchkjson
    - errname
    - errorlint
    - exhaustive
    - exportloopref
    - forbidigo
    - forcetypeassert
    - funlen
    - gci
    - gochecknoglobals
    - gochecknoinits
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    - godot
    - gofmt
    - gofumpt
    - goheader
    - goimports
    - gomnd
    - gomoddirectives
    - gomodguard
    - goprintffuncname
    - grouper
    - ifshort
    - importas
    - ineffassign
    - lll
    - maintidx
    - makezero
    - misspell
    - nakedret
    - nestif
    - nilerr
    - nilnil
    - nlreturn
    - noctx
    - nolintlint
    - nonamedreturns
    - nosnakecase
    - nosprintfhostport
    - paralleltest
    - prealloc
    - predeclared
    - promlinter
    - revive
    - rowserrcheck
    - sqlclosecheck
    - structcheck
    - stylecheck
    - tagliatelle
    - tenv
    - thelper
    - tparallel
    - typecheck
    - unconvert
    - unparam
    - varcheck
    - varnamelen
    - wastedassign
    - whitespace
    - wrapcheck
    - wsl

Go environment

$ go version && go env
go version go1.18.4 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/invidian/.cache/go-build"
GOENV="/home/invidian/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/invidian/.cache/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/invidian/.cache/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/invidian/repos/libflexkube/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build687876676=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

Code example or link to a public repository

// add your code here
@invidian invidian added the bug Something isn't working label Jul 18, 2022
@ldez
Copy link
Member

ldez commented Jul 18, 2022

Hello,

I confirm, I'm working on.

@ldez
Copy link
Member

ldez commented Jul 18, 2022

are you able to reproduce that locally?

Because I have the same problem with Github Action, but not locally.

@whs
Copy link

whs commented Jul 18, 2022

Got this also, on a private GitLab CI instance.

Cleaning GitLab CI cache doesn't solve it. I can't reproduce it locally either, even with the same Docker image used (but not the same environment variables, etc.)

edit: I'd like to add that we use go install to install golangci-lint, as we use plugins

@invidian
Copy link
Contributor Author

are you able to reproduce that locally?

No, unfortunately not. Running locally seem fine. I've tried dropping caches as well and it still works as expected.

@pmalek
Copy link

pmalek commented Jul 18, 2022

I've got the same issue: https://github.com/Kong/gateway-operator/runs/7390384872?check_suite_focus=true

Also can't reproduce locally (neither on Mac M1, nor in an arm64 linux VM)

@ldez
Copy link
Member

ldez commented Jul 18, 2022

The problem will be fixed by #2984

@mrz1836
Copy link

mrz1836 commented Jul 18, 2022

I've got the same issue as well. Thanks for already working on it!

@ldez ldez added the dependencies Relates to an upstream dependency label Jul 18, 2022
detro pushed a commit to hashicorp/terraform-plugin-sdk that referenced this issue Jul 19, 2022
This is necessary until a fix for golangci/golangci-lint#2982 is released.
It should come with v1.4.8 of golangci-lint.
invidian added a commit to invidian/libflexkube that referenced this issue Jul 19, 2022
v1.47.0 has a bug and it did not work on CI:
golangci/golangci-lint#2982

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Relates to an upstream dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants