Merge pull request #1323 from opencloud-eu/dependabot/go_modules/golang.org/x/image-0.30.0

build(deps): bump golang.org/x/image from 0.28.0 to 0.30.0
This commit is contained in:
Ralf Haferkamp
2025-08-14 08:52:35 +02:00
committed by GitHub
9 changed files with 67 additions and 47 deletions
+4 -4
View File
@@ -99,12 +99,12 @@ require (
go.opentelemetry.io/otel/trace v1.37.0 go.opentelemetry.io/otel/trace v1.37.0
golang.org/x/crypto v0.40.0 golang.org/x/crypto v0.40.0
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac
golang.org/x/image v0.28.0 golang.org/x/image v0.30.0
golang.org/x/net v0.42.0 golang.org/x/net v0.42.0
golang.org/x/oauth2 v0.30.0 golang.org/x/oauth2 v0.30.0
golang.org/x/sync v0.16.0 golang.org/x/sync v0.16.0
golang.org/x/term v0.33.0 golang.org/x/term v0.33.0
golang.org/x/text v0.27.0 golang.org/x/text v0.28.0
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822
google.golang.org/grpc v1.74.0 google.golang.org/grpc v1.74.0
google.golang.org/protobuf v1.36.6 google.golang.org/protobuf v1.36.6
@@ -328,10 +328,10 @@ require (
go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect go.uber.org/zap v1.27.0 // indirect
golang.org/x/mod v0.25.0 // indirect golang.org/x/mod v0.26.0 // indirect
golang.org/x/sys v0.34.0 // indirect golang.org/x/sys v0.34.0 // indirect
golang.org/x/time v0.12.0 // indirect golang.org/x/time v0.12.0 // indirect
golang.org/x/tools v0.34.0 // indirect golang.org/x/tools v0.35.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
+8 -8
View File
@@ -1256,8 +1256,8 @@ golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac/go.mod h1:hH+7mtFmImwwcMvScy
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/image v0.28.0 h1:gdem5JW1OLS4FbkWgLO+7ZeFzYtL3xClb97GaUzYMFE= golang.org/x/image v0.30.0 h1:jD5RhkmVAnjqaCUXfbGBrn3lpxbknfN9w2UhHHU+5B4=
golang.org/x/image v0.28.0/go.mod h1:GUJYXtnGKEUgggyzh+Vxt+AviiCcyiwpsl8iQ8MvwGY= golang.org/x/image v0.30.0/go.mod h1:SAEUTxCCMWSrJcCy/4HwavEsfZZJlYxeHLc6tTiAe/c=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -1282,8 +1282,8 @@ 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.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.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1478,8 +1478,8 @@ 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.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -1542,8 +1542,8 @@ 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.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= 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/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+23 -16
View File
@@ -26,28 +26,35 @@ func readUint32(b []byte) uint32 {
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
} }
// decodePaletted reads an 8 bit-per-pixel BMP image from r. // decodePaletted reads a 1, 2, 4 or 8 bit-per-pixel BMP image from r.
// If topDown is false, the image rows will be read bottom-up. // If topDown is false, the image rows will be read bottom-up.
func decodePaletted(r io.Reader, c image.Config, topDown bool) (image.Image, error) { func decodePaletted(r io.Reader, c image.Config, topDown bool, bpp int) (image.Image, error) {
paletted := image.NewPaletted(image.Rect(0, 0, c.Width, c.Height), c.ColorModel.(color.Palette)) paletted := image.NewPaletted(image.Rect(0, 0, c.Width, c.Height), c.ColorModel.(color.Palette))
if c.Width == 0 || c.Height == 0 { if c.Width == 0 || c.Height == 0 {
return paletted, nil return paletted, nil
} }
var tmp [4]byte
y0, y1, yDelta := c.Height-1, -1, -1 y0, y1, yDelta := c.Height-1, -1, -1
if topDown { if topDown {
y0, y1, yDelta = 0, c.Height, +1 y0, y1, yDelta = 0, c.Height, +1
} }
pixelsPerByte := 8 / bpp
// Pad up to ensure each row is 4-bytes aligned.
bytesPerRow := ((c.Width+pixelsPerByte-1)/pixelsPerByte + 3) &^ 3
b := make([]byte, bytesPerRow)
for y := y0; y != y1; y += yDelta { for y := y0; y != y1; y += yDelta {
p := paletted.Pix[y*paletted.Stride : y*paletted.Stride+c.Width] p := paletted.Pix[y*paletted.Stride : y*paletted.Stride+c.Width]
if _, err := io.ReadFull(r, p); err != nil { if _, err := io.ReadFull(r, b); err != nil {
return nil, err return nil, err
} }
// Each row is 4-byte aligned. byteIndex, bitIndex, mask := 0, 8, byte((1<<bpp)-1)
if c.Width%4 != 0 { for pixIndex := 0; pixIndex < c.Width; pixIndex++ {
_, err := io.ReadFull(r, tmp[:4-c.Width%4]) bitIndex -= bpp
if err != nil { p[pixIndex] = (b[byteIndex]) >> bitIndex & mask
return nil, err if bitIndex == 0 {
byteIndex++
bitIndex = 8
} }
} }
} }
@@ -118,8 +125,8 @@ func Decode(r io.Reader) (image.Image, error) {
return nil, err return nil, err
} }
switch bpp { switch bpp {
case 8: case 1, 2, 4, 8:
return decodePaletted(r, c, topDown) return decodePaletted(r, c, topDown, bpp)
case 24: case 24:
return decodeRGB(r, c, topDown) return decodeRGB(r, c, topDown)
case 32: case 32:
@@ -190,12 +197,12 @@ func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown b
return image.Config{}, 0, false, false, ErrUnsupported return image.Config{}, 0, false, false, ErrUnsupported
} }
switch bpp { switch bpp {
case 8: case 1, 2, 4, 8:
colorUsed := readUint32(b[46:50]) colorUsed := readUint32(b[46:50])
// If colorUsed is 0, it is set to the maximum number of colors for the given bpp, which is 2^bpp.
if colorUsed == 0 { if colorUsed == 0 {
colorUsed = 256 colorUsed = 1 << bpp
} else if colorUsed > 256 { } else if colorUsed > (1 << bpp) {
return image.Config{}, 0, false, false, ErrUnsupported return image.Config{}, 0, false, false, ErrUnsupported
} }
@@ -212,7 +219,7 @@ func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown b
// Every 4th byte is padding. // Every 4th byte is padding.
pcm[i] = color.RGBA{b[4*i+2], b[4*i+1], b[4*i+0], 0xFF} pcm[i] = color.RGBA{b[4*i+2], b[4*i+1], b[4*i+0], 0xFF}
} }
return image.Config{ColorModel: pcm, Width: width, Height: height}, 8, topDown, false, nil return image.Config{ColorModel: pcm, Width: width, Height: height}, int(bpp), topDown, false, nil
case 24: case 24:
if offset != fileHeaderLen+infoLen { if offset != fileHeaderLen+infoLen {
return image.Config{}, 0, false, false, ErrUnsupported return image.Config{}, 0, false, false, ErrUnsupported
-1
View File
@@ -217,7 +217,6 @@ func typeOf(n ast.Node) uint64 {
return 0 return 0
} }
//go:linkname maskOf golang.org/x/tools/go/ast/inspector.maskOf
func maskOf(nodes []ast.Node) uint64 { func maskOf(nodes []ast.Node) uint64 {
if len(nodes) == 0 { if len(nodes) == 0 {
return math.MaxUint64 // match all node types return math.MaxUint64 // match all node types
+13 -5
View File
@@ -224,13 +224,22 @@ extractQueries:
return response.dr, nil return response.dr, nil
} }
// abs returns an absolute representation of path, based on cfg.Dir.
func (cfg *Config) abs(path string) (string, error) {
if filepath.IsAbs(path) {
return path, nil
}
// In case cfg.Dir is relative, pass it to filepath.Abs.
return filepath.Abs(filepath.Join(cfg.Dir, path))
}
func (state *golistState) runContainsQueries(response *responseDeduper, queries []string) error { func (state *golistState) runContainsQueries(response *responseDeduper, queries []string) error {
for _, query := range queries { for _, query := range queries {
// TODO(matloob): Do only one query per directory. // TODO(matloob): Do only one query per directory.
fdir := filepath.Dir(query) fdir := filepath.Dir(query)
// Pass absolute path of directory to go list so that it knows to treat it as a directory, // Pass absolute path of directory to go list so that it knows to treat it as a directory,
// not a package path. // not a package path.
pattern, err := filepath.Abs(fdir) pattern, err := state.cfg.abs(fdir)
if err != nil { if err != nil {
return fmt.Errorf("could not determine absolute path of file= query path %q: %v", query, err) return fmt.Errorf("could not determine absolute path of file= query path %q: %v", query, err)
} }
@@ -703,9 +712,8 @@ func (state *golistState) getGoVersion() (int, error) {
// getPkgPath finds the package path of a directory if it's relative to a root // getPkgPath finds the package path of a directory if it's relative to a root
// directory. // directory.
func (state *golistState) getPkgPath(dir string) (string, bool, error) { func (state *golistState) getPkgPath(dir string) (string, bool, error) {
absDir, err := filepath.Abs(dir) if !filepath.IsAbs(dir) {
if err != nil { panic("non-absolute dir passed to getPkgPath")
return "", false, err
} }
roots, err := state.determineRootDirs() roots, err := state.determineRootDirs()
if err != nil { if err != nil {
@@ -715,7 +723,7 @@ func (state *golistState) getPkgPath(dir string) (string, bool, error) {
for rdir, rpath := range roots { for rdir, rpath := range roots {
// Make sure that the directory is in the module, // Make sure that the directory is in the module,
// to avoid creating a path relative to another module. // to avoid creating a path relative to another module.
if !strings.HasPrefix(absDir, rdir) { if !strings.HasPrefix(dir, rdir) {
continue continue
} }
// TODO(matloob): This doesn't properly handle symlinks. // TODO(matloob): This doesn't properly handle symlinks.
+1 -1
View File
@@ -55,7 +55,7 @@ func (state *golistState) determineRootDirsModules() (map[string]string, error)
} }
if mod.Dir != "" && mod.Path != "" { if mod.Dir != "" && mod.Path != "" {
// This is a valid module; add it to the map. // This is a valid module; add it to the map.
absDir, err := filepath.Abs(mod.Dir) absDir, err := state.cfg.abs(mod.Dir)
if err != nil { if err != nil {
return nil, err return nil, err
} }
+8 -8
View File
@@ -36,13 +36,13 @@ const (
) )
// LookupAll only returns those Candidates whose import path // LookupAll only returns those Candidates whose import path
// finds all the nms. // finds all the names.
func (ix *Index) LookupAll(pkg string, names ...string) map[string][]Candidate { func (ix *Index) LookupAll(pkgName string, names ...string) map[string][]Candidate {
// this can be made faster when benchmarks show that it needs to be // this can be made faster when benchmarks show that it needs to be
names = uniquify(names) names = uniquify(names)
byImpPath := make(map[string][]Candidate) byImpPath := make(map[string][]Candidate)
for _, nm := range names { for _, nm := range names {
cands := ix.Lookup(pkg, nm, false) cands := ix.Lookup(pkgName, nm, false)
for _, c := range cands { for _, c := range cands {
byImpPath[c.ImportPath] = append(byImpPath[c.ImportPath], c) byImpPath[c.ImportPath] = append(byImpPath[c.ImportPath], c)
} }
@@ -67,9 +67,9 @@ func uniquify(in []string) []string {
// Lookup finds all the symbols in the index with the given PkgName and name. // Lookup finds all the symbols in the index with the given PkgName and name.
// If prefix is true, it finds all of these with name as a prefix. // If prefix is true, it finds all of these with name as a prefix.
func (ix *Index) Lookup(pkg, name string, prefix bool) []Candidate { func (ix *Index) Lookup(pkgName, name string, prefix bool) []Candidate {
loc, ok := slices.BinarySearchFunc(ix.Entries, pkg, func(e Entry, pkg string) int { loc, ok := slices.BinarySearchFunc(ix.Entries, pkgName, func(e Entry, pkg string) int {
return strings.Compare(e.PkgName, pkg) return strings.Compare(e.PkgName, pkgName)
}) })
if !ok { if !ok {
return nil // didn't find the package return nil // didn't find the package
@@ -78,7 +78,7 @@ func (ix *Index) Lookup(pkg, name string, prefix bool) []Candidate {
// loc is the first entry for this package name, but there may be several // loc is the first entry for this package name, but there may be several
for i := loc; i < len(ix.Entries); i++ { for i := loc; i < len(ix.Entries); i++ {
e := ix.Entries[i] e := ix.Entries[i]
if e.PkgName != pkg { if e.PkgName != pkgName {
break // end of sorted package names break // end of sorted package names
} }
nloc, ok := slices.BinarySearchFunc(e.Names, name, func(s string, name string) int { nloc, ok := slices.BinarySearchFunc(e.Names, name, func(s string, name string) int {
@@ -105,7 +105,7 @@ func (ix *Index) Lookup(pkg, name string, prefix bool) []Candidate {
continue // should never happen continue // should never happen
} }
px := Candidate{ px := Candidate{
PkgName: pkg, PkgName: pkgName,
Name: flds[0], Name: flds[0],
Dir: string(e.Dir), Dir: string(e.Dir),
ImportPath: e.ImportPath, ImportPath: e.ImportPath,
+6
View File
@@ -5,6 +5,8 @@
// Package packagesinternal exposes internal-only fields from go/packages. // Package packagesinternal exposes internal-only fields from go/packages.
package packagesinternal package packagesinternal
import "fmt"
var GetDepsErrors = func(p any) []*PackageError { return nil } var GetDepsErrors = func(p any) []*PackageError { return nil }
type PackageError struct { type PackageError struct {
@@ -13,5 +15,9 @@ type PackageError struct {
Err string // the error itself Err string // the error itself
} }
func (err PackageError) String() string {
return fmt.Sprintf("%s: %s (import stack: %s)", err.Pos, err.Err, err.ImportStack)
}
var TypecheckCgo int var TypecheckCgo int
var DepsErrors int // must be set as a LoadMode to call GetDepsErrors var DepsErrors int // must be set as a LoadMode to call GetDepsErrors
+4 -4
View File
@@ -2198,7 +2198,7 @@ golang.org/x/exp/slices
golang.org/x/exp/slog golang.org/x/exp/slog
golang.org/x/exp/slog/internal golang.org/x/exp/slog/internal
golang.org/x/exp/slog/internal/buffer golang.org/x/exp/slog/internal/buffer
# golang.org/x/image v0.28.0 # golang.org/x/image v0.30.0
## explicit; go 1.23.0 ## explicit; go 1.23.0
golang.org/x/image/bmp golang.org/x/image/bmp
golang.org/x/image/ccitt golang.org/x/image/ccitt
@@ -2210,7 +2210,7 @@ golang.org/x/image/math/fixed
golang.org/x/image/tiff golang.org/x/image/tiff
golang.org/x/image/tiff/lzw golang.org/x/image/tiff/lzw
golang.org/x/image/vector golang.org/x/image/vector
# golang.org/x/mod v0.25.0 # golang.org/x/mod v0.26.0
## explicit; go 1.23.0 ## explicit; go 1.23.0
golang.org/x/mod/internal/lazyregexp golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/module golang.org/x/mod/module
@@ -2262,7 +2262,7 @@ golang.org/x/sys/windows/svc/mgr
# golang.org/x/term v0.33.0 # golang.org/x/term v0.33.0
## explicit; go 1.23.0 ## explicit; go 1.23.0
golang.org/x/term golang.org/x/term
# golang.org/x/text v0.27.0 # golang.org/x/text v0.28.0
## explicit; go 1.23.0 ## explicit; go 1.23.0
golang.org/x/text/cases golang.org/x/text/cases
golang.org/x/text/encoding golang.org/x/text/encoding
@@ -2290,7 +2290,7 @@ golang.org/x/text/width
# golang.org/x/time v0.12.0 # golang.org/x/time v0.12.0
## explicit; go 1.23.0 ## explicit; go 1.23.0
golang.org/x/time/rate golang.org/x/time/rate
# golang.org/x/tools v0.34.0 # golang.org/x/tools v0.35.0
## explicit; go 1.23.0 ## explicit; go 1.23.0
golang.org/x/tools/cover golang.org/x/tools/cover
golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/ast/astutil