From bc419c1e56deb7fc4702978f3784cdec497b1e7a Mon Sep 17 00:00:00 2001 From: connero <88785126+conneroisu@users.noreply.github.com> Date: Sun, 9 Jun 2024 12:58:55 -0500 Subject: [PATCH 01/33] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 767a0e1..ad16e81 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ func main() { - [goskyr](https://github.com/jakopako/goskyr), an easily configurable command-line scraper written in Go. - [goGetJS](https://github.com/davemolk/goGetJS), a tool for extracting, searching, and saving JavaScript files (with optional headless browser). - [fitter](https://github.com/PxyUp/fitter), a tool for selecting values from JSON, XML, HTML and XPath formatted pages. +- [seltabl](github.com/conneroisu/seltabl), an orm-like tool for extracting values from HTML ## Support From 400486e492b6ebec7b250d5b0e4cd75204db9172 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Tue, 2 Jul 2024 21:54:31 +0200 Subject: [PATCH 02/33] Bump GitHub workflows to their latest versions --- .github/dependabot.yml | 5 +++++ .github/workflows/test.yml | 4 ++-- README.md | 10 +++++----- expand.go | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8723fab..da11a95 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,8 @@ updates: directory: "/" schedule: interval: "daily" + # Enable version updates for GitHub action workflows + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 638ae63..0bbf5b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,12 +14,12 @@ jobs: steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Test run: go test ./... -v -cover diff --git a/README.md b/README.md index ad16e81..54081a6 100644 --- a/README.md +++ b/README.md @@ -184,15 +184,15 @@ There are a number of ways you can support the project: The [BSD 3-Clause license][bsd], the same as the [Go language][golic]. Cascadia's license is [here][caslic]. -[jquery]: http://jquery.com/ -[go]: http://golang.org/ +[jquery]: https://jquery.com/ +[go]: https://go.dev/ [cascadia]: https://github.com/andybalholm/cascadia [cascadiacli]: https://github.com/suntong/cascadia -[bsd]: http://opensource.org/licenses/BSD-3-Clause -[golic]: http://golang.org/LICENSE +[bsd]: https://opensource.org/licenses/BSD-3-Clause +[golic]: https://go.dev/LICENSE [caslic]: https://github.com/andybalholm/cascadia/blob/master/LICENSE [doc]: https://pkg.go.dev/github.com/PuerkitoBio/goquery -[index]: http://api.jquery.com/index/ +[index]: https://api.jquery.com/index/ [gonet]: https://github.com/golang/net/ [html]: https://pkg.go.dev/golang.org/x/net/html [wiki]: https://github.com/PuerkitoBio/goquery/wiki/Tips-and-tricks diff --git a/expand.go b/expand.go index 7caade5..af54acf 100644 --- a/expand.go +++ b/expand.go @@ -62,7 +62,7 @@ func (s *Selection) AddBackFiltered(selector string) *Selection { } // AddBackMatcher reduces the previous set of elements on the stack to those that match -// the mateher, and adds them to the curernt set. +// the matcher, and adds them to the current set. // It returns a new Selection object containing the current Selection combined // with the filtered previous one func (s *Selection) AddBackMatcher(m Matcher) *Selection { From 8bd5b7d432f5f0f7c0194c808075c6689d735380 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 21:04:32 +0000 Subject: [PATCH 03/33] Bump golang.org/x/net from 0.24.0 to 0.26.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.24.0 to 0.26.0. - [Commits](https://github.com/golang/net/compare/v0.24.0...v0.26.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 964f256..d768748 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.24.0 + golang.org/x/net v0.26.0 ) go 1.18 diff --git a/go.sum b/go.sum index 2c920e5..8e03d05 100644 --- a/go.sum +++ b/go.sum @@ -10,10 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From fd5dc59310eaf2e1a3c2962a6bed1546430ec0f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 05:45:20 +0000 Subject: [PATCH 04/33] Bump golang.org/x/net from 0.26.0 to 0.27.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.26.0 to 0.27.0. - [Commits](https://github.com/golang/net/compare/v0.26.0...v0.27.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d768748..2fe9f3c 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.26.0 + golang.org/x/net v0.27.0 ) go 1.18 diff --git a/go.sum b/go.sum index 8e03d05..c89711e 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From dd1e02fa622a00a919965d3cd4d384b81c21a374 Mon Sep 17 00:00:00 2001 From: connero <88785126+conneroisu@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:58:32 -0400 Subject: [PATCH 05/33] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 54081a6..c45ba32 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ func main() { - [goskyr](https://github.com/jakopako/goskyr), an easily configurable command-line scraper written in Go. - [goGetJS](https://github.com/davemolk/goGetJS), a tool for extracting, searching, and saving JavaScript files (with optional headless browser). - [fitter](https://github.com/PxyUp/fitter), a tool for selecting values from JSON, XML, HTML and XPath formatted pages. -- [seltabl](github.com/conneroisu/seltabl), an orm-like tool for extracting values from HTML +- [seltabl](github.com/conneroisu/seltabl), an orm-like package and supporting language server for extracting values from HTML ## Support From 629afd96a7c5dcfd80a14454176aa7b1f65ff814 Mon Sep 17 00:00:00 2001 From: amikai Date: Sat, 20 Jul 2024 11:37:24 +0800 Subject: [PATCH 06/33] Bump the version to 1.23 --- .github/workflows/test.yml | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0bbf5b0..c4cedee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: test: strategy: matrix: - go-version: [1.21.x, 1.22.x] + go-version: [1.21.x, 1.22.x, 1.23.0-rc.1] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} diff --git a/go.mod b/go.mod index 2fe9f3c..8fba30d 100644 --- a/go.mod +++ b/go.mod @@ -5,4 +5,4 @@ require ( golang.org/x/net v0.27.0 ) -go 1.18 +go 1.23 From 3f0ba08339354b340dd90a79173f79d386e33060 Mon Sep 17 00:00:00 2001 From: amikai Date: Sat, 20 Jul 2024 11:38:01 +0800 Subject: [PATCH 07/33] Support EachIter based on 1.23 iterator --- bench_iteration_test.go | 42 +++++++++++++++++++++++++++++++++++++++++ iteration.go | 14 ++++++++++++++ iteration_test.go | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) diff --git a/bench_iteration_test.go b/bench_iteration_test.go index 71bfd59..1def1a2 100644 --- a/bench_iteration_test.go +++ b/bench_iteration_test.go @@ -25,6 +25,48 @@ func BenchmarkEach(b *testing.B) { } } +func BenchmarkEachIter(b *testing.B) { + var tmp, n int + + b.StopTimer() + sel := DocW().Find("td") + b.StartTimer() + for i := 0; i < b.N; i++ { + for range sel.EachIter() { + tmp++ + } + if n == 0 { + n = tmp + } + } + if n != 59 { + b.Fatalf("want 59, got %d", n) + } +} + +func BenchmarkEachIterWithBreak(b *testing.B) { + var tmp, n int + + b.StopTimer() + sel := DocW().Find("td") + b.StartTimer() + for i := 0; i < b.N; i++ { + tmp = 0 + for range sel.EachIter() { + tmp++ + if tmp >= 10 { + break + } + } + if n == 0 { + n = tmp + } + } + if n != 10 { + b.Fatalf("want 10, got %d", n) + } +} + func BenchmarkMap(b *testing.B) { var tmp, n int diff --git a/iteration.go b/iteration.go index 1c98158..1ca5245 100644 --- a/iteration.go +++ b/iteration.go @@ -1,5 +1,7 @@ package goquery +import "iter" + // Each iterates over a Selection object, executing a function for each // matched element. It returns the current Selection object. The function // f is called for each element in the selection with the index of the @@ -12,6 +14,18 @@ func (s *Selection) Each(f func(int, *Selection)) *Selection { return s } +// EachIter returns an iterator that yields the Selection object in order. +// The implementation is similar to Each, but it returns an iterator instead. +func (s *Selection) EachIter() iter.Seq2[int, *Selection] { + return func(yield func(int, *Selection) bool) { + for i, n := range s.Nodes { + if !yield(i, newSingleSelection(n, s.document)) { + return + } + } + } +} + // EachWithBreak iterates over a Selection object, executing a function for each // matched element. It is identical to Each except that it is possible to break // out of the loop by returning false in the callback function. It returns the diff --git a/iteration_test.go b/iteration_test.go index dd6fefa..48cebb2 100644 --- a/iteration_test.go +++ b/iteration_test.go @@ -105,3 +105,39 @@ func TestGenericMap(t *testing.T) { t.Errorf("Expected Map array result to have a length of 3, found %v.", len(vals)) } } + +func TestEachIter(t *testing.T) { + var cnt int + + sel := Doc().Find(".hero-unit .row-fluid") + + for i, s := range sel.EachIter() { + cnt++ + t.Logf("At index %v, node %v", i, s.Nodes[0].Data) + } + + sel = sel.Find("a") + + if cnt != 4 { + t.Errorf("Expected Each() to call function 4 times, got %v times.", cnt) + } + assertLength(t, sel.Nodes, 6) +} + +func TestEachIterWithBreak(t *testing.T) { + var cnt int + + sel := Doc().Find(".hero-unit .row-fluid") + for i, s := range sel.EachIter() { + cnt++ + t.Logf("At index %v, node %v", i, s.Nodes[0].Data) + break + } + + sel = sel.Find("a") + + if cnt != 1 { + t.Errorf("Expected Each() to call function 1 time, got %v times.", cnt) + } + assertLength(t, sel.Nodes, 6) +} From 0f5ed940723e8cbb6630cdc6550c54927a952279 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Tue, 23 Jul 2024 10:04:34 -0400 Subject: [PATCH 08/33] Update test.yml to use go1.23rc2 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4cedee..d279c8c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: test: strategy: matrix: - go-version: [1.21.x, 1.22.x, 1.23.0-rc.1] + go-version: [1.21.x, 1.22.x, 1.23rc2] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} From 466380eec709da6d847c263032ccc3d69d8c796f Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Tue, 23 Jul 2024 10:08:48 -0400 Subject: [PATCH 09/33] Update test.yml (another attempt to use the go1.23 rc version) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d279c8c..d987a83 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: test: strategy: matrix: - go-version: [1.21.x, 1.22.x, 1.23rc2] + go-version: [1.21.x, 1.22.x, 1.23.0-rc.2] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} From 6802fc555536600b8f0cae60362afe82bc23504b Mon Sep 17 00:00:00 2001 From: amikai Date: Wed, 24 Jul 2024 10:56:30 +0800 Subject: [PATCH 10/33] Re-orangize code for compitable - We don't need to use the iter.Seq2 type; instead, we can use func(yield func(int, *Selection) bool). In fact, the underlying type of iter.Seq2 is func(yield func(int, *Selection) bool), so we don't need to upgrade the go.mod version. - For for-range testing in version 1.23, we can use build tags to compile only for versions above 1.23. --- bench_iteration123_test.go | 48 ++++++++++++++++++++++++++++++++++++++ bench_iteration_test.go | 14 +++++------ go.mod | 2 +- iteration.go | 4 +--- iteration123_test.go | 42 +++++++++++++++++++++++++++++++++ iteration_test.go | 22 ++++++++--------- 6 files changed, 109 insertions(+), 23 deletions(-) create mode 100644 bench_iteration123_test.go create mode 100644 iteration123_test.go diff --git a/bench_iteration123_test.go b/bench_iteration123_test.go new file mode 100644 index 0000000..956b723 --- /dev/null +++ b/bench_iteration123_test.go @@ -0,0 +1,48 @@ +//go:build go1.23 +// +build go1.23 + +package goquery + +import "testing" + +func BenchmarkEachIter123(b *testing.B) { + var tmp, n int + + b.StopTimer() + sel := DocW().Find("td") + b.StartTimer() + for i := 0; i < b.N; i++ { + for range sel.EachIter() { + tmp++ + } + if n == 0 { + n = tmp + } + } + if n != 59 { + b.Fatalf("want 59, got %d", n) + } +} + +func BenchmarkEachIterWithBreak123(b *testing.B) { + var tmp, n int + + b.StopTimer() + sel := DocW().Find("td") + b.StartTimer() + for i := 0; i < b.N; i++ { + tmp = 0 + for range sel.EachIter() { + tmp++ + if tmp >= 10 { + break + } + } + if n == 0 { + n = tmp + } + } + if n != 10 { + b.Fatalf("want 10, got %d", n) + } +} diff --git a/bench_iteration_test.go b/bench_iteration_test.go index 1def1a2..1ff9507 100644 --- a/bench_iteration_test.go +++ b/bench_iteration_test.go @@ -32,9 +32,10 @@ func BenchmarkEachIter(b *testing.B) { sel := DocW().Find("td") b.StartTimer() for i := 0; i < b.N; i++ { - for range sel.EachIter() { + sel.EachIter()(func(i int, s *Selection) bool { tmp++ - } + return true + }) if n == 0 { n = tmp } @@ -52,12 +53,11 @@ func BenchmarkEachIterWithBreak(b *testing.B) { b.StartTimer() for i := 0; i < b.N; i++ { tmp = 0 - for range sel.EachIter() { + sel.EachIter()(func(i int, s *Selection) bool { tmp++ - if tmp >= 10 { - break - } - } + return tmp < 10 + }) + if n == 0 { n = tmp } diff --git a/go.mod b/go.mod index 8fba30d..2fe9f3c 100644 --- a/go.mod +++ b/go.mod @@ -5,4 +5,4 @@ require ( golang.org/x/net v0.27.0 ) -go 1.23 +go 1.18 diff --git a/iteration.go b/iteration.go index 1ca5245..882be2d 100644 --- a/iteration.go +++ b/iteration.go @@ -1,7 +1,5 @@ package goquery -import "iter" - // Each iterates over a Selection object, executing a function for each // matched element. It returns the current Selection object. The function // f is called for each element in the selection with the index of the @@ -16,7 +14,7 @@ func (s *Selection) Each(f func(int, *Selection)) *Selection { // EachIter returns an iterator that yields the Selection object in order. // The implementation is similar to Each, but it returns an iterator instead. -func (s *Selection) EachIter() iter.Seq2[int, *Selection] { +func (s *Selection) EachIter() func(yield func(int, *Selection) bool) { return func(yield func(int, *Selection) bool) { for i, n := range s.Nodes { if !yield(i, newSingleSelection(n, s.document)) { diff --git a/iteration123_test.go b/iteration123_test.go new file mode 100644 index 0000000..23f4a2f --- /dev/null +++ b/iteration123_test.go @@ -0,0 +1,42 @@ +//go:build go1.23 +// +build go1.23 + +package goquery + +import "testing" + +func TestEachIter123(t *testing.T) { + var cnt int + + sel := Doc().Find(".hero-unit .row-fluid") + + for i, s := range sel.EachIter() { + cnt++ + t.Logf("At index %v, node %v", i, s.Nodes[0].Data) + } + + sel = sel.Find("a") + + if cnt != 4 { + t.Errorf("Expected EachIter() to call function 4 times, got %v times.", cnt) + } + assertLength(t, sel.Nodes, 6) +} + +func TestEachIterWithBreak123(t *testing.T) { + var cnt int + + sel := Doc().Find(".hero-unit .row-fluid") + for i, s := range sel.EachIter() { + cnt++ + t.Logf("At index %v, node %v", i, s.Nodes[0].Data) + break + } + + sel = sel.Find("a") + + if cnt != 1 { + t.Errorf("Expected EachIter() to call function 1 time, got %v times.", cnt) + } + assertLength(t, sel.Nodes, 6) +} diff --git a/iteration_test.go b/iteration_test.go index 48cebb2..b976fce 100644 --- a/iteration_test.go +++ b/iteration_test.go @@ -110,16 +110,15 @@ func TestEachIter(t *testing.T) { var cnt int sel := Doc().Find(".hero-unit .row-fluid") - - for i, s := range sel.EachIter() { + sel.EachIter()(func(i int, n *Selection) bool { cnt++ - t.Logf("At index %v, node %v", i, s.Nodes[0].Data) - } - + t.Logf("At index %v, node %v", i, n.Nodes[0].Data) + return true + }) sel = sel.Find("a") if cnt != 4 { - t.Errorf("Expected Each() to call function 4 times, got %v times.", cnt) + t.Errorf("Expected EachIter() to call function 4 time, got %v times.", cnt) } assertLength(t, sel.Nodes, 6) } @@ -128,16 +127,15 @@ func TestEachIterWithBreak(t *testing.T) { var cnt int sel := Doc().Find(".hero-unit .row-fluid") - for i, s := range sel.EachIter() { + sel.EachIter()(func(i int, n *Selection) bool { cnt++ - t.Logf("At index %v, node %v", i, s.Nodes[0].Data) - break - } - + t.Logf("At index %v, node %v", i, n.Nodes[0].Data) + return false + }) sel = sel.Find("a") if cnt != 1 { - t.Errorf("Expected Each() to call function 1 time, got %v times.", cnt) + t.Errorf("Expected EachIter() to call function 1 time, got %v times.", cnt) } assertLength(t, sel.Nodes, 6) } From 3e5761b53859651d095c2516c44bce8a3450cb63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 05:37:47 +0000 Subject: [PATCH 11/33] Bump golang.org/x/net from 0.27.0 to 0.28.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.27.0 to 0.28.0. - [Commits](https://github.com/golang/net/compare/v0.27.0...v0.28.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2fe9f3c..07e2c75 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.27.0 + golang.org/x/net v0.28.0 ) go 1.18 diff --git a/go.sum b/go.sum index c89711e..c87402e 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From e91ee4d7904a8d361b11af7b9b1e1301eccdf9d9 Mon Sep 17 00:00:00 2001 From: Kiyo510 Date: Mon, 12 Aug 2024 22:23:40 +0900 Subject: [PATCH 12/33] Fixed checkout to repo before executing actions/setup-go@v5 step to avoid error that go.mod does not exist --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0bbf5b0..fb3083b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,13 +13,13 @@ jobs: runs-on: ${{ matrix.os }} steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Go uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - - name: Checkout code - uses: actions/checkout@v4 - - name: Test run: go test ./... -v -cover From 0984c44baeff66eb69180bc2d55b49e9dbaf4a97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 06:00:31 +0000 Subject: [PATCH 13/33] Bump golang.org/x/net from 0.28.0 to 0.29.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.28.0 to 0.29.0. - [Commits](https://github.com/golang/net/compare/v0.28.0...v0.29.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 07e2c75..92b4e93 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.28.0 + golang.org/x/net v0.29.0 ) go 1.18 diff --git a/go.sum b/go.sum index c87402e..970c96c 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 957a8644434a5db6078c111a7d0b7c1f3786d751 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Fri, 6 Sep 2024 10:05:29 -0400 Subject: [PATCH 14/33] Prepare 1.9.3 release --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c45ba32..abbf6a5 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Please note that starting with version `v1.9.0` of goquery, Go 1.18+ is required **Note that goquery's API is now stable, and will not break.** +* **2024-09-06 (v1.9.3)** : Update `go.mod` dependencies. * **2024-04-29 (v1.9.2)** : Update `go.mod` dependencies. * **2024-02-29 (v1.9.1)** : Improve allocation and performance of the `Map` function and `Selection.Map` method, better document the cascadia differences (thanks [@jwilsson](https://github.com/jwilsson)). * **2024-02-22 (v1.9.0)** : Add a generic `Map` function, **goquery now requires Go version 1.18+** (thanks [@Fesaa](https://github.com/Fesaa)). From eec8e87fed856dc0ebbdc6c19efbb835b3ee627e Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Fri, 6 Sep 2024 10:14:32 -0400 Subject: [PATCH 15/33] Revert "Re-orangize code for compitable" This reverts commit 6802fc555536600b8f0cae60362afe82bc23504b. --- bench_iteration123_test.go | 48 -------------------------------------- bench_iteration_test.go | 14 +++++------ go.mod | 2 +- iteration.go | 4 +++- iteration123_test.go | 42 --------------------------------- iteration_test.go | 22 +++++++++-------- 6 files changed, 23 insertions(+), 109 deletions(-) delete mode 100644 bench_iteration123_test.go delete mode 100644 iteration123_test.go diff --git a/bench_iteration123_test.go b/bench_iteration123_test.go deleted file mode 100644 index 956b723..0000000 --- a/bench_iteration123_test.go +++ /dev/null @@ -1,48 +0,0 @@ -//go:build go1.23 -// +build go1.23 - -package goquery - -import "testing" - -func BenchmarkEachIter123(b *testing.B) { - var tmp, n int - - b.StopTimer() - sel := DocW().Find("td") - b.StartTimer() - for i := 0; i < b.N; i++ { - for range sel.EachIter() { - tmp++ - } - if n == 0 { - n = tmp - } - } - if n != 59 { - b.Fatalf("want 59, got %d", n) - } -} - -func BenchmarkEachIterWithBreak123(b *testing.B) { - var tmp, n int - - b.StopTimer() - sel := DocW().Find("td") - b.StartTimer() - for i := 0; i < b.N; i++ { - tmp = 0 - for range sel.EachIter() { - tmp++ - if tmp >= 10 { - break - } - } - if n == 0 { - n = tmp - } - } - if n != 10 { - b.Fatalf("want 10, got %d", n) - } -} diff --git a/bench_iteration_test.go b/bench_iteration_test.go index 1ff9507..1def1a2 100644 --- a/bench_iteration_test.go +++ b/bench_iteration_test.go @@ -32,10 +32,9 @@ func BenchmarkEachIter(b *testing.B) { sel := DocW().Find("td") b.StartTimer() for i := 0; i < b.N; i++ { - sel.EachIter()(func(i int, s *Selection) bool { + for range sel.EachIter() { tmp++ - return true - }) + } if n == 0 { n = tmp } @@ -53,11 +52,12 @@ func BenchmarkEachIterWithBreak(b *testing.B) { b.StartTimer() for i := 0; i < b.N; i++ { tmp = 0 - sel.EachIter()(func(i int, s *Selection) bool { + for range sel.EachIter() { tmp++ - return tmp < 10 - }) - + if tmp >= 10 { + break + } + } if n == 0 { n = tmp } diff --git a/go.mod b/go.mod index 2fe9f3c..8fba30d 100644 --- a/go.mod +++ b/go.mod @@ -5,4 +5,4 @@ require ( golang.org/x/net v0.27.0 ) -go 1.18 +go 1.23 diff --git a/iteration.go b/iteration.go index 882be2d..1ca5245 100644 --- a/iteration.go +++ b/iteration.go @@ -1,5 +1,7 @@ package goquery +import "iter" + // Each iterates over a Selection object, executing a function for each // matched element. It returns the current Selection object. The function // f is called for each element in the selection with the index of the @@ -14,7 +16,7 @@ func (s *Selection) Each(f func(int, *Selection)) *Selection { // EachIter returns an iterator that yields the Selection object in order. // The implementation is similar to Each, but it returns an iterator instead. -func (s *Selection) EachIter() func(yield func(int, *Selection) bool) { +func (s *Selection) EachIter() iter.Seq2[int, *Selection] { return func(yield func(int, *Selection) bool) { for i, n := range s.Nodes { if !yield(i, newSingleSelection(n, s.document)) { diff --git a/iteration123_test.go b/iteration123_test.go deleted file mode 100644 index 23f4a2f..0000000 --- a/iteration123_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.23 -// +build go1.23 - -package goquery - -import "testing" - -func TestEachIter123(t *testing.T) { - var cnt int - - sel := Doc().Find(".hero-unit .row-fluid") - - for i, s := range sel.EachIter() { - cnt++ - t.Logf("At index %v, node %v", i, s.Nodes[0].Data) - } - - sel = sel.Find("a") - - if cnt != 4 { - t.Errorf("Expected EachIter() to call function 4 times, got %v times.", cnt) - } - assertLength(t, sel.Nodes, 6) -} - -func TestEachIterWithBreak123(t *testing.T) { - var cnt int - - sel := Doc().Find(".hero-unit .row-fluid") - for i, s := range sel.EachIter() { - cnt++ - t.Logf("At index %v, node %v", i, s.Nodes[0].Data) - break - } - - sel = sel.Find("a") - - if cnt != 1 { - t.Errorf("Expected EachIter() to call function 1 time, got %v times.", cnt) - } - assertLength(t, sel.Nodes, 6) -} diff --git a/iteration_test.go b/iteration_test.go index b976fce..48cebb2 100644 --- a/iteration_test.go +++ b/iteration_test.go @@ -110,15 +110,16 @@ func TestEachIter(t *testing.T) { var cnt int sel := Doc().Find(".hero-unit .row-fluid") - sel.EachIter()(func(i int, n *Selection) bool { + + for i, s := range sel.EachIter() { cnt++ - t.Logf("At index %v, node %v", i, n.Nodes[0].Data) - return true - }) + t.Logf("At index %v, node %v", i, s.Nodes[0].Data) + } + sel = sel.Find("a") if cnt != 4 { - t.Errorf("Expected EachIter() to call function 4 time, got %v times.", cnt) + t.Errorf("Expected Each() to call function 4 times, got %v times.", cnt) } assertLength(t, sel.Nodes, 6) } @@ -127,15 +128,16 @@ func TestEachIterWithBreak(t *testing.T) { var cnt int sel := Doc().Find(".hero-unit .row-fluid") - sel.EachIter()(func(i int, n *Selection) bool { + for i, s := range sel.EachIter() { cnt++ - t.Logf("At index %v, node %v", i, n.Nodes[0].Data) - return false - }) + t.Logf("At index %v, node %v", i, s.Nodes[0].Data) + break + } + sel = sel.Find("a") if cnt != 1 { - t.Errorf("Expected EachIter() to call function 1 time, got %v times.", cnt) + t.Errorf("Expected Each() to call function 1 time, got %v times.", cnt) } assertLength(t, sel.Nodes, 6) } From 7019296f03391013d526544d8cd6aaa98e4db3ff Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Fri, 6 Sep 2024 10:21:11 -0400 Subject: [PATCH 16/33] Update CI to target go1.23+ --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d987a83..f42f31b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: test: strategy: matrix: - go-version: [1.21.x, 1.22.x, 1.23.0-rc.2] + go-version: [1.23.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} From 7d37930884bfdad3d5a49b185e89be42f7bf4410 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Fri, 6 Sep 2024 10:34:28 -0400 Subject: [PATCH 17/33] Update readme to prepare 1.10 version --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index abbf6a5..6f4619d 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,13 @@ Syntax-wise, it is as close as possible to jQuery, with the same function names ## Installation -Please note that starting with version `v1.9.0` of goquery, Go 1.18+ is required due to the use of generics. For previous goquery versions, a Go version of 1.1+ was required because of the `net/html` dependency. Ongoing goquery development is tested on the latest 2 versions of Go. +Required Go version: + +* Starting with version `v1.10.0` of goquery, Go 1.23+ is required due to the use of function-based iterators. +* For `v1.9.0` of goquery, Go 1.18+ is required due to the use of generics. +* For previous goquery versions, a Go version of 1.1+ was required because of the `net/html` dependency. + +Ongoing goquery development is tested on the latest 2 versions of Go. $ go get github.com/PuerkitoBio/goquery @@ -40,6 +46,7 @@ Please note that starting with version `v1.9.0` of goquery, Go 1.18+ is required **Note that goquery's API is now stable, and will not break.** +* **2024-09-06 (v1.10.0)** : Add `EachIter` which provides an iterator that can be used in `for..range` loops on the `*Selection` object. **goquery now requires Go version 1.23+** (thanks [@amikai](https://github.com/amikai)). * **2024-09-06 (v1.9.3)** : Update `go.mod` dependencies. * **2024-04-29 (v1.9.2)** : Update `go.mod` dependencies. * **2024-02-29 (v1.9.1)** : Improve allocation and performance of the `Map` function and `Selection.Map` method, better document the cascadia differences (thanks [@jwilsson](https://github.com/jwilsson)). From ae85fefd98be8c17824575c87d215ade0dcefd82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 05:35:20 +0000 Subject: [PATCH 18/33] Bump golang.org/x/net from 0.29.0 to 0.30.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.29.0 to 0.30.0. - [Commits](https://github.com/golang/net/compare/v0.29.0...v0.30.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 382b634..90f37d1 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.29.0 + golang.org/x/net v0.30.0 ) go 1.23 diff --git a/go.sum b/go.sum index 970c96c..68e6781 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 41a89239afa36c4f0c2e35c9b1882690f244664e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 05:45:30 +0000 Subject: [PATCH 19/33] Bump golang.org/x/net from 0.30.0 to 0.31.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.30.0 to 0.31.0. - [Commits](https://github.com/golang/net/compare/v0.30.0...v0.31.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 90f37d1..a7e4247 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.30.0 + golang.org/x/net v0.31.0 ) go 1.23 diff --git a/go.sum b/go.sum index 68e6781..b2e8306 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 0f6e1ada8642b348f8add7d24eb9aef1bbed038d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 05:10:44 +0000 Subject: [PATCH 20/33] Bump golang.org/x/net from 0.31.0 to 0.32.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.31.0 to 0.32.0. - [Commits](https://github.com/golang/net/compare/v0.31.0...v0.32.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a7e4247..59d427a 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.31.0 + golang.org/x/net v0.32.0 ) go 1.23 diff --git a/go.sum b/go.sum index b2e8306..999e0d7 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 40758683ede28cb06df81b65faf2a6a8c75ac0e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 05:47:33 +0000 Subject: [PATCH 21/33] Bump golang.org/x/net from 0.32.0 to 0.33.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.32.0 to 0.33.0. - [Commits](https://github.com/golang/net/compare/v0.32.0...v0.33.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 59d427a..2d876b7 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.2 - golang.org/x/net v0.32.0 + golang.org/x/net v0.33.0 ) go 1.23 diff --git a/go.sum b/go.sum index 999e0d7..97cad74 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 381d6b903d4c2ec943677605394a07e44fbea485 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 05:44:06 +0000 Subject: [PATCH 22/33] Bump github.com/andybalholm/cascadia from 1.3.2 to 1.3.3 Bumps [github.com/andybalholm/cascadia](https://github.com/andybalholm/cascadia) from 1.3.2 to 1.3.3. - [Release notes](https://github.com/andybalholm/cascadia/releases) - [Commits](https://github.com/andybalholm/cascadia/compare/v1.3.2...v1.3.3) --- updated-dependencies: - dependency-name: github.com/andybalholm/cascadia dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 2d876b7..3977cc1 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/PuerkitoBio/goquery require ( - github.com/andybalholm/cascadia v1.3.2 + github.com/andybalholm/cascadia v1.3.3 golang.org/x/net v0.33.0 ) diff --git a/go.sum b/go.sum index 97cad74..1351652 100644 --- a/go.sum +++ b/go.sum @@ -1,38 +1,68 @@ -github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= -github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= +github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM= +github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 985aab32bab2da927c5db0e34492885a81c5baa3 Mon Sep 17 00:00:00 2001 From: Leonardo Taccari Date: Thu, 26 Dec 2024 17:39:06 +0100 Subject: [PATCH 23/33] Prepare for version v1.10.1 Add changelog entry for 1.10.1. Only dependencies update, however includes fixes for GO-2024-3333. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6f4619d..29beb28 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Ongoing goquery development is tested on the latest 2 versions of Go. **Note that goquery's API is now stable, and will not break.** +* **2024-12-26 (v1.10.1)** : Update `go.mod` dependencies. * **2024-09-06 (v1.10.0)** : Add `EachIter` which provides an iterator that can be used in `for..range` loops on the `*Selection` object. **goquery now requires Go version 1.23+** (thanks [@amikai](https://github.com/amikai)). * **2024-09-06 (v1.9.3)** : Update `go.mod` dependencies. * **2024-04-29 (v1.9.2)** : Update `go.mod` dependencies. From 3db152488a4b75b818af787372db9fb83cb7e0bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 05:25:05 +0000 Subject: [PATCH 24/33] Bump golang.org/x/net from 0.33.0 to 0.34.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0. - [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 3977cc1..5dcc087 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.3 - golang.org/x/net v0.33.0 + golang.org/x/net v0.34.0 ) go 1.23 diff --git a/go.sum b/go.sum index 1351652..af52a96 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,9 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 86e3da86b2e1353ebe3ae88bf544a2284415124d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 05:55:08 +0000 Subject: [PATCH 25/33] Bump golang.org/x/net from 0.34.0 to 0.35.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.34.0 to 0.35.0. - [Commits](https://github.com/golang/net/compare/v0.34.0...v0.35.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5dcc087..4b1f135 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.3 - golang.org/x/net v0.34.0 + golang.org/x/net v0.35.0 ) go 1.23 diff --git a/go.sum b/go.sum index af52a96..1ef6887 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From a2ae60f0487f6d49c098d7cbcd3aa3e20dbd1ae6 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Thu, 13 Feb 2025 09:35:55 -0500 Subject: [PATCH 26/33] Add go1.24 to test matrix --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1413a40..a58b574 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: test: strategy: matrix: - go-version: [1.23.x] + go-version: [1.23.x, 1.24.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} From e8b5d743a8faf6328c35af8c84b234f61d0e3c6b Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Thu, 13 Feb 2025 09:41:22 -0500 Subject: [PATCH 27/33] Prepare for 1.10.2 --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 29beb28..9211fc3 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ Syntax-wise, it is as close as possible to jQuery, with the same function names Required Go version: -* Starting with version `v1.10.0` of goquery, Go 1.23+ is required due to the use of function-based iterators. -* For `v1.9.0` of goquery, Go 1.18+ is required due to the use of generics. -* For previous goquery versions, a Go version of 1.1+ was required because of the `net/html` dependency. +* Starting with version `v1.10.0` of goquery, Go 1.23+ is required due to the use of function-based iterators. +* For `v1.9.0` of goquery, Go 1.18+ is required due to the use of generics. +* For previous goquery versions, a Go version of 1.1+ was required because of the `net/html` dependency. Ongoing goquery development is tested on the latest 2 versions of Go. @@ -46,6 +46,7 @@ Ongoing goquery development is tested on the latest 2 versions of Go. **Note that goquery's API is now stable, and will not break.** +* **2025-02-13 (v1.10.2)** : Update `go.mod` dependencies, add go1.24 to the test matrix. * **2024-12-26 (v1.10.1)** : Update `go.mod` dependencies. * **2024-09-06 (v1.10.0)** : Add `EachIter` which provides an iterator that can be used in `for..range` loops on the `*Selection` object. **goquery now requires Go version 1.23+** (thanks [@amikai](https://github.com/amikai)). * **2024-09-06 (v1.9.3)** : Update `go.mod` dependencies. From 3951e6049509628778ba47a0f6c2a93b92af058a Mon Sep 17 00:00:00 2001 From: Saddam Azy Date: Thu, 27 Feb 2025 08:48:50 +0700 Subject: [PATCH 28/33] increase performance by migrating from bytes.Buffer to strings.Builder --- bench_example_test.go | 8 ++++---- property.go | 13 ++++++------- utilities.go | 21 ++++++++++----------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/bench_example_test.go b/bench_example_test.go index ba9ebe5..e7eb5a1 100644 --- a/bench_example_test.go +++ b/bench_example_test.go @@ -1,15 +1,15 @@ package goquery import ( - "bytes" "fmt" "strconv" + "strings" "testing" ) func BenchmarkMetalReviewExample(b *testing.B) { var n int - var buf bytes.Buffer + var builder strings.Builder b.StopTimer() doc := loadDoc("metalreview.html") @@ -27,12 +27,12 @@ func BenchmarkMetalReviewExample(b *testing.B) { if score, e = strconv.ParseFloat(s.Find(".score").Text(), 64); e != nil { // Not a valid float, ignore score if n <= 4 { - buf.WriteString(fmt.Sprintf("Review %d: %s - %s.\n", i, band, title)) + builder.WriteString(fmt.Sprintf("Review %d: %s - %s.\n", i, band, title)) } } else { // Print all, including score if n <= 4 { - buf.WriteString(fmt.Sprintf("Review %d: %s - %s (%2.1f).\n", i, band, title, score)) + builder.WriteString(fmt.Sprintf("Review %d: %s - %s (%2.1f).\n", i, band, title, score)) } } }) diff --git a/property.go b/property.go index 411126d..f1c80b9 100644 --- a/property.go +++ b/property.go @@ -1,7 +1,6 @@ package goquery import ( - "bytes" "regexp" "strings" @@ -60,14 +59,14 @@ func (s *Selection) SetAttr(attrName, val string) *Selection { // Text gets the combined text contents of each element in the set of matched // elements, including their descendants. func (s *Selection) Text() string { - var buf bytes.Buffer + var builder strings.Builder // Slightly optimized vs calling Each: no single selection object created var f func(*html.Node) f = func(n *html.Node) { if n.Type == html.TextNode { // Keep newlines and spaces, like jQuery - buf.WriteString(n.Data) + builder.WriteString(n.Data) } if n.FirstChild != nil { for c := n.FirstChild; c != nil; c = c.NextSibling { @@ -79,7 +78,7 @@ func (s *Selection) Text() string { f(n) } - return buf.String() + return builder.String() } // Size is an alias for Length. @@ -97,16 +96,16 @@ func (s *Selection) Length() int { func (s *Selection) Html() (ret string, e error) { // Since there is no .innerHtml, the HTML content must be re-created from // the nodes using html.Render. - var buf bytes.Buffer + var builder strings.Builder if len(s.Nodes) > 0 { for c := s.Nodes[0].FirstChild; c != nil; c = c.NextSibling { - e = html.Render(&buf, c) + e = html.Render(&builder, c) if e != nil { return } } - ret = buf.String() + ret = builder.String() } return diff --git a/utilities.go b/utilities.go index ecd3453..361795b 100644 --- a/utilities.go +++ b/utilities.go @@ -1,8 +1,8 @@ package goquery import ( - "bytes" "io" + "strings" "golang.org/x/net/html" ) @@ -26,13 +26,12 @@ var nodeNames = []string{ // Go's net/html package defines the following node types, listed with // the corresponding returned value from this function: // -// ErrorNode : #error -// TextNode : #text -// DocumentNode : #document -// ElementNode : the element's tag name -// CommentNode : #comment -// DoctypeNode : the name of the document type -// +// ErrorNode : #error +// TextNode : #text +// DocumentNode : #document +// ElementNode : the element's tag name +// CommentNode : #comment +// DoctypeNode : the name of the document type func NodeName(s *Selection) string { if s.Length() == 0 { return "" @@ -77,11 +76,11 @@ func Render(w io.Writer, s *Selection) error { // because this is not a jQuery method (in javascript-land, this is // a property provided by the DOM). func OuterHtml(s *Selection) (string, error) { - var buf bytes.Buffer - if err := Render(&buf, s); err != nil { + var builder strings.Builder + if err := Render(&builder, s); err != nil { return "", err } - return buf.String(), nil + return builder.String(), nil } // Loop through all container nodes to search for the target node. From 5c48549c056a1aa09e8631da316fa9952bf99315 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 02:27:30 +0000 Subject: [PATCH 29/33] Bump golang.org/x/net from 0.35.0 to 0.37.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.35.0 to 0.37.0. - [Commits](https://github.com/golang/net/compare/v0.35.0...v0.37.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 4b1f135..2dc1105 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.3 - golang.org/x/net v0.35.0 + golang.org/x/net v0.37.0 ) -go 1.23 +go 1.23 \ No newline at end of file diff --git a/go.sum b/go.sum index 1ef6887..9fbb47a 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= -golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 858507ff1bed91b3892f1d9e6af6f548ca4fe4a2 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Wed, 5 Mar 2025 21:32:02 -0500 Subject: [PATCH 30/33] Run go mod tidy --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 2dc1105..c669a0e 100644 --- a/go.mod +++ b/go.mod @@ -5,4 +5,4 @@ require ( golang.org/x/net v0.37.0 ) -go 1.23 \ No newline at end of file +go 1.23.0 From 9cd3cf0815b7dbd0d29a29cdce3ea9643d63bba9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Mar 2025 05:59:18 +0000 Subject: [PATCH 31/33] Bump golang.org/x/net from 0.37.0 to 0.38.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.37.0 to 0.38.0. - [Commits](https://github.com/golang/net/compare/v0.37.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 +++- go.sum | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c669a0e..6783f29 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,9 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.3 - golang.org/x/net v0.37.0 + golang.org/x/net v0.38.0 ) go 1.23.0 + +toolchain go1.24.1 diff --git a/go.sum b/go.sum index 9fbb47a..8917f53 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 58dcec12a03eff89924ac7c6c4045beeda4f0c88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 05:08:10 +0000 Subject: [PATCH 32/33] Bump golang.org/x/net from 0.38.0 to 0.39.0 Bumps [golang.org/x/net](https://github.com/golang/net) from 0.38.0 to 0.39.0. - [Commits](https://github.com/golang/net/compare/v0.38.0...v0.39.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-version: 0.39.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6783f29..c63fe12 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/PuerkitoBio/goquery require ( github.com/andybalholm/cascadia v1.3.3 - golang.org/x/net v0.38.0 + golang.org/x/net v0.39.0 ) go 1.23.0 diff --git a/go.sum b/go.sum index 8917f53..cc8c59d 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= -golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 9c6a69cd4d7b07e401b68ccf12c736a3efe12c47 Mon Sep 17 00:00:00 2001 From: Martin Angers Date: Fri, 11 Apr 2025 14:15:50 -0400 Subject: [PATCH 33/33] Prepare for v1.10.3 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9211fc3..89f0239 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Ongoing goquery development is tested on the latest 2 versions of Go. **Note that goquery's API is now stable, and will not break.** +* **2025-04-11 (v1.10.3)** : Update `go.mod` dependencies, small optimization (thanks [@myxzlpltk](https://github.com/myxzlpltk)). * **2025-02-13 (v1.10.2)** : Update `go.mod` dependencies, add go1.24 to the test matrix. * **2024-12-26 (v1.10.1)** : Update `go.mod` dependencies. * **2024-09-06 (v1.10.0)** : Add `EachIter` which provides an iterator that can be used in `for..range` loops on the `*Selection` object. **goquery now requires Go version 1.23+** (thanks [@amikai](https://github.com/amikai)).