-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
"duplicate symbol" error when running easyjson on a file in the main package (go1.12) #236
Comments
easyjson parser and codegen based on reflection, so it wont works on package main files, because they cant be imported by parser. I added this note to readme. Fixing this requires to full rewrite parser from reflection to AST traversal, and this not in plan. See #1 for details |
Thanks for the clarification. I couldn't find anything in the go1.12.0 changelog to explain why it would stop working only at that point, but it could have been undefined behaviour to begin with. It's a wild shot and likely not feasible, but I'm wondering if the |
I think we can copy to separate dir with pkg renaming, this is very good idea. PR welcomed. |
easyjson does not work with main packages. Workaround changing the package name as suggested in mailru/easyjson#236 Some code has been moved from skydive to graffity: common.Getter Clean and update gomod: k8s deps should be added with replace, kubernetes/kubernetes#79384 Same problem with networkservicemesh viper is not being used add skydive as dep, not local replace Once compiled it fails to run with skydive because problems with the Go plugin framework. The error is: plugin was built with a different version of package golang.org/x/sys/unix golang/go#20481 golang/go#27751
easyjson does not work with main packages. Workaround changing the package name as suggested in mailru/easyjson#236 Some code has been moved from skydive to graffity: common.Getter Clean and update gomod: k8s deps should be added with replace, kubernetes/kubernetes#79384 Same problem with networkservicemesh viper is not being used add skydive as dep, not local replace Once compiled it fails to run with skydive because problems with the Go plugin framework. The error is: plugin was built with a different version of package golang.org/x/sys/unix golang/go#20481 golang/go#27751 Tested adding to the skydive.yml config file: plugin: plugins_dir: /home/adrian/go/src/github.com/skydive-project/skydive-plugins/memory topology: probes: memory
It would be nice to add into error message that main package is not supported. |
This is ridiculous; |
When running
easyjson -all ./path/to/file.go
on a file that's inpackage main
, the program fails with the following output:The
..._easyjson.go
file will be present, but generated only up until thetype EasyJSON_exporter_ ...
declaration. The error disappears if the package is renamed to something other thanmain
.The issue can be reproduced with a minimal file such as:
I couldn't find caveats in the README about
package main
limitations, so I assume it's a bug. Running an identical test with go1.11.11 (no error) and go1.12.0 (error) suggests that this is specific to go1.12+. Travis only tests with 1.11, which is why this would not be showing up in CI.Environment: go1.12.6 on macOS 10.14.5
easyjson version: da37f6c
The text was updated successfully, but these errors were encountered: