-
Notifications
You must be signed in to change notification settings - Fork 61
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
Conversation
Signed-off-by: Arjun Naik <anaik@redhat.com>
/assign @dustman9000 @2uasimojo |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that GOOS
is defined, default to go env GOOS
if not.
Signed-off-by: Arjun Naik <anaik@redhat.com>
I tested this by moving
|
@dustman9000 You will have to set and pass the |
Signed-off-by: Arjun Naik <anaik@redhat.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: arjunrn, dustman9000 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Tested locally with latest changes and it pulls down the proper golangci-lint regardless of cross-compile GOOS. |
/label tide/merge-method-squash |
if which golangci-lint ; then | ||
exit |
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 the gocheck
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:
if which golangci-lint ; then | |
exit | |
if which golangci-lint && [[ $(golangci-lint --version) == *" v$GOLANGCI_LINT_VERSION "* ]]; then | |
exit |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the amd64
bit also break on Mac? (ppc
or something?)
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.
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 comment
The 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.
Attempts to fix #20
Currently the
ensure.sh
attempts to download thegolangci-lint
tool even when the tool is present on the path. Theensure.sh
will now download the script only when the tool is not present in$PATH
. Also other minor improvements:$GOPATH/bin
is present in$PATH
.$GOLANGCI_LINT_CACHE