如果我拼写了依赖性错误,请仅查看我的供应商目录。我用滑动来添加供应商。
此导入拼写正确
package goserver
import (
"net/http"
"fmt"
"github.com/gorilla/mux"
)
正确拼写dep的结果。 Go查看2个目录,但不查看供应商树目录
myhost:goserver myuser$ go build main.go
go-server/routers.go:6:2: cannot find package "_/Users/myuser/go/src/goserver/vendor/github.com/gorilla/mux" in any of:
/usr/local/Cellar/go/1.9/libexec/src/_/Users/myuser/go/src/goserver/vendor/github.com/gorilla/mux (from $GOROOT)
/Users/myuser/go/src/_/Users/myuser/go/src/goserver/vendor/github.com/gorilla/mux (from $GOPATH)
导入拼写不正确
package goserver
import (
"net/http"
"fmt"
"githubwwwww.com/gorilla/mux"
)
拼写错误的结果。 Go查看3个目录并查看供应商目录
myhost:goserver myuser$ go build main.go
go-server/routers.go:6:2: cannot find package "githubwwwww.com/gorilla/mux" in any of:
/Users/myuser/go/src/goserver/vendor/githubwwwww.com/gorilla/mux (vendor tree)
/usr/local/Cellar/go/1.9/libexec/src/githubwwwww.com/gorilla/mux (from $GOROOT)
/Users/myuser/go/src/githubwwwww.com/gorilla/mux (from $GOPATH)
证明gorrila / mux在那里
myhost:goserver myuser$ ls /Users/myuser/go/src/goserver/vendor/github.com/gorilla/mux/
LICENSE bench_test.go context_gorilla_test.go context_native_test.go mux.go old_test.go route.go
README.md context_gorilla.go context_native.go doc.go mux_test.go regexp.go
去环境结果
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/myuser/go/"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ty/vksmqd9x38vclbmpbnvnqwwh0000gp/T/go-build089246630=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"