Open rmmh opened 6 years ago
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 notifications@github.com 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.
This issue has a high similarity to #22302 in nature, which was resolved with CL 75751. Perhaps that is a good example to follow?
It stands out that unlike runtime.GOROOT
being a single function, there are many functions in os
that deal with getting/setting environment variables.
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".