Quick actions

cmd+k|ctrl+k

Navigation

Languages

Parsing command line arguments / Raw access to command line arguments / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T10:15:52Z

Updated

2019-03-26T10:15:52Z

package main

import (
	"fmt"
	"os"
)

func main() {
	fmt.Printf("Name of executable: '%s'\n", os.Args[0])
	args := os.Args[1:]
	for i, arg := range args {
		fmt.Printf("Arg %d, value: '%s'\n", i, arg)
	}
}
INFO