mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
These comments were added to enforce using the correct import path for
our packages ("github.com/docker/docker", not "github.com/moby/moby").
However, when working in go module mode (not GOPATH / vendor), they have
no effect, so their impact is limited.
Remove these imports in preparation of migrating our code to become an
actual go module.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
28 lines
726 B
Go
28 lines
726 B
Go
package oci
|
|
|
|
import "github.com/opencontainers/runtime-spec/specs-go"
|
|
|
|
// RemoveNamespace removes the `nsType` namespace from OCI spec `s`
|
|
func RemoveNamespace(s *specs.Spec, nsType specs.LinuxNamespaceType) {
|
|
if s.Linux == nil {
|
|
return
|
|
}
|
|
for i, n := range s.Linux.Namespaces {
|
|
if n.Type == nsType {
|
|
s.Linux.Namespaces = append(s.Linux.Namespaces[:i], s.Linux.Namespaces[i+1:]...)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
// NamespacePath returns the configured Path of the first namespace in
|
|
// s.Linux.Namespaces of type nsType.
|
|
func NamespacePath(s *specs.Spec, nsType specs.LinuxNamespaceType) (path string, ok bool) {
|
|
for _, n := range s.Linux.Namespaces {
|
|
if n.Type == nsType {
|
|
return n.Path, true
|
|
}
|
|
}
|
|
return "", false
|
|
}
|