Last active
September 17, 2016 00:34
-
-
Save techtonik/98ff54ef262f88bf98f29b0cd41890d8 to your computer and use it in GitHub Desktop.
Go - show program name and arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go run argi.go | |
package main | |
import "os" | |
import "fmt" | |
func main() { | |
fmt.Println("prog:", os.Args[0]) | |
if len(os.Args) > 1 { | |
fmt.Println("args:", os.Args[1:]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment