go install compiles and installs a named Go program. The invocation stanza for go run is go install [-i] [build flags] [packages]
These are imported to $GOPATH/pkg. Cached items will be used on the next compilation if they haven't been modified. The resulting output from go install is an executable file that is the same as the one that gets compiled with a go build command, installed on the $GOBIN path on the system. For example, if we wanted to install our Prometheus HTTP server on our host, we could invoke a go install command, that is, GOBIN=~/prod-binaries/ go install -i prometheusExporterExample.go.
Setting our GOBIN variable tells the compiler where to install the compiled binary after compilation is complete. The go install program allows us to install the binary to our GOBIN location. The -i flag installs the dependencies...