-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: "only supported as of -lang=go1.13" error is misleading #33753
Comments
An idea to slightly improve the error given by the main Go tool (not the compiler):
|
The go command does not parse the file and so does not know whether it uses binary literals. It is the compiler that finds the error. Maybe just mention go 1.13, without -lang? |
I should have been clearer in my comment. I assume that this is the compiler giving the error (hence the For example, this could be done by detecting the error. I realise that's hacky, but I assume that the Go tool already does that elsewhere. Not mentioning either |
I think we can just change the compiler to give a better error message. How about binary literals not supported in language version 1.12 (may need to update language version in go.mod file) |
@gopherbot please open backport to 1.13 This is an unnecessarily confusing error message for people who want to try the new 1.13 language features, so when we fix it I think we should backport the fix to the 1.13 release series. |
Backport issue(s) opened: #33761 (for 1.13). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
I'm in favor of @cherrymui's suggestion with respect to the compiler error. But perhaps it could say:
This is short, makes it clear what minimum version is needed, and provides clear information as to what caused this (the current setting of -lang) without speculating what needs to be done. |
I think that something needs to say "go.mod". I'm thinking that it's fine to do that in cmd/compile, but if we don't put it there then it has to be in cmd/go as @mvdan suggested. |
Any updates on this? |
The compiler doesn't know who/what set the -lang flag, yet the compiler will need to provide an error message. I'll send out a CL for discussion. |
Change https://golang.org/cl/198491 mentions this issue: |
Change https://golang.org/cl/201480 mentions this issue: |
…e version errors Fixes #33761. Updates #33753. Updates #31747. Change-Id: Icc42b23405ead4f7f17b0ffa3611405454b6b271 Reviewed-on: https://go-review.googlesource.com/c/go/+/198491 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> (cherry picked from commit 27fc32f) Reviewed-on: https://go-review.googlesource.com/c/go/+/201480 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
When I compile some Go code that uses binary literals and has an old (go1.12) Go version declaration in its
go.mod
file, I get this error message:This makes it sound like I need to enable go1.13 support by passing a
-lang=go1.13
flag to thego build
invocation, where actually the problem is the incorrectgo 1.12
directive inside thego.mod
file -go build
does not recognize the-lang
flag.The text was updated successfully, but these errors were encountered: