Skip to content

Commit 6282dc0

Browse files
sathia27MalloZup
authored andcommitted
chore(#57): add new stage for go fmt check (#64)
1 parent 46aee69 commit 6282dc0

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ git:
99
depth: 1
1010
go_import_path: github.com/Clusterlab/ha_cluster_exporter
1111

12-
script:
13-
- make
12+
jobs:
13+
include:
14+
- stage: Go fmt
15+
- script: ./go_lint.sh
16+
- stage: Build
17+
- script: make

go_lint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# NOTE: This script needs be run from the root of the GD2 repository
4+
5+
# Find all Go source files in the repository, that are not vendored or generated
6+
# and then run gofmt on them
7+
GOFMT_FILE_LIST=$(gofmt -l . | grep -v vendor)
8+
if [ -n "${GOFMT_FILE_LIST}" ]; then
9+
printf >&2 'gofmt failed for the following files:\n%s\n\nplease run "gofmt -w ." on your changes before committing.\n' "${GOFMT_FILE_LIST}"
10+
exit 1
11+
fi

0 commit comments

Comments
 (0)