我在运行Go测试时遇到问题。我跟着go instructions
export GOPATH=/Users/chris/Projects/go
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$GOPATH
./main.go
./roundrobin.go
./roundrobin_test.go
package main
import "github.com/chris/schedule"
func main(teamCount int) {
http.HandleFunc('/', func(w http.ResponseWriter, r, *http.Request) {
gameSchedule := schedule.NewSchedule()
}
}
package roundrobin
// nothing imported here for now
...
package roundrobin
import (
"testing"
"github.com/chris/roundrobin/schedule"
)
...
我能够构建,直到我更改为github.com/username/文件夹布局
➜ roundrobin go build
can't load package: package github.com/chris/roundrobin: found packages main (main.go) and roundrobin (schedule.go) in /Users/chris/Projects/go/src/github.com/chris/roundrobin
➜ roundrobin go test
# github.com/chris/roundrobin
schedule_test.go:6:2: cannot find package "github.com/chris/roundrobin/schedule" in any of:
/usr/local/go/src/pkg/github.com/chris/roundrobin/schedule (from $GOROOT)
/Users/chris/Projects/go/src/github.com/chris/roundrobin/schedule (from $GOPATH)
FAIL github.com/chris/roundrobin [setup failed]
有什么想法吗?