This is not really a shebang. Real one was rejected several times. But it still works:
-
When you run
./main.go
then it's evaluated as shell-script (sh or bash). Pretty version of it looks like this:go run <current file> <arguments>
-
Go ignores first comment and executes as usually.
-
Exit code is handled correctly.
//usr/bin/env go
seeks forgo
binary and handles Go comment//
correctly.$0 "$@"
passess current file and arguments to binary.exit "$?"
returns exit code.