我正在尝试使用Go Buildpack在 Heroku 上放置一个 Go 应用程序,这在它是基本的东西时很好,但是一旦我做了一个本地包它就不会编译。这是一个示例设置:
结构
+ship
+foo
foo.go
main.go
main.go
package main
import (
"os"
"fmt"
"net/http"
"ship/foo"
)
func main() {
foo.Bar()
port := os.Getenv("PORT")
http.HandleFunc("/", root)
http.ListenAndServe(":" + port, nil)
}
func root(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Aloha, world!")
}
foo.go
package foo
func Bar() {}
推
git push heroku master
Initializing repository, done.
Counting objects: 20, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (20/20), 1.53 MiB | 586.00 KiB/s, done.
Total 20 (delta 2), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Go app detected
-----> Installing go1.3.1... done
-----> Running: godep go install -tags heroku ./...
main.go:7:3: cannot find package "ship/foo" in any of:
/app/tmp/cache/go1.3.1/go/src/pkg/ship/foo (from $GOROOT)
/tmp/build_4b92e51c-3959-4ddb-8eff-90d72da70729/.heroku/g/src/_/Users/Daryl/Go/src/ship/Godeps/_workspace/src/ship/foo (from $GOPATH)
/tmp/build_4b92e51c-3959-4ddb-8eff-90d72da70729/.heroku/g/src/ship/foo
godep: go exit status 1
! Push rejected, failed to compile Go app
知道这里发生了什么以及如何去做吗?