Skip to content

Instantly share code, notes, and snippets.

@ppanyukov
Created April 8, 2016 10:52
Show Gist options
  • Save ppanyukov/660a72e86ead14947555b1a769b58447 to your computer and use it in GitHub Desktop.
Save ppanyukov/660a72e86ead14947555b1a769b58447 to your computer and use it in GitHub Desktop.
Southpaw:~ philip$ export GOPATH="/Users/philip/scratch/gobook"; export PATH=${GOPATH}/bin:${PATH}
Southpaw:~ philip$ mkdir -p $GOPATH/src/hello
Southpaw:~ philip$ vi $GOPATH/src/hello/hello.go
// source:
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Contents of os.Args[0]:", os.Args[0])
}
// end source
Southpaw:~ philip$ go install hello
Southpaw:~ philip$ hello
Contents of os.Args[0]: hello
Southpaw:~ philip$ $GOPATH/bin/hello
Contents of os.Args[0]: /Users/philip/scratch/gobook/bin/hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment