Browse Source

add `make gofmt`

tags/v2.2.0-rc1
Shivaram Lingamneni 3 years ago
parent
commit
70a6ea375c
2 changed files with 8 additions and 1 deletions
  1. 4
    0
      .check-gofmt.sh
  2. 4
    1
      Makefile

+ 4
- 0
.check-gofmt.sh View File

@@ -3,6 +3,10 @@
3 3
 # exclude vendor/
4 4
 SOURCES="./oragono.go ./irc"
5 5
 
6
+if [ "$1" = "--fix" ]; then
7
+	exec gofmt -s -w $SOURCES
8
+fi
9
+
6 10
 if [ -n "$(gofmt -s -l $SOURCES)" ]; then
7 11
     echo "Go code is not formatted correctly with \`gofmt -s\`:"
8 12
     gofmt -s -d $SOURCES

+ 4
- 1
Makefile View File

@@ -1,4 +1,4 @@
1
-.PHONY: all install build release capdefs test smoke
1
+.PHONY: all install build release capdefs test smoke gofmt
2 2
 
3 3
 GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null)
4 4
 
@@ -36,3 +36,6 @@ test:
36 36
 smoke:
37 37
 	oragono mkcerts --conf ./default.yaml || true
38 38
 	oragono run --conf ./default.yaml --smoke
39
+
40
+gofmt:
41
+	./.check-gofmt.sh --fix

Loading…
Cancel
Save