What a home Go program was built from: the release CI stamped, its --version answer, and the info panel of repo, build, install path and checkout (from at-home-tools and agent-tools, AHT-258)
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nelson 687e478a4a
All checks were successful
Suite release / check-build (none, ubuntu-latest) (ubuntu-latest, none) (push) Has been skipped
Suite release / scope (push) Successful in 50s
Suite release / publish (push) Has been skipped
Suite release / deliver (push) Has been skipped
Suite release / deliver-prune (push) Has been skipped
Suite release / build (none, ubuntu-latest) (ubuntu-latest, none) (push) Has been skipped
Suite release / reused-checks (push) Has been skipped
Suite release / deploy-image (push) Has been skipped
Suite release / reserve (push) Has been skipped
Suite release / check-manifest (push) Has been skipped
Suite release / check-package (push) Has been skipped
Suite release / finalize (push) Has been skipped
Suite release / module (push) Has been skipped
README's Go example indents with spaces (#3)
2026-11-30 14:57:31 -08:00
buildinfo.go buildinfo moves in from at-home-tools, one copy for both repos (#1) 2026-11-29 22:37:33 -08:00
buildinfo_test.go buildinfo moves in from at-home-tools, one copy for both repos (#1) 2026-11-29 22:37:33 -08:00
executable_other.go buildinfo moves in from at-home-tools, one copy for both repos (#1) 2026-11-29 22:37:33 -08:00
executable_windows.go buildinfo moves in from at-home-tools, one copy for both repos (#1) 2026-11-29 22:37:33 -08:00
executable_windows_test.go buildinfo moves in from at-home-tools, one copy for both repos (#1) 2026-11-29 22:37:33 -08:00
go.mod The module is forgejo.romaine.life/romaine-life/buildinfo (#2) 2026-11-29 22:49:35 -08:00
go.sum buildinfo moves in from at-home-tools, one copy for both repos (#1) 2026-11-29 22:37:33 -08:00
README.md README's Go example indents with spaces (#3) 2026-11-30 14:57:31 -08:00

buildinfo

What a home Go program was built from. The release suite stamps the release, its repository, the Forgejo server and the build time into this package with -ldflags -X, by the names it stamps every Go release with (pipeline-templates' suites/go/build.mjs); a local build leaves them empty and says so.

  • Version and Tag: the release CI stamped (Tag is empty for a local build).
  • AnswerVersion: a program run with --version alone writes its release and returns, so every program carries the release it came from (PIPT-48).
  • Read: the lines of a terminal app's palette "info" panel: its repo and link, version, build time in Pacific time, where it runs from (the image the process mapped, so the current junction doesn't hide the release) and its checkout under D:\repos.

It joins at-home-tools' and agent-tools' buildinfo packages, which were one copy each, until shared packages got repositories of their own (AGT-85, AHT-258).

Using it

require forgejo.romaine.life/romaine-life/buildinfo v0.1.1
import "forgejo.romaine.life/romaine-life/buildinfo"

func main() {
    if buildinfo.AnswerVersion(os.Args[1:], os.Stdout) {
        return
    }
    ...
}

A program's .goreleaser.yaml stamps it:

ldflags: >-
  -s -w
  {{ if isEnvSet "VERSION" }}-X forgejo.romaine.life/romaine-life/buildinfo.version={{ .Env.VERSION }}{{ end }}

Testing

go test ./...; the panel's Windows tests run on Windows.

Shipping

A library: the release-module topic in pipeline-templates' fleet.json tags each merge that changes the code, and every fleet repository whose go.mod requires it gets a take-up. Forgejo pushes it to its public GitHub copy, which proxy.golang.org serves to builds outside CI.