Go在Windows中找不到包。

huangapple go评论149阅读模式
英文:

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
>

huangapple
  • 本文由 发表于 2014年8月12日 10:55:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/25255459.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定