0

依存関係のスペルが間違っている場合にのみ、ベンダーディレクトリを検索します。グライドを使用してベンダーを追加しました。

このインポートのスペルは正しいです

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"
)

スペルが間違っている dep の結果。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)

ゴリラ/マックスがいる証拠

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"
4

0 に答える 0