Skip to content

Commit

Permalink
chore: Bump go version to 1.19 (#305)
Browse files Browse the repository at this point in the history
* chore: Bump go version to 1.18

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* chore: Build binary for FreeBSD too

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* chore: Bump to 1.19

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>

* fix: Compare random execs using map

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
  • Loading branch information
mrexox authored Aug 7, 2022
1 parent 4217296 commit 4521c56
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ builds:
- linux
- darwin
- windows
- freebsd
goarch:
- amd64
- arm64
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/evilmartians/lefthook

go 1.17
go 1.19

require (
github.com/MakeNowJust/heredoc v1.0.0
Expand Down
22 changes: 14 additions & 8 deletions internal/lefthook/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
},
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 4521c56

Please sign in to comment.