Home > OS >  Module lookup disabled by GOPROXY=off golangci
Module lookup disabled by GOPROXY=off golangci

Time:03-05

I have a vendor folder and CI/CD task Linter. Before push the folder to gitlab I did

go mod tidy
go mod vendor

My Linter task in Makefile looks like

@GO111MODULE=on GOFLAGS=-mod=vendor GOPROXY=off $(GOLINT) run ./... -v --max-same-issues 0

and I have no any problems when I start linting locally. But during CI/CD I got an error

Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: github.com/jmoiron/[email protected]: module lookup disabled by GOPROXY=off

So i can't understand why I got this error

Update I decided to remove the vendor, go.mod and go.sum. Then I created new go.mod and did

go mod vendor

After that I got the same error but with another package

level=error msg="Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: github.com/fsnotify/[email protected]: module lookup disabled by GOPROXY=off

CodePudding user response:

The problem was in the settings of golangci modules-download-mode

this solution is set this variable to vendor mode:

modules-download-mode: vendor
  •  Tags:  
  • go
  • Related