debian

Golang打包在Debian上遇到问题怎么办

小樊
36
2025-12-18 22:55:38
栏目: 编程语言

快速定位与修复清单

常见报错与对应修复

最小可用的 debian/ 配置示例

Source: my-go-app
Section: utils
Priority: optional
Maintainer: Your Name <you@example.com>
Build-Depends: debhelper-compat (= 13), dh-golang, golang-go
Standards-Version: 4.6.0
Homepage: https://github.com/your/my-go-app
Vcs-Git: https://github.com/your/my-go-app.git
Vcs-Browser: https://github.com/your/my-go-app

Package: my-go-app
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A brief description of my Go application.
 A longer description here.
#!/usr/bin/make -f
export GOPATH := $(CURDIR)/.gopath
export GOBIN  := $(CURDIR)/bin

%:
	dh $@ --with golang

override_dh_auto_install:
	dh_golang_install
	# 如有额外资源:dh_install path/to/config.toml /etc/my-go-app/

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(GOPATH) $(GOBIN)
debuild -us -uc
lintian ../my-go-app_*.changes

以上示例遵循 dh-golang 推荐做法,简洁且符合 Debian 规范。

进阶与替代方案

0
看了该问题的人还看了