barelyhuman / goblin

Golang binaries compiled on-demand for your system
http://goblin.run
MIT License
138 stars 4 forks source link

Suggestion: Introduce a CLI to allow synchronization and easy maintenance of project binaries #21

Open brian-dlee opened 2 months ago

brian-dlee commented 2 months ago

I found your project and thought it was a nice solution for managing standalone tools for golang projects. One case we have in our project is compiling SQL to Go using sqlc. This binary requires pinning. If one developer has a different version than another then building the project could cause unnecessary or unintended changes to project files.

Currently we install sqlc inside a Justfile using go install .... We also use air and golangci-lint. What'd I'd like to do is make an easy way to manage these external dependencies. I currently use direnv to construct an ignored directory .bin in the project. Your tool fit right into this as I can just use curl to install the binaries into the .bin directory and update the PATH accordingly. The only problem I have is automatically installing updates when we bump the version.

I figured there was a solution to this with some scripting. I put together a little CLI script to download binaries via Goblin and keep track of what's installed with a .goblin and .goblin.lock files. I wrote it in python so I can slap it together relatively quickly to test out the idea. I'm happy to port it over to Go or some other language. I figured I'd drop by here, let you know my use case, and see if this project is interested in expanding its footprint by including something like this. I can surely maintain this separately on my own, so please feel free to tell me this doesn't belong here.

It's a bit hacky at the moment as it extracts the resolved version from the shell script returned by goblin.run. Should this be something more official or relied on, I'd probably want to add an API endpoint to return this information to improve stability. Here's the a brief setup for a project with this configured.

I dropped my tool into a GitHub repository here: https://github.com/brian-dlee/goblin-cli.

barelyhuman commented 2 months ago

I like the idea of goblin maintaining the versions but it’s a slightly more bigger in scope and might take time. I consider it a valid feature and have thought of doing so myself but with a tad bit more functionality where if the builds are already available for a app it would download instead of build.

As for the version extraction, the resolution part of goblin can be exposed as an API if needed, it’s easier to add that and i’ll do that first

barelyhuman commented 2 months ago

As for the version extraction, the resolution part of goblin can be exposed as an API if needed, it’s easier to add that and i’ll do that first

This should be closed by https://github.com/barelyhuman/goblin/pull/25 and will be a part of the next nightly docker build. I'll deploy that evening tomorrow (28th Sep, IST)