Akagi201
3/13/2015 - 7:47 PM

Run Go program as script

Run Go program as script

//usr/bin/env go run $0 "$@"; exit
package main

import (
	"fmt"
	"os"
)

func main() {
	fmt.Println("Hello world!")
	cwd, _ := os.Getwd()
	fmt.Println("cwd:", cwd)
	fmt.Println("args:", os.Args[1:])
}