[chore/deps] Upgrade to go-sqlite 0.27.1 (#4334)

# Description

This brings some performance improvements and SQLite 3.50.3.

## Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]`

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

- [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md).
- [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
- [x] I/we have not leveraged AI to create the proposed changes.
- [ ] I/we have performed a self-review of added code.
- [ ] I/we have written code that is legible and maintainable by others.
- [ ] I/we have commented the added code, particularly in hard-to-understand areas.
- [ ] I/we have made any necessary changes to documentation.
- [ ] I/we have added tests that cover new code.
- [x] I/we have run tests and they pass locally with the changes.
- [ ] I/we have run `go fmt ./...` and `golangci-lint run`.

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4334
Co-authored-by: Daenney <git@noreply.sourcery.dny.nu>
Co-committed-by: Daenney <git@noreply.sourcery.dny.nu>
This commit is contained in:
Daenney 2025-07-18 11:56:40 +02:00 committed by tobi
commit eb60081985
67 changed files with 662 additions and 261 deletions

View file

@ -27,12 +27,13 @@ import (
"unicode"
"unicode/utf8"
"maps"
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/gopathwalk"
"golang.org/x/tools/internal/stdlib"
"maps"
)
// importToGroup is a list of functions which map from an import path to
@ -290,8 +291,8 @@ func (p *pass) loadPackageNames(ctx context.Context, imports []*ImportInfo) erro
return nil
}
// if there is a trailing major version, remove it
func withoutVersion(nm string) string {
// WithoutVersion removes a trailing major version, if there is one.
func WithoutVersion(nm string) string {
if v := path.Base(nm); len(v) > 0 && v[0] == 'v' {
if _, err := strconv.Atoi(v[1:]); err == nil {
// this is, for instance, called with rand/v2 and returns rand
@ -313,7 +314,7 @@ func (p *pass) importIdentifier(imp *ImportInfo) string {
}
known := p.knownPackages[imp.ImportPath]
if known != nil && known.Name != "" {
return withoutVersion(known.Name)
return WithoutVersion(known.Name)
}
return ImportPathToAssumedName(imp.ImportPath)
}

View file

@ -93,7 +93,7 @@ func FixImports(ctx context.Context, filename string, src []byte, goroot string,
// env is needed.
func ApplyFixes(fixes []*ImportFix, filename string, src []byte, opt *Options, extraMode parser.Mode) (formatted []byte, err error) {
// Don't use parse() -- we don't care about fragments or statement lists
// here, and we need to work with unparseable files.
// here, and we need to work with unparsable files.
fileSet := token.NewFileSet()
parserMode := parser.SkipObjectResolution
if opt.Comments {

View file

@ -26,7 +26,7 @@ type directory struct {
syms []symbol
}
// filterDirs groups the directories by import path,
// byImportPath groups the directories by import path,
// sorting the ones with the same import path by semantic version,
// most recent first.
func byImportPath(dirs []Relpath) (map[string][]*directory, error) {

View file

@ -75,7 +75,7 @@ func (ix *Index) Lookup(pkg, name string, prefix bool) []Candidate {
return nil // didn't find the package
}
var ans []Candidate
// loc is the first entry for this package name, but there may be severeal
// loc is the first entry for this package name, but there may be several
for i := loc; i < len(ix.Entries); i++ {
e := ix.Entries[i]
if e.PkgName != pkg {

View file

@ -30,7 +30,7 @@ import (
type symbol struct {
pkg string // name of the symbols's package
name string // declared name
kind string // T, C, V, or F, follwed by D if deprecated
kind string // T, C, V, or F, followed by D if deprecated
sig string // signature information, for F
}
@ -110,7 +110,7 @@ func getFileExports(f *ast.File) []symbol {
// The only place a $ can occur seems to be in a struct tag, which
// can be an arbitrary string literal, and ExprString does not presently
// print struct tags. So for this to happen the type of a formal parameter
// has to be a explict struct, e.g. foo(x struct{a int "$"}) and ExprString
// has to be a explicit struct, e.g. foo(x struct{a int "$"}) and ExprString
// would have to show the struct tag. Even testing for this case seems
// a waste of effort, but let's remember the possibility
if strings.Contains(tp, "$") {

View file

@ -65,14 +65,16 @@ func ClassifyCall(info *types.Info, call *ast.CallExpr) CallKind {
if info.Types == nil {
panic("ClassifyCall: info.Types is nil")
}
if info.Types[call.Fun].IsType() {
tv := info.Types[call.Fun]
if tv.IsType() {
return CallConversion
}
if tv.IsBuiltin() {
return CallBuiltin
}
obj := info.Uses[UsedIdent(info, call.Fun)]
// Classify the call by the type of the object, if any.
switch obj := obj.(type) {
case *types.Builtin:
return CallBuiltin
case *types.Func:
if interfaceMethod(obj) {
return CallInterface

View file

@ -69,6 +69,34 @@ func NameRelativeTo(pkg *types.Package) types.Qualifier {
}
}
// TypeNameFor returns the type name symbol for the specified type, if
// it is a [*types.Alias], [*types.Named], [*types.TypeParam], or a
// [*types.Basic] representing a type.
//
// For all other types, and for Basic types representing a builtin,
// constant, or nil, it returns nil. Be careful not to convert the
// resulting nil pointer to a [types.Object]!
//
// If t is the type of a constant, it may be an "untyped" type, which
// has no TypeName. To access the name of such types (e.g. "untyped
// int"), use [types.Basic.Name].
func TypeNameFor(t types.Type) *types.TypeName {
switch t := t.(type) {
case *types.Alias:
return t.Obj()
case *types.Named:
return t.Obj()
case *types.TypeParam:
return t.Obj()
case *types.Basic:
// See issues #71886 and #66890 for some history.
if tname, ok := types.Universe.Lookup(t.Name()).(*types.TypeName); ok {
return tname
}
}
return nil
}
// A NamedOrAlias is a [types.Type] that is named (as
// defined by the spec) and capable of bearing type parameters: it
// abstracts aliases ([types.Alias]) and defined types
@ -77,7 +105,7 @@ func NameRelativeTo(pkg *types.Package) types.Qualifier {
// Every type declared by an explicit "type" declaration is a
// NamedOrAlias. (Built-in type symbols may additionally
// have type [types.Basic], which is not a NamedOrAlias,
// though the spec regards them as "named".)
// though the spec regards them as "named"; see [TypeNameFor].)
//
// NamedOrAlias cannot expose the Origin method, because
// [types.Alias.Origin] and [types.Named.Origin] have different
@ -85,32 +113,15 @@ func NameRelativeTo(pkg *types.Package) types.Qualifier {
type NamedOrAlias interface {
types.Type
Obj() *types.TypeName
// TODO(hxjiang): add method TypeArgs() *types.TypeList after stop supporting go1.22.
TypeArgs() *types.TypeList
TypeParams() *types.TypeParamList
SetTypeParams(tparams []*types.TypeParam)
}
// TypeParams is a light shim around t.TypeParams().
// (go/types.Alias).TypeParams requires >= 1.23.
func TypeParams(t NamedOrAlias) *types.TypeParamList {
switch t := t.(type) {
case *types.Alias:
return aliases.TypeParams(t)
case *types.Named:
return t.TypeParams()
}
return nil
}
// TypeArgs is a light shim around t.TypeArgs().
// (go/types.Alias).TypeArgs requires >= 1.23.
func TypeArgs(t NamedOrAlias) *types.TypeList {
switch t := t.(type) {
case *types.Alias:
return aliases.TypeArgs(t)
case *types.Named:
return t.TypeArgs()
}
return nil
}
var (
_ NamedOrAlias = (*types.Alias)(nil)
_ NamedOrAlias = (*types.Named)(nil)
)
// Origin returns the generic type of the Named or Alias type t if it
// is instantiated, otherwise it returns t.