I like this! currently quick testing locally have to start with a file. 
Also I think for AI agent to run quick script, this would be perfect

On Monday, 6 July 2026 at 03:29:09 UTC+1 Dan Kegel wrote:

> How about -e ?  That's what perl and ruby use.
> - Dan
>
> On Sun, Jul 5, 2026 at 6:35 PM Ian Lance Taylor <[email protected]> wrote:
>
>> 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/0d4be2ed-14a6-4a44-b834-704caede5ef0n%40googlegroups.com.

Reply via email to