Programming/golang2022. 9. 15. 19:00

 

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)
}

[링크 : https://gobyexample.com/command-line-arguments]

[링크 : https://stackoverflow.com/questions/2707434/how-to-access-command-line-arguments-passed-to-a-go-program]

[링크 : https://golangdocs.com/command-line-arguments-in-golang]

 

[링크 : https://pkg.go.dev/github.com/pborman/getopt]

 

[링크 : https://pkg.go.dev/os]

'Programming > golang' 카테고리의 다른 글

golang REST client  (0) 2022.09.23
golang 'go doc'  (0) 2022.09.15
golang json  (0) 2022.09.15
golang ini  (0) 2022.09.15
golang http.request  (0) 2022.09.14
Posted by 구차니