-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure golangci-lint for the correct OS #22
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,27 @@ set -euo pipefail | |
|
||
GOLANGCI_LINT_VERSION="1.30.0" | ||
DEPENDENCY=${1:-} | ||
GOOS=$(go env GOOS) | ||
|
||
case "${DEPENDENCY}" in | ||
golangci-lint) | ||
GOPATH=$(go env GOPATH) | ||
if [ ! -f "${GOPATH}/bin/golangci-lint" ]; then | ||
DOWNLOAD_URL="https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" | ||
curl -sfL "${DOWNLOAD_URL}" | tar -C "${GOPATH}/bin" -zx --strip-components=1 "golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint" | ||
golangci-lint) | ||
GOPATH=$(go env GOPATH) | ||
if which golangci-lint ; then | ||
exit | ||
else | ||
mkdir -p "${GOPATH}/bin" | ||
echo "${PATH}" | grep -q "${GOPATH}/bin" | ||
IN_PATH=$? | ||
if [ $IN_PATH != 0 ]; then | ||
echo "${GOPATH}/bin not in $$PATH" | ||
exit 1 | ||
fi | ||
DOWNLOAD_URL="https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-${GOOS}-amd64.tar.gz" | ||
curl -sfL "${DOWNLOAD_URL}" | tar -C "${GOPATH}/bin" -zx --strip-components=1 "golangci-lint-${GOLANGCI_LINT_VERSION}-${GOOS}-amd64/golangci-lint" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No Macs have used intel x86 architecture for about 10 years now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL. We're still totally screwing all the people trying to develop on AIX though. |
||
fi | ||
;; | ||
*) | ||
echo "Unknown dependency: ${DEPENDENCY}" | ||
exit 1 | ||
*) | ||
echo "Unknown dependency: ${DEPENDENCY}" | ||
exit 1 | ||
;; | ||
esac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't ensure we're using
$GOLANGCI_LINT_VERSION
. As written, there are several ways that could go awry even when we're running thegocheck
target in a container -- e.g. if the base container image we're using already has the binary (at the wrong version).So IMO we really ought to include a version check here. Something like: