chore: switch to stdlib's slices pkg (#2148)

* chore: switch to stdlib's slices pkg

Signed-off-by: hainenber <dotronghai96@gmail.com>

* fix linting

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: hainenber <dotronghai96@gmail.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Đỗ Trọng Hải
2023-09-20 18:38:37 +00:00
committed by GitHub
co-authored by Alex Goodman
parent 7d0d3e1977
commit b7fa75d7f8
10 changed files with 13 additions and 16 deletions
@@ -1,12 +1,12 @@
package cyclonedxhelpers
import (
"slices"
"strings"
"time"
"github.com/CycloneDX/cyclonedx-go"
"github.com/google/uuid"
"golang.org/x/exp/slices"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/artifact"
@@ -5,14 +5,13 @@ import (
"crypto/sha1"
"fmt"
"path"
"slices"
"sort"
"strings"
"time"
"github.com/docker/distribution/reference"
"github.com/spdx/tools-golang/spdx"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
"github.com/anchore/packageurl-go"
"github.com/anchore/syft/internal"
@@ -722,7 +721,11 @@ func toOtherLicenses(catalog *pkg.Collection) []*spdx.OtherLicense {
var result []*spdx.OtherLicense
ids := maps.Keys(licenses)
var ids []string
for licenseID := range licenses {
ids = append(ids, licenseID)
}
slices.Sort(ids)
for _, id := range ids {
license := licenses[id]
+1 -2
View File
@@ -6,10 +6,9 @@ import (
"fmt"
"io"
"regexp"
"slices"
"strings"
"golang.org/x/exp/slices"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/formats/cyclonedxjson"
"github.com/anchore/syft/syft/formats/cyclonedxxml"
@@ -6,6 +6,7 @@ import (
"io/fs"
"os"
"path"
"slices"
"sort"
"strings"
"time"
@@ -13,7 +14,6 @@ import (
"github.com/bmatcuk/doublestar/v4"
"github.com/mitchellh/go-homedir"
"github.com/spf13/afero"
"golang.org/x/exp/slices"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/file"
@@ -7,10 +7,10 @@ import (
"fmt"
"io"
"log"
"slices"
"strings"
"github.com/facebookincubator/nvdtools/wfn"
"golang.org/x/exp/slices"
"github.com/anchore/syft/syft/pkg/cataloger/common/cpe/dictionary"
)
+1 -1
View File
@@ -1,7 +1,7 @@
package cataloger
import (
"golang.org/x/exp/slices"
"slices"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/pkg"
+1 -2
View File
@@ -1,10 +1,9 @@
package sbom
import (
"slices"
"sort"
"golang.org/x/exp/slices"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"