Run Golang script from shell script

I try to run my golang program whenever I enter OSX. I am trying to use a script using Automator:

#!/bin/sh export GOPATH=/Volumes/DTSE9/worker go run /Volumes/worker/worker.go 

Whenever I run this using Automator, it tells me go: command not found

0
bash go automator
source share
1 answer

Create a file, for example say file.go , and its contents should look like this:

 ///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 .

Change This works on Ubuntu. I have not seen that OSX is in question.

+1
source share

All Articles