Open
Conversation
Our current approach with these deps is that we download the binary
directly to `$CACHE_BIN/<binary>`, and then touch an associated empty
file at `$CACHE_VERSIONS/<binary>/<version>`. This is annoying when you
want to wipe away an existing binary to get a new version; you ought to
be able to `rm (which <binary>)`, but you can't, because you also have
to remove the version.
This changes the approach to what we've done in some internal projects,
where instead we create a `$CACHE_VERSIONS/<binary>/<binary>-<version>`
file that gets symlinked in to `$CACHE_BIN`. You can now wipe away the
binary and always get the version back in place:
```console
$ which golangci-lint
/Users/stefanvanburen/.cache/makego/Darwin/arm64/bin/golangci-lint
$ rm (which golangci-lint) # remove the linked binary
$ make dockerdeps # relinks the binary
ln -sf /Users/stefanvanburen/.cache/makego/Darwin/arm64/versions/golangci-lint/golangci-lint-v2.9.0 /Users/stefanvanburen/.cache/makego/Darwin/arm64/bin/golangci-lint
$ rm (which golangci-lint) # remove the linked binary
$ rm /Users/stefanvanburen/.cache/makego/Darwin/arm64/versions/golangci-lint/golangci-lint-v2.9.0 # remove the versioned binary
$ make dockerdeps # re-downloads the binary and relinks the version
curl -fsSL -o /var/folders/q9/562j68913xs71bhqdrqh8drh0000gn/T/tmp.UMVVIYlet2/golangci-lint.tar.gz \
https://github.com/golangci/golangci-lint/releases/download/v2.9.0/golangci-lint-2.9.0-darwin-arm64.tar.gz
cd /var/folders/q9/562j68913xs71bhqdrqh8drh0000gn/T/tmp.UMVVIYlet2; tar zxf golangci-lint.tar.gz --strip-components 1 && mv golangci-lint /Users/stefanvanburen/.cache/makego/Darwin/arm64/versions/golangci-lint/golangci-lint-v2.9.0
ln -sf /Users/stefanvanburen/.cache/makego/Darwin/arm64/versions/golangci-lint/golangci-lint-v2.9.0 /Users/stefanvanburen/.cache/makego/Darwin/arm64/bin/golangci-lint
```
Inspired by @pkwarren.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our current approach with these deps is that we download the binary directly to
$CACHE_BIN/<binary>, and then touch an associated empty file at$CACHE_VERSIONS/<binary>/<version>. This is annoying when you want to wipe away an existing binary to get a new version; you ought to be able torm (which <binary>), but you can't, because you also have to remove the version.This changes the approach to what we've done in some internal projects, where instead we create a
$CACHE_VERSIONS/<binary>/<binary>-<version>file that gets symlinked in to$CACHE_BIN. You can now wipe away the binary and always get the version back in place:Inspired by @pkwarren.