Add //usr/bin/env go run $0 $@; exit
to go file to run like a shell script
$ cat a.go
//usr/bin/env go run $0 $@; exit
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
$ chmod a+x a.go
$ ./a.go
hello world
$
Add //usr/bin/env go run $0 $@; exit
to go file to run like a shell script
$ cat a.go
//usr/bin/env go run $0 $@; exit
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
$ chmod a+x a.go
$ ./a.go
hello world
$