baisang
baisang

Reputation: 434

Go importing vendor dependencies issue when building a Go 1.7 project using govendor, dh-make-golang

I've been looking into building a go project into a debian package.

I've looked into dh-make-golang and I have a nice and shiny debian folder set up in my repository. When I try to use gbp buildpackage --git-pbuilder though it errors out due to all of my dependencies not being found. It seems that dh-make-golang ignores the vendor folder when it copies everything from my project's git repository, and I use govendor so all of my dependencies are in there.

How can I resolve this dependency issue and build the project as a .deb package properly? For reference, the error I am getting is:

src/github.com/project/project/project.go:15:2: cannot find package "google.golang.org/grpc/grpclog" in any of: /usr/lib/go-1.7/src/google.golang.org/grpc/grpclog (from $GOROOT) /tmp/project/obj-x86_64-linux-gnu/src/google.golang.org/grpc/grpclog (from $GOPATH)

Upvotes: 1

Views: 759

Answers (2)

baisang
baisang

Reputation: 434

Issue was a bug in dh-make-golang regarding importing vendor dependencies. It was just fixed today.

https://github.com/Debian/dh-make-golang/issues/46

Upvotes: 1

jaxxstorm
jaxxstorm

Reputation: 13261

Take a look at goxc - it can do this for you!

You simply need to add a .goxc.json to the root of your directory, that looks like this

{
    "AppName": "my_app",
    "ArtifactsDest": "downloads",
    "Tasks": [
        "interpolate-source"
        "deb",
    ],
    "BuildConstraints": "linux,amd64 windows,amd64 darwin,amd64 linux,arm",
    "ResourcesInclude": "INSTALL*,README*,LICENSE*,config/*,static/*,templates/*",
    "PackageVersion": "0.9.3",
    "TaskSettings": {
        "deb": {
            "metadata": {
                "description": "my app",
                "maintainer": "me",
                "maintainer-email": "[email protected]"
            },
            "metadata-deb": {
                "Homepage": "https://example.com"
            },
            "other-mapped-files": {
                "/": "debian/",
                "/usr/share/something/static": "static/",
                "/usr/share/something/templates": "templates/"
            }
        }
    },
    "ConfigVersion": "0.9"
}

Then run goxc and it'll do all the work for you.

Upvotes: 0

Related Questions