Avatar ·

What does `go build` actually do? Understanding `go build` vs `go install`

Hi everyone! I just started learning Go and I'm trying to understand how to properly build projects. I've read a bunch of articles, but I'm still confused about the `go build` and `go install` commands. I have a simple project with a main package in the root. When I run `go build` in the project folder, it creates a binary right there (I'm using Go 1.20 on Windows). But if I run `go install`, I don't see any binary in the project folder, instead my executable appears in `%GOPATH%/bin`. What's the difference here? Why would I need `go install` if `go build` already creates a binary? I've heard that `go build` also checks dependencies somehow, and `go install` installs them? Or is that not the case? My example code: ```go package main import "fmt" func main() { fmt.Println("Hello, Go!") } ``` I run `go buil