runtime: cgo Unix C code can't modify environment variables for Go #27693
Labels
Milestone
Comments
Any suggestions on where this could be documented where the people who need to know about it would actually see it? |
Maybe a "Known Issues" section on the cmd/cgo docs might work, linking to a relevant GitHub search? It already has some tidbits like "avoid passing uninitialized C memory to Go code if the Go code is going to store pointer values in it. Zero out the memory in C before passing it to Go.". I'm sure there are a few other cgo gotchas that should be documented. |
Even if this was possible, I don’t see how it could be data race free when C code is mixed with goroutines.
… On 15 Sep 2018, at 11:03, Ryan Hitchman ***@***.***> wrote:
Maybe a "Known Issues" section on the cmd/cgo docs might work, maybe linking to a relevant GitHub search? It already has some tidbits like "avoid passing uninitialized C memory to Go code if the Go code is going to store pointer values in it. Zero out the memory in C before passing it to Go.". I'm sure there are a few other cgo gotchas that should be documented.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I have added it to the wiki For me, that would suffice. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Go are you using (
go version
)?1.11
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?linux amd64
What did you do?
Because of envOnce and copyenv in env_unix.go, linked non-Go programs can't set environment variables that are visible to Go code.
This is probably WAI, but it's surprising when embedding and could use a mention somewhere.
What did you see instead?
"1 1 3" instead of "1 2 3".
The text was updated successfully, but these errors were encountered: