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

depguard linter emits alert #3116

Closed
4 tasks done
jerome-laforge opened this issue Aug 20, 2022 · 15 comments · Fixed by #3186
Closed
4 tasks done

depguard linter emits alert #3116

jerome-laforge opened this issue Aug 20, 2022 · 15 comments · Fixed by #3186
Labels
bug Something isn't working dependencies Relates to an upstream dependency

Comments

@jerome-laforge
Copy link

jerome-laforge commented Aug 20, 2022

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

With golangci/golangci-lint:v1.48 docker image (works fine with golangci/golangci-lint:v1.47 docker image), depguard linter emits those alerts:

xxxx: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"

xxxx `github.com/davecgh/go-spew/spew` is in the denylist (depguard)
        "github.com/davecgh/go-spew/spew"
...
...

I don't have those errors, when I run golangci-lint with binary of course with the same version of docker image (i.e. v1.38) (fetched by arch package https://aur.archlinux.org/packages/golangci-lint-bin).

Of course, I don't put this package into my .golangci.yml, plz find the extract for depguard:

  depguard:
    list-type: blacklist
    include-go-root: true
    packages:
      - io/ioutil
      - math/rand
      - golang.org/x/net/context
      - github.com/satori/go.uuid
      - gopkg.in/go-playground/assert.v1
      - github.com/magiconair/properties/assert
      - github.com/globalsign/mgo
      - github.com/globalsign/mgo/bson

I run golangci/golangci-lint:v1.48 docker image within makefile:

linter:
	mkdir -p /tmp/.cache_golint
	docker run -it --rm -e GOLANGCI_LINT_CACHE=/tmp/.cache -v ${HOME}/go:/go -v /tmp/.cache_golint:/tmp/.cache -v  $(CURDIR):/app -w /app golangci/golangci-lint:${LINTERVERSION} sh -c "/usr/bin/golangci-lint run"

Version of golangci-lint

v1.48

Configuration file

$ cat .golangci.yml


# This file contains all available configuration options
# with their default values.

# options for analysis running
run:
  # default concurrency is a available CPU number
  #  concurrency: 4

  # timeout for analysis, e.g. 30s, 5m, default is 1m
  deadline: 20m

  # 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: true

  # list of build tags, all linters use it. Default is empty list.
  build-tags:
  #    - mytag


  # 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:
    - .*_pie.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 options
output:
  # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
  format: colored-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 linters
linters-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: false

    # 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
  govet:
    # 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
    # run `go tool vet help` to see all analyzers
    enable-all: true
    disable:
      - composites
      - fieldalignment
      - shadow

  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: 10
  dupl:
    # tokens count to trigger issue, 150 by default
    threshold: 100
  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: blacklist
    include-go-root: true
    packages:
      - io/ioutil
      - math/rand
      - golang.org/x/net/context
      - github.com/satori/go.uuid
      - gopkg.in/go-playground/assert.v1
      - github.com/magiconair/properties/assert
      - github.com/globalsign/mgo
      - github.com/globalsign/mgo/bson

  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:
    #      - someword
    #  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: true # 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

  forbidigo:
    # Forbid the following identifiers
    forbid:
      - ^fmt\.Print(|f|ln)$
      - ^spew\.Dump$
      - ^spew\.Print(|f|ln)$

linters:
  enable-all: true
  disable:
    - asciicheck
    - containedctx
    - contextcheck
    - cyclop
    - dupl
    - durationcheck
    - exhaustive
    - exhaustivestruct
    - exhaustruct
    - forcetypeassert
    - funlen
    - gci
    - gochecknoglobals
    - gochecknoinits
    - gocognit
    - goconst
    - gocritic
    - gocyclo
    - godot
    - godox
    - goerr113
    - gofumpt
    - golint
    - gomnd
    - interfacer
    - ireturn
    - lll
    - maintidx
    - maligned
    - misspell
    - nakedret
    - nestif
    - nlreturn
    - noctx
    - nonamedreturns
    - nosnakecase
    - paralleltest
    - revive
    - scopelint
    - staticcheck
    - stylecheck
    - tagliatelle
    - testpackage
    - thelper
    - varnamelen
    - wrapcheck
    - wsl
  disable-all: false
  fast: false


issues:

  # 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-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`
  #  new-from-rev: REV

  # Show only new issues created in git patch with set file path.
#  new-from-patch: path/to/patch/file

Go environment

$ go version && go env
go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/user/dev/OM/MYPROJECT/bin"
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org"
GOROOT="/home/user/sdk/go1.19"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/sdk/go1.19/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/dev/OM/MYPROJECT/src/myproject/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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build684505404=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

xxxx: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"

xxxx `github.com/davecgh/go-spew/spew` is in the denylist (depguard)
        "github.com/davecgh/go-spew/spew"

Code example or link to a public repository

It is just an import

@jerome-laforge jerome-laforge added the bug Something isn't working label Aug 20, 2022
@ldez
Copy link
Member

ldez commented Aug 20, 2022

Hello,

I am not able to reproduce your problem.

.golangci.yml
linters:
  disable-all: true
  enable:
    - typecheck
    - depguard

linters-settings:
  depguard:
    list-type: blacklist
    include-go-root: true
    packages:
      - io/ioutil
      - math/rand
      - golang.org/x/net/context
      - github.com/satori/go.uuid
      - gopkg.in/go-playground/assert.v1
      - github.com/magiconair/properties/assert
      - github.com/globalsign/mgo
      - github.com/globalsign/mgo/bson
code
package main

import (
	"fmt"

	"github.com/davecgh/go-spew/spew"
)

func main() {
	spew.Dump()
	fmt.Println("")
}
run
$ docker run -it --rm -e GOLANGCI_LINT_CACHE=/tmp/.cache \
-v /tmp/.cache_golint:/tmp/.cache \
-v $(pwd):/app \
-w /app \
golangci/golangci-lint:v1.48.0 golangci-lint run -v
INFO [config_reader] Config search paths: [./ /app / /root] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 2 linters: [depguard typecheck] 
INFO [loader] Go packages loading at mode 575 (deps|imports|name|compiled_files|exports_file|files|types_sizes) took 220.586703ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 70.809µs 
INFO [linters context/goanalysis] analyzers took 31.174µs with top 10 stages: depguard: 24.911µs, typecheck: 6.263µs 
INFO [runner] processing took 2.276µs with stages: max_same_issues: 356ns, nolint: 277ns, max_from_linter: 169ns, skip_dirs: 156ns, cgo: 138ns, exclude: 138ns, filename_unadjuster: 131ns, autogenerated_exclude: 129ns, path_prettifier: 124ns, skip_files: 123ns, uniq_by_line: 122ns, max_per_file_from_linter: 119ns, path_shortener: 46ns, severity-rules: 40ns, identifier_marker: 37ns, source_code: 37ns, sort_results: 35ns, diff: 35ns, path_prefixer: 33ns, exclude-rules: 31ns 
INFO [runner] linters took 20.349801ms with stages: goanalysis_metalinter: 20.327703ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 4 samples, avg is 54.5MB, max is 54.5MB 
INFO Execution took 245.859459ms 

@ldez ldez added the feedback required Requires additional feedback label Aug 20, 2022
@jerome-laforge
Copy link
Author

jerome-laforge commented Aug 20, 2022

I am not also able to reproduce my problem with your example.
I try to find an minimal problematic example that I can give it here but I didn't find it until now...

