3 ms·
> I don't get it. The default case is simple (go run .), and the complex case (specifying the relevant .go files one by one) is a little bit more complex. What'
by skissane 3y ago
> I don't get it. The default case is simple (go run .), and the complex case (specifying the relevant .go files one by one) is a little bit more complex. What's frustrating with that?
The problem is many Go tutorials start out by teaching the complex case first and leave the simple case to later (if they cover it at all).
- rtheunissen 3y agoMaybe it is because the simple way requires knowledge of packages, which are covered later perhaps, since many tutorials go straight to "go run helloworld.go"
- skissane 3y agoYou don't need to cover packages. You could just say this: the standard convention is that the source for each Go program lives in its own directory, and it starts running the code in a file called `main.go`. To run the Go program in the current directory, run `go run .` Introducing the concept of "packages", and the fact that the directory is a package, can be deferred until later.