add go vet
This commit is contained in:
parent
832d0d3d01
commit
327564ae66
9
Makefile
9
Makefile
@ -19,9 +19,6 @@ check: imports build $(PARSERS)
|
|||||||
check-full: imports build $(PARSERS)
|
check-full: imports build $(PARSERS)
|
||||||
go test
|
go test
|
||||||
|
|
||||||
check-fmt: $(SOURCES)
|
|
||||||
@if [ "$$(gofmt -s -d $(SOURCES))" != "" ]; then false; else true; fi
|
|
||||||
|
|
||||||
.coverprofile: $(SOURCES) imports
|
.coverprofile: $(SOURCES) imports
|
||||||
go test -coverprofile .coverprofile
|
go test -coverprofile .coverprofile
|
||||||
|
|
||||||
@ -44,6 +41,12 @@ cpu: cpu.out
|
|||||||
fmt: $(SOURCES)
|
fmt: $(SOURCES)
|
||||||
@gofmt -w -s $(SOURCES)
|
@gofmt -w -s $(SOURCES)
|
||||||
|
|
||||||
|
check-fmt: $(SOURCES)
|
||||||
|
@if [ "$$(gofmt -s -d $(SOURCES))" != "" ]; then false; else true; fi
|
||||||
|
|
||||||
|
vet:
|
||||||
|
@go vet
|
||||||
|
|
||||||
precommit: fmt build check-full
|
precommit: fmt build check-full
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -234,14 +234,14 @@ func checkJSON(t *testing.T, got, expected interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(v) != len(o) {
|
if len(v) != len(o) {
|
||||||
t.Error("invalid object length, expected: %d, got: %d", len(v), len(o))
|
t.Errorf("invalid object length, expected: %d, got: %d", len(v), len(o))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, val := range v {
|
for key, val := range v {
|
||||||
gotVal, ok := o[key]
|
gotVal, ok := o[key]
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Error("expected key not found: %s", key)
|
t.Errorf("expected key not found: %s", key)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ func checkJSON(t *testing.T, got, expected interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(v) != len(a) {
|
if len(v) != len(a) {
|
||||||
t.Error("invalid array length, expected: %d, got: %d", len(v), len(a))
|
t.Errorf("invalid array length, expected: %d, got: %d", len(v), len(a))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user