What's Go's equivalent of argv[0]?

Import "os os. Args0 Arguments are exposed in the os package golang.org/pkg/os/#Variables If you're going to do argument handling, the flag package golang.org/pkg/flag is the preferred way. Specifically for your case flag.

Usage Update for the example you gave: func usage() { fmt. Fprintf(os. Stderr, "usage: %s inputfile\n", os.

Args0) flag.PrintDefaults() os. Exit(2) } should do the trick.

Import "os" os. Args0 Arguments are exposed in the os package golang.org/pkg/os/#Variables If you're going to do argument handling, the flag package golang.org/pkg/flag is the preferred way. Specifically for your case flag.

Usage Update for the example you gave: func usage() { fmt. Fprintf(os. Stderr, "usage: %s inputfile\n", os.

Args0) flag.PrintDefaults() os. Exit(2) } should do the trick.

I couldn't figure out how to get it in flag and didn't know os has that information. Thanks. – grokus Jul 28 '10 at 18:24.

Use os. Args0 from the os package package main import "os" func main() { println("I am ", os. Args0) }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions