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

cmd/go: build failing due to `cannot find module providing package golang.org/x/net/lex/httplex` #32280

Closed
akashbdj opened this issue May 28, 2019 · 4 comments

Comments

@akashbdj
Copy link

@akashbdj akashbdj commented May 28, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/akash/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/akash/Sites/gowork"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/akash/Sites/new_gowork/gateway/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fx/qxs939gj3xb7mh206kbp5m2svpzq54/T/go-build292717818=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I'm trying to port my dep based project to go modules. I moved a few basic packages to the new repo and then I ran go build -v. Build is failing with

$ go build
go: finding golang.org/x/net/lex/httplex latest
go: finding golang.org/x/net/lex latest
go: finding golang.org/x/net latest
build bitbucket.org/myntra/gateway/cmd/gateway: cannot load golang.org/x/net/lex/httplex: cannot find module providing package golang.org/x/net/lex/httplex

What did you expect to see?

A successful build

What did you see instead?

$ go build
go: finding golang.org/x/net/lex/httplex latest
go: finding golang.org/x/net/lex latest
go: finding golang.org/x/net latest
build bitbucket.org/myntra/gateway/cmd/gateway: cannot load golang.org/x/net/lex/httplex: cannot find module providing package golang.org/x/net/lex/httplex

go.mod file:

module example.org/akash/x

go 1.12

require (
	github.com/BurntSushi/toml v0.3.1 // indirect
	github.com/bkaradzic/go-lz4 v1.0.0
	github.com/go-chi/chi v4.0.2+incompatible
	github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
	github.com/google/uuid v1.1.1
	github.com/graph-gophers/graphql-go v0.0.0-20190513003547-158e7b876106
	github.com/hobbes26/go-cache v2.1.0+incompatible // indirect
	github.com/newrelic/go-agent v2.7.0+incompatible
	github.com/nytlabs/gojsonexplode v0.0.0-20160201065013-0f3fe6bb573f
	github.com/pkg/errors v0.8.1 // indirect
	github.com/sethgrid/pester v0.0.0-20190127155807-68a33a018ad0 // indirect
	github.com/sirupsen/logrus v1.4.2
	github.com/yogeshpandey/gocookie-string-reader v0.0.0-20180403114556-4f0cc6395c5e
	go.uber.org/atomic v1.4.0 // indirect
	go.uber.org/zap v1.10.0
	golang.org/x/text v0.3.2 // indirect
	gopkg.in/yaml.v2 v2.2.2 // indirect
)
@julieqiu julieqiu changed the title Build failing due to `cannot find module providing package golang.org/x/net/lex/httplex` cmd/go: build failing due to `cannot find module providing package golang.org/x/net/lex/httplex` May 28, 2019
@julieqiu

This comment has been minimized.

Copy link

@julieqiu julieqiu commented May 28, 2019

The issue is that you have a transitive dependency on "golang.org/x/net/lex/httplex", which does not exists. As mentioned in the error message:

cannot load golang.org/x/net/lex/httplex: cannot find module providing package golang.org/x/net/lex/httplex

Looking at the go.mod file, this seems to be due to the dependency on github.com/yogeshpandey/gocookie-string-reader:

https://github.com/yogeshpandey/gocookie-string-reader/blob/master/parser.go#L4

For additional questions, please see one of our forums: https://golang.org/wiki/Questions, as this is expected behavior for cmd/go.

@julieqiu julieqiu closed this May 28, 2019
@akashbdj

This comment has been minimized.

Copy link
Author

@akashbdj akashbdj commented May 28, 2019

@julieqiu Thanks for pointing out!

How did you figure this out? Did you run some command to find out which dependency uses httplex?
Let me know so that it helps me figure out my future problems?

Thanks again,
Akash

@julieqiu

This comment has been minimized.

Copy link

@julieqiu julieqiu commented May 28, 2019

I ran go get on the modules that were listed and got this error:

go get github.com/yogeshpandey/gocookie-string-reader@v0.0.0-20180403114556-4f0cc6395c5e

go: downloading github.com/yogeshpandey/gocookie-string-reader v0.0.0-20180403114556-4f0cc6395c5e
go: extracting github.com/yogeshpandey/gocookie-string-reader v0.0.0-20180403114556-4f0cc6395c5e
go: finding golang.org/x/net latest
go: downloading golang.org/x/net v0.0.0-20190522155817-f3200d17e092
go: extracting golang.org/x/net v0.0.0-20190522155817-f3200d17e092
go build golang.org/x/net/lex/httplex: no Go files in

go mod why could also be useful in this case - see https://golang.org/cmd/go/#hdr-Explain_why_packages_or_modules_are_needed and https://github.com/golang/go/wiki/Modules for additional info

@akashbdj

This comment has been minimized.

Copy link
Author

@akashbdj akashbdj commented May 28, 2019

Great! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.