Skip to content

Instantly share code, notes, and snippets.

@leonj1
Created August 18, 2017 12:48
Show Gist options
  • Save leonj1/3066180b0482e928ff45cdf1631829d9 to your computer and use it in GitHub Desktop.
Save leonj1/3066180b0482e928ff45cdf1631829d9 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Starting")
argsWithProg := os.Args
fmt.Printf("Arg count is %d\n", len(os.Args))
if len(os.Args) == 1 {
os.Exit(0)
}
argsWithoutProg := os.Args[1:]
arg := os.Args[3]
fmt.Println(argsWithProg)
fmt.Println(argsWithoutProg)
fmt.Println(arg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment