Skip to content

x/tools/go/analysis/passes/stdversion, cmd/vet: stdversion check refers to "rand.(*Rand).N" method as "rand.N" #80363

Closed

Description

@dmitshur

Consider:

$ cat <(echo -- go.mod --) go.mod <(echo -- main.go --) main.go
-- go.mod --
module test

go 1.25.0
-- main.go --
package main

import ("fmt"; "math/rand/v2")

func main() {
    r := rand.New(rand.NewChaCha8([32]byte{1, 2, 3}))
    fmt.Println(r.N(100), "bottles of ...")
}
$ GOTOOLCHAIN=go1.26.5 go run . 
# test
./main.go:7:19: r.N undefined (type *rand.Rand has no field or method N)

$ ~/gotip/bin/go vet  # local gotip with a newer x/tools/internal/stdlib vendored
main.go:7:19: rand.N requires go1.27 or later (file is go1.25)
main.go:7:19: rand.N requires go1.27 or later (file is go1.25)

This symbol name is incorrect, it should be rand.(*Rand).N.

Originally posted by @prattmic in #80360

CC @golang/tools-team, @mrkfrmn, @griesemer.

Activity

  1. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Jul 10, 2026
  2. added
    ToolsThis label describes issues relating to any tools in the x/tools repository.
    on Jul 10, 2026
  3. added this to the Unreleased milestone on Jul 10, 2026
  4. self-assigned this
    on Jul 10, 2026
  5. dmitshur commented on Jul 10, 2026

    @dmitshur
    MemberAuthor

    It looks like this isn't a regression related to generic methods, rather it's how this check displays methods in general:

    Image
  6. gopherbot commented on Jul 10, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/799600 mentions this issue: go/analysis/passes/stdversion: correctly format symbol names

  7. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    FixPendingIssues that have a fix which has not yet been reviewed or submitted.
    and removed
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Jul 10, 2026
  8. gopherbot commented on Jul 14, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/800620 mentions this issue: [internal-branch.go1.27-vendor] go/analysis/passes/stdversion: correctly format symbol names

  9. gopherbot commented on Jul 14, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/798502 mentions this issue: cmd/vet: improve how stdversion analyzer refers to methods

  10. added a commit that references this issue on Jul 14, 2026
    e414538
  11. added a commit that references this issue on Aug 2, 2026
    5703a00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.ToolsThis label describes issues relating to any tools in the x/tools repository.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions