Skip to content

depguard hangs when using go 1.11 with modules #291

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

Closed
bbatha opened this issue Nov 14, 2018 · 3 comments
Closed

depguard hangs when using go 1.11 with modules #291

bbatha opened this issue Nov 14, 2018 · 3 comments

Comments

@bbatha
Copy link

bbatha commented Nov 14, 2018

Thank you for creating the issue!

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)

cb5d1da

  1. Config file: cat .golangci.yml
[run]
deadline = "240s"
tests = true
skip-dirs = ["vendor$", "smoketests/node"]
skip-files = [".*/pkg/mod/.*$"]

[linters-settings.depguard]
list-type = "blacklist"
include-go-root = false
packages = [
    "github.com/pkg/errors", # should only be used by our errors package
    "github.com/Sirupsen/logrus", # canonical package is sirupsen/logrus note lowercase
    "errors",
    "golang.org/x/net/context",
]

[linters]
disable-all = true
enable = [
    "govet",
    "errcheck",
    "staticcheck",
    "unused",
    "gosimple",
    "structcheck",
    "ineffassign",
    "varcheck",
    "deadcode",
    "typecheck",

    # disabled by default linters
    "golint",
    # "gas", # disabled too many false positives because of the way we handle sql strings :(
    "interfacer",
    "unconvert",
    "dupl",
    # "goconst", # too many false postives especially in tests
    "gocyclo",
    #"goimports", # to many files failing on this check because the imports are spaced wrong
    "maligned",
    "depguard",
    "misspell",
    # "lll", # TODO enable with ~160 there are a lot of tests with really long strings blocking this though
    "unparam",
    "nakedret",
    "prealloc",
]
  1. Go environment: go version && go env
go version go1.11.2 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/bbatha/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/bbatha/go"
GOPROXY=""
GORACE=""
GOROOT="/home/user/bbatha/.linuxbrew/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/home/user/bbatha/.linuxbrew/Cellar/go/1.11.2/libexec/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc-5"
CXX="g++-5"
CGO_ENABLED="1"
GOMOD="/home/user/bbatha/projects/cid/api/go.mod"
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-build951659879=/tmp/go-build -gno-record-gcc-switches"
  1. Verbose output of running: golangci-lint run -v

With depguard:

