Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump go version #305

Merged
merged 4 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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