-
Notifications
You must be signed in to change notification settings - Fork 18.1k
cmd/go: go refuses to compile hex floats on +build go1.13 file #38529
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
Comments
But you use |
Yes, so there should be no error, since go 1.13 supports hex float notation. |
You specified |
So how to I make my project buildable under 1.11? I've put the 1.13 stuff in a |
Use go1.11.x or 1.12.x to build. Or maybe drop support for go < 1.13, set go1.13 in go.mod |
It builds fine under 1.11 and 1.12. It only fails when I try to build using 1.13. Dropping support for 1.11 and 1.12 seems a silly thing to do when it builds fine under those versions. This is a problem with two compiler rules fighting each other, not a rational thing. |
I think this should work. Having a go1.11 mark in the mod file means we shouldn't define a go1.13 build tag. |
I don't think it's silly. Go is backward compatible, and also go1.11 and 1.12 are not supported anymore (see release policy) |
@randall77 How about passing the current |
@kstenerud Doesn't doing something like this work for you? https://play.golang.org/p/nqejHFvguRv |
@kortschak Change this to |
So don't change it to |
Then that defeats the whole purpose. If The point is that I want to have my software package buildable in 1.11 and 1.12, but also use hex floats for more specific floating point test code when building in 1.13+. |
More specifically: this code doesn't take the current |
This is not true. In the following session I build and run the code in the playground (with the exception that the float literal is negated in foo_old.go so that the code used is identified) in each version of Go from 1.11.9 to 1.14.2 (build chain is rebuilt for each version in another term).
|
Then this is exposing another issue. If go.mod specifies 1.13, why are the go 1.11 and 1.12 compilers not detecting this and throwing an error? If the version in go.mod is ignored by the compiler, what's it for? |
It is to indicate language features that are required. The question you are asking is #30791. |
See specifically #31747 (comment). |
Duplicate of #30791 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go.mod:
main.go:
main_1_13_test.go:
command:
go test
What did you expect to see?
What did you see instead?
Since the build settings will not compile this file on go < 1.13, this shouldn't be an error.
The text was updated successfully, but these errors were encountered: