Skip to content

Commit 62dee16

Browse files
authored
Merge pull request kubernetes-sigs#700 from camilamacedo86/golint
🏃 Change the golint install to do it as recommended
2 parents a87f999 + df41020 commit 62dee16

File tree

4 files changed

+39
-11
lines changed

4 files changed

+39
-11
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,4 @@ Please see https://git.k8s.io/community/CLA.md for more info
1616

1717
## Test locally
1818

19-
1. Setup tools
20-
```bash
21-
$ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.17.1
22-
```
23-
1. Test
24-
```bash
25-
GO111MODULE=on TRACE=1 ./hack/check-everything.sh
26-
```
27-
19+
Run the command `make check-all` to test the changes locally.

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2019 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
#
18+
# Makefile with some common workflow for dev, build and test
19+
#
20+
21+
##@ General
22+
23+
# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
24+
# The awk commands is responsable to read the entire set of makefiles included in this invocation, looking for lines of the file as xyz: ## something, and then pretty-format the target and help. Then, if there's a line with ##@ something, that gets pretty-printed as a category.
25+
# More info over the usage of ANSI control characters for terminal formatting: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
26+
# More info over awk command: http://linuxcommand.org/lc3_adv_awk.php
27+
.PHONY: help
28+
help: ## Display this help
29+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
30+
31+
##@ Tests
32+
33+
.PHONY: check-all
34+
test: ## Run the script check-everything.sh which will check all
35+
GO111MODULE=on TRACE=1 ./hack/check-everything.sh
36+

hack/check-everything.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function fetch_go_tools {
7070
header_text "Checking for gometalinter.v2"
7171
if ! is_installed golangci-lint; then
7272
header_text "Installing golangci-lint"
73-
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.17.1
73+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.21.0
7474
fi
7575
}
7676

hack/ci-check-everything.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export PATH=$(go env GOPATH)/bin:$PATH
2424
mkdir -p $(go env GOPATH)/bin
2525

2626
echo "Installing golangci-lint"
27-
curl --location --silent --retry 5 --fail https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.17.1
27+
curl --location --silent --retry 5 --fail https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.21.0
2828
echo "Finished installing golangci-lint"
2929

3030
$(dirname ${BASH_SOURCE})/check-everything.sh

0 commit comments

Comments
 (0)