-
-
Save matyunin/00f9ad8c6e0783719d25d2e5d44fa47f to your computer and use it in GitHub Desktop.
Run Go program as script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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