Commit 63f6d9d3 authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Kirill Smelkov

helloweb.go: don't use underscores in Go names

Following go conventions.

'go lint' is your friend

https://github.com/golang/lint

Effective Go: https://golang.org/doc/effective_go.html

helloweb.go:49:2: don't use underscores in Go names; var bind_ip should be bindIP
helloweb.go:50:2: don't use underscores in Go names; var bind_port should be bindPort
helloweb.go:51:2: don't use underscores in Go names; var bind_addr should be bindAddr
parent 95741ff4
...@@ -36,7 +36,7 @@ func webhello(w http.ResponseWriter, r *http.Request) { ...@@ -36,7 +36,7 @@ func webhello(w http.ResponseWriter, r *http.Request) {
func main() { func main() {
logfile := flag.String("logfile", "", "log output to file instead of stderr") logfile := flag.String("logfile", "", "log output to file instead of stderr")
flag.Usage = func() { flag.Usage = func() {
fmt.Println("Usage: helloweb.go [options] bind_ip bind_port ...") fmt.Println("Usage: helloweb.go [options] bindIP bindPort ...")
flag.PrintDefaults() flag.PrintDefaults()
} }
flag.Parse() flag.Parse()
...@@ -46,9 +46,9 @@ func main() { ...@@ -46,9 +46,9 @@ func main() {
os.Exit(1) os.Exit(1)
} }
bind_ip := flag.Arg(0) bindIP := flag.Arg(0)
bind_port := flag.Arg(1) bindPort := flag.Arg(1)
bind_addr := net.JoinHostPort(bind_ip, bind_port) bindAddr := net.JoinHostPort(bindIP, bindPort)
name = strings.Join(flag.Args()[2:], " ") name = strings.Join(flag.Args()[2:], " ")
if name == "" { if name == "" {
...@@ -65,9 +65,9 @@ func main() { ...@@ -65,9 +65,9 @@ func main() {
log.SetOutput(f) log.SetOutput(f)
} }
log.Printf("* %s helloweb.go starting at %s", asctime(), bind_addr) log.Printf("* %s helloweb.go starting at %s", asctime(), bindAddr)
http.HandleFunc("/", webhello) http.HandleFunc("/", webhello)
log.Fatal( log.Fatal(
http.ListenAndServe(bind_addr, logit(http.DefaultServeMux))) http.ListenAndServe(bindAddr, logit(http.DefaultServeMux)))
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment