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

WARN [runner/golint] Golint: can't lint 5 files: no file name for file #755

Closed
daixiang0 opened this issue Sep 27, 2019 · 8 comments
Closed
Labels
bug Something isn't working feedback required Requires additional feedback
Milestone

Comments

@daixiang0
Copy link
Contributor

daixiang0 commented Sep 27, 2019

You can run with below cmd to reproduce:

git clone https://github.com/daixiang0/loki.git $GOPATH/src/github.com/loki
git checkout lint-bug
docker run -it -v $GOPATH/src/github.com/grafana/loki:/go/src/github.com/grafana/loki grafana/loki-build-image:0.6.0 lint

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
    golangci-lint has version 1.17.1 built from 4ba2155 on 2019-06-10T09:06:49Z

  2. Config file: cat .golangci.yml
    https://github.com/daixiang0/loki/blob/lint-bug/.golangci.yml

  3. Go environment: go version && go env

go version go1.12.9 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/go/cache"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build389554688=/tmp/go-build -gno-record-gcc-switches"

  1. Verbose output of running: golangci-lint run -v
# docker run -it -v /go/src/github.com/grafana/loki:/go/src/github.com/grafana/loki grafana/loki-build-image:0.6.0 lint
make: Entering directory '/go/src/github.com/grafana/loki'
GO111MODULE=on GOGC=10 golangci-lint run -v
INFO [config_reader] Config search paths: [./ /go/src/github.com/grafana/loki /go/src/github.com/grafana /go/src/github.com /go/src /go /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 18 linters: [deadcode errcheck goconst gofmt goimports golint gosimple govet ineffassign interfacer misspell staticcheck structcheck typecheck unconvert unparam unused varcheck] 
INFO [lintersdb] Optimized sublinters [staticcheck gosimple unused] into metalinter megacheck 
INFO [loader] Go packages loading at mode load types and syntax took 37.870239616s 
INFO [loader] SSA repr building timing: packages building 514.548614ms, total 7.342077289s 
WARN [runner/golint] Golint: can't lint 5 files: no file name for file &{Doc:<nil> Package:53941166 Name:main Decls:[0xc04bd5a5c0 0xc04bd5a640 0xc04bd5e8a0 0xc04bd5a7c0 0xc04bd5a840 0xc04bd5a880 0xc04bd5aac0 0xc04bd5fa70] Scope:scope 0xc04bd38b90 {
	const kvPairFormat
	type config
	func parseConfig
	var defaultClientCfg
	type ConfigGetter
	type format
	const jsonFormat
}
 Imports:[0xc04bd5e570 0xc04bd5e5a0 0xc04bd5e5d0 0xc04bd5e600 0xc04bd5e630 0xc04bd5e660 0xc04bd5e690 0xc04bd5e6c0 0xc04bd5e6f0 0xc04bd5e720 0xc04bd5e750 0xc04bd5e780 0xc04bd5e7b0] Unresolved:[client flagext string string int iota client logging string string bool string error flagext nil nil errors strconv nil nil fmt time time strconv nil nil fmt logql nil nil make model model model lokiflag logging nil nil fmt strings strings false true nil fmt nil fmt ioutil nil nil fmt json nil nil fmt nil nil] Comments:[0xc04bd571a0]} 
INFO [runner/filename_unadjuster] Unadjusted from /go/src/github.com/grafana/loki/pkg/logql/pkg/logql/expr.y:30 to /go/src/github.com/grafana/loki/pkg/logql/expr.y.go:36:7 
INFO [runner] worker.2 took 1m0.478254777s with stages: govet: 23.192408148s, golint: 12.075625295s, goimports: 11.10705779s, gofmt: 4.109383123s, misspell: 2.96978566s, interfacer: 2.550979455s, ineffassign: 2.17585406s, unparam: 1.514612422s, deadcode: 207.786484ms, unconvert: 167.653783ms, varcheck: 154.318145ms, errcheck: 92.324096ms, structcheck: 86.693751ms, goconst: 73.589026ms, typecheck: 8.628µs 
INFO [runner] worker.1 took 1m9.646873511s with stages: megacheck: 1m9.646851752s 
INFO [runner] Workers idle times: #2: 9.130332667s 
INFO [runner] Issues before processing: 804, after processing: 0 
INFO [runner] processing took 426.13951ms with stages: identifier_marker: 201.834987ms, exclude: 150.765971ms, nolint: 50.504264ms, skip_dirs: 13.729654ms, autogenerated_exclude: 3.994737ms, cgo: 2.47854ms, path_prettifier: 1.461182ms, filename_unadjuster: 1.325683ms, skip_files: 9.718µs, diff: 6.268µs, exclude-rules: 5.971µs, path_shortener: 4.093µs, source_code: 4µs, max_same_issues: 3.958µs, uniq_by_line: 3.904µs, max_from_linter: 3.6µs, max_per_file_from_linter: 2.98µs 
INFO File cache stats: 178 entries of total size 7.1MiB 
INFO Memory: 199 samples, avg is 983.3MB, max is 4167.0MB 
INFO Execution took 1m55.43423078s     
@daixiang0
Copy link
Contributor Author

