forked from zeta-chain/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfmt.sh
More file actions
executable file
·26 lines (20 loc) · 705 Bytes
/
fmt.sh
File metadata and controls
executable file
·26 lines (20 loc) · 705 Bytes
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
#!/bin/bash
# Exit on any error
set -e
if ! command -v golangci-lint &> /dev/null
then
echo "golangci-lint is not found, installing..."
go install github.com/golangci/golangci-lint/cmd/[email protected]
fi
if ! command -v golines &> /dev/null
then
echo "golines could not be found, installing..."
go install github.com/segmentio/[email protected]
fi
# Fix long lines
echo "Fixing long lines..."
golines -w --max-len=120 --ignore-generated --ignored-dirs=".git" --base-formatter="gofmt" .
# Gofmt, fix & order imports, remove whitespaces
echo "Formatting code..."
golangci-lint run --enable-only 'gci' --enable-only 'gofmt' --enable-only 'whitespace' --fix
echo "Code is formatted"