I copy the verbose result with -v (I just mask the sensible stuffs by xxx) below if it can help (but I didn't found a clue into verbose result)

INFO [config_reader] Config search paths: [./ /app / /root]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 48 linters: [asasalint bidichk bodyclose deadcode decorder depguard dogsled errcheck errchkjson errname errorlint execinquery exportloopref forbidigo gofmt goheader goimports gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper ifshort importas ineffassign makezero nilerr nilnil nolintlint nosprintfhostport prealloc predeclared promlinter rowserrcheck sqlclosecheck structcheck tenv tparallel typecheck unconvert unparam unused usestdlibvars varcheck wastedassign whitespace]
INFO [loader] Go packages loading at mode 575 (compiled_files|deps|exports_file|imports|name|files|types_sizes) took 30.817705555s
WARN [runner] The linter 'ifshort' is deprecated (since v1.48.0) due to: The repository of the linter has been deprecated by the owner.
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 135.478736ms
INFO [linters context] importas settings found, but no aliases listed. List aliases under alias: key.
INFO [linters context/goanalysis] analyzers took 0s with no stages
WARN [linters context] rowserrcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] sqlclosecheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
WARN [linters context] wastedassign is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
INFO [runner/skip dirs] Skipped 50 issues from dir xxx by pattern xxx$
INFO [runner/skip dirs] Skipped 739 issues from dir xxx by pattern xxx$
INFO [runner/skip dirs] Skipped 149 issues from dir xxx by pattern xxx$
INFO [runner/max_from_linter] 81/131 issues from linter depguard were hidden, use --max-issues-per-linter
INFO [runner] Issues before processing: 2808, after processing: 50
INFO [runner] Processors filtering stat (out/in): max_per_file_from_linter: 131/131, max_from_linter: 50/131, path_shortener: 50/50, severity-rules: 50/50, path_prettifier: 2808/2808, skip_files: 2716/2808, skip_dirs: 1778/2716, max_same_issues: 131/131, path_prefixer: 50/50, sort_results: 50/50, cgo: 2808/2808, filename_unadjuster: 2808/2808, exclude: 1253/1266, diff: 131/131, source_code: 50/50, autogenerated_exclude: 1266/1778, identifier_marker: 1266/1266, exclude-rules: 1253/1253, nolint: 131/1253, uniq_by_line: 131/131
INFO [runner] processing took 219.874494ms with stages: nolint: 154.460296ms, identifier_marker: 27.870681ms, exclude: 15.91581ms, skip_files: 9.203905ms, path_prettifier: 4.401575ms, autogenerated_exclude: 3.394312ms, skip_dirs: 3.050357ms, source_code: 1.108126ms, cgo: 253.957µs, filename_unadjuster: 123.874µs, uniq_by_line: 52.775µs, max_from_linter: 18.678µs, path_shortener: 10.653µs, max_per_file_from_linter: 6.797µs, max_same_issues: 1.298µs, sort_results: 362ns, diff: 357ns, exclude-rules: 297ns, severity-rules: 249ns, path_prefixer: 135ns
INFO [runner] linters took 498.332443ms with stages: goanalysis_metalinter: 278.305577ms, rowserrcheck: 22.942µs, sqlclosecheck: 10.145µs, wastedassign: 9.474µs, structcheck: 6.651µs
xxx.go:12:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:16:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:12:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:8:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:10:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:11:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:14:2: `github.com/davecgh/go-spew/spew` is in the denylist (depguard)
        "github.com/davecgh/go-spew/spew"
        ^
