Skip to content

Commit

Permalink
package_managers: gomod: Bump the max go version to 1.24
Browse files Browse the repository at this point in the history
Go 1.24 has been released [1]. No tangible impact on our logic
thankfully. The only relevant section for us is [2] which adds a new
'tool' subcommand:
    - we don't care about the subcommand per-se
    - tool can fetch/install additional development tools, e.g.
      stringer
    - tool modifies user's go.mod file accordingly with the relevant
      directives
    - development tools are prefetched just like any other modules \o/

Here's a snippet from using an external (i.e. not Go built-in) tools
experiment that makes use of the github.com/vektra/mockery/v2 tool:
    $ go get -tool github.com/vektra/mockery/v2
    $ go mod tidy
    $ git diff
        #go.mod
        ...
        +require (
        ...
        +    github.com/vektra/mockery/v2 v2.52.2 // indirect
        ...
        +)
        +
        +tool (
        +   github.com/vektra/mockery/v2
        +)

        #go.sum
        ...
        +github.com/vektra/mockery/v2 v2.52.2 h1:<checksum>
        +github.com/vektra/mockery/v2 v2.52.2/go.mod h1:<checksum>
    $ cachi2 fetch-dependencies gomod
    $ find ./cachi2-output | grep mockery
      ./cachi2-output/deps/gomod/pkg/mod/cache/download/github.com/vektra/mockery
      ./cachi2-output/deps/gomod/pkg/mod/cache/download/github.com/vektra/mockery/v2
      ...

    $ cachi2 generate-env --format env cachi2-output > cachi2.env
    $ nmcli dev dis <iface>
    $ ping 8.8.8.8
        ping: connect: Network is unreachable
    $ source cachi2.env
    $ go tool mockery --help
        Generate mock objects for your Golang interfaces

        Usage:
        mockery [flags]
        mockery [command]
        ...

Since this is a trivial version bump, update the docs at the same time.

[1] https://tip.golang.org/doc/go1.24
[2] https://tip.golang.org/doc/go1.24#go-command

Signed-off-by: Erik Skultety <eskultet@redhat.com>
  • Loading branch information
eskultety committed Feb 24, 2025
1 parent f37a09c commit 630c70e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ See [docs/generic.md](docs/generic.md) for more details.

<https://go.dev/ref/mod>

Current version: 1.23 [^go-version] [^go-compat]
Current version: 1.24 [^go-version] [^go-compat]

The gomod package manager works by parsing the [go.mod](https://go.dev/ref/mod#go-mod-file) file present in the source
repository to determine which dependencies to download. Cachi2 does not parse this file on its own - rather, we rely on
Expand Down
2 changes: 1 addition & 1 deletion cachi2/core/package_managers/gomod.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ def _setup_go_toolchain(go_mod_file: RootedPath) -> Go:
GO_121 = version.Version("1.21")
go = Go()
target_version = None
go_max_version = version.Version("1.23")
go_max_version = version.Version("1.24")
go_base_version = go.version
go_mod_version_msg = "go.mod reported versions: '%s'[go], '%s'[toolchain]"

Expand Down

0 comments on commit 630c70e

Please sign in to comment.