: bbatha@unixdeva22:[api]; time golangci-lint --verbose --config .golangci-lint.toml run ./...
INFO [config_reader] Used config file .golangci-lint.toml
INFO Gocritic enabled checks: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef unlambda unslice defaultCaseOrder]
INFO [lintersdb] Active 19 linters: [deadcode depguard dupl errcheck gocyclo golint govet ineffassign interfacer maligned megacheck misspell nakedret prealloc structcheck typecheck unconvert unparam varcheck]
INFO [loader] Go packages loading at mode load deps types and syntax took 7.448827139s
INFO [loader] SSA repr building timing: packages building 51.534133ms, total 1.671083312s
INFO [loader] SSA for megacheck repr building timing: packages building 71.172749ms, total 1.897580427s
INFO [runner] worker.46 took 52.381µs
INFO [runner] worker.49 took 5.845µs
INFO [runner] worker.9 took 5.82µs
INFO [runner] worker.53 took 5.297µs
INFO [runner] worker.26 took 519.241µs
INFO [runner] worker.51 took 13.551µs
INFO [runner] worker.16 took 7.1µs
INFO [runner] worker.55 took 4.252µs
INFO [runner] worker.10 took 8.542µs
INFO [runner] worker.29 took 6.616µs
INFO [runner] worker.32 took 5.566µs
INFO [runner] worker.56 took 780.774µs
INFO [runner] worker.17 took 93.358µs
INFO [runner] worker.7 took 7.921µs
INFO [runner] worker.20 took 6.728µs
INFO [runner] worker.19 took 7.38µs
INFO [runner] worker.21 took 4.043µs
INFO [runner] worker.23 took 5.537µs
INFO [runner] worker.50 took 986.605µs
INFO [runner] worker.41 took 1.457998ms
INFO [runner] worker.4 took 2.770893ms
INFO [runner] worker.2 took 45.687µs
INFO [runner] worker.40 took 469.495µs
INFO [runner] worker.42 took 656.921µs
INFO [runner] worker.47 took 134.181µs
INFO [runner] worker.48 took 920.258µs
INFO [runner] worker.28 took 6.110674ms
INFO [runner] worker.3 took 5.648463ms
INFO [runner] worker.6 took 6.2147ms
INFO [runner] worker.36 took 6.754354ms
INFO [runner] worker.13 took 4.613671ms
INFO [runner] worker.14 took 329.622µs
INFO [runner] worker.25 took 7.631378ms
INFO [runner] worker.54 took 4.721275ms
INFO [runner] worker.27 took 8.91886ms
INFO [runner] worker.11 took 71.145µs
INFO [runner] worker.44 took 38.896104ms with stages: gocyclo: 38.83766ms
INFO [runner] worker.5 took 40.363011ms
INFO [runner] worker.12 took 41.962574ms
INFO [runner] worker.35 took 46.840032ms with stages: unconvert: 46.70683ms, typecheck: 42.274µs
INFO [runner] worker.37 took 47.068023ms with stages: errcheck: 46.745356ms
INFO [runner] worker.18 took 49.467253ms with stages: prealloc: 49.360451ms
INFO [runner] worker.24 took 49.924784ms with stages: nakedret: 49.853354ms
INFO [runner] worker.34 took 51.562633ms with stages: maligned: 51.503493ms
INFO [runner] worker.31 took 58.067342ms with stages: structcheck: 58.023866ms
INFO [runner] worker.39 took 150.912569ms with stages: varcheck: 150.649504ms
INFO [runner] worker.8 took 158.142993ms with stages: deadcode: 157.805478ms
INFO [runner] worker.33 took 771.607096ms with stages: ineffassign: 771.539396ms
INFO [runner] worker.43 took 830.51751ms with stages: misspell: 830.471215ms
INFO [runner] worker.45 took 1.058277847s with stages: govet: 1.058217936s
INFO [runner] worker.52 took 1.417232462s with stages: interfacer: 1.417176965s
INFO [runner] worker.38 took 1.79468724s with stages: dupl: 1.794627496s
INFO [runner] worker.30 took 2.668286076s with stages: unparam: 2.668231393s
INFO [runner] worker.15 took 5.250726761s with stages: golint: 5.250691921s
INFO [runner] worker.1 took 6.789862385s with stages: megacheck: 6.789843552s
INFO Memory: 2398 samples, avg is 1883.2MB, max is 1962.7MB
INFO Execution took 4m0.000204609s
INFO [runner] worker.22 took 10m15.57874253s with stages: depguard: 10m15.578707261s
INFO [runner] Workers idle times: #1: 10m8.789279998s, #2: 10m15.572924772s, #3: 10m15.571763576s, #4: 10m15.575741609s, #5: 10m15.537659476s, #6: 10m15.571531484s, #7: 10m15.577241278s, #8: 10m15.420554282s, #9: 10m15.577655403s, #10: 10m15.577497415s, #11: 10m15.566908959s, #12: 10m15.535570447s, #13: 10m15.570808666s, #14: 10m15.57024118s, #15: 10m10.328022068s, #16: 10m15.577564975s, #17: 10m15.577253757s, #18: 10m15.52918513s, #19: 10m15.577174847s, #20: 10m15.57720959s, #21: 10m15.577139559s, #23: 10m15.577106463s, #24: 10m15.528155126s, #25: 10m15.569850664s, #26: 10m15.577613046s, #27: 10m15.56891196s, #28: 10m15.571958439s, #29: 10m15.577456976s, #30: 10m12.910512632s,
#31: 10m15.520339831s, #32: 10m15.57731859s, #33: 10m14.804933791s, #34: 10m15.526980335s, #35: 10m15.531723539s, #36: 10m15.571398885s, #37: 10m15.531708487s, #38: 10m13.783851006s, #39: 10m15.427627826s, #40: 10m15.572712048s,
#41: 10m15.576248048s, #42: 10m15.572535854s, #43: 10m14.748082432s, #44: 10m15.539742551s, #45: 10m14.520494365s, #46: 10m15.577726251s, #47: 10m15.572191405s, #48: 10m15.572150394s, #49: 10m15.577687956s, #50: 10m15.577060131s, #51: 10m15.577572712s, #52: 10m14.161486248s, #53: 10m15.577622805s, #54: 10m15.569467176s, #55: 10m15.577518994s, #56: 10m15.577292488s
INFO [runner] processing took 82.849512ms with stages: exclude: 43.599283ms, nolint: 14.025441ms, skip_dirs: 10.848099ms, autogenerated_exclude: 5.544135ms, cgo: 5.073717ms, path_prettifier: 1.938685ms, skip_files: 1.807274ms, diff: 2.625µs, source_code: 2.42µs, max_same_issues: 1.865µs, path_shortener: 1.574µs, max_from_linter: 1.542µs, uniq_by_line: 1.507µs, max_per_file_from_linter: 1.345µs
ERRO Deadline exceeded: try increase it by passing --deadline option

