Skip to content

Instantly share code, notes, and snippets.

@matyunin
Forked from msoap/script.go
Created June 27, 2018 08:18
Show Gist options
  • Save matyunin/00f9ad8c6e0783719d25d2e5d44fa47f to your computer and use it in GitHub Desktop.
Save matyunin/00f9ad8c6e0783719d25d2e5d44fa47f to your computer and use it in GitHub Desktop.
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:])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment