Add ability to work with individual namespaces
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
67a1625791
commit
0114737132
2 changed files with 11 additions and 4 deletions
|
@ -53,7 +53,8 @@ func (ns *Namespace) String() string {
|
|||
func GetNamespace(key string) *Namespace {
|
||||
for _, ns := range namespaceList {
|
||||
if ns.Key == key {
|
||||
return ns
|
||||
cpy := *ns
|
||||
return &cpy
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -62,12 +63,16 @@ func GetNamespace(key string) *Namespace {
|
|||
// Contains returns true if the specified Namespace is
|
||||
// in the slice
|
||||
func (n Namespaces) Contains(ns string) bool {
|
||||
return n.Get(ns) != nil
|
||||
}
|
||||
|
||||
func (n Namespaces) Get(ns string) *Namespace {
|
||||
for _, nsp := range n {
|
||||
if nsp.Key == ns {
|
||||
return true
|
||||
return nsp
|
||||
}
|
||||
}
|
||||
return false
|
||||
return nil
|
||||
}
|
||||
|
||||
type (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue