Skip to content

v1.53.1 Depguard error #3877

Closed
Closed
@piotratlz

Description

@piotratlz

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 (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)

Description of the problem

Issue occurs on golangci github action with standard configuration and latest version

run golangci-lint
  Running [/home/runner/golangci-lint-1.53.1-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
    Error: import 'github.com/google/wire' is not allowed from list 'Main' (depguard)

Version of golangci-lint

$ golangci-lint --version
v1.53.1

Configuration file

$ cat .golangci.yml
go: "1.20"
linters:
  disable-all: true
  enable:
    - bodyclose
    - contextcheck
    - depguard
    - dogsled
    - dupl
    - errcheck
    - errname
    - exhaustive
    - exportloopref
    - funlen
    - gochecknoinits
    - goconst
    - gocritic
    - gocyclo
    - gofmt
    - goimports
    - gosec
    - gosimple
    - govet
    - ineffassign
    - makezero
    - misspell
    - nakedret
    - nilnil
    - paralleltest
    - staticcheck
    - stylecheck
    - typecheck
    - unconvert
    - unparam
    - unused
run:
  timeout: 5m
  skip-files:
    - .*/ent/.*
    - .*/mocks/.*
    - \\_gen.go$
  modules-download-mode: readonly
issues:
  exclude-rules:
    - path: .*_test.go
      linters:
        - funlen
        - gosec
        - dupl

Go environment

$ go version && go env
go version go1.20.4 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/runner/.cache/go-build"
GOENV="/home/runner/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/runner/go/pkg/mod"
GONOPROXY="<hidden>"
GONOSUMDB="<hidden>"
GOOS="linux"
GOPATH="/home/runner/go"
GOPRIVATE="<hidden>"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/hostedtoolcache/go/1.20.4/x64"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/hostedtoolcache/go/1.20.4/x64/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/runner/work/<hidden>/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 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build354993[7](<hidden>)465=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
Running [/home/runner/golangci-lint-1.53.1-linux-amd64/golangci-lint run --out-format=github-actions -v] in [] ...
  Error: import 'github.com/google/uuid' is not allowed from list 'Main' (depguard)

  level=info msg="[config_reader] Config search paths: [./ /home/runner/work/<hidden> /home/runner/work/<hidden> /home/runner/work /home/runner /home /]"
  level=info msg="[config_reader] Used config file .golangci.yml"
  level=info msg="[lintersdb] Active 34 linters: [bodyclose contextcheck depguard dogsled dupl errcheck errname exhaustive exportloopref funlen gochecknoinits goconst gocritic gocyclo gofmt goimports gosec gosimple govet ineffassign makezero misspell nakedret nilerr nilnil paralleltest prealloc reassign staticcheck stylecheck typecheck unconvert unparam unused]"
  level=info msg="[loader] Go packages loading at mode 575 (exports_file|files|imports|name|compiled_files|deps|types_sizes) took 959.823517ms"
  level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 88.256865ms"
  level=info msg="[linters_context/goanalysis] analyzers took 0s with no stages"
  level=info msg="[runner/max_same_issues] 73/76 issues with text \"import 'github.com/google/uuid' is not allowed from list 'Main'\" were hidden, use --max-same-issues"
  level=info msg="[runner/max_from_linter] 110/160 issues from linter depguard were hidden, use --max-issues-per-linter"
  level=info msg="[runner] Issues before processing: 1974, after processing: 50"
  level=info msg="[runner] Processors filtering stat (out/in): path_prefixer: 50/50, cgo: 1974/1974, filename_unadjuster: 1974/1974, autogenerated_exclude: 1050/1084, exclude: 1050/1050, max_per_file_from_linter: 770/770, max_same_issues: 160/770, source_code: 50/50, sort_results: 50/50, path_prettifier: 1974/1974, severity-rules: 50/50, skip_files: 1084/1974, max_from_linter: 50/160, fixer: 50/50, skip_dirs: 1084/1084, identifier_marker: 1050/1050, exclude-rules: 778/1050, nolint: 770/778, uniq_by_line: 770/770, diff: 770/770, path_shortener: 50/50"
  level=info msg="[runner] processing took 116.557204ms with stages: nolint: 41.601002ms, exclude-rules: 39.012171ms, identifier_marker: 19.613237ms, path_prettifier: 5.953472ms, skip_files: 5.618668ms, autogenerated_exclude: 2.929035ms, skip_dirs: 506.706µs, max_same_issues: 399.704µs, source_code: 389.204µs, cgo: 173.602µs, uniq_by_line: 165.001µs, filename_unadjuster: 113.501µs, max_per_file_from_linter: 41.4µs, max_from_linter: 21.701µs, path_shortener: 17.1µs, exclude: 400ns, fixer: 400ns, diff: 300ns, severity-rules: 200ns, path_prefixer: 200ns, sort_results: 200ns"
  level=info msg="[runner] linters took 2.009183852s with stages: goanalysis_metalinter: 1.892501544s"
  level=info msg="File cache stats: 12 entries of total size 139.6KiB"
  level=info msg="Memory: 32 samples, avg is 48.5MB, max is 92.9MB"
  level=info msg="Execution took 3.064274417s"
  
  Error: issues found
  Ran golangci-lint in 3177ms

Code example or link to a public repository

// add your code here

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions