Logo Go Build Release

Go Build Release

Cộng đồng
eduardo-sl
go-build-release

Build and release Go binaries that are reproducible and verifiable: version stamping, -trimpath builds, cross-compilation, GoReleaser, checksums, SBOMs, cosign signing, build provenance attestations, and container images with ko or a multi-stage Dockerfile. Use when: "release a Go binary", "set up GoReleaser", "cross-compile", "reproducible build", "sign the release", "generate an SBOM", "build provenance", "publish a container image", "version command shows (devel)". Not for: test and lint pipelines (go-ci), shrinking the binary or image (go-binary-size), auditing dependencies (go-dependency-audit).

Tổng quan

Nhà phát hànheduardo-sl
Kho mãgo-agent-skills
Tên kỹ nănggo-build-release
Sao
86
Bản fork
11
Tệp đi kèm
2
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 2 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được eduardo-sl công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Go Build Release trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/(workflow)/go-build-release
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.

Sử dụng trong TypingMind

Bật Go Build Release trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Go Build Release ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Go Build Release với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Go Build and Release

A release is a promise that the binary users run is the one your source and pipeline produced. Make it reproducible so anyone can rebuild it, and verifiable so anyone can check it — before automating the publishing.

Detailed reference material, loaded on demand:

  • references/goreleaser.md — a complete .goreleaser.yaml and the tag-triggered release workflow.
  • references/supply-chain.md — SBOMs, cosign signing and verification, provenance attestations, signing container images.

Read a reference file only when the summary below is not enough.

1. Version Stamping

go
// Go 1.24+: built from a git checkout, Main.Version is the tag (v1.4.0)
// or a pseudo-version; vcs.* settings carry the commit and dirty flag.
info, _ := debug.ReadBuildInfo()
fmt.Println(info.Main.Version, info.GoVersion)
bash
go version -m ./bin/api          # inspect what a binary was built from
  • Prefer build info: it needs no flags and cannot drift from the source.
  • When a release tool builds from an archive without .git, inject the values: -ldflags "-X main.version=v1.4.0 -X main.commit=$SHA".
  • Never stamp the wall-clock build time — it makes every build unique. Use the commit time if you need a date.

2. Reproducible Builds

The same source, toolchain and flags must give byte-identical binaries:

bash
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o bin/api ./cmd/api
sha256sum bin/api   # rebuild in a clean checkout and compare
  • -trimpath removes your machine's paths from the binary.
  • Pin the toolchain: the go and toolchain lines in go.mod, the same image or setup-go version in CI. Go's own toolchain is reproducible since 1.21.
  • CGO_ENABLED=0 unless you need cgo — a C toolchain is one more input that varies between machines.
  • go mod download and go mod verify before building, so a tampered module cache fails the build.

3. Cross-Compilation

bash
go tool dist list                                  # every GOOS/GOARCH pair
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -trimpath -o bin/api-linux-arm64 ./cmd/api
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o bin/api.exe ./cmd/api

Pure Go cross-compiles from any host. With cgo you need a C cross-compiler per target; prefer pure-Go dependencies (e.g. a pure-Go SQLite driver) when you ship to several platforms. Raise GOAMD64 (v2/v3) only when every target CPU supports it — the binary will not start on older ones.

4. Release Automation with GoReleaser

One config builds every target, archives, checksums, SBOMs and signs:

yaml
# .goreleaser.yaml (excerpt — full file in references/goreleaser.md)
version: 2
builds:
  - main: ./cmd/api
    env: [CGO_ENABLED=0]
    flags: [-trimpath]
    ldflags: ["-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}"]
    mod_timestamp: "{{ .CommitTimestamp }}" # reproducible file times
    goos: [linux, darwin, windows]
    goarch: [amd64, arm64]
checksum:
  name_template: checksums.txt
bash
goreleaser check                         # validate the config
goreleaser release --snapshot --clean    # full dry run, nothing published

Release on tag push (v1.4.0) from CI, never from a laptop: the pipeline is the only place whose inputs are recorded.

5. Supply-Chain Artifacts

ArtifactAnswersProduced by
checksums.txtDid my download arrive intact?GoReleaser checksum
SBOM (SPDX or CycloneDX)What is inside this binary?syft, GoReleaser sboms
Signature bundle (.sigstore.json)Did this project's pipeline publish it?cosign sign-blob --bundle, keyless in CI
Provenance attestationWhich workflow, commit and runner built it?actions/attest (SLSA provenance)

Sign the checksums file rather than every archive — one signature then covers them all. Keyless signing uses the CI job's OIDC identity, so there is no private key to leak or rotate. Publish the exact verification commands in the release notes; a signature nobody verifies protects nobody. Commands: references/supply-chain.md.

6. Container Images

  • Pure-Go services: ko. Builds from the Go source without a Dockerfile, on a distroless base, multi-arch, with an SBOM, reproducibly: KO_DOCKER_REPO=ghcr.io/acme ko build --bare --platform=linux/amd64,linux/arm64 ./cmd/api.
  • Otherwise a multi-stage Dockerfile: build in golang:<version>, copy the binary into gcr.io/distroless/static:nonroot, run as non-root.
  • Reference images by digest in deployments, and sign them with cosign.
  • Image size is owned by the go-binary-size skill.

7. Versioning

  • Tags are semver with a v prefix: v1.4.0. Never move or delete a published tag — the module proxy has cached it, and users' go.sum pins its hash.
  • A breaking change to a library is a new major version with a /v2 module path, not just a v2.0.0 tag.
  • A bad release is withdrawn with retract in go.mod (the go-dependency-audit skill), then fixed in a new patch release.
  • Generate release notes from Conventional Commits (git-commit skill); GoReleaser's changelog.groups sorts them into features and fixes.

Verification Checklist

  1. go version -m on the release binary shows the tag and commit
  2. Two clean builds of the same tag produce identical SHA-256 sums
  3. -trimpath, CGO_ENABLED=0 (or a justified cgo build), pinned toolchain
  4. No build timestamps; file times derived from the commit
  5. Releases come from a tag-triggered CI job, never a laptop
  6. checksums.txt is signed; SBOMs are published; provenance is attested
  7. Release notes include the cosign verify-blob / gh attestation verify commands
  8. Images built with ko or multi-stage on distroless, non-root, referenced by digest
  9. Published tags are never moved; bad releases are retracted

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Go Build Release làm được gì?

Build and release Go binaries that are reproducible and verifiable: version stamping, -trimpath builds, cross-compilation, GoReleaser, checksums, SBOMs, cosign signing, build provenance attestations, and container images with ko or a multi-stage Dockerfile. Use when: "release a Go binary", "set up GoReleaser", "cross-compile", "reproducible build", "sign the release", "generate an SBOM", "build provenance", "publish a container image", "version command shows (devel)". Not for: test and lint pipelines (go-ci), shrinking the binary or image (go-binary-size), auditing dependencies (go-dependen...

Vì sao nên dùng Go Build Release trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Go Build Release là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Go Build Release trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/(workflow)/go-build-release. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Go Build Release?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Go Build Release với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Go Build Release với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Go Build Release có miễn phí không?

Có. Kỹ năng này được eduardo-sl phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