Without:

time golangci-lint --verbose --config .golangci-lint.toml run ./...
INFO [config_reader] Used config file .golangci-lint.toml
INFO Gocritic enabled checks: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef unlambda unslice defaultCaseOrder]
INFO [lintersdb] Active 18 linters: [deadcode dupl errcheck gocyclo golint govet ineffassign interfacer maligned megacheck misspell nakedret prealloc structcheck typecheck unconvert unparam varcheck]
INFO [loader] Go packages loading at mode load deps types and syntax took 6.038630596s
INFO [loader] SSA repr building timing: packages building 114.399983ms, total 1.856187301s
INFO [loader] SSA for megacheck repr building timing: packages building 49.093564ms, total 1.803757745s
INFO [runner] worker.47 took 9.921µs
INFO [runner] worker.48 took 5.246µs
INFO [runner] worker.49 took 5.805µs
INFO [runner] worker.50 took 4.189µs
INFO [runner] worker.51 took 5.202µs
INFO [runner] worker.44 took 9.055µs
INFO [runner] worker.42 took 5.997µs
INFO [runner] worker.36 took 10.24µs
INFO [runner] worker.8 took 13.776µs
INFO [runner] worker.2 took 5.614µs
INFO [runner] worker.3 took 4.46µs
INFO [runner] worker.4 took 4.323µs
INFO [runner] worker.5 took 4.04µs
INFO [runner] worker.6 took 4.086µs
INFO [runner] worker.7 took 4.301µs
INFO [runner] worker.11 took 4.694µs
INFO [runner] worker.9 took 4.447µs
INFO [runner] worker.40 took 6.398µs
INFO [runner] worker.10 took 3.906µs
INFO [runner] worker.22 took 4.95µs
INFO [runner] worker.16 took 4.295µs
INFO [runner] worker.17 took 3.988µs
INFO [runner] worker.18 took 4.122µs
INFO [runner] worker.19 took 3.975µs
INFO [runner] worker.20 took 4.16µs
INFO [runner] worker.21 took 4.046µs
INFO [runner] worker.13 took 3.983µs
INFO [runner] worker.12 took 4.003µs
INFO [runner] worker.54 took 12.395µs
INFO [runner] worker.53 took 5.055µs
INFO [runner] worker.26 took 8.787µs
INFO [runner] worker.23 took 5.016µs
INFO [runner] worker.24 took 4.274µs
INFO [runner] worker.25 took 5.449µs
INFO [runner] worker.39 took 10.390253ms with stages: nakedret: 10.356257ms
INFO [runner] worker.28 took 7.308µs
INFO [runner] worker.27 took 4.631µs
INFO [runner] worker.29 took 4.522µs
INFO [runner] worker.35 took 10.631444ms with stages: prealloc: 10.613983ms
INFO [runner] worker.14 took 6.973µs
INFO [runner] worker.55 took 7.107µs
INFO [runner] worker.43 took 12.999344ms with stages: maligned: 12.981929ms
INFO [runner] worker.38 took 13.926274ms with stages: unconvert: 13.913048ms
INFO [runner] worker.46 took 16.075705ms with stages: errcheck: 16.063451ms
INFO [runner] worker.34 took 31.963269ms with stages: structcheck: 31.947135ms
INFO [runner] worker.31 took 36.164634ms with stages: gocyclo: 36.140978ms
INFO [runner] worker.56 took 51.691345ms with stages: deadcode: 51.64056ms, typecheck: 11.646µs
INFO [runner] worker.32 took 55.519422ms with stages: varcheck: 55.495698ms
INFO [runner] worker.33 took 208.229757ms with stages: misspell: 208.208641ms
INFO [runner] worker.41 took 410.154626ms with stages: ineffassign: 410.132384ms
INFO [runner] worker.37 took 501.346157ms with stages: govet: 501.315573ms
INFO [runner] worker.15 took 850.731787ms with stages: interfacer: 850.711474ms
INFO [runner] worker.52 took 943.290408ms with stages: dupl: 943.265783ms
INFO [runner] worker.30 took 2.317098151s with stages: unparam: 2.317066908s
INFO [runner] worker.45 took 4.712658375s with stages: golint: 4.712635238s
INFO [runner] worker.1 took 6.641936989s with stages: megacheck: 6.64191266s
INFO [runner] Workers idle times: #2: 6.632384429s, #3: 6.632360056s, #4: 6.632336554s, #5: 6.632313429s, #6: 6.632290534s, #7: 6.632266855s, #8: 6.63241275s, #9: 6.632154178s, #10: 6.632129444s, #11: 6.632178766s, #12: 6.6319254
01s, #13: 6.631949619s, #14: 6.629749475s, #15: 5.790675557s, #16: 6.632089565s, #17: 6.632066352s, #18: 6.632043257s, #19: 6.632020566s, #20: 6.631996307s, #21: 6.631973705s, #22: 6.632112994s, #23: 6.631375153s, #24: 6.63135047
1s, #25: 6.631325073s, #26: 6.631402301s, #27: 6.630810495s, #28: 6.630836607s, #29: 6.630785437s, #30: 4.324552592s, #31: 6.605193173s, #32: 6.585795094s, #33: 6.433181419s, #34: 6.609309719s, #35: 6.630759417s, #36: 6.63708082s
, #37: 6.140331041s, #38: 6.627353876s, #39: 6.630909072s, #40: 6.632147189s, #41: 6.23032695s, #42: 6.637376468s, #43: 6.628348484s, #44: 6.637408159s, #45: 1.92900137s, #46: 6.625115745s, #47: 6.639622435s, #48: 6.639582692s, #49: 6.639552285s, #50: 6.639516222s, #51: 6.639488849s, #52: 5.69809577s, #53: 6.631420483s, #54: 6.63145052s, #55: 6.629635309s, #56: 6.589624132s
INFO [runner] processing took 96.477275ms with stages: exclude: 35.309965ms, nolint: 19.148611ms, autogenerated_exclude: 17.652486ms, skip_files: 9.379728ms, skip_dirs: 8.568423ms, cgo: 4.83888ms, path_prettifier: 1.566329ms, sou
rce_code: 2.477µs, diff: 2.344µs, max_same_issues: 1.966µs, path_shortener: 1.623µs, uniq_by_line: 1.596µs, max_from_linter: 1.487µs, max_per_file_from_linter: 1.36µs
INFO Memory: 162 samples, avg is 967.6MB, max is 2091.7MB
INFO Execution took 16.424173468s

real    0m16.960s
user    0m42.411s
sys     0m8.270s

Without depguard linting our project takes around 17s. With depguard the lint process times out after several minutes.

@ghost
Copy link

ghost commented Apr 29, 2019

There are a no. of bugs with golangci-lint relating to deadline exceeded. Disbling depguard fixes all of them.

@jirfag
Copy link
Contributor

jirfag commented Jun 9, 2019

Hi! It looks like a bug in depguard. I've made the issue. Please, make a new issue to update depguard when it will be fixed.

@jirfag jirfag closed this as completed Jun 9, 2019
@jirfag
Copy link
Contributor

jirfag commented Jun 9, 2019

As a workaround, you can set include-go-root: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants