fix: Bump golang.org/x/text and its dependencies to fix CVE

This commit is contained in:
João "Pisco" Fernandes
2026-07-22 16:49:49 +01:00
parent 12e11208ae
commit 78865b19bc
59 changed files with 3283 additions and 711 deletions
+28 -2
View File
@@ -539,6 +539,11 @@ type Package struct {
// depsErrors is the DepsErrors field from the go list response, if any.
depsErrors []*packagesinternal.PackageError
// exportDataError is the error encountered reading export data, if any.
// Decoding export data should ordinarily be infallible, so this typically
// indicates a producer/consumer version skew.
exportDataError error
}
// Module provides module information for a package.
@@ -810,6 +815,12 @@ func (ld *loader) refine(response *DriverResponse) ([]*Package, error) {
needsrc: needsrc,
goVersion: response.GoVersion,
}
// Don't trust the driver to respond with duplicate-free
// package names (go.dev/issue/63822).
if _, ok := ld.pkgs[lpkg.ID]; ok {
return nil, fmt.Errorf("%s response contained duplicate packages for ID %q",
cond(ld.externalDriver, "go/packages driver", "go list"), lpkg.ID)
}
ld.pkgs[lpkg.ID] = lpkg
if rootIndex >= 0 {
initial[rootIndex] = lpkg
@@ -1073,10 +1084,11 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
}
// TODO(adonovan): this condition looks wrong:
// I think it should be lpkg.needtypes && !lpg.needsrc,
// I think it should be lpkg.needtypes && !lpkg.needsrc,
// so that NeedSyntax without NeedTypes can be satisfied by export data.
if !lpkg.needsrc {
if err := ld.loadFromExportData(lpkg); err != nil {
lpkg.exportDataError = err
lpkg.Errors = append(lpkg.Errors, Error{
Pos: "-",
Msg: err.Error(),
@@ -1215,7 +1227,13 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) {
if ipkg.Types != nil && ipkg.Types.Complete() {
return ipkg.Types, nil
}
log.Fatalf("internal error: package %q without types was imported from %q", path, lpkg)
// If types are unavailable, there must be an export data error.
if ipkg.exportDataError != nil {
return nil, ipkg.exportDataError
}
log.Fatalf("internal error: expected complete types for package %q", path)
panic("unreachable")
})
@@ -1577,3 +1595,11 @@ func usesExportData(cfg *Config) bool {
}
type unit struct{}
func cond[T any](cond bool, t, f T) T {
if cond {
return t
} else {
return f
}
}