Skip to content

x/tools/gopls/internal/analysis/modernize: Incorrect fix for map clone #72009

Closed as not planned
@silverwind

Description

@silverwind

Go version

go version go1.24.0 darwin/arm64

Output of go env in your module/workspace:

not relevant

What did you do?

Given this code snippet:

env := append([]string{}, os.Environ()...)

What did you see happen?

Running go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix ./... against it changes it to unexpected

env := os.Environ()

What did you expect to see?

env := maps.Clone(os.Environ())

Full example: https://github.com/go-gitea/gitea/pull/33739/files#diff-9eb7ecf3f47cf4bf4925d890d93f44741dbfb744515e9e5b5e159dc02866ebf5

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions