I use command go get github.com/gorilla/mux
. I made http server using Golang, and I run this program :
package main
import (
\"fmt\"
\"htm
I wish this helpful. You may off the 'mod'.
$ export GO111MODULE=off
Try go build /Users/imac/go/src/project
because I see you try to use go build
under /Users/imac/go/src
Just remove quotes like this:
go get github.com/gorilla/mux
I try to remove github.com/gorilla
and github.com/peterbourgon
directory, then, retry: make
, it works.
<pre>
fail log:
mac@user:~/TempPlace/temp/ngrok% make
go fmt ngrok/...
go get github.com/jteeuwen/go-bindata
GOOS="" GOARCH="" go install github.com/jteeuwen/go-bindata/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=debug \
-debug=true \
-o=src/ngrok/client/assets/assets_debug.go \
assets/client/...
go get github.com/jteeuwen/go-bindata
GOOS="" GOARCH="" go install github.com/jteeuwen/go-bindata/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=debug \
-debug=true \
-o=src/ngrok/server/assets/assets_debug.go \
assets/server/...
go get -tags 'debug' -d -v ngrok/...
src/ngrok/server/config.go:16:2: no Go files in /Users/apple/TempPlace/temp/ngrok/src/github.com/gorilla/mux
src/ngrok/server/config.go:17:2: no Go files in /Users/apple/TempPlace/temp/ngrok/src/github.com/peterbourgon/diskv
make: *** [deps] Error 1
success log:
mac@user:~/TempPlace/temp/ngrok% make
go fmt ngrok/...
go get github.com/jteeuwen/go-bindata
GOOS="" GOARCH="" go install github.com/jteeuwen/go-bindata/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=debug \
-debug=true \
-o=src/ngrok/client/assets/assets_debug.go \
assets/client/...
go get github.com/jteeuwen/go-bindata
GOOS="" GOARCH="" go install github.com/jteeuwen/go-bindata/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=debug \
-debug=true \
-o=src/ngrok/server/assets/assets_debug.go \
assets/server/...
go get -tags 'debug' -d -v ngrok/...
github.com/gorilla/websocket (download)
github.com/gorilla/mux (download)
src/ngrok/server/config.go:17:2: no Go files in /Users/apple/TempPlace/temp/ngrok/src/github.com/peterbourgon/diskv
make: *** [deps] Error 1
mac@user:~/TempPlace/temp/ngrok% make
go fmt ngrok/...
go get github.com/jteeuwen/go-bindata
GOOS="" GOARCH="" go install github.com/jteeuwen/go-bindata/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=debug \
-debug=true \
-o=src/ngrok/client/assets/assets_debug.go \
assets/client/...
go get github.com/jteeuwen/go-bindata
GOOS="" GOARCH="" go install github.com/jteeuwen/go-bindata/go-bindata
bin/go-bindata -nomemcopy -pkg=assets -tags=debug \
-debug=true \
-o=src/ngrok/server/assets/assets_debug.go \
assets/server/...
go get -tags 'debug' -d -v ngrok/...
github.com/peterbourgon/diskv (download)
github.com/google/btree (download)
go install -tags 'debug' ngrok/main/ngrok
go install -ldflags "-s" -tags 'debug' ngrok/main/ngrokd
</pre>
Could you try this steps to debug it:
ls -l /usr/local/go/src/github.com | grep gorilla
cd $GOPATH
go list ... | grep gorilla
if you din't see gorilla in the above two command, then you need to install it:
go get -v -u github.com/gorilla/mux
Please run this: export PATH=$PATH:$GOPATH/bin
How about running go run main.go
? is that working, if yes you should be able to do go build
from your project path.
If you are using VS Code as your IDE and facing this problem:
VS Code uses $HOME/go
as your default GOPATH
- if you export another GOPATH
you running into this trouble.
How to solve:
cd prjectFolder
. Type go env
and check if the GOPATH
entry is the same as you get when you use cmd+t
and then >Go: Current GOPATH
"go.gopath": "/some/path"
where /some/path
is the same path you export in you shell, zsh and so on. Hope this helps.