Skip to content

cmd/go: cannot find module providing package: golang.org/x/net/context #26914

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Comments

@xiaoxiaoyijian123456
Copy link

xiaoxiaoyijian123456 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
Copy link
Member

myitcv 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 as completed 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
Copy link
Author

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

@golang golang locked and limited conversation to collaborators Aug 10, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants