Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: cmd/go: warn if module uses features from next version of Go #67907

Closed
Antonboom opened this issue Jun 8, 2024 · 1 comment
Closed
Labels
Milestone

Comments

@Antonboom
Copy link

Proposal Details

// go.mod        
module test

go 1.20
// main.go
package main

import (
    "fmt"
    "go/types"
)

func main() {
    fmt.Println(types.Unalias(nil))
}
$ go version
go version go1.22.2 darwin/arm64

$ go run main.go
<nil>

But! types.Unalias was appeared in Go 1.22.

And any other module >= Go 1.20 can use module above as dependency (according to new policy) but will receive compiler error like

main.go:9: undefined: types.Unalias

How can a developer check the version of your module to ensure that it does not contain features from the new toolchain (which may be installed as the latest version on the developer's machine)?

@seankhliao
Copy link
Member

Duplicate of #46136

@seankhliao seankhliao marked this as a duplicate of #46136 Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants