Packaging Go application for Debian

后端 未结 5 611
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 05:32

How can I put my Go binary into a Debian package? Since Go is statically linked, I just have a single executable--I don\'t need a lot of complicated project metadata information

5条回答
  •  伪装坚强ぢ
    2021-01-30 05:43

    There is an official Debian policy document describing the packaging procedure for Go: https://go-team.pages.debian.net/packaging.html

    For libraries: Use dh-make-golang to create a package skeleton. Name your package with a name derived from import path, with a -dev suffix, e.g. golang-github-lib-pq-dev. Specify the dependencies ont Depends: line. (These are source dependencies for building, not binary dependencies for running, since Go statically links all source.)

    Installing the library package will install its source code to /usr/share/golang/src (possibly, the compiled libraries could go into .../pkg). Building depending Go packages will use the artifacts from those system-wide locations.

    For executables: Use dh-golang to create the package. Specify dependencies in Build-Depends: line (see above regarding packaging the dependencies).

提交回复
热议问题