diff options
| author | David Hill <[email protected]> | 2016-11-23 15:24:26 -0500 |
|---|---|---|
| committer | Dave Collins <[email protected]> | 2017-07-11 11:24:36 -0500 |
| commit | 9fadf46324c4cfc36cc82310ca92ded38af91249 (patch) | |
| tree | 7ee45c2a10640ab30ad0f169bad9c2b87d12bc16 /spew | |
| parent | e250ec7f597aa5cd2c9f38b9cbf3dbc81cc1e3bb (diff) | |
travis: Use gometalinter
Diffstat (limited to 'spew')
| -rw-r--r-- | spew/bypass.go | 6 | ||||
| -rw-r--r-- | spew/dump.go | 10 | ||||
| -rw-r--r-- | spew/format.go | 4 | ||||
| -rw-r--r-- | spew/internal_test.go | 5 |
4 files changed, 11 insertions, 14 deletions
diff --git a/spew/bypass.go b/spew/bypass.go index 8a4a658..7f166c3 100644 --- a/spew/bypass.go +++ b/spew/bypass.go @@ -41,9 +41,9 @@ var ( // after commit 82f48826c6c7 which changed the format again to mirror // the original format. Code in the init function updates these offsets // as necessary. - offsetPtr = uintptr(ptrSize) + offsetPtr = ptrSize offsetScalar = uintptr(0) - offsetFlag = uintptr(ptrSize * 2) + offsetFlag = ptrSize * 2 // flagKindWidth and flagKindShift indicate various bits that the // reflect package uses internally to track kind information. @@ -58,7 +58,7 @@ var ( // changed their positions. Code in the init function updates these // flags as necessary. flagKindWidth = uintptr(5) - flagKindShift = uintptr(flagKindWidth - 1) + flagKindShift = flagKindWidth - 1 flagRO = uintptr(1 << 0) flagIndir = uintptr(1 << 1) ) diff --git a/spew/dump.go b/spew/dump.go index df1d582..f78d89f 100644 --- a/spew/dump.go +++ b/spew/dump.go @@ -35,16 +35,16 @@ var ( // cCharRE is a regular expression that matches a cgo char. // 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 // char. It is used to detect unsigned character arrays to hexdump // them. - cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$") + cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) // cUint8tCharRE is a regular expression that matches a cgo uint8_t. // 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. @@ -143,10 +143,10 @@ func (d *dumpState) dumpPtr(v reflect.Value) { // Display dereferenced value. d.w.Write(openParenBytes) switch { - case nilFound == true: + case nilFound: d.w.Write(nilAngleBytes) - case cycleFound == true: + case cycleFound: d.w.Write(circularBytes) default: diff --git a/spew/format.go b/spew/format.go index c49875b..b04edb7 100644 --- a/spew/format.go +++ b/spew/format.go @@ -182,10 +182,10 @@ func (f *formatState) formatPtr(v reflect.Value) { // Display dereferenced value. switch { - case nilFound == true: + case nilFound: f.fs.Write(nilAngleBytes) - case cycleFound == true: + case cycleFound: f.fs.Write(circularShortBytes) default: diff --git a/spew/internal_test.go b/spew/internal_test.go index 20a9cfe..e312b4f 100644 --- a/spew/internal_test.go +++ b/spew/internal_test.go @@ -36,10 +36,7 @@ type dummyFmtState struct { } func (dfs *dummyFmtState) Flag(f int) bool { - if f == int('+') { - return true - } - return false + return f == int('+') } func (dfs *dummyFmtState) Precision() (int, bool) { |
