Skip to content

Commit 7b9d686

Browse files
yaronfcursoragent
andcommitted
chore: bump deps and replace unmaintained andreyvit/diff
Upgrade httpsfv to v1.1.1 and testify to v1.12.1. Drop andreyvit/diff in favor of sergi/go-diff plus a local CharacterDiff-style test helper. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 03c40f4 commit 7b9d686

4 files changed

Lines changed: 48 additions & 22 deletions

File tree

diff_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package httpsign
2+
3+
import (
4+
"strings"
5+
6+
"github.com/sergi/go-diff/diffmatchpatch"
7+
)
8+
9+
// characterDiff returns an inline diff using (++added++) and (~~deleted~~) markup.
10+
// Same formatting as the old github.com/andreyvit/diff CharacterDiff helper.
11+
func characterDiff(a, b string) string {
12+
dmp := diffmatchpatch.New()
13+
diffs := dmp.DiffMain(a, b, true)
14+
if len(diffs) > 2 {
15+
diffs = dmp.DiffCleanupSemantic(diffs)
16+
diffs = dmp.DiffCleanupEfficiency(diffs)
17+
}
18+
var bld strings.Builder
19+
for _, d := range diffs {
20+
switch d.Type {
21+
case diffmatchpatch.DiffInsert:
22+
bld.WriteString("(++")
23+
bld.WriteString(d.Text)
24+
bld.WriteString("++)")
25+
case diffmatchpatch.DiffDelete:
26+
bld.WriteString("(~~")
27+
bld.WriteString(d.Text)
28+
bld.WriteString("~~)")
29+
case diffmatchpatch.DiffEqual:
30+
bld.WriteString(d.Text)
31+
}
32+
}
33+
return bld.String()
34+
}

go.mod

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ module github.com/yaronf/httpsign
33
go 1.27.0
44

55
require (
6-
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
7-
github.com/dunglas/httpsfv v1.0.2
6+
github.com/dunglas/httpsfv v1.1.1
87
github.com/lestrrat-go/jwx/v4 v4.4.0
9-
github.com/stretchr/testify v1.12.0
8+
github.com/sergi/go-diff v1.4.0
9+
github.com/stretchr/testify v1.12.1
1010
)
1111

1212
require (
1313
github.com/lestrrat-go/dsig v1.4.0 // indirect
1414
github.com/lestrrat-go/option/v3 v3.0.0-alpha1 // indirect
15-
github.com/sergi/go-diff v1.3.1 // indirect
1615
github.com/valyala/fastjson v1.6.10 // indirect
17-
gopkg.in/yaml.v3 v3.0.1 // indirect
16+
go.yaml.in/yaml/v3 v3.0.5 // indirect
1817
)

go.sum

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
2-
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
31
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
42
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5-
github.com/dunglas/httpsfv v1.0.2 h1:iERDp/YAfnojSDJ7PW3dj1AReJz4MrwbECSSE59JWL0=
6-
github.com/dunglas/httpsfv v1.0.2/go.mod h1:zID2mqw9mFsnt7YC3vYQ9/cjq30q41W+1AnDwH8TiMg=
7-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
3+
github.com/dunglas/httpsfv v1.1.1 h1:HoSs101zIE9I23DlqlmljJ/OIi7ILwrH347pXhRZdxI=
4+
github.com/dunglas/httpsfv v1.1.1/go.mod h1:zID2mqw9mFsnt7YC3vYQ9/cjq30q41W+1AnDwH8TiMg=
85
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
96
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
10-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
117
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
128
github.com/lestrrat-go/dsig v1.4.0 h1:g7LUjK8cT74A5DzBXJI5HzsJuLhoYN0Wzj4nuOMIrH8=
139
github.com/lestrrat-go/dsig v1.4.0/go.mod h1:I8Nddg/vN2cUl/h8N7SRRApLnNNeyZPIqLYpvpOtGGo=
@@ -16,20 +12,19 @@ github.com/lestrrat-go/jwx/v4 v4.4.0/go.mod h1:65utsGK/iSrjgGfu6iqj/TAvSfia6SSXk
1612
github.com/lestrrat-go/option/v3 v3.0.0-alpha1 h1:dvdzLwm/Ba5CJUF3jQP7w/iNYSLfy7yyh9XXNa1WjxI=
1713
github.com/lestrrat-go/option/v3 v3.0.0-alpha1/go.mod h1:5KSg20dfsKkNJtjDmaQRLZVXuUrzuCCcz/gbDK0pfKk=
1814
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
19-
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
20-
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
15+
github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
16+
github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
2117
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2218
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
23-
github.com/stretchr/testify v1.12.0 h1:K6Mr6jO9JICuend/5xzTM03ydSV3vdNRYAdPSukj8uI=
24-
github.com/stretchr/testify v1.12.0/go.mod h1:bOYBZb5qJ00vPzWfIqBUZPaxK8jWiXc6d3ErP4Ca9Gw=
19+
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
20+
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
2521
github.com/valyala/fastjson v1.6.10 h1:/yjJg8jaVQdYR3arGxPE2X5z89xrlhS0eGXdv+ADTh4=
2622
github.com/valyala/fastjson v1.6.10/go.mod h1:e6FubmQouUNP73jtMLmcbxS6ydWIpOfhz34TSfO3JaE=
23+
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
24+
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
2725
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
2826
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
2927
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
30-
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
3128
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3229
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
3330
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
34-
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
35-
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

http2_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"strings"
1212
"testing"
1313
"text/template"
14-
15-
"github.com/andreyvit/diff"
1614
)
1715

1816
var wantFields = `"kuku": my awesome header
@@ -88,7 +86,7 @@ func testHTTP(t *testing.T, proto string) {
8886
}
8987

9088
if sigInput != wf {
91-
t.Errorf("unexpected fields: %s\n", diff.CharacterDiff(sigInput, wantFields))
89+
t.Errorf("unexpected fields: %s\n", characterDiff(sigInput, wantFields))
9290
}
9391
w.WriteHeader(200)
9492
}
@@ -143,7 +141,7 @@ func testMessageHTTP(t *testing.T, proto string) {
143141
}
144142

145143
if sigInput != wf {
146-
t.Errorf("unexpected fields: %s\n", diff.CharacterDiff(sigInput, wantFields))
144+
t.Errorf("unexpected fields: %s\n", characterDiff(sigInput, wantFields))
147145
}
148146
w.WriteHeader(200)
149147
}

0 commit comments

Comments
 (0)