Gorram: go run for any go function
github.com
github.com
I used to use a lot of one-liners, but as time passed and I worked with more different languages, I came to prefer having things "programmized" and available either through BASH functions/aliases, or in my handy "tools" directory.
What I like about Gorram is that it should be trivial to make it turn the one-liner into a standalone utility program.
So: try a one-liner in Gorram and if it's useful, run it again with a flag, say "-s FILE" and it saves the compiled program for you.
I guess that's a feature request. :-)
Also, I really like the "STDIN or file" guessing.
I would expect -c -o to do what you expect.... which is not yet implemented but will be at some point :)
Also seems like the heuristics used are simple enough to hold in your head - hope it stays that way.
This is a typical response from a non-Firefly fan. :)
Another thing I intend to do quite soon is add usage for a particular function, so you don't have to guess how gorram will interpret it.
Pretty cool.
Can't help but think the examples don't really demonstrate anything new though, in the sense that there are existing tools for manipulating json (jq), generation SHA digests etc
I have a small go script I wrote in my toolbox that reads lines from stdin, puts them into a map and increments a counter each time that line is seen (sort like `sort | uniq -c` but less memory efficient in some situations.
The tedium with that code is having to write the bits to read from stdin etc, so I can imagine using this to 'auto generate' that bit for me
The .go files it generates for 'go run' are stored in $HOMEDIR/.gorram/$PACKAGE/$FUNCTION, a "go build" from there produces a standard executable. At the moment it seems to directly invoke "go run" with no ability to change that.
The tradeoff between go build and go run is that go build makes subsequent runs faster, but it creates a somewhat large binary that takes up disk space.
So, when I say go run is fast enough, I mean that the speedup of using go build is not big enough to justify the extra disk space required to store those binaries, compared to the speed hit we get from using go run each time (IMO of course).
If not, then neater.
And when you get into closures or use complex initializations.... a lot can happen with a single function call.
"Quite specific. It is, however, somewhat fuzzier on the subject of kneecaps."