Skip to content

Instantly share code, notes, and snippets.

@zealws
Created December 3, 2015 01:22
Show Gist options
  • Save zealws/2c292ad0ee2f9fb5fca1 to your computer and use it in GitHub Desktop.
Save zealws/2c292ad0ee2f9fb5fca1 to your computer and use it in GitHub Desktop.
$ go run test.go google.com
173.194.33.163
$ go run test.go 127.0.0.1
127.0.0.1
$ go run test.go netflix.com
174.129.2.58
package main
import (
"fmt"
"gopkg.in/alecthomas/kingpin.v2"
)
func main() {
addr := kingpin.Arg("addr", "server address").Required().NetAddr()
kingpin.Parse()
fmt.Println(*addr)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment