We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using cgo, the behavior can be incorrect if there is only an import "C" statement in the Go file.
Before:
package demo /* #include <stdlib.h> #include "version.h" */ import "C" // Version returns version string func Version() string { return C.GoString(C.version()) }
After:
package demo import "C" func Version() string { return C.GoString(C.version()) }
One workaround for this issue is to add an underscore import after import "C". This ensures the correct behavior. Here is the modified code:
package demo /* #include <stdlib.h> #include "version.h" */ import "C" import ( _ "fmt" ) // Version returns version string func Version() string { return C.GoString(C.version()) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When using cgo, the behavior can be incorrect if there is only an import "C" statement in the Go file.
Before:
After:
One workaround for this issue is to add an underscore import after import "C". This ensures the correct behavior. Here is the modified code:
The text was updated successfully, but these errors were encountered: