I have a file to which I've written the go run header, but the file isn't executing.
This site shows an example that doesn't work for me. https://coderwall.com/p/_kdjzq/go-run-run-go-as-a-script-language
./scripts/test.go
//usr/bin/env go run "$0" "$@"; exit
package scripts
import (
"fmt"
)
func main() {
fmt.Println("hello")
}
I am trying to invoke it like this:
chmod +x ./scripts/test.go
./scripts/test.go
Failed to execute process './scripts/test.go'. Reason:
exec: Exec format error
The file './scripts/test.go' is marked as an executable but could not be run by the operating system.