One nice side effect of using vcsh was developing more complex scripts to help me do things. I didn’t have to worry a script or tool would get lost when a machine inevitibly died.
However before writing a script, sometimes it’s not a bad idea to check and see if someone else already has. Lately many of those that I’ve found have been in Go.
Originally I did these with update but it made update
take a long time to run and sometimes
with die if a rarely used Go util was broken.
Based on that I switched to shell stubs to install them if they’re missing and then run them. However most of these tools are in regular development so it’s also nice to keep them current. Again, local stamp files come into play.
The stub itself is simple. Here’s the one for scc which I first read about in an interesting article on Go optimization.
|
|
The __get_and_run_go_binary
function comes from the .go-run
file.
It’s also rather simple, but putting it all here makes for much
smaller stub files and stops me reinventing all the same mistakes
I make in such stub files.
One thing to note is that it’s sometimes hard to derive the binary name from the repo name. Go has some rules for stripping those names that I don’t fully know. So rather than try and figure them out - and mess up at some future point when they change - I just put the binary name in explicitly.
|
|