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 errors with "cannot find module for path golang.org/x/net/context" #28064

Open
1486327116 opened this Issue Oct 7, 2018 · 7 comments

Comments

Projects
None yet
5 participants
@1486327116

1486327116 commented Oct 7, 2018

Please answer these questions before submitting your issue. Thanks!
My English is pool, i am sorry.

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

go 1.11

Does this issue reproduce with the latest release?

i do not know, i am a beginner of go, this is happened when i use etcd clientv3 (go get github.com/coreos/etcd/clientv3@v3.3.9)
,and i remember that when i run go get github.com/coreos/etcd/clientv3@v3.3.9, the terminal tell me some dir is no go files,but i ignored these,

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

win10
go env:
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Administrator\go
set GOPROXY=
set GORACE=
set GOROOT=E:\toolsForDev\go1.11
set GOTMPDIR=
set GOTOOLDIR=E:\toolsForDev\go1.11\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=E:\go_pro\logagent\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build894792506=/tmp/go
-build -gno-record-gcc-switches

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
package main

import (
"fmt"
"github.com/coreos/etcd/clientv3"
"time"
)

func main() {
test02()
}

func test02() {
client, _ := clientv3.New(clientv3.Config{Endpoints: []string{"192.168.208.128:2789"},DialTimeout:time.Second*3})
fmt.Println(*client)
}

What did you expect to see?

i just want to fixed the err about cannot find module for path golang.org/x/net/context

What did you see instead?

@mvdan mvdan changed the title from when i run go build,there is a err: cannot find module for path golang.org/x/net/context to cmd/go: build errors with "cannot find module for path golang.org/x/net/context" Oct 7, 2018

@mvdan

This comment has been minimized.

Member

mvdan commented Oct 7, 2018

Have you tried Go 1.11.1?

@adamdecaf

This comment has been minimized.

Contributor

adamdecaf commented Oct 7, 2018

golang.org/x/net/context was replaced with context, which won't require a download. The etcd client uses context - https://github.com/etcd-io/etcd/blob/master/clientv3/client.go#L18

Also, the Go project does not use its bug tracker for general discussion or asking questions. There are more people available to help with questions on slack/mailing lists. Thanks!

@zjmnssy

This comment has been minimized.

zjmnssy commented Oct 9, 2018

@mvdan I use Go 1.11.1 with vgo, build project has the error : build XXXXXXX/main: cannot find module for path golang.org/x/net/context

@zjmnssy

This comment has been minimized.

zjmnssy commented Oct 9, 2018

when i use low version Go, not has the erroe

@zjmnssy

This comment has been minimized.

zjmnssy commented Oct 9, 2018

i think it is because of vgo bug of find package at Go 1,11,1

@bcmills

This comment has been minimized.

Member

bcmills commented Nov 16, 2018

@zjmnssy, @1486327116, I'm not able to reproduce this issue on linux/amd64 with a recent go built from source. Please provide the exact commands you ran and the errors they produced.

Note that the golang.org/x repos may fail to resolve from within China (see #28652).

$ cat main.go
package main

import (
        "fmt"
        "github.com/coreos/etcd/clientv3"
        "time"
)

func main() {
        test02()
}

func test02() {
        client, _ := clientv3.New(clientv3.Config{Endpoints: []string{"192.168.208.128:2789"}, DialTimeout: time.Second * 3})
        fmt.Println(*client)
}

$ go get github.com/coreos/etcd/clientv3@v3.3.9
go: finding github.com/coreos/etcd/clientv3 v3.3.9
go: finding github.com/coreos/etcd v3.3.9
go: downloading github.com/coreos/etcd v3.3.9+incompatible
go: extracting github.com/coreos/etcd v3.3.9+incompatible
go: finding github.com/golang/protobuf/proto latest
go: finding github.com/gogo/protobuf/gogoproto latest
go: finding google.golang.org/grpc/credentials latest
go: finding google.golang.org/grpc v1.16.0
go: finding google.golang.org/grpc/grpclog latest
go: finding google.golang.org/grpc/codes latest
go: finding google.golang.org/grpc/status latest
go: finding google.golang.org/grpc/health/grpc_health_v1 latest
go: finding google.golang.org/grpc/metadata latest
go: finding github.com/golang/protobuf v1.2.0
go: finding golang.org/x/net/context latest
go: downloading google.golang.org/grpc v1.16.0
go: downloading github.com/golang/protobuf v1.2.0
go: finding github.com/gogo/protobuf v1.1.1
go: extracting github.com/golang/protobuf v1.2.0
go: finding google.golang.org/grpc/keepalive latest
go: finding google.golang.org/grpc/health latest
go: extracting google.golang.org/grpc v1.16.0
go: finding golang.org/x/net latest
go: downloading golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
go: downloading github.com/gogo/protobuf v1.1.1
go: extracting golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
go: extracting github.com/gogo/protobuf v1.1.1
go: finding golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
go: finding github.com/golang/lint v0.0.0-20180702182130-06c8688daad7
go: finding github.com/golang/mock v1.1.1
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding golang.org/x/text v0.3.0
go: finding golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52
go: finding golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding honnef.co/go/tools v0.0.0-20180728063816-88497007e858
go: finding google.golang.org/appengine v1.1.0
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding github.com/kisielk/gotool v1.0.0
go: finding github.com/client9/misspell v0.3.4
go: finding cloud.google.com/go v0.26.0
go: finding golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: downloading google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: downloading golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: downloading golang.org/x/text v0.3.0
go: extracting golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: extracting google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: extracting golang.org/x/text v0.3.0

$ go build .
go: finding github.com/coreos/etcd v3.3.9+incompatible

$ go list -m all
golang.org/issue/scratch
cloud.google.com/go v0.26.0
github.com/client9/misspell v0.3.4
github.com/coreos/etcd v3.3.9+incompatible
github.com/gogo/protobuf v1.1.1
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7
github.com/golang/mock v1.1.1
github.com/golang/protobuf v1.2.0
github.com/kisielk/gotool v1.0.0
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
golang.org/x/text v0.3.0
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52
google.golang.org/appengine v1.1.0
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
google.golang.org/grpc v1.16.0
honnef.co/go/tools v0.0.0-20180728063816-88497007e858

$ go version
go version devel +3fee82ca31 Mon Nov 5 22:39:19 2018 -0500 linux/amd64
@bcmills

This comment has been minimized.

Member

bcmills commented Nov 16, 2018

Please also provide the Git version in use (#26746).

@bcmills bcmills added the modules label Nov 16, 2018

@bcmills bcmills added this to the Go1.13 milestone Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment