github.com/olljanat/moby@v1.13.1/oci/namespaces.go (about)

     1  package oci
     2  
     3  import specs "github.com/opencontainers/runtime-spec/specs-go"
     4  
     5  // RemoveNamespace removes the `nsType` namespace from OCI spec `s`
     6  func RemoveNamespace(s *specs.Spec, nsType specs.NamespaceType) {
     7  	idx := -1
     8  	for i, n := range s.Linux.Namespaces {
     9  		if n.Type == nsType {
    10  			idx = i
    11  		}
    12  	}
    13  	if idx >= 0 {
    14  		s.Linux.Namespaces = append(s.Linux.Namespaces[:idx], s.Linux.Namespaces[idx+1:]...)
    15  	}
    16  }