What does go install do?

go build vs go install:

go build just compiles the executable file and moves it to the destination.
go install does a little bit more. It moves the executable file to
$GOPATH/bin and caches all non-main packages which are imported to
$GOPATH/pkg. The cache will be used during the next compilation provided the
source did not change yet.


A package tree after go build and go install:

.
├── bin
│   └── hello  # by go install
└── src 
    └── hello
        ├── hello  # by go build
        └── hello.go

More detailed information.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)