On Thu, 25 Feb 2021 at 09:08, Paul Förster <paul.foers...@gmail.com> wrote:

> Hi Volker,
>
> > On 25. Feb, 2021, at 08:46, Volker Dobler <dr.volker.dob...@gmail.com>
> wrote:
> >
> > I think there is a major problem with "go run main.go": It creates
> > a _false mental model_ of how Go code is built and executed in the
> > minds of _beginners_.
>
> I am a Go newbie and I agree, though I immediately understood that "go run
> ..." should only be for the developing/testing phase. But then, I did a
> little C before and know about what compilers do. But I also found tons of
> stuff immediately that said to "go build ...".
>
> Also, experience is good, but RTFM is also good, especially when starting
> with something completely new.
>
> Maybe rename the "run" command to "test", so it would be "go test ..."
> instead of "go run ..."?
>

Well, there is already subcommand "test": go test runs the (unit) tests
defined in the *_test.go files using package testing, so this won't work.

Well there is nothing wrong with a plain "go run" (nor arguments at all)
or "go run ." (a single dot for "current directory") and this is even _less_
to type than "go run main.go" and doesn't suffer from the problematic
"file focus".
I think the problem is not "go run" per se, but "go run main.go"
as cargo cult for "execute my program written in Go".

V.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAFdwN_n8Y2sqKuXgwR8mm%2BcVoH85gGKj8OUi%3D22K%3D%3DpWFXO7nQ%40mail.gmail.com.

Reply via email to