Skip to content

Commit

Permalink
go.mod: upgrade to go 1.23
Browse files Browse the repository at this point in the history
The go.mod major version now matches what we use for Dockerfiles.

The version of staticcheck that works with Go 1.23 revealed several
uses of deprecated functions. Some of these were easy to change,
but other require more care and will be addressed in some later CLs.

Change-Id: I7f8344e419b8be6351d51db90faa64cef04057a0
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/609142
Reviewed-by: Robert Findley <rfindley@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
jba committed Sep 4, 2024
1 parent 676c19e commit 6851d87
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module golang.org/x/pkgsite

go 1.19
go 1.23

require (
cloud.google.com/go/cloudtasks v1.10.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw=
github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
Expand Down Expand Up @@ -1037,6 +1038,7 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
Expand Down
1 change: 1 addition & 0 deletions internal/fetch/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ func (g *goPackagesModuleGetter) Search(ctx context.Context, query string, limit
continue
}
if f.Doc != nil {
//lint:ignore SA1019 TODO(jba) create a doc.Package
result.Synopsis = doc.Synopsis(f.Doc.Text())
}
}
Expand Down
4 changes: 3 additions & 1 deletion internal/godoc/codec/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (g *generator) generate() ([]byte, error) {
}
// We use the same code for T and *T, so both are done.
g.done[t] = true
g.done[reflect.PtrTo(t)] = true
g.done[reflect.PointerTo(t)] = true
}
}

Expand Down Expand Up @@ -437,6 +437,8 @@ const initialBody = `
// Code generated by the codec package. DO NOT EDIT.
//lint:file-ignore SA1019 TODO(jba): fix
package «.Package»
import (
Expand Down
2 changes: 2 additions & 0 deletions internal/godoc/codec/testdata/map.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/godoc/codec/testdata/slice.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/godoc/codec/testdata/struct.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 28 additions & 2 deletions internal/godoc/encode_ast.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/godoc/encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ func printNode(w io.Writer, root ast.Node) error {
idx := len(seen)
seen[x] = idx
pr("%s#%d", ts, idx)
//lint:ignore SA1019 TODO(jba) remove ast.Object
if obj, ok := x.(*ast.Object); ok {
pr(" %s %s %v\n", obj.Name, obj.Kind, obj.Data)
prValue(obj.Decl, depth+1)
Expand Down
2 changes: 1 addition & 1 deletion internal/godoc/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (p *Package) DocInfo(ctx context.Context, innerPath string, sourceInfo *sou
if err != nil {
return "", nil, nil, err
}
return doc.Synopsis(d.Doc), cleanImports(d.Imports, d.ImportPath), api, nil
return d.Synopsis(d.Doc), cleanImports(d.Imports, d.ImportPath), api, nil
}

// cleanImports cleans import paths, in the sense of path.Clean.
Expand Down
5 changes: 2 additions & 3 deletions internal/middleware/experiment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,13 @@ func TestSetAndLoadExperiments(t *testing.T) {
}

func TestShouldSetExperiment(t *testing.T) {
// Force the pre-go1.20 behavior of rand.Seed
rand.Seed(1)
rng := rand.New(rand.NewSource(1))
ipv4Addr := func() string {
a := make([]string, 4)
for i := 0; i < 4; i++ {
// The use case is simple enough that a deterministic
// seed should provide enough coverage.
a[i] = strconv.Itoa(rand.Intn(256))
a[i] = strconv.Itoa(rng.Intn(256))
}
return strings.Join(a, ".")
}
Expand Down

0 comments on commit 6851d87

Please sign in to comment.