Skip to content

go directive is too stringent #983

@mx-psi

Description

@mx-psi

What is the problem?

The go directive on this module was updated in #975 to 1.24.9. This prevents downstream Go modules from offering compatibility with Go versions 1.24.0 to 1.24.8.

Background

The go directive defines semantic compatibility:

A go directive indicates that a module was written assuming the semantics of a given version of Go.

The toolchain directive instead suggests a Go toolchain version to use:

A toolchain directive declares a suggested Go toolchain to use with a module. The suggested Go toolchain’s version cannot be less than the required Go version declared in the go directive. The toolchain directive only has an effect when the module is the main module and the default toolchain’s version is less than the suggested toolchain’s version.

Proposed fix

The go directive was bumped to 1.24.9 on #975 to help use the correct version in local development.
The toolchain directive is preferrable because:

  • The previous PR dropped compatibility with all versions from 1.24.0 to 1.24.8, while it still supports them
  • The toolchain directive applies only to the local module, so it does not affect downstream users.

A way to address the problem described in #975 while not affecting downstream users would be to do:

--- a/browsertests/go.mod
+++ b/browsertests/go.mod
@@ -1,6 +1,8 @@
 module github.com/google/pprof/browsertests

-go 1.24.9
+go 1.24.0
+
+toolchain go1.24.9

 // Use the version of pprof in this directory tree.
 replace github.com/google/pprof => ../
diff --git a/go.mod b/go.mod
index db65a4d..97386cf 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,8 @@
 module github.com/google/pprof

-go 1.24.9
+go 1.24.0
+
+toolchain go1.24.9

 require (
 	github.com/chzyer/readline v1.5.1

cc @aalexand as the author of #975

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions