package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func getPassedArgs() string {
|
|
|
|
if len(os.Args) != 2 {
|
|
fmt.Printf("Exactly 1 argument is needed\n")
|
|
os.Exit(1)
|
|
}
|
|
|
|
return os.Args[1]
|
|
|
|
}
|
|
|
|
func main() {
|
|
|
|
m := map[string]string{
|
|
"305": "Sue",
|
|
"204": "Bob",
|
|
"631": "Jake",
|
|
"073": "Tracy",
|
|
}
|
|
|
|
key := getPassedArgs()
|
|
if name := m[key]; name != "" {
|
|
fmt.Println("Hi,", name)
|
|
} else {
|
|
fmt.Println(key, "not found")
|
|
os.Exit(1)
|
|
}
|
|
|
|
}
|