Skip to content

Commit 40da61c

Browse files
committed
Add the linting command
1 parent ccddfea commit 40da61c

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
build:
22
go build -ldflags="-s -w"
33

4-
tests:
4+
.PHONY: test
5+
test:
56
go test -count=1 ./...
7+
8+
format-lint:
9+
errors=$$(gofmt -l .); if [ "$${errors}" != "" ]; then echo "Format Lint Error Files:\n$${errors}"; exit 1; fi
10+
11+
import-lint:
12+
errors=$$(goimports -l .); if [ "$${errors}" != "" ]; then echo "Import Lint Error Files:\n$${errors}"; exit 1; fi
13+
14+
style-lint:
15+
errors=$$(golint ./...); if [ "$${errors}" != "" ]; then echo "Style Lint Error Files:\n$${errors}"; exit 1; fi
16+
17+
lint: format-lint import-lint style-lint

gcb-visualizer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package main
22

33
import (
44
"fmt"
5+
"os"
6+
57
"github.com/RyanSiu1995/gcb-visualizer/cmd"
68
log "github.com/sirupsen/logrus"
7-
"os"
89
)
910

1011
func init() {

internal/utils/cloudbuild_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package util
33
import (
44
"bytes"
55
"fmt"
6-
"gopkg.in/yaml.v2"
76
"io/ioutil"
87
"os"
98
"path"
@@ -14,6 +13,7 @@ import (
1413
graphviz "github.com/goccy/go-graphviz"
1514
"github.com/goccy/go-graphviz/cgraph"
1615
"github.com/stretchr/testify/assert"
16+
"gopkg.in/yaml.v2"
1717
)
1818

1919
var supportedFormat = []string{".yaml", ".yml", ".json"}

0 commit comments

Comments
 (0)