我有错误:
go install: no install location for directory /Users/xwilly/Dropbox/go/project/src outside GOPATH
我在 OS X 上使用 go 版本 1.1。
我可以构建和运行但不能安装包。
我的环境:
GOPATH=/Users/xwilly/Dropbox/go/project
PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin:/Users/xwilly/Dropbox/go/project/bin
项目树:
/Users/xwilly/Dropbox/go/project
bin
pkg
src
我可以毫无错误地构建:
..:src xwilly$ go build test.go
..:src xwilly$ go install test.go
go install: no install location for directory /Users/xwilly/Dropbox/go/project/src outside GOPATH
这是一个简单的例子:
xwilly$ cat test.go
package main
import (
"fmt"
)
func main() {
fmt.Println("Bonjour")
}
xwilly$ go run test.go
Bonjour
xwilly$ go install test.go
go install: no install location for directory /Users/xwilly/Dropbox/go/project/src/learning outside GOPATH