4

What are the differences between "go run", "go build" and "go install" and in which cases I should use them?

Kumaran
  • 3,460
  • 5
  • 32
  • 34
  • 2
    What is unclear in the documentation you get from `go help run`, `go help build` and `go help install`? – Volker Jun 29 '16 at 08:09
  • @Volker I am not able to understand the usecase – Kumaran Jun 29 '16 at 12:08
  • 6
    `go install` compiles packages and binaries and stores them in $GOPATH/pkg and $GOPATH/bin. `go build` builds packages and discards the result, for binaries it builds and keeps the executable. `go run` is a handy shortcut to build some code and run it directly. – Volker Jun 29 '16 at 12:13
  • Checkout all command official documentation on https://golang.org/cmd/go/ – Harsh Nagarkar Nov 27 '20 at 23:00

0 Answers0