On Sun, Jul 5, 2026 at 6:31 PM 'Dan Kegel' via golang-nuts
<[email protected]> wrote:
>
> Evidently AIs like Claude expect unix languages to accept input on the 
> commandline, e.g.
>
> go run -e -c 'package main; func main() { println("hello"); }'
>
> This mistake happens very frequently.  Presumably it's hallucinating -e and 
> -c because various other tools accept those as flags to indicate the input is 
> on the commandline.
>
> I asked Claude's opinion on this:
>
> --- snip ---
>
>  Before you run that command, I'm going to file a bug against go to make your 
> life easier.  Which example feels more natural to you for running short go 
> programs: 1)  go run -c 'package main; func main()
>
> {println("hello");}'  or   2) echo 'package main; func main() 
> {println("hello");}' | go run -
>
> ------- snip ----
>
> It replied:
>
> ------- snip ----
>
> Option 1 (go run -c '...') is what I instinctively reach for — it matches 
> python -c, bash -c, perl -e. Less pipeline plumbing for quick checks.
>
> ------- snip ----
>
> Why not obey the principle of least surprise here, and do what feels natural 
> to this (non-sentient) user?

I don't feel strongly one way or another about whether the go tool
should support passing in the source, but I note that the suggested
approach would make "go run -c" very different from "go test -c".

Ian

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWDOgz1rtrEK8Y1T6npxH4O9B9h%2B9Mfywi1s8KbCLTjYw%40mail.gmail.com.

Reply via email to