Control: tag -1 patch
I've filed https://github.com/fatih/semgroup/pull/7 as a workaround.
Anthony, what's your take on this, should we include that patch in the Debian
Package?
-rt
From bb5f94c0d8e6ddf1f24f673303d73e84c285e1ac Mon Sep 17 00:00:00 2001
From: Reinhard Tartler <siret...@tauware.de>
Date: Mon, 13 May 2024 08:31:03 -0400
Subject: [PATCH] chore: bump x/sync to 0.7
Note that this version changes the behavior of semaphore slightly.
After
https://cs.opensource.google/go/x/sync/+/14be23e5b48bec28285f8a694875175ecacfddb3
the semaphore package will reliably raise errors for both go routines
change the test to test for a substring to be more relaxed in case that
behavior gets reverted
---
go.mod | 2 +-
go.sum | 4 ++--
semgroup_test.go | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/go.mod b/go.mod
index 1a651d6..5926c6b 100644
--- a/go.mod
+++ b/go.mod
@@ -2,4 +2,4 @@ module github.com/fatih/semgroup
go 1.17
-require golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
+require golang.org/x/sync v0.7.0
diff --git a/go.sum b/go.sum
index 5c00efd..e8ef4a3 100644
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,2 @@
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod
h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
+golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
diff --git a/semgroup_test.go b/semgroup_test.go
index 255206d..3c90bf6 100644
--- a/semgroup_test.go
+++ b/semgroup_test.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"os"
+ "strings"
"sync"
"testing"
)
@@ -85,11 +86,10 @@ func TestGroup_deadlock(t *testing.T) {
t.Fatalf("g.Wait() should return an error")
}
- wantErr := `1 error(s) occurred:
-* couldn't acquire semaphore: context canceled`
+ wantErr := `couldn't acquire semaphore: context canceled`
- if wantErr != err.Error() {
- t.Errorf("error should be:\n%s\ngot:\n%s\n", wantErr,
err.Error())
+ if !strings.Contains(err.Error(), wantErr) {
+ t.Errorf("error should contain:\n%s\ngot:\n%s\n", wantErr,
err.Error())
}
}