Reputation: 3330
I'm trying to run my golang program whenever I log into OSX. I'm trying the following script with Automator:
#!/bin/sh
export GOPATH=/Volumes/DTSE9/worker
go run /Volumes/worker/worker.go
Whenever I run this with Automator, it tells me go: command not found
Upvotes: 2
Views: 13593
Reputation: 13523
Create a file like say file.go
and it's content should look like:
///path-to/bin/go run $0 $@; exit $?
package main
func main() {
println("Hello World!")
}
Then run chmod +x file.go
and then you can execute it as ./file.go p1 p2
.
Edit: This works on Ubuntu. I did not saw that OSX was in question.
This is another version of the first line which does not require the path to the go
command (tested on zsh):
///$(which go) run $0 $@; exit $?
Upvotes: 4