chore(deps): update Go version (#4773)

Signed-off-by: anchore-oss-update-bot <anchore-oss-update-bot@users.noreply.github.com>
Co-authored-by: anchore-oss-update-bot <anchore-oss-update-bot@users.noreply.github.com>
This commit is contained in:
anchore-oss-update-bot
2026-04-15 10:01:39 -04:00
committed by GitHub
co-authored by anchore-oss-update-bot
parent 26e87c7cd3
commit 5b58ec96b7
113 changed files with 339 additions and 394 deletions
@@ -7,6 +7,7 @@ import (
"fmt"
"io"
"regexp"
"slices"
"strings"
"github.com/go-viper/mapstructure/v2"
@@ -95,7 +96,7 @@ func (p *person) UnmarshalJSON(b []byte) error {
}
} else {
// it's a map that may contain fields of various data types (not just strings)
var fields map[string]interface{}
var fields map[string]any
if err := json.Unmarshal(b, &fields); err != nil {
return fmt.Errorf("unable to parse package.json author: %w", err)
}
@@ -210,12 +211,7 @@ func licensesFromJSON(b []byte) ([]npmPackageLicense, error) {
var filepathSeparator = regexp.MustCompile(`[\\/]`)
func pathContainsNodeModulesDirectory(p string) bool {
for _, subPath := range filepathSeparator.Split(p, -1) {
if subPath == "node_modules" {
return true
}
}
return false
return slices.Contains(filepathSeparator.Split(p, -1), "node_modules")
}
func (p *people) UnmarshalJSON(b []byte) error {
@@ -242,7 +238,7 @@ func (p *people) UnmarshalJSON(b []byte) error {
}
// Try to unmarshal as an array of objects
var authorObjs []map[string]interface{}
var authorObjs []map[string]any
if err := json.Unmarshal(b, &authorObjs); err == nil {
// Successfully parsed as an array of objects
auths := make([]person, len(authorObjs))
@@ -41,7 +41,7 @@ type pnpmV6PackageEntry struct {
// pnpmV6LockYaml represents the structure of pnpm lockfiles for versions < 9.0.
type pnpmV6LockYaml struct {
Dependencies map[string]interface{} `yaml:"dependencies"`
Dependencies map[string]any `yaml:"dependencies"`
Packages map[string]pnpmV6PackageEntry `yaml:"packages"`
}
@@ -61,7 +61,7 @@ type pnpmV9PackageEntry struct {
// pnpmV9LockYaml represents the structure of pnpm lockfiles for versions >= 9.0.
type pnpmV9LockYaml struct {
LockfileVersion string `yaml:"lockfileVersion"`
Importers map[string]interface{} `yaml:"importers"` // Using interface{} for forward compatibility
Importers map[string]any `yaml:"importers"` // Using interface{} for forward compatibility
Packages map[string]pnpmV9PackageEntry `yaml:"packages"`
Snapshots map[string]pnpmV9SnapshotEntry `yaml:"snapshots"`
}
@@ -214,11 +214,11 @@ func (a genericPnpmLockAdapter) parsePnpmLock(ctx context.Context, resolver file
}
// parseVersionField extracts the version string from a dependency entry.
func parseVersionField(name string, info interface{}) (string, error) {
func parseVersionField(name string, info any) (string, error) {
switch v := info.(type) {
case string:
return v, nil
case map[string]interface{}:
case map[string]any:
if ver, ok := v["version"].(string); ok {
// e.g., "1.2.3(react@17.0.0)" -> "1.2.3"
return strings.SplitN(ver, "(", 2)[0], nil