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

cmd/compile: build tags don't respect the go version in go.mod #47259

Closed
OneOfOne opened this issue Jul 16, 2021 · 1 comment
Closed

cmd/compile: build tags don't respect the go version in go.mod #47259

OneOfOne opened this issue Jul 16, 2021 · 1 comment

Comments

@OneOfOne
Copy link
Contributor

This mainly applies to dev.typeparams since everything breaks if you use generics and go.mod isn't set to 1.18, however I tested with tip and go1.16 and the same issue happens.

To reproduce:

  • go.mod
module x

go 1.15
  • main.go
package main

func main() {
        println(Version)
}
  • main_go115.go
//go:build !go1.16
// +build !go1.16

package main

const Version = "1.15"
  • main_go116.go
//go:build go1.16
// +build go1.16

package main

const Version = "1.16"
@OneOfOne OneOfOne changed the title cmd/compile: dev.typeparams the compiler ignores go version in go.mod when parses build tags. cmd/compile: dev.typeparams the compiler ignores go version in go.mod and build tags. Jul 16, 2021
@OneOfOne OneOfOne changed the title cmd/compile: dev.typeparams the compiler ignores go version in go.mod and build tags. cmd/compile: build tags don't respect the go version in g.mod Jul 16, 2021
@OneOfOne OneOfOne changed the title cmd/compile: build tags don't respect the go version in g.mod cmd/compile: build tags don't respect the go version in go.mod Jul 16, 2021
@seankhliao
Copy link
Member

The build tags are chosen by the version of the toolchain used, not the the go directive (if it was it would be redundant)

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@golang golang locked and limited conversation to collaborators Jul 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants