travis: Use gometalinter

This commit is contained in:
David Hill 2016-11-23 15:24:26 -05:00
parent 346938d642
commit bef1507bbd
5 changed files with 26 additions and 20 deletions

View File

@ -1,14 +1,23 @@
language: go language: go
go: go:
- 1.5.4
- 1.6.3 - 1.6.3
- 1.7 - 1.7.4
sudo: false
install: install:
- go get -v golang.org/x/tools/cmd/cover - go get -v github.com/alecthomas/gometalinter
- gometalinter --install
script: script:
- go test -v -tags=safe ./spew - export PATH=$PATH:$HOME/gopath/bin
- go test -v -tags=testcgo ./spew -covermode=count -coverprofile=profile.cov - export GORACE="halt_on_error=1"
- test -z "$(gometalinter --disable-all
--enable=gofmt
--enable=golint
--enable=vet
--enable=gosimple
--enable=unconvert
--deadline=4m ./spew | tee /dev/stderr)"
- go test -v -race -tags safe ./spew
- go test -v -race -tags testcgo ./spew -covermode=count -coverprofile=profile.cov
after_success: after_success:
- go get -v github.com/mattn/goveralls - go get -v github.com/mattn/goveralls
- export PATH=$PATH:$HOME/gopath/bin
- goveralls -coverprofile=profile.cov -service=travis-ci - goveralls -coverprofile=profile.cov -service=travis-ci

View File

@ -41,9 +41,9 @@ var (
// after commit 82f48826c6c7 which changed the format again to mirror // after commit 82f48826c6c7 which changed the format again to mirror
// the original format. Code in the init function updates these offsets // the original format. Code in the init function updates these offsets
// as necessary. // as necessary.
offsetPtr = uintptr(ptrSize) offsetPtr = ptrSize
offsetScalar = uintptr(0) offsetScalar = uintptr(0)
offsetFlag = uintptr(ptrSize * 2) offsetFlag = ptrSize * 2
// flagKindWidth and flagKindShift indicate various bits that the // flagKindWidth and flagKindShift indicate various bits that the
// reflect package uses internally to track kind information. // reflect package uses internally to track kind information.
@ -58,7 +58,7 @@ var (
// changed their positions. Code in the init function updates these // changed their positions. Code in the init function updates these
// flags as necessary. // flags as necessary.
flagKindWidth = uintptr(5) flagKindWidth = uintptr(5)
flagKindShift = uintptr(flagKindWidth - 1) flagKindShift = flagKindWidth - 1
flagRO = uintptr(1 << 0) flagRO = uintptr(1 << 0)
flagIndir = uintptr(1 << 1) flagIndir = uintptr(1 << 1)
) )

View File

@ -35,16 +35,16 @@ var (
// cCharRE is a regular expression that matches a cgo char. // cCharRE is a regular expression that matches a cgo char.
// It is used to detect character arrays to hexdump them. // It is used to detect character arrays to hexdump them.
cCharRE = regexp.MustCompile("^.*\\._Ctype_char$") cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`)
// cUnsignedCharRE is a regular expression that matches a cgo unsigned // cUnsignedCharRE is a regular expression that matches a cgo unsigned
// char. It is used to detect unsigned character arrays to hexdump // char. It is used to detect unsigned character arrays to hexdump
// them. // them.
cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$") cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`)
// cUint8tCharRE is a regular expression that matches a cgo uint8_t. // cUint8tCharRE is a regular expression that matches a cgo uint8_t.
// It is used to detect uint8_t arrays to hexdump them. // It is used to detect uint8_t arrays to hexdump them.
cUint8tCharRE = regexp.MustCompile("^.*\\._Ctype_uint8_t$") cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`)
) )
// dumpState contains information about the state of a dump operation. // dumpState contains information about the state of a dump operation.
@ -143,10 +143,10 @@ func (d *dumpState) dumpPtr(v reflect.Value) {
// Display dereferenced value. // Display dereferenced value.
d.w.Write(openParenBytes) d.w.Write(openParenBytes)
switch { switch {
case nilFound == true: case nilFound:
d.w.Write(nilAngleBytes) d.w.Write(nilAngleBytes)
case cycleFound == true: case cycleFound:
d.w.Write(circularBytes) d.w.Write(circularBytes)
default: default:

View File

@ -182,10 +182,10 @@ func (f *formatState) formatPtr(v reflect.Value) {
// Display dereferenced value. // Display dereferenced value.
switch { switch {
case nilFound == true: case nilFound:
f.fs.Write(nilAngleBytes) f.fs.Write(nilAngleBytes)
case cycleFound == true: case cycleFound:
f.fs.Write(circularShortBytes) f.fs.Write(circularShortBytes)
default: default:

View File

@ -36,10 +36,7 @@ type dummyFmtState struct {
} }
func (dfs *dummyFmtState) Flag(f int) bool { func (dfs *dummyFmtState) Flag(f int) bool {
if f == int('+') { return f == int('+')
return true
}
return false
} }
func (dfs *dummyFmtState) Precision() (int, bool) { func (dfs *dummyFmtState) Precision() (int, bool) {