daixiang0 commented Sep 27, 2019

The warn does not provide useful info, i really do not know how to fix.

@daixiang0
Copy link
Contributor Author

@@jirfag mind have a look?

@tpounds
Copy link
Contributor

tpounds commented Oct 1, 2019

@daixiang0 Is it possible you can narrow the issue down to a single file and include the contents of it here? That will help make debugging the issue much easier.

@tpounds tpounds added bug Something isn't working feedback required Requires additional feedback labels Oct 1, 2019
@daixiang0
Copy link
Contributor Author

@tpounds the issue happen under /go/src/github.com/grafana/loki/cmd/fluent-bit:

root@93fa30352374:/go/src/github.com/grafana/loki/cmd/fluent-bit# GO111MODULE=on golangci-lint run -v
INFO [config_reader] Config search paths: [./ /go/src/github.com/grafana/loki/cmd/fluent-bit /go/src/github.com/grafana/loki/cmd /go/src/github.com/grafana/loki /go/src/github.com/grafana /go/src/github.com /go/src /go /] 
INFO [config_reader] Used config file ../../.golangci.yml 
INFO [lintersdb] Active 18 linters: [deadcode errcheck goconst gofmt goimports golint gosimple govet ineffassign interfacer misspell staticcheck structcheck typecheck unconvert unparam unused varcheck] 
INFO [lintersdb] Optimized sublinters [staticcheck gosimple unused] into metalinter megacheck 
INFO [loader] Go packages loading at mode load types and syntax took 8.210420848s 
INFO [loader] SSA repr building timing: packages building 71.106917ms, total 695.814622ms 
WARN [runner/golint] Golint: can't lint 5 files: no file name for file &{Doc:<nil> Package:26448103 Name:main Decls:[0xc026a04280 0xc026a04300 0xc0281d7170 0xc026a04480 0xc026a04500 0xc026a04540 0xc026a04780 0xc028143b30] Scope:scope 0xc02874eb50 {
	var defaultClientCfg
	type ConfigGetter
	type format
	const jsonFormat
	const kvPairFormat
	type config
	func parseConfig
}
 Imports:[0xc0281d6960 0xc0281d6a20 0xc0281d6ab0 0xc0281d6b40 0xc0281d6bd0 0xc0281d6c30 0xc0281d6c90 0xc0281d6d50 0xc0281d6e10 0xc0281d6e40 0xc0281d6ea0 0xc0281d6ed0 0xc0281d6f30] Unresolved:[client flagext string string int iota client logging string string bool string error flagext nil nil errors strconv nil nil fmt time time strconv nil nil fmt logql nil nil make model model model lokiflag logging nil nil fmt strings strings false true nil fmt nil fmt ioutil nil nil fmt json nil nil fmt nil nil] Comments:[0xc01351ede0]} 
INFO [runner] worker.1 took 3.101129592s with stages: govet: 2.408139383s, interfacer: 258.617007ms, unparam: 163.402019ms, misspell: 124.313041ms, goimports: 63.261509ms, gofmt: 59.989845ms, unconvert: 12.569973ms, ineffassign: 5.835889ms, varcheck: 1.612257ms, deadcode: 1.124076ms, errcheck: 1.024293ms, structcheck: 524.108µs, goconst: 353.539µs, golint: 241.695µs, typecheck: 14.353µs 
INFO [runner] worker.2 took 9.294038853s with stages: megacheck: 9.294020756s 
INFO [runner] Workers idle times: #1: 6.192799567s 
INFO [runner] Issues before processing: 29, after processing: 0 
INFO [runner] processing took 5.222192ms with stages: exclude: 3.746967ms, identifier_marker: 935.061µs, autogenerated_exclude: 204.592µs, skip_dirs: 152.003µs, cgo: 79.096µs, path_prettifier: 46.542µs, filename_unadjuster: 43.227µs, nolint: 7.236µs, max_same_issues: 2.342µs, skip_files: 994ns, diff: 814ns, max_from_linter: 664ns, source_code: 622ns, path_shortener: 552ns, uniq_by_line: 506ns, max_per_file_from_linter: 506ns, exclude-rules: 468ns 
INFO File cache stats: 5 entries of total size 26.5KiB 
INFO Memory: 81 samples, avg is 1018.3MB, max is 2493.9MB 
INFO Execution took 18.273785676s   

