How can I run Go binary files?

Viewed 35108

I read a lot about "You can run a Go program from binaries without even having Go installed on your machine", etc. How exactly should I execute the app?

In my case I have a console application which sends emails if a certain event occurs. There also is a .toml file for configuring it. How should I run the app on a PC which does not have Go installed and is running Ubuntu 14.04.1 (Trusty Tahr) 64-bit OS?

2 Answers

To avoid using ./ or any other path to the binary, you can copy the binary file to your /usr/local/bin/ path.

For example-

  1. Download a binary file that was compiled with Go, for example app
  2. Provide execution permission - chmod +x ~/Downloads/app
  3. Copy binary file to /usr/local/bin - cp ~/Downloads/app /usr/local/bin/app
  4. Execute the application from anywhere - app
Related