News for hackers. Stuff that matters.
Re:Go Run by mseepgood on Wednesday February 21, 2024 @06:19PM (#39461033)
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?
Re:Go Run by skissane on Wednesday February 21, 2024 @07:08PM (#39461417)
> 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).

Re:Go Run by rtheunissen on Wednesday February 21, 2024 @07:48PM (#39461687)
Maybe 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"
Re:Go Run by skissane on Wednesday February 21, 2024 @10:02PM (#39462670)
You 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.

Re:Go Run by aeturnum on Wednesday February 21, 2024 @08:45PM (#39462115)
It's not this specifically - it's when this "kind of thing" comes up in golang in particular. Every language needs to pick when to hold back complexity and when to make the user deal with it and I just personally dislike golang's particular balance. I also respect the work! It just irritates me.