Commit 57b5956 1 parent b6978e5 commit 57b5956 Copy full SHA for 57b5956
File tree 2 files changed +8
-15
lines changed
2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change 1
- #! /usr/bin/env bash
2
-
3
- # prints error if a specific command does not exist
4
- function panic_if_command_not_exists() {
5
- if ! command -v " $1 " >> /dev/null 2> /dev/null; then
6
- echo -e " \033[0;33m$1 \033[0m command is not available - please install it first"
7
- exit 1
8
- fi
9
- }
1
+ #! /bin/bash
2
+ set -euo pipefail
10
3
11
4
# installs the golangci-lint of the specific version to the specific directory
12
5
function install_golangci_lint() {
13
6
local version=" $1 "
7
+ local project_dir=" ." # cd "$(git rev-parse --show-toplevel)"
14
8
15
9
# check presence and version of golangci-lint
16
- if [[ -f third_party/golangci-lint ]]; then
10
+ if [[ -f " $project_dir / third_party/golangci-lint" ]]; then
17
11
local installed_version
18
- installed_version=$( third_party/golangci-lint --version | grep -E -o ' [0-9]+\.[0-9]+\.[0-9]+' )
12
+ installed_version=$( " $project_dir / third_party/golangci-lint" --version | grep -E -o ' [0-9]+\.[0-9]+\.[0-9]+' )
19
13
if [[ $installed_version == " $version " ]]; then
20
14
exit 0
21
15
fi
22
16
echo " golangci version is not as expected - got '$installed_version ', want '$version ' - will update"
23
17
fi
24
18
25
- panic_if_command_not_exists " curl"
26
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b " ./third_party" " v$version "
27
- }
19
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b " $project_dir /third_party" " v$version "
20
+ }
Original file line number Diff line number Diff line change 1
- golangci-lint
1
+ golangci-lint
You can’t perform that action at this time.
0 commit comments