Closed sashayakovtseva closed 4 years ago
Had to use two distinct configs: one for golangci.com and one when running locally from Makefile :(
What did the new config look like?
Hello @gdbelvin! I saw your issue #578, it is pretty similar to what I have here. After attempts to tune golangci service I found out there is no way to do that. So in singularity-cri repo we decided to have two configs: one for golangci.com without modules-download-mode: vendor
(can be found here) and another one for local run during make lint
(config is here).
Thanks for linking to your configs - very helpful.
Hi, is the issue solved? I'm trying to integrate golangci-lint with Goland. I use go mod without vendor, run golangci-lint with run --print-issued-lines=false -E golint -E gofmt -E goimports $FileDir$
, get the message:
Running error: context loading failed: package git.ice.org/aa/bb/cc/dd
imports git.ice.org/data/databus_client: cannot find package "git.ice.org/data/databus_client" in any of:
/usr/local/Cellar/go/1.12.7/libexec/src/git.ice.org/data/databus_client (from $GOROOT)
/Users/ice/Workspace/Go/src/git.ice.org/data/databus_client (from $GOPATH): failed to analyze
I also tried export GO111MODULE=on
before running golangci-lint, got message:
Running error: context loading failed: failed to load program with go/packages: go [list -e -json -compiled=true -test=true -export=false -deps=true -find=false -- /Users/ice/Workspace/Go/src/git.ice.org/aa/bb/cc/dd]: exit status 1: go: cannot find main module; see 'go help modules'
GOARCH="amd64"
GOBIN="/Users/ice/Workspace/Go/bin"
GOCACHE="/Users/ice/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ice/Workspace/Go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.7/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.7/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b9/jdnrtcy92bx1t63gfy9rb7d00000gn/T/go-build533803939=/tmp/go-build -gno-record-gcc-switches **-fno-common"**
I believe it's caused by empty GOMOD. Is there anyway to resolve this without a config file? I just want to use it with file watcher in goland.
oh sorry, I get the solution, just set working directory = $FileDir$.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Version of golangci-lint: According to logs:
golangci-lint has version 1.17.1 built from 4ba2155 on 2019-06-10T09:06:49Z
Config file:
linters: enable-all: true disable:
linters-settings: govet: settings: printf: funcs:
github.com/golang/glog.Exitf golint:
minimal confidence for issues, default is 0.8
min-confidence: 0 gocyclo:
minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 20
lll: tab-width: 4 prealloc: simple: true
issues: exclude-rules:
Exclude some linters from running on tests files.
max-issues-per-linter: 0 max-same-issues: 0
$ go version go version go1.11.5 linux/amd64 $ go env GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" 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-build543853952=/tmp/go-build -gno-record-gcc-switches"
$ GOLANGCI_COM_RUN=1 golangci-lint run --out-format=json --issues-exit-code=0 --deadline=5m --new=false --new-from-rev= --new-from-patch=../changes.patch Running error: context loading failed: failed to load program with go/packages: go [list -e -json -compiled=true -test=true -export=false -deps=true -find=false -tags selinux seccomp -mod=vendor -- ./...]: exit status 1: build flag -mod=vendor only valid when using modules