gobincache

command module
v0.0.0-...-5d30afa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 10 Imported by: 0

README

gobincache

gobincache checks whether a given install Go binary is up to date with the version in your projects go.mod. This can help remove unecessary work of installing vendored or cached binaries locally or in CI.

gobincache returns an exit code of 2 when the binary binary requires updating, 0 if it doesn't, and 1 for any other error encountered when running.

Install

go install github.com/CGA1123/gobincache@latest

Usage

#!/bin/bash

set -u

binary="${1}" # e.g. bin/sqlc
module="${2}" # e.g. github.com/kyleconroy/sqlc/cmd/sqlc

gobincache "${binary}"
status=$?

if [[ $status = "0" ]]; then
  echo "binary is up to date!"
  exit 0
fi

if [[ $status = "1" ]]; then
  echo "there was an error running gobincache"
  exit 1
fi

if [[ $status != "2" ]]; then
  echo "unknown exit code from gobincache"
  exit 1
fi

GOBIN="${PWD}/bin" go install "${module}"

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL