我正在尝试安装我的 Go 测试包,但我不断收到此错误:D:\Developpement\golang\src\github.com\gorilla\mux\mux.go:12: can't find import: "github.com/gorilla/context"这是我的代码:package mainimport ( "github.com/gorilla/pat" "net/http")func main() { mux := pat.New() mux.Get("/user/:name/profile", http.HandlerFunc(profile)) http.Handle("/", mux) log.Println("Listening...") http.ListenAndServe(":3000", nil)}func profile(w http.ResponseWriter, r *http.Request) { params := r.URL.Query() name := params.Get(":name") w.Write([]byte("Hello " + name))}MyGOROOT指向 Go 的安装根目录和GOPATH我的工作区根目录。编辑这是输出go env:D:\Développement\golang\src\github.com\jpmonette\hello>go envset GOARCH=386set GOBIN=set GOCHAR=8set GOEXE=.exeset GOHOSTARCH=386set GOHOSTOS=windowsset GOOS=windowsset GOPATH=D:\Développement\golang\set GORACE=set GOROOT=C:\Goset GOTOOLDIR=C:\Go\pkg\tool\windows_386set CC=gccset GOGCCFLAGS=-g -O2 -m32 -mthreadsset CGO_ENABLED=1
1 回答
- 1 回答
- 0 关注
- 179 浏览
添加回答
举报
0/150
提交
取消