Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wrapping a Go source with a few lines of shell to make it directly runnable (chmod u+x)
#!/bin/sh
f=$(mktemp -t XXXXXXXX.go); sed -n '3,$p' "$0" >"$f"; go run "$f"; e=$?; rm -f "$f"; exit $?
package main
import "fmt"
func main() {
fmt.Println("Hello")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment