I'm trying to install my Go test package, but I keep getting this error:
D:\Developpement\golang\src\github.com\gorilla\mux\mux.go:12: can't find import: "github.com/gorilla/context"
Here's my code:
package main
import (
"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))
}
My GOROOT
is pointing to Go's installation root, and GOPATH
to my workspace root.
EDIT
Here's the output of go env
:
D:\Développement\golang\src\github.com\jpmonette\hello>go env
set GOARCH=386
set GOBIN=
set GOCHAR=8
set GOEXE=.exe
set GOHOSTARCH=386
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\Développement\golang\
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_386
set CC=gcc
set GOGCCFLAGS=-g -O2 -m32 -mthreads
set CGO_ENABLED=1