GoReleaser 的官网是：https://goreleaser.com/

 1 2 3  goreleaser init goreleaser release --snapshot --rm-dist goreleaser release --rm-dist 

1. 构建生成

1. 多系统多架构的交叉编译
2. 构建参数设置
2. 压缩，主要是使用 upx 进行可执行程序的压缩

3. 打包，部分小工具会有对应配置文件，需要一起打包

4. 发布到 GitLab

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48  # This is an example .goreleaser.yml file with some sensible defaults. # Make sure to check the documentation at https://goreleaser.com before: hooks: # You may remove this if you don't use go modules. - go mod tidy # you may remove this if you don't need go generate - go generate ./... env_files: gitlab_token: ./gitlab_token gitlab_urls: api: http://192.168.0.200/api/v4/ download: http://192.168.0.200/ # set to true if you use a self-signed certificate skip_tls_verify: true # set to true if you want to upload to the Package Registry rather than attachments # Only works with GitLab 13.5+ use_package_registry: false builds: - env: - CGO_ENABLED=0 goos: - windows goarch: - amd64 hooks: post: - upx "{{ .Path }}" archives: - replacements: darwin: Darwin linux: Linux windows: Windows 386: i386 amd64: x86_64 format: zip files: - config.json checksum: name_template: 'checksums.txt' snapshot: name_template: "{{ incpatch .Version }}-next" changelog: sort: asc filters: exclude: - '^docs:' - '^test:'