diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 45497eae..bba7dfa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: test: strategy: matrix: - go-version: [1.17.x] + go-version: [1.19.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: @@ -27,7 +27,7 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.17.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v2 - name: Build binaries diff --git a/.goreleaser.yml b/.goreleaser.yml index 3b1cdfd0..3d3afdd4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,6 +9,7 @@ builds: - linux - darwin - windows + - freebsd goarch: - amd64 - arm64 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3908b58b..001dfd35 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ First off, thanks for taking the time to contribute! Feel free to make Pull Requ # Requirements -Go >= 1.17.0 +Go >= 1.19.0 # Process diff --git a/go.mod b/go.mod index f92f1341..8031fa7b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/evilmartians/lefthook -go 1.17 +go 1.19 require ( github.com/MakeNowJust/heredoc v1.0.0 diff --git a/internal/lefthook/runner/runner_test.go b/internal/lefthook/runner/runner_test.go index 3d66cad8..deb4ec19 100644 --- a/internal/lefthook/runner/runner_test.go +++ b/internal/lefthook/runner/runner_test.go @@ -87,8 +87,8 @@ func TestRunAll(t *testing.T) { Scripts: map[string]*config.Script{}, }, success: []Result{ - {Name: "lint", Status: StatusOk}, {Name: "test", Status: StatusOk}, + {Name: "lint", Status: StatusOk}, }, fail: []Result{{Name: "type-check", Status: StatusErr}}, }, @@ -238,26 +238,32 @@ func TestRunAll(t *testing.T) { } } - if !resultsEqual(success, tt.success) { + if !resultsMatch(success, tt.success) { t.Errorf("success results are not matching") } - if !resultsEqual(fail, tt.fail) { + if !resultsMatch(fail, tt.fail) { t.Errorf("fail results are not matching") } }) } } -func resultsEqual(a, b []Result) bool { +func resultsMatch(a, b []Result) bool { if len(a) != len(b) { return false } - for i, item := range a { - if item.Name != b[i].Name || - item.Status != b[i].Status || - item.Text != b[i].Text { + matches := make(map[string]struct{}) + + for _, item := range a { + str := fmt.Sprintf("%s_%d_%s", item.Name, item.Status, item.Text) + matches[str] = struct{}{} + } + + for _, item := range b { + str := fmt.Sprintf("%s_%d_%s", item.Name, item.Status, item.Text) + if _, ok := matches[str]; !ok { return false } }