On Tuesday, July 7, 2026 at 12:08:53 PM UTC-7 Ian Lance Taylor wrote:
One version for C (or C++) is a thing of beauty. It's a bit
inconvenient since you need to put the string in the middle of the
command. And you need to name an executable file. This assumes bash.
gcc -o /tmp/run -x c - <<< '#include <stdio.h>
int main() { printf("hello, world\n"); }' && /tmp/run
Good point. gcc comes close here!
Go currently allows
echo 'package main; func main() {println("Hello, world!")}' > hello.go; go
run hello.go; rm hello.go
but following gcc's example would let us shorten that to
echo 'package main; func main() {println("Hello, world!")}' | go run -
--
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/d877a5a3-d32f-4449-9e2f-c652d64c6e9bn%40googlegroups.com.