You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
all env printed at name run [platform] go [version]
https://github.com/godcong/cgoenv/actions/runs/8660795647/job/23749374671
https://github.com/godcong/cgoenv/actions/runs/8660795645/job/23749373828
https://github.com/godcong/cgoenv/actions/runs/8660795643/job/23749373813
https://github.com/godcong/cgoenv/actions/runs/8660795642/job/23749374674
What did you do?
example in two files:
package main
import"fmt"funcmain() {
fmt.Println("[MAIN] Hello, World!")
}
package main
import"C"import"fmt"funcinit() {
fmt.Println("[OTHER] Import C and init in other.go")
}
When I run the program, windows executes init().
But, linux skips the execution of init().
What did you see happen?
in windows:
[OTHER] Import C and init in other.go
[MAIN] Hello, World!
in linux:
[MAIN] Hello, World!
What did you expect to see?
In different operating environments the same result can be outputted
The text was updated successfully, but these errors were encountered:
The special import "C" implies the "cgo" build constraint, as though the file also said "//go:build cgo". Therefore, if cgo is disabled, files that import "C" will not be built by the go tool.
Go version
1.21.0 1.22.0 1.22.1 1.22.2
Output of
go env
in your module/workspace:What did you do?
example in two files:
When I run the program, windows executes init().
But, linux skips the execution of init().
What did you see happen?
in windows:
[OTHER] Import C and init in other.go
[MAIN] Hello, World!
in linux:
[MAIN] Hello, World!
What did you expect to see?
In different operating environments the same result can be outputted
The text was updated successfully, but these errors were encountered: