Go Ports Can Now Declare What Version of Go They Need

Herby G herby.gillot at gmail.com
Mon Aug 3 18:54:04 UTC 2026


The `go` port is now a thin wrapper that provides the newest Go compiler
release each system can actually run:

    macOS 10.7 - 10.12    -> Go 1.17
    macOS 10.13 - 11      -> Go 1.24
    macOS 12 and later    -> Go 1.26

The versioned toolchains are installed side by side as go-1.NN, and a new
go_toolchain PortGroup owns the mapping. Background and reasoning are in
https://trac.macports.org/ticket/73086 -- this note is just what maintainers
need to do.

This mechanism prevents a Go port from attempting to build on an unsupported
version of macOS where it cannot be built or run. In this way, we increase
Buildbot
efficiency and improve the user experience for Go port users.

WHAT TO DO WITH YOUR GO PORTS

1. If your Portfile sets `go.offline_build no`, add the `go` directive from
   the project's go.mod, verbatim:

       go.offline_build    no
       go.toolchain_min    1.25.0

   On a system that cannot provide that version of Go, the port will then be
   marked known_fail, so it is skipped rather than fetched, built and
failed on
   every push. You can indicate the toolchain version series (eg., 1.25) or
the
   specific version (eg., 1.25.1).

2. Re-check the value when you update the port. go.mod directives move,
   and an annotation that was right at 1.2.3 can be wrong at 1.3.0.

3. If your Portfile uses `go.vendors`, then this cannot apply. `go.vendors`
   disables Go modules in order to force Go to build against the packages it
   downloads through `go.vendors`. To convert a port to using `go_toolchain
`,
   delete the `go.vendors` block, add `go.offline_build    no` and the
   `go.toolchain_min` declaration.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20260803/4d44162b/attachment.htm>


More information about the macports-dev mailing list