golangci-lint icon indicating copy to clipboard operation
golangci-lint copied to clipboard

broken all paths in subprojects

Open Vany opened this issue 1 year ago • 5 comments

Welcome

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

Description of the problem

i'm not sure, but #2654 may be related

there is no go.mod in the root folder

$ cd libclient
$ head go.mod -n3
module github.com/binarly-io/client/libclient

go 1.18

$ GO111MODULE=on  golangci-lint run -v ./...
INFO [config_reader] Config search paths: [./ /home/vany/w/b/client/libclient /home/vany/w/b/client /home/vany/w/b /home/vany/w /home/vany /home /] 
INFO [lintersdb] Active 7 linters: [errcheck gosimple govet ineffassign staticcheck typecheck unused] 
INFO [loader] Go packages loading at mode 575 (compiled_files|deps|imports|exports_file|files|name|types_sizes) took 176.768616ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 5.49µs 
ERRO [linters context] typechecking error: # github.com/binarly-io/client/libclient [github.com/binarly-io/client/libclient.test]
./cmd_root.go:4:2: could not import reflect (open : no such file or directory)

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.49.0 built from (unknown, mod sum: "h1:I8WHOavragDttlLHtSraHn/h39C+R60bEQ5NoGcHQr8=") on (unknown)

Configuration file

.golangci.yml is not used yet

Go environment

$ go version && go env
go version go1.18.5 linux/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/vany/.cache/go-build"
GOENV="/home/vany/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/vany/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/vany/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/9952"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/9952/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/vany/w/b/client/libclient/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-build2674431381=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v

story the same

Code example or link to a public repository

all imports

Vany avatar Sep 11 '22 23:09 Vany

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

boring-cyborg[bot] avatar Sep 11 '22 23:09 boring-cyborg[bot]

Hello,

without a concrete reproducible context, it's impossible to diagnose the problem.

ldez avatar Sep 11 '22 23:09 ldez

@ldez there is very simple context GO111MODULE=on + go.mod in folder

Vany avatar Sep 11 '22 23:09 Vany

and sorry, i can't provide the code.

Vany avatar Sep 11 '22 23:09 Vany

so no concrete reproducible context.

golangci-lint has mainly the same constraints as Go. go.mod is required. you cannot use golangci-lint to check several projects/modules at the same time. That's all that I can say based on your information.

ldez avatar Sep 12 '22 00:09 ldez

I've got this kind of error after switching from 1.46

dmitrytrager avatar Oct 03 '22 16:10 dmitrytrager

May cause by import cycles in test file?

ref: https://github.com/golang/go/issues/51180

I occurred the issue as well, I found there are import cycles in my test file. When I fixed the problem, the error was dismissed.

foamzou avatar Feb 15 '23 13:02 foamzou

@foamzou Yes =) It is. Thankyou =)

Vany avatar Feb 20 '23 17:02 Vany