Browse Source

prevent white spaces as being accepted as valid host

Fabrizio (Misto) Milo 12 years ago
parent
commit
4247e1ce74
1 changed files with 4 additions and 2 deletions
  1. 4 2
      etcd.go

+ 4 - 2
etcd.go

@@ -542,13 +542,15 @@ func getInfo(path string) *Info {
 	} else {
 		// Otherwise ask user for info and write it to file.
 
+		hostname = strings.TrimSpace(hostname)
+
 		if hostname == "" {
 			fatal("Please give the address of the local machine")
 		}
 
+		fmt.Println("address ", hostname)
+
 		info.Hostname = hostname
-		info.Hostname = strings.TrimSpace(info.Hostname)
-		fmt.Println("address ", info.Hostname)
 
 		info.RaftPort = raftPort
 		info.ClientPort = clientPort