Add go1.10 build constraint

This prevents netns from being used on older Go runtimes on which it's
not safe to perform any state manipulations of a scheduling thread
(https://github.com/golang/go/issues/20676).

Signed-off-by: Martynas Pumputis <m@lambda.lt>
This commit is contained in:
Martynas Pumputis 2018-12-21 10:30:08 +01:00
parent 13995c7128
commit b8d862b06e
2 changed files with 12 additions and 1 deletions

View File

@ -49,3 +49,14 @@ func main() {
}
```
## NOTE
The library can be safely used only with Go >= 1.10 due to [golang/go#20676](https://github.com/golang/go/issues/20676).
After locking a goroutine to its current OS thread with `runtime.LockOSThread()`
and changing its network namespace, any new subsequent goroutine won't be
scheduled on that thread while it's locked. Therefore, the new goroutine
will run in a different namespace leading to unexpected results.
See [here](https://www.weave.works/blog/linux-namespaces-golang-followup) for more details.

View File

@ -1,4 +1,4 @@
// +build linux
// +build linux,go1.10
package netns