Answers for "golang command line argument"

Go
0

golang command line argument

package main
import (
    "fmt"
    "os"
)
func main() {

    argsWithProg := os.Args
    argsWithoutProg := os.Args[1:]
You can get individual args with normal indexing.

    arg := os.Args[3]
    fmt.Println(argsWithProg)
    fmt.Println(argsWithoutProg)
    fmt.Println(arg)
}
Posted by: Guest on August-10-2021

Code answers related to "golang command line argument"

Browse Popular Code Answers by Language