-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
42 lines (28 loc) · 1.31 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Sets up the project with dependencies needs for local testing/linting
# Name of the temporary directory in which compiled binaries will be stored.
temp_directory="tmp"
binaries=(errcheck gofumpt goimports golint gosec shadow staticcheck golangci-lint)
echo -e "\nInstalling Shadow"
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
echo -e "\nInstalling GoImports"
go install golang.org/x/tools/cmd/goimports
echo -e "\nInstalling GoLint"
go install golang.org/x/lint/golint
echo -e "\nInstalling StaticCheck"
go install honnef.co/go/tools/cmd/staticcheck
echo -e "\nInstalling ErrCheck"
go install github.com/kisielk/errcheck
echo -e "\nInstalling Golang CI - Lint"
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.34.1
# Fetching the location of the compiled binaries.
gopath=$(go env GOPATH)
# Creating a directory named `tmp` - command will be ignored if the directory exists
mkdir -p "./${temp_directory}"
path=$(pwd)
# Switching over to the path in GoRoot containing the compiled binaries.
cd "${gopath}/bin/"
# Moving all the binaries into the directory.
for file in "${binaries[@]}"; do
mv "${file}" "${path}/tmp/"
done
echo -e "\n\nExecution completed. Compiled binaries are now stored in \`${path}/${temp_directory}\`\n"