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>
This commit is contained in:
Jonathan Amsterdam 2024-08-30 15:18:26 -04:00
Родитель 676c19eae9
Коммит 6851d87f22
11 изменённых файлов: 45 добавлений и 8 удалений

2
go.mod
Просмотреть файл

@ -1,6 +1,6 @@
module golang.org/x/pkgsite
go 1.19
go 1.23
require (
cloud.google.com/go/cloudtasks v1.10.0

2
go.sum
Просмотреть файл

@ -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=
@ -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=

Просмотреть файл

@ -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())
}
}

Просмотреть файл

@ -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
}
}
@ -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 (

2
internal/godoc/codec/testdata/map.go поставляемый
Просмотреть файл

@ -4,6 +4,8 @@
// Code generated by the codec package. DO NOT EDIT.
//lint:file-ignore SA1019 TODO(jba): fix
package somepkg
import (

2
internal/godoc/codec/testdata/slice.go поставляемый
Просмотреть файл

@ -4,6 +4,8 @@
// Code generated by the codec package. DO NOT EDIT.
//lint:file-ignore SA1019 TODO(jba): fix
package somepkg
import (

2
internal/godoc/codec/testdata/struct.go поставляемый
Просмотреть файл

@ -4,6 +4,8 @@
// Code generated by the codec package. DO NOT EDIT.
//lint:file-ignore SA1019 TODO(jba): fix
package somepkg
import (

Просмотреть файл

@ -4,6 +4,8 @@
// Code generated by the codec package. DO NOT EDIT.
//lint:file-ignore SA1019 TODO(jba): fix
package godoc
import (
@ -2512,7 +2514,7 @@ func init() {
})
}
// Fields of ast_RangeStmt: For Key Value TokPos Tok X Body
// Fields of ast_RangeStmt: For Key Value TokPos Tok X Body Range
func encode_ast_RangeStmt(e *codec.Encoder, x *ast.RangeStmt) {
if !e.StartStruct(x == nil, x) {
@ -2546,6 +2548,10 @@ func encode_ast_RangeStmt(e *codec.Encoder, x *ast.RangeStmt) {
e.EncodeUint(6)
encode_ast_BlockStmt(e, x.Body)
}
if x.Range != 0 {
e.EncodeUint(7)
e.EncodeInt(int64(x.Range))
}
e.EndStruct()
}
@ -2580,6 +2586,8 @@ func decode_ast_RangeStmt(d *codec.Decoder, p **ast.RangeStmt) {
x.X = d.DecodeAny().(ast.Expr)
case 6:
decode_ast_BlockStmt(d, &x.Body)
case 7:
x.Range = token.Pos(d.DecodeInt())
default:
d.UnknownField("ast.RangeStmt", n)
}
@ -3954,7 +3962,7 @@ func init() {
})
}
// Fields of ast_File: Doc Package Name Decls Scope Imports Unresolved Comments
// Fields of ast_File: Doc Package Name Decls Scope Imports Unresolved Comments FileStart FileEnd GoVersion
func encode_ast_File(e *codec.Encoder, x *ast.File) {
if !e.StartStruct(x == nil, x) {
@ -3992,6 +4000,18 @@ func encode_ast_File(e *codec.Encoder, x *ast.File) {
e.EncodeUint(7)
encode_slice_ast_CommentGroup(e, x.Comments)
}
if x.FileStart != 0 {
e.EncodeUint(8)
e.EncodeInt(int64(x.FileStart))
}
if x.FileEnd != 0 {
e.EncodeUint(9)
e.EncodeInt(int64(x.FileEnd))
}
if x.GoVersion != "" {
e.EncodeUint(10)
e.EncodeString(x.GoVersion)
}
e.EndStruct()
}
@ -4028,6 +4048,12 @@ func decode_ast_File(d *codec.Decoder, p **ast.File) {
decode_slice_ast_Ident(d, &x.Unresolved)
case 7:
decode_slice_ast_CommentGroup(d, &x.Comments)
case 8:
x.FileStart = token.Pos(d.DecodeInt())
case 9:
x.FileEnd = token.Pos(d.DecodeInt())
case 10:
x.GoVersion = d.DecodeString()
default:
d.UnknownField("ast.File", n)
}

Просмотреть файл

@ -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)

Просмотреть файл

@ -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.

Просмотреть файл

@ -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, ".")
}