diff --git a/.travis.yml b/.travis.yml index be1df6f..e2b0fd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,12 @@ go: - stable script: - go get -t ./... + - go get -u golang.org/x/lint/golint - go test ./... - go test -race ./... - go vet ./... - diff -u <(echo -n) <(gofmt -d -s .) - diff -u <(echo -n) <(./scripts/autogen_licences.sh .) + - diff -u <(echo -n) <(golint ./...) after_success: - ./scripts/coverage.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 55143db..43c0812 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The LineChart widget now correctly determines the Y axis scale when multiple series are provided. +- Lint issues in the codebase, and updated Travis configuration so that golint + is executed on every run. ## [0.6.1] - 12-Feb-2019 diff --git a/draw/segdisp/sixteen/sixteen.go b/draw/segdisp/sixteen/sixteen.go index 410aec6..7de149e 100644 --- a/draw/segdisp/sixteen/sixteen.go +++ b/draw/segdisp/sixteen/sixteen.go @@ -86,21 +86,37 @@ var segmentNames = map[Segment]string{ const ( segmentUnknown Segment = iota + // A1 is a segment, see the diagram above. A1 + // A2 is a segment, see the diagram above. A2 + // B is a segment, see the diagram above. B + // C is a segment, see the diagram above. C + // D1 is a segment, see the diagram above. D1 + // D2 is a segment, see the diagram above. D2 + // E is a segment, see the diagram above. E + // F is a segment, see the diagram above. F + // G1 is a segment, see the diagram above. G1 + // G2 is a segment, see the diagram above. G2 + // H is a segment, see the diagram above. H + // J is a segment, see the diagram above. J + // K is a segment, see the diagram above. K + // L is a segment, see the diagram above. L + // M is a segment, see the diagram above. M + // N is a segment, see the diagram above. N segmentMax // Used for validation. @@ -340,7 +356,8 @@ func (d *Display) ToggleSegment(s Segment) error { return nil } -// Character sets all the segments that are needed to display the provided character. +// SetCharacter sets all the segments that are needed to display the provided +// character. // The display only supports a subset of ASCII characters, use SupportsChars() // or Sanitize() to ensure the provided character is supported. // Doesn't clear the display of segments set previously. @@ -435,7 +452,7 @@ func (d *Display) Draw(cvs *canvas.Canvas, opts ...Option) error { return bc.CopyTo(cvs) } -// Required, when given an area of cells, returns either an area of the same +// Required when given an area of cells, returns either an area of the same // size or a smaller area that is required to draw one display. // Returns a smaller area when the provided area didn't have the required // aspect ratio. diff --git a/mouse/button/button.go b/mouse/button/button.go index d421abc..3ced57e 100644 --- a/mouse/button/button.go +++ b/mouse/button/button.go @@ -112,18 +112,17 @@ func wantRelease(fsm *FSM, m *terminalapi.Mouse) (bool, State, stateFn) { // Remain in the same state, since termbox reports move of mouse with // button held down as a series of clicks, one per position. return false, Down, wantRelease - } else { - return false, Up, wantPress } + return false, Up, wantPress case mouse.ButtonRelease: if m.Position.In(fsm.area) { // Seen both press and release, report a click. return true, Up, wantPress - } else { - // Release the button even if the release event happened outside of the area. - return false, Up, wantPress } + // Release the button even if the release event happened outside of the area. + return false, Up, wantPress + default: return false, Up, wantPress } diff --git a/widgets/donut/circle.go b/widgets/donut/circle.go index 466abe8..b835050 100644 --- a/widgets/donut/circle.go +++ b/widgets/donut/circle.go @@ -64,14 +64,14 @@ func startEndAngles(current, total, startAngle, direction int) (start, end int) func midAndRadius(ar image.Rectangle) (image.Point, int) { mid := image.Point{ar.Dx() / 2, ar.Dy() / 2} if mid.X%2 != 0 { - mid.X -= 1 + mid.X-- } switch mid.Y % 4 { case 0: - mid.Y += 1 + mid.Y++ case 1: case 2: - mid.Y -= 1 + mid.Y-- case 3: mid.Y -= 2 diff --git a/widgets/linechart/axes/label.go b/widgets/linechart/axes/label.go index e37a868..c99522a 100644 --- a/widgets/linechart/axes/label.go +++ b/widgets/linechart/axes/label.go @@ -45,7 +45,7 @@ const ( // flows horizontally. LabelOrientationHorizontal LabelOrientation = iota - // LabelOrientationvertical is an orientation where text flows vertically. + // LabelOrientationVertical is an orientation where text flows vertically. LabelOrientationVertical )