News for hackers. Stuff that matters.
Re:Scripting with Go: A Modest Proposal by jvictor118 on Sunday August 20, 2023 @11:03AM (#37199848)
If one were actually going to use something like this, I’d think it’d be worth implementing a little shebang script that can wrap a single-file script in the necessary boilerplate and call go run!
Re:Scripting with Go: A Modest Proposal by simonw on Sunday August 20, 2023 @11:42AM (#37200202)
That's a really fun idea. I got that working here: https://til.simonwillison.net/bash/go-script

Now you can run this:

    cat file.txt | ./goscript.sh -c 'script.Stdin().Column(1).Freq().First(10).Stdout()'
Or write scripts like this - call it 'top10.sh':

    #!/tmp/goscript.sh
    script.Stdin().Column(1).Freq().First(10).Stdout()
Then run this:

    chmod 755 topten.sh
    echo "one\none\ntwo" | ./topten.sh
Re:Scripting with Go: A Modest Proposal by moondev on Sunday August 20, 2023 @10:25PM (#37204834)
This is fantastic. Thanks for sharing and also including docs on your process and usage!
Re:Scripting with Go: A Modest Proposal by jayd16 on Sunday August 20, 2023 @02:23PM (#37201693)
Hmm, I wonder if this is Microsoft's real endgame with allowing the single line C# syntax.