go-lang-plugin-org / go-lang-idea-plugin

Google Go language IDE built using the IntelliJ Platform
https://plugins.jetbrains.com/plugin/5047
Other
4.56k stars 571 forks source link

Fail to compile and run gotest #2916

Closed Ewg-sha closed 6 years ago

Ewg-sha commented 6 years ago

Your issue description goes here. Please be as detailed as possible

The problem is in the way how IntelliJ tries to run compiler. It compiles single file instead of compiling the whole package (folder): OROOT=/go #gosetup GOPATH=/build/private/bgospace/pkg1:/build/private/bgospace/Go3p-Ginkgo-Gomega:/build/private/bgospace/Go3p-Github-Fortytw2-Leaktest:/build/private/bgospace/Go3p-Github-Gogo-Protobuf:/build/private/bgospace/Go3p-Github-Golang-Protobuf:/build/private/bgospace/pkg2:/build/private/bgospace/Go3p-Github-Grpc-GrpcGo:/build/private/bgospace/Go3p-Github-Pkg-Errors:/build/private/bgospace/Go3p-Github-Stretchr-Testify:/build/private/bgospace/Go3p-Golang-X-Crypto:/build/private/bgospace/Go3p-Golang-X-Net:/build/private/bgospace/Go3p-Golang-X-Sync:/build/private/bgospace/Go3p-Golang-X-Text:/build/private/bgospace/Go3p-Gopkg-Check:/build/private/bgospace/Go3p-Gopkg-Yaml:/build:/build/private/bgospace/pkg3 #gosetup

/go/bin/go test -c -i -o /tmp/___config_file_parsing_test_go__1_ //proxy/config_file_parsing_test.go #gosetup # command-line-arguments ./config_file_parsing_test.go:12:17: undefined: initializeProxyConfig ./config_file_parsing_test.go:22:17: undefined: initializeProxyConfig ./config_file_parsing_test.go:38:17: undefined: initializeProxyConfig ./config_file_parsing_test.go:38:53: undefined: commandLineOptions ./config_file_parsing_test.go:64:17: undefined: initializeProxyConfig ./config_file_parsing_test.go:64:53: undefined: commandLineOptions ./config_file_parsing_test.go:84:17: undefined: initializeProxyConfig ./config_file_parsing_test.go:84:53: undefined: commandLineOptions ./config_file_parsing_test.go:100:17: undefined: initializeProxyConfig ./config_file_parsing_test.go:100:53: undefined: commandLineOptions ./config_file_parsing_test.go:100:53: too many errors Compilation finished with exit code 2 All undefined symbols could be found in //proxy/config_file_parsing.go The same setup works in GoLand, where IDE issues a bit different compilation instruction: /go test -c -i -o /tmp/___config_file_parsing_test_go /proxy #gosetup
dlsniper commented 6 years ago

Please report any further issues on the official tracker: https://youtrack.jetbrains.com/issues/Go, this is not to be used anymore.

However, to answer your question for now: You need to create the run configuration to use the package instead of a single file. To do so, go to Run | Edit Configuration | Go Application | <name of your configuration> | Run kind and select Package instead of File then the IDE will complete automatically the first part of the package in the field, for example github.com/dlsniper/demo and then you can add the rest of the package path as needed.