Unverified Commit 577907af authored by Max Kuznetsov's avatar Max Kuznetsov Committed by GitHub
Browse files

fix linter warnings and add GH lint workflow (#1074)

* fix linter warnings and add GH lint workflow

* address PR feedback
parent 7294047b
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
name: golangci-lint
on:
  workflow_dispatch:
  pull_request:

permissions:
  contents: read
  pull-requests: read

jobs:
  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-go@v4
        with:
          go-version: "stable"
          cache: false
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.54
          only-new-issues: true
          args: --timeout=10m

.golangci.yml

0 → 100644
+18 −0
Original line number Diff line number Diff line
run:
  # Enables skipping of directories:
  # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
  skip-dirs-use-default: true
  skip-dirs:
    - internal/gopher-lua
    - internal/cronexpr

linters:
  enable:
    - gofmt

linters-settings:
  gofmt:
    simplify: false

  errcheck:
    ignore: cleanup
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ All notable changes to this project are documented below.
The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org).

## [Unreleased]
### Fixed
- Fixed multiple issues found by linter.

### [3.17.1] - 2023-08-23
### Added
+102 −102
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@
//	}
//
// will create the following flags
//
//	-dbname string
//	      dbname
//	-interval int
@@ -174,7 +175,6 @@
// duplication in flag names (in the flattened case it's more likely to happen
// unless the caller make due dilligence to create the struct properly), it panics.
//
//
// Note that not all types can have command line flags created for. map, channel
// and function type will not defien a flag corresponding to the field. Pointer
// types are properly handled and slice type will create multi-value command
+1 −2
Original line number Diff line number Diff line
@@ -73,8 +73,6 @@ func TestInt(t *testing.T) {
	sl.Delete(Int(888))
	sl.Delete(Int(1000))

	expect = []Int{Int(-999), Int(-888), Int(1), Int(3), Int(999)}

	if sl.Front().Value.(Int) != -999 {
		t.Fatal()
	}
@@ -283,6 +281,7 @@ func BenchmarkIntRankRandom(b *testing.B) {
	}
}

// nolint:unused
func output(sl *SkipList) {
	var x *Element
	for i := 0; i < SKIPLIST_MAXLEVEL; i++ {
Loading