I tried to test single file but failed to get same warn.

@tpounds
Copy link
Contributor

tpounds commented Oct 2, 2019

@daixiang0 It looks like I'm able to reproduce your issue with Go 1.13 and latest v1.19.1 release but it looks like the issue doesn't occur with latest master release. Can you try running against the latest master commit to see if you are still seeing the issue?

@daixiang0
Copy link
Contributor Author

I use 13e3a1a and can not reproduce, i think it could be better to backport the commit which fix this.

# golangci-lint --version
golangci-lint has version v1.19.1-16-g13e3a1a built from 13e3a1a
# # GO111MODULE=on golangci-lint run -v
INFO [config_reader] Config search paths: [./ /deploy/go/src/github.com/grafana/loki/cmd/fluent-bit /deploy/go/src/github.com/grafana/loki/cmd /deploy/go/src/github.com/grafana/loki /deploy/go/src/github.com/grafana /deploy/go/src/github.com /deploy/go/src /deploy/go /deploy /] 
INFO [config_reader] Used config file ../../.golangci.yml 
INFO [lintersdb] Active 18 linters: [deadcode errcheck goconst gofmt goimports golint gosimple govet ineffassign interfacer misspell staticcheck structcheck typecheck unconvert unparam unused varcheck] 
INFO [loader] Go packages loading at mode 575 (name|compiled_files|exports_file|imports|types_sizes|deps|files) took 715.805146ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 3.357885ms 
INFO [runner] Issues before processing: 77, after processing: 1 
INFO [runner] Processors filtering stat (out/in): exclude: 1/24, diff: 1/1, path_prettifier: 24/24, exclude-rules: 1/1, uniq_by_line: 1/1, skip_files: 24/24, skip_dirs: 24/24, autogenerated_exclude: 24/24, max_per_file_from_linter: 1/1, source_code: 1/1, path_shortener: 1/1, cgo: 24/77, filename_unadjuster: 24/24, identifier_marker: 24/24, nolint: 1/1, max_same_issues: 1/1, max_from_linter: 1/1 
INFO [runner] processing took 3.116073ms with stages: exclude: 1.230939ms, identifier_marker: 831.619µs, nolint: 751.37µs, path_prettifier: 114.415µs, autogenerated_exclude: 75.456µs, source_code: 64.908µs, cgo: 16.422µs, skip_dirs: 12.614µs, filename_unadjuster: 6.15µs, max_same_issues: 3.714µs, uniq_by_line: 2.527µs, max_per_file_from_linter: 1.601µs, max_from_linter: 1.506µs, path_shortener: 1.42µs, skip_files: 593ns, diff: 497ns, exclude-rules: 322ns 
INFO [runner] linters took 3.047788171s with stages: goanalysis_metalinter: 1.69785074s, unused: 1.346650598s 
loki_test.go:115:6: func compareJson should be compareJSON (golint)
func compareJson(t *testing.T, got, want string) {
     ^
INFO File cache stats: 8 entries of total size 38.8KiB 
INFO Memory: 39 samples, avg is 147.6MB, max is 269.1MB 
INFO Execution took 3.787881971s  

@tpounds
Copy link
Contributor

tpounds commented Oct 3, 2019

@daixiang0 The plan is to release v1.20.0 soon which includes several memory/speed enhancements as well as fixing the issue you are having here. I'll add this issue to the v1.20.0 milestone and close it once the new version is released.

/cc @jirfag

@tpounds tpounds added this to the v1.20.0 milestone Oct 3, 2019
@tpounds
Copy link
Contributor

tpounds commented Oct 8, 2019

@daixiang0 Resolving now that v1.20.0 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback required Requires additional feedback
Projects
None yet
Development

No branches or pull requests

2 participants