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
go 1.7beta1: go vet: import failed: fmt.a:1:4 (byte offset = 3): expected keyword package, got "cn" #16044
Comments
I'm seeing the same problem. |
What is the output of Do you have |
Here is the output of
|
From the error message, it looks like go vet is using an old gcimporter that doesn't know about the new binary export format (the export data of which happens to start in this case with "cn" rather than "package"). @aaronbee Can you please verify that you are running the latest version of go vet? Specifically, a version compiled with the 1.7 compiler and using 1.7 libraries? For instance, in the std library dir, you should have a file If this is all true, try building the std library (make.bash in the src directory) and confirm/deny that the error is still present. Thanks. |
Yeah, that fixed it. Here are the steps I took:
This would indicate there is likely a bug in the brew install script for go. |
Version skew. I've seen this myself but the solution is just to update the installation. |
@griesemer what do you think about making the gcimporter detect old versions of the object files, and reporting a more useful error message? |
@adg It does detect old versions and automatically uses the old format if present - no need for an error message. What happened here is the opposite: the installed version of gcimporter didn't know about the new version because it was out of date. There's not much I can do about that automatically (w/o knowing the future, at least). |
Oh, sorry, I misunderstood the error report. On 14 June 2016 at 14:50, Robert Griesemer notifications@github.com wrote:
|
Apologies but I'm still hitting this error message. It might not be a problem in the Go stdlib, but I'd appreciate your feedback. I installed this package:
On Mac you need zeromq 2.2 to install that. You'll also want to install the following additional packages
I then try running
where
This fails with the following error message:
Here's the relevant code in var initialSource string
for _, pp := range printerPkgs {
_, err := types.DefaultImport(s.Types.Packages, pp.path)
if err == nil {
initialSource = fmt.Sprintf(initialSourceTemplate, pp.path, pp.code)
break
}
debugf("could not import %q: %s", pp.path, err)
}
if initialSource == "" {
return nil, fmt.Errorf(`Could not load pretty printing package (even "fmt"; something is wrong)`)
} Here's my
Here's my
I rebuilt using |
Oh, I'm an idiot. It's importing |
I'm getting the same error on 1.7.5 if I run |
@mmatczuk You have packages installed generated by different versions of the compiler. This error will go away if all your installed packages are compiled by the same compiler version. If it doesn't please file a new issue with exact details how to reproduce the failure. Thanks. |
@griesemer thanks I think it's not related to mixing versions, anyway I'll double check that. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go1.7beta1
go env
)?darwin amd64
Installed go1.7beta1 with
brew upgrade go --devel
. Executedgo vet
on any go file.Normal vet output
This is repeated twice per file:
And then it would print out normal vet warnings if there were any for the file:
The text was updated successfully, but these errors were encountered: