1

我一直在考虑将一个 go 项目构建到一个 debian 包中。

我查看了dh-make-golangdebian并且在我的存储库中设置了一个漂亮而闪亮的文件夹。当我尝试使用gbp buildpackage --git-pbuilder时,由于找不到我的所有依赖项而出错。当它从我的项目的 git 存储库中复制所有内容时,它似乎dh-make-golang忽略了该文件夹,并且我使用了所以我的所有依赖项都在那里。vendorgovendor

如何解决此依赖问题并将项目.deb正确构建为包?作为参考,我得到的错误是:

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)

4

2 回答 2

1

问题是dh-make-golang有关导入供应商依赖项的错误。今天刚修好。

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

于 2017-03-29T22:29:43.550 回答
0

看看goxc - 它可以为您做到这一点!

您只需将 a 添加.goxc.json到目录的根目录,如下所示

{
    "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": "me@example.com"
            },
            "metadata-deb": {
                "Homepage": "https://example.com"
            },
            "other-mapped-files": {
                "/": "debian/",
                "/usr/share/something/static": "static/",
                "/usr/share/something/templates": "templates/"
            }
        }
    },
    "ConfigVersion": "0.9"
}

然后运行goxc,它会为您完成所有工作。

于 2017-03-29T06:41:51.540 回答