xxx.go:12:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:10:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:12:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:7:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:9:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:4:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:7:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:7:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:16:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/davecgh/go-spew/spew` is in the denylist (depguard)
        "github.com/davecgh/go-spew/spew"
        ^
xxx.go:9:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:16:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:14:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:9:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:16:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:9:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:17:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:9:2: `github.com/emersion/go-smtp` is in the denylist (depguard)
        "github.com/emersion/go-smtp"
        ^
xxx.go:10:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:15:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:16:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:13:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:8:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:16:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:17:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
xxx.go:8:2: `github.com/gin-gonic/gin` is in the denylist (depguard)
        "github.com/gin-gonic/gin"
        ^
INFO File cache stats: 48 entries of total size 726.5KiB
INFO Memory: 316 samples, avg is 53.6MB, max is 91.9MB
INFO Execution took 31.464009067s
make: *** [Makefile:14 : linter] Erreur 1

@jerome-laforge
Copy link
Author

FYI, I produce this problem on my personal dev computer and also on our gitlab ci

@ldez
Copy link
Member

ldez commented Aug 20, 2022

I need something to reproduce it.

have you tried golangci-lint cache clean?

@jerome-laforge
Copy link
Author

Is it equivalent to delete the $GOLANGCI_LINT_CACHE directory?

@ldez
Copy link
Member

ldez commented Aug 20, 2022

yes, it's equivalent.

Can you provide your full configuration file?
can you also check that don't have multiple golangci-lint configuration files (TOML, YAML, ...)

@jerome-laforge
Copy link
Author

jerome-laforge commented Aug 20, 2022

yes, it's equivalent.

In this case, I test it

Can you provide your full configuration file?

Unfortunately not. But the difference with the initial provided configuration file is:

  • skip-dirs (generated code that doesn't match linters requirments)
  • skip-files on one file that doesn't also match linters requirments
  • exclude pattern

can you also check that don't have multiple golangci-lint configuration files (TOML, YAML, ...)

I have once. I also tested with

find . | grep ".golangci." | wc -l
1

By the way, If I multiple golangci-lint configuration files, I did have the same behavior with v1.37, didn't it?
Because, I have just changed the ${LINTERVERSION} used by the makefile

@ldez
Copy link
Member

ldez commented Aug 20, 2022

I'm confused: you talk about v1.38, v1.37, v1.48, v1.47. It's not clear.

There no change around depguard since a long time https://github.com/OpenPeeDeeP/depguard

@ldez
Copy link
Member

ldez commented Aug 20, 2022

did you have a .depguard.json file?

@ldez ldez added question Further information is requested and removed bug Something isn't working labels Aug 20, 2022
@jerome-laforge
Copy link
Author

jerome-laforge commented Aug 20, 2022

I'm confused: you talk about v1.38, v1.37, v1.48, v1.47. It's not clear.

sorry for the typo, I am talking about v1.47

did you have a .depguard.json file?

No, I didn't

I will try to debug on my side, if you have a clue, then don't hesitate to give me.
And if I won't find the root cause or example as workaround, then I will disable depguard linter.

@ldez
Copy link
Member

ldez commented Aug 21, 2022

Maybe it's related to OpenPeeDeeP/depguard#24, OpenPeeDeeP/depguard#25, and OpenPeeDeeP/depguard#23

@jerome-laforge
Copy link
Author

I remember back that I have already this error sometime with previous error (and it disappears if after clearing cache or restarting computer, I don't remember exactly).
Initially, I think that error was related with latest version of golanglint-ci but I have also upgraded to Go 1.19 and this error becomes more prevalent.
So from my point of view, it is related to OpenPeeDeeP/depguard#25

@ldez ldez added bug Something isn't working dependencies Relates to an upstream dependency and removed question Further information is requested feedback required Requires additional feedback labels Aug 21, 2022
@ldez ldez changed the title with golangci/golangci-lint:v1.48 docker image, depguard linter emits alert depguard linter emits alert Sep 3, 2022
@ldez ldez closed this as completed in #3186 Sep 3, 2022
LukeShu added a commit to emissary-ingress/emissary that referenced this issue Sep 21, 2022
@jerome-laforge
Copy link
Author

This fix, is it embed with v1.50.0?

@ldez
Copy link
Member

ldez commented Oct 4, 2022

You have to test it and validate that.
In theory, it's fixed.

@jerome-laforge
Copy link
Author

OK, as I didn't see this issue into the changelog.
It seems fixed as I can no longer reproduce it with the v1.50.0.

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.

2 participants