Just for fun, I wondered how easy it would be to create a bash script that 
facilitates using Go in this way.

https://gist.github.com/JetSetIlly/9147e371074734aac7fe05c801b457d9

Usage would be something like

   echo 'println("hello world"); fmt.Println("goodbye")' | GORUN

   echo 'println(math.Pi)' | GORUN

Or using actual newlines
   echo '
   println("hello world")
   println("goodbye")
   ' | GORUN 


On Tuesday, 7 July 2026 at 03:33:24 UTC+1 Dan Kegel wrote:

> On Mon, Jul 6, 2026 at 3:10 AM Rob Pike <[email protected]> wrote:
>
>> Surely these AI tools are powerful enough that you can tell them how to 
>> run the command rather than changing the language's tools to cover their 
>> inadequacies.
>>
>
> I've observed people never bothering to do go build; they want to treat go 
> like an interpreter.
> And most popular interpreters offer a way to run code from the commandline.
> Here's a little rosetta stone:
>
> # Program coming from stdin
>
> echo 'echo "Hello, World!"' | sh
>
> echo 'echo "Hello, World!"' | pwsh
>
> echo 'print("Hello, World!")' | python3
>
> echo 'print "Hello, World!\n"' | perl
>
> echo 'puts "Hello, World!"' | ruby
>
> echo '<?php echo "Hello, World!\n"; ?>' | php
>
> echo 'console.log("Hello, World!")' | node
>
> echo 'print("Hello, World!")' | lua
>
> #not supported in go
>
>
> # Program coming from commandline option
>
> sh -c 'echo "Hello, World!"'
>
> pwsh -Command 'echo "Hello, World!"'
>
> python3 -c 'print("Hello, World!")'
>
> perl -e 'print "Hello, World!\n"'
>
> ruby -e 'puts "Hello, World!"'
>
> php -r 'echo "Hello, World!\n";'
>
> node -e 'console.log("Hello, World!")'
>
> lua -e 'print("Hello, World!")'
>
> awk 'BEGIN{print "Hello, World!"}'
>
> echo 'package main; func main() {println("Hello, world!")}' > hello.go; go 
> run hello.go; rm hello.go
>
>
> It does seem worth supporting, at least to me, as an idiom for quickly 
> printing out constants or running really tiny programs.
>
> - Dan
>

-- 
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/bbbd40a1-cc54-47a9-83c7-1ebfbcd78c67n%40googlegroups.com.

Reply via email to