diff --git a/hello.go b/hello.go index 1795ac8..44fe76e 100644 --- a/hello.go +++ b/hello.go @@ -1,7 +1,18 @@ package main -import "fmt" +import ( + "flag" + "fmt" +) func main() { - fmt.Println("Hello, Björn!") + //fmt.Println("Hello, Björn!") + var argName string + + // flags declaration using flag package + flag.StringVar(&argName, "n", "Bruno", "Benutzernamen angeben. Default ist Bruno") + + flag.Parse() // after declaring flags we need to call it + + fmt.Println("Hallo " + argName + " !") }