Skip to content

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

Closed

Description

@OneOfOne

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"

Activity

  1. 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.[/+] on Jul 16, 2021
  2. 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[/+] on Jul 16, 2021
  3. 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[/+] on Jul 16, 2021
  4. seankhliao commented on Jul 16, 2021

    @seankhliao
    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

  5. locked and limited conversation to collaborators on Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions