英文:
Go cannot find package in windows
问题
我在Windows上安装了一个包,使用以下命令:
go get github.com/couchbaselabs/go-couchbase
安装完成后没有出现任何消息。
然后我尝试在Go代码中引入该包:
import (
"github.com/couchbaselabs/go-couchbase"
)
然而,在构建时,我收到以下消息:
main.go:7:2: 找不到包 "github.com/couchbaselabs/go-couchbase",在以下任何位置都找不到:
c:\go\src\pkg\github.com\couchbaselabs\go-couchbase(来自$GOROOT)
C:\Go\src\Chaatz\src\github.com\couchbaselabs\go-couchbase(来自$GOPATH)
C:\Go\src\github.com\couchbaselabs\go-couchbase
我是否漏掉了什么,或者该包安装到了其他路径?
英文:
I have installed a package in windows using
go get github.com/couchbaselabs/go-couchbase
No message apprear after installation.
Then I tried to include in Go
import (
"github.com/couchbaselabs/go-couchbase"
)
However,when I build, I got the message
main.go:7:2: cannot find package "github.com/couchbaselabs/go-couchbase" in any of:
c:\go\src\pkg\github.com\couchbaselabs\go-couchbase (from $GOROOT)
C:\Go\src\Chaatz\src\github.com\couchbaselabs\go-couchbase (from $GOPATH)
C:\Go\src\github.com\couchbaselabs\go-couchbase
Am I miss something, or the package is installed to other path?
答案1
得分: 1
例如,
>设置gopath
GOPATH=C:\gopath
>go get -v github.com/couchbaselabs/go-couchbase
github.com/couchbaselabs/go-couchbase(下载)
github.com/couchbase/gomemcached(下载)
github.com/couchbaselabs/retriever(下载)
github.com/natefinch/npipe(下载)
github.com/couchbase/gomemcached
github.com/couchbaselabs/retriever/lockfile
github.com/natefinch/npipe
github.com/couchbaselabs/retriever/logger
github.com/couchbaselabs/retriever/stats
github.com/couchbase/gomemcached/client
github.com/couchbaselabs/go-couchbase
>go version
go version go1.3 windows/amd64
>type cb.go
package main
import (
"fmt"
"github.com/couchbaselabs/go-couchbase"
)
func main() {
var _ couchbase.Bucket
fmt.Println("couchbase")
}
>go run cb.go
couchbase
>
英文:
For example,
>set gopath
GOPATH=C:\gopath
>go get -v github.com/couchbaselabs/go-couchbase
github.com/couchbaselabs/go-couchbase (download)
github.com/couchbase/gomemcached (download)
github.com/couchbaselabs/retriever (download)
github.com/natefinch/npipe (download)
github.com/couchbase/gomemcached
github.com/couchbaselabs/retriever/lockfile
github.com/natefinch/npipe
github.com/couchbaselabs/retriever/logger
github.com/couchbaselabs/retriever/stats
github.com/couchbase/gomemcached/client
github.com/couchbaselabs/go-couchbase
>go version
go version go1.3 windows/amd64
>type cb.go
package main
import (
"fmt"
"github.com/couchbaselabs/go-couchbase"
)
func main() {
var _ couchbase.Bucket
fmt.Println("couchbase")
}
>go run cb.go
couchbase
>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论