mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Replace bash release helper scripts with Go progam
This commit is contained in:
26
cmd/gorepomod/internal/utils/utils.go
Normal file
26
cmd/gorepomod/internal/utils/utils.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func DirExists(name string) bool {
|
||||
info, err := os.Stat(name)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
func SliceToSet(slice []string) map[string]bool {
|
||||
result := make(map[string]bool)
|
||||
for _, x := range slice {
|
||||
if _, ok := result[x]; ok {
|
||||
log.Fatalf("programmer error - repeated value: %s", x)
|
||||
} else {
|
||||
result[x] = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user