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: cannot find module providing package: golang.org/x/net/context #26914

Closed
xiaoxiaoyijian123456 opened this issue Aug 10, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@xiaoxiaoyijian123456
Copy link

commented Aug 10, 2018

Please answer these questions before submitting your issue. Thanks!

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

go1.11beta3 windows/amd64

Does this issue reproduce with the latest release?

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

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\m1358\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\GOPATH
set GOPROXY=
set GORACE=
set GOROOT=D:\Go
set GOTMPDIR=
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\steven\gintest\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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\m1358\AppData\Local\Temp\go-build378069066=/tmp/go-build -gno-record-gcc-switches

What did you do?

Use go1.11 Modules on a simple gin-gonic/gin example:

package main

import (
	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()
	r.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "pong",
		})
	})
	r.Run() // listen and serve on 0.0.0.0:8080
}

Run command:

go mod init github.com/go-steven/gintest
go mod tidy

What did you expect to see?

go mod tidy works well, no errors reported.

What did you see instead?

D:\steven\gintest>go mod tidy
go: finding github.com/manucorporat/sse latest
go: finding github.com/golang/protobuf/proto latest
go: finding github.com/stretchr/testify/assert latest
go: import "github.com/go-steven/gintest" ->
import "github.com/gin-gonic/gin" ->
import "golang.org/x/net/context": cannot find module providing package golang.org/x/net/context

@myitcv

This comment has been minimized.

Copy link
Member

commented Aug 10, 2018

Unfortunately, you've run into a variant of #26722

This will be fixed in the next beta/first release candidate.

Or else it's already fixed in tip, if you're happy to build Go from source

@myitcv myitcv closed this Aug 10, 2018

@myitcv myitcv added the modules label Aug 10, 2018

@myitcv myitcv added this to the Go1.11 milestone Aug 10, 2018

@xiaoxiaoyijian123456

This comment has been minimized.

Copy link
Author

commented Aug 10, 2018

Yes, with the build go from source, that works, thanks.

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