Skip to content

Instantly share code, notes, and snippets.

@RoryQ
Last active March 16, 2025 09:59
Show Gist options
  • Select an option

  • Save RoryQ/e6688846286af7b77e8e5814df597904 to your computer and use it in GitHub Desktop.

Select an option

Save RoryQ/e6688846286af7b77e8e5814df597904 to your computer and use it in GitHub Desktop.
EGET_VERSION=1.3.4
tooldep.eget:
@[[ "$(shell eget -v)" =~ "$(EGET_VERSION)" ]] \
|| go install github.com/zyedidia/eget@v$(EGET_VERSION)
# Go Get Tool command. Installs prebuilt binary if available, with fallback to go install.
# $1: github repo
# $2: version
# $3: sha256
# $4: go install fallback url (default is github repo)
EGET_BIN ?= $(GOPATH)/bin
define go_get_tool
eget --to $(EGET_BIN) $(if $(2),--tag $(2)) $(if $(3),--verify-sha256 $(3)) $(1) \
|| $(if $(4), go install $(4), go install github.com/$(1)@$(2))
endef
# Define a function to select platform-specific hash
# Usage: $(call mac_or_linux,darwin_hash,linux_hash)
UNAME_S := $(shell uname -s)
define mac_or_linux
$(if $(filter Darwin,$(UNAME_S)),$(1),$(2))
endef
tooldep.reflex: tooldep.eget
@hash reflex \
|| $(call go_get_tool,cespare/reflex,,,github.com/cespare/reflex@latest)
HIVEMIND_VERSION=1.1.0
HIVEMIND_SHA256=$(call mac_or_linux,4286e8eb2f0edd3ded654aee1a0f6c330915c9cfb5926d9ab238102086045fd4,8dee22ce0b3e8aa95363cb460c57949bd72b2d5c9c8b66f9368218b021d7ee56)
tooldep.hivemind: tooldep.eget
[[ "$(shell hivemind -v)" =~ "v$(HIVEMIND_VERSION)" ]] \
|| $(call go_get_tool,DarthSim/hivemind,v$(HIVEMIND_VERSION),$(HIVEMIND_SHA256),)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment