diff --git a/main.go b/main.go index 14d09492..2a117a75 100644 --- a/main.go +++ b/main.go @@ -42,8 +42,8 @@ func main() { registerCmd("/sbin/halt", power.Halt) registerCmd("/usr/bin/respawn", respawn.Main) registerCmd("/usr/sbin/rancherctl", control.Main) - registerCmd("/sbin/tlsconf", util.TLSConf) - + registerCmd("/sbin/tlsconf", util.TLSConf) + if !reexec.Init() { log.Fatalf("Failed to find an entry point for %s", os.Args[0]) } diff --git a/scripts/test b/scripts/test index 6e99b547..222dd5db 100755 --- a/scripts/test +++ b/scripts/test @@ -1,9 +1,13 @@ #!/bin/bash set -e +if [[ ! -x "$(which go)" && -x /usr/local/go/bin/go ]]; then + PATH=/usr/local/go/bin:${PATH} +fi + cd $(dirname $0)/.. -result=$(find . -name "*.go" | grep -v ./Godeps | xargs gofmt -s -l) +result=$(find . -name "*.go" | grep -v ./Godeps | xargs gofmt -l) for i in $result; do echo $i done diff --git a/util/util.go b/util/util.go index 7d168b41..a595c73c 100644 --- a/util/util.go +++ b/util/util.go @@ -18,7 +18,6 @@ var ( letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ) - func TLSConf() { name := "rancher" bits := 2048 @@ -44,7 +43,7 @@ func TLSConf() { fmt.Println("--outdir \t the output directory to save the generate certs or keys") return } else if arg == "--outdir" { - if len(vargs) > index + 1 { + if len(vargs) > index+1 { outDir = vargs[index+1] } else { fmt.Println("please specify a output directory") @@ -52,13 +51,13 @@ func TLSConf() { } else if arg == "-g" { generateCaCerts = false } else if arg == "--cakey" { - if len(vargs) > index + 1 { + if len(vargs) > index+1 { inputCaKey = vargs[index+1] } else { fmt.Println("please specify a input ca-key file path") } } else if arg == "--ca" { - if len(vargs) > index + 1 { + if len(vargs) > index+1 { inputCaCert = vargs[index+1] } else { fmt.Println("please specify a input ca file path") @@ -109,7 +108,6 @@ func TLSConf() { } - func mountProc() error { if _, err := os.Stat("/proc/self/mountinfo"); os.IsNotExist(err) { if _, err := os.Stat("/proc"); os.IsNotExist(err) {