Closed as not planned
Description
Proposal Details
It would be great if *.go
files can allow more fine-grained version constraints.
The go.mod
file permits it - so it seems like an incongruency.
My project is dealing with compiled object files which have been compiled on a very specific go version/OS/arch. It is important to be able to differentiate between different versions of go with precision.
=== go.mod ===
module mymod
go 1.22.3
=== main1.go ===
//go:build go1.23.5 && !go1.23.6
package main
func main() {
println("built using go1.23.5")
}
=== main2.go ===
//go:build go1.23.6 && !go1.24
package main
func main() {
println("built using go1.23.6")
}
$ go1.23.5 run .
package mymod: build constraints exclude all Go files in /Users/x/Documents/test-go-build-constraints
$ go1.23.6 run .
package mymod: build constraints exclude all Go files in /Users/x/Documents/test-go-build-constraints
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Incoming