3

I am using Heroku's Golang buildpack to deploy a simple web app with the following structure

my-app/
    handler/
        user.go
        session.go
    vendor/
        github.com/
        golang.org/
    main.go
    Gopkg.toml
    Gopkg.lock

Inside my main file, I imported my own handler package

import (
    "fmt"
    "net/http"
    "my-app/handler"
)

Heroku was not able to run go install on my project due the following error:

----> Using go1.9.3
----> Running: go install -v -tags heroku . 
----> cannot find package "my-app/handler" in any of: ... 

I can run go install and my-app without any problem locally. It seems to me that heroku does not recognize my internal project package.

I am using dep and I have the following configurations in my Gopkg.toml:

[metadata.heroku]
root-package = "github.com/mygithub/my-app"
go-version = "go1.9.3"
install = ["."]
ensure = "false"

What else do I need to do to deploy a Go app with internal package? Thanks.

mofury
  • 644
  • 1
  • 11
  • 23

1 Answers1

4

Try to set the root package to just the name of the project without the domain

[metadata.heroku] root-package = "my-app" go-version = "go1.9.2" install = [ "./..." ]

Frits
  • 106
  • 1
  • 7
  • Yep that worked. I actually only changed root-package to "my-app". I didn't need to do install = ["./..."]. Now I am doing it just in case. Just want to say, thank you very much, your help is much appreciated. – mofury Feb 05 '18 at 09:31