Add gosimports (#1205)

This commit is contained in:
Keith Zantow 2022-09-14 13:38:18 -04:00 committed by GitHub
parent 9097614f3b
commit b20310eaf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
217 changed files with 492 additions and 401 deletions

View File

@ -26,6 +26,7 @@ jobs:
BOUNCER_LATEST_VERSION=$(go list -m -json github.com/wagoodman/go-bouncer@latest 2>/dev/null | jq -r '.Version') BOUNCER_LATEST_VERSION=$(go list -m -json github.com/wagoodman/go-bouncer@latest 2>/dev/null | jq -r '.Version')
CHRONICLE_LATEST_VERSION=$(go list -m -json github.com/anchore/chronicle@latest 2>/dev/null | jq -r '.Version') CHRONICLE_LATEST_VERSION=$(go list -m -json github.com/anchore/chronicle@latest 2>/dev/null | jq -r '.Version')
GORELEASER_LATEST_VERSION=$(go list -m -json github.com/goreleaser/goreleaser@latest 2>/dev/null | jq -r '.Version') GORELEASER_LATEST_VERSION=$(go list -m -json github.com/goreleaser/goreleaser@latest 2>/dev/null | jq -r '.Version')
GOSIMPORTS_LATEST_VERSION=$(go list -m -json github.com/rinchsan/gosimports@latest 2>/dev/null | jq -r '.Version')
YAJSV_LATEST_VERSION=$(go list -m -json github.com/neilpa/yajsv@latest 2>/dev/null | jq -r '.Version') YAJSV_LATEST_VERSION=$(go list -m -json github.com/neilpa/yajsv@latest 2>/dev/null | jq -r '.Version')
COSIGN_LATEST_VERSION=$(go list -m -json github.com/sigstore/cosign@latest 2>/dev/null | jq -r '.Version') COSIGN_LATEST_VERSION=$(go list -m -json github.com/sigstore/cosign@latest 2>/dev/null | jq -r '.Version')
@ -34,6 +35,7 @@ jobs:
sed -r -i -e 's/^(BOUNCER_VERSION = ).*/\1'${BOUNCER_LATEST_VERSION}'/' Makefile sed -r -i -e 's/^(BOUNCER_VERSION = ).*/\1'${BOUNCER_LATEST_VERSION}'/' Makefile
sed -r -i -e 's/^(CHRONICLE_VERSION = ).*/\1'${CHRONICLE_LATEST_VERSION}'/' Makefile sed -r -i -e 's/^(CHRONICLE_VERSION = ).*/\1'${CHRONICLE_LATEST_VERSION}'/' Makefile
sed -r -i -e 's/^(GORELEASER_VERSION = ).*/\1'${GORELEASER_LATEST_VERSION}'/' Makefile sed -r -i -e 's/^(GORELEASER_VERSION = ).*/\1'${GORELEASER_LATEST_VERSION}'/' Makefile
sed -r -i -e 's/^(GOSIMPORTS_VERSION = ).*/\1'${GOSIMPORTS_LATEST_VERSION}'/' Makefile
sed -r -i -e 's/^(YAJSV_VERSION = ).*/\1'${YAJSV_LATEST_VERSION}'/' Makefile sed -r -i -e 's/^(YAJSV_VERSION = ).*/\1'${YAJSV_LATEST_VERSION}'/' Makefile
sed -r -i -e 's/^(COSIGN_VERSION = ).*/\1'${COSIGN_LATEST_VERSION}'/' Makefile sed -r -i -e 's/^(COSIGN_VERSION = ).*/\1'${COSIGN_LATEST_VERSION}'/' Makefile
@ -46,6 +48,7 @@ jobs:
echo "::set-output name=BOUNCER::$BOUNCER_LATEST_VERSION" echo "::set-output name=BOUNCER::$BOUNCER_LATEST_VERSION"
echo "::set-output name=CHRONICLE::$CHRONICLE_LATEST_VERSION" echo "::set-output name=CHRONICLE::$CHRONICLE_LATEST_VERSION"
echo "::set-output name=GORELEASER::$GORELEASER_LATEST_VERSION" echo "::set-output name=GORELEASER::$GORELEASER_LATEST_VERSION"
echo "::set-output name=GOSIMPORTS::$GOSIMPORTS_LATEST_VERSION"
echo "::set-output name=YAJSV::$YAJSV_LATEST_VERSION" echo "::set-output name=YAJSV::$YAJSV_LATEST_VERSION"
echo "::set-output name=COSIGN::$COSIGN_LATEST_VERSION" echo "::set-output name=COSIGN::$COSIGN_LATEST_VERSION"
id: latest-versions id: latest-versions
@ -69,6 +72,7 @@ jobs:
- [bouncer ${{ steps.latest-versions.outputs.BOUNCER }}](https://github.com/wagoodman/go-bouncer/releases/tag/${{ steps.latest-versions.outputs.BOUNCER }}) - [bouncer ${{ steps.latest-versions.outputs.BOUNCER }}](https://github.com/wagoodman/go-bouncer/releases/tag/${{ steps.latest-versions.outputs.BOUNCER }})
- [chronicle ${{ steps.latest-versions.outputs.CHRONICLE }}](https://github.com/anchore/chronicle/releases/tag/${{ steps.latest-versions.outputs.CHRONICLE }}) - [chronicle ${{ steps.latest-versions.outputs.CHRONICLE }}](https://github.com/anchore/chronicle/releases/tag/${{ steps.latest-versions.outputs.CHRONICLE }})
- [goreleaser ${{ steps.latest-versions.outputs.GORELEASER }}](https://github.com/goreleaser/goreleaser/releases/tag/${{ steps.latest-versions.outputs.GORELEASER }}) - [goreleaser ${{ steps.latest-versions.outputs.GORELEASER }}](https://github.com/goreleaser/goreleaser/releases/tag/${{ steps.latest-versions.outputs.GORELEASER }})
- [gosimports ${{ steps.latest-versions.outputs.GOSIMPORTS }}](https://github.com/rinchsan/gosimports/releases/tag/${{ steps.latest-versions.outputs.GOSIMPORTS }})
- [yajsv ${{ steps.latest-versions.outputs.YAJSV }}](https://github.com/neilpa/yajsv/releases/tag/${{ steps.latest-versions.outputs.YAJSV }}) - [yajsv ${{ steps.latest-versions.outputs.YAJSV }}](https://github.com/neilpa/yajsv/releases/tag/${{ steps.latest-versions.outputs.YAJSV }})
- [cosign ${{ steps.latest-versions.outputs.COSIGN }}](https://github.com/sigstore/cosign/releases/tag/${{ steps.latest-versions.outputs.COSIGN }}) - [cosign ${{ steps.latest-versions.outputs.COSIGN }}](https://github.com/sigstore/cosign/releases/tag/${{ steps.latest-versions.outputs.COSIGN }})
This is an auto-generated pull request to update all of the bootstrap tools to the latest versions. This is an auto-generated pull request to update all of the bootstrap tools to the latest versions.

View File

@ -22,7 +22,6 @@ linters:
- gocritic - gocritic
- gocyclo - gocyclo
- gofmt - gofmt
- goimports
- goprintffuncname - goprintffuncname
- gosec - gosec
- gosimple - gosimple
@ -49,6 +48,7 @@ linters:
# - godot # - godot
# - godox # - godox
# - goerr113 # - goerr113
# - goimports # we're using gosimports now instead to account for extra whitespaces (see https://github.com/golang/go/issues/20818)
# - golint # deprecated # - golint # deprecated
# - gomnd # this is too aggressive # - gomnd # this is too aggressive
# - interfacer # this is a good idea, but is no longer supported and is prone to false positives # - interfacer # this is a good idea, but is no longer supported and is prone to false positives

View File

@ -4,6 +4,7 @@ RESULTSDIR = test/results
COVER_REPORT = $(RESULTSDIR)/unit-coverage-details.txt COVER_REPORT = $(RESULTSDIR)/unit-coverage-details.txt
COVER_TOTAL = $(RESULTSDIR)/unit-coverage-summary.txt COVER_TOTAL = $(RESULTSDIR)/unit-coverage-summary.txt
LINTCMD = $(TEMPDIR)/golangci-lint run --tests=false --timeout=4m --config .golangci.yaml LINTCMD = $(TEMPDIR)/golangci-lint run --tests=false --timeout=4m --config .golangci.yaml
GOIMPORTS_CMD = $(TEMPDIR)/gosimports -local github.com/anchore
RELEASE_CMD=$(TEMPDIR)/goreleaser release --rm-dist RELEASE_CMD=$(TEMPDIR)/goreleaser release --rm-dist
SNAPSHOT_CMD=$(RELEASE_CMD) --skip-publish --snapshot SNAPSHOT_CMD=$(RELEASE_CMD) --skip-publish --snapshot
VERSION=$(shell git describe --dirty --always --tags) VERSION=$(shell git describe --dirty --always --tags)
@ -12,6 +13,7 @@ COMPARE_DIR = ./test/compare
GOLANGCILINT_VERSION = v1.49.0 GOLANGCILINT_VERSION = v1.49.0
BOUNCER_VERSION = v0.4.0 BOUNCER_VERSION = v0.4.0
CHRONICLE_VERSION = v0.4.1 CHRONICLE_VERSION = v0.4.1
GOSIMPORTS_VERSION = v0.3.1
GORELEASER_VERSION = v1.11.2 GORELEASER_VERSION = v1.11.2
YAJSV_VERSION = v1.4.0 YAJSV_VERSION = v1.4.0
COSIGN_VERSION = v1.11.1 COSIGN_VERSION = v1.11.1
@ -116,6 +118,8 @@ bootstrap-tools: $(TEMPDIR)
curl -sSfL https://raw.githubusercontent.com/wagoodman/go-bouncer/master/bouncer.sh | sh -s -- -b $(TEMPDIR)/ $(BOUNCER_VERSION) curl -sSfL https://raw.githubusercontent.com/wagoodman/go-bouncer/master/bouncer.sh | sh -s -- -b $(TEMPDIR)/ $(BOUNCER_VERSION)
curl -sSfL https://raw.githubusercontent.com/anchore/chronicle/main/install.sh | sh -s -- -b $(TEMPDIR)/ $(CHRONICLE_VERSION) curl -sSfL https://raw.githubusercontent.com/anchore/chronicle/main/install.sh | sh -s -- -b $(TEMPDIR)/ $(CHRONICLE_VERSION)
.github/scripts/goreleaser-install.sh -d -b $(TEMPDIR)/ $(GORELEASER_VERSION) .github/scripts/goreleaser-install.sh -d -b $(TEMPDIR)/ $(GORELEASER_VERSION)
# the only difference between goimports and gosimports is that gosimports removes extra whitespace between import blocks (see https://github.com/golang/go/issues/20818)
GOBIN="$(realpath $(TEMPDIR))" go install github.com/rinchsan/gosimports/cmd/gosimports@$(GOSIMPORTS_VERSION)
GOBIN="$(realpath $(TEMPDIR))" go install github.com/neilpa/yajsv@$(YAJSV_VERSION) GOBIN="$(realpath $(TEMPDIR))" go install github.com/neilpa/yajsv@$(YAJSV_VERSION)
GOBIN="$(realpath $(TEMPDIR))" go install github.com/sigstore/cosign/cmd/cosign@$(COSIGN_VERSION) GOBIN="$(realpath $(TEMPDIR))" go install github.com/sigstore/cosign/cmd/cosign@$(COSIGN_VERSION)
@ -139,6 +143,7 @@ lint: ## Run gofmt + golangci lint checks
# run all golangci-lint rules # run all golangci-lint rules
$(LINTCMD) $(LINTCMD)
@[ -z "$(shell $(GOIMPORTS_CMD) -d .)" ] || (echo "goimports needs to be fixed" && false)
# go tooling does not play well with certain filename characters, ensure the common cases don't result in future "go get" failures # go tooling does not play well with certain filename characters, ensure the common cases don't result in future "go get" failures
$(eval MALFORMED_FILENAMES := $(shell find . | grep -e ':')) $(eval MALFORMED_FILENAMES := $(shell find . | grep -e ':'))
@ -148,6 +153,7 @@ lint: ## Run gofmt + golangci lint checks
lint-fix: ## Auto-format all source code + run golangci lint fixers lint-fix: ## Auto-format all source code + run golangci lint fixers
$(call title,Running lint fixers) $(call title,Running lint fixers)
gofmt -w -s . gofmt -w -s .
$(GOIMPORTS_CMD) -w .
$(LINTCMD) --fix $(LINTCMD) --fix
go mod tidy go mod tidy

View File

@ -4,14 +4,14 @@ import (
"fmt" "fmt"
"log" "log"
sigopts "github.com/sigstore/cosign/cmd/cosign/cli/options"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/anchore/syft/cmd/syft/cli/attest" "github.com/anchore/syft/cmd/syft/cli/attest"
"github.com/anchore/syft/cmd/syft/cli/options" "github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/config" "github.com/anchore/syft/internal/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
sigopts "github.com/sigstore/cosign/cmd/cosign/cli/options"
) )
const ( const (

View File

@ -7,24 +7,6 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/wagoodman/go-progress"
"github.com/anchore/stereoscope"
"github.com/anchore/stereoscope/pkg/image"
"github.com/anchore/syft/cmd/syft/cli/eventloop"
"github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/cmd/syft/cli/packages"
"github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/config"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/ui"
"github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/event"
"github.com/anchore/syft/syft/formats/cyclonedxjson"
"github.com/anchore/syft/syft/formats/spdx22json"
"github.com/anchore/syft/syft/formats/syftjson"
"github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source"
"github.com/google/go-containerregistry/pkg/name" "github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1" v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/in-toto/in-toto-golang/in_toto" "github.com/in-toto/in-toto-golang/in_toto"
@ -43,9 +25,26 @@ import (
"github.com/sigstore/rekor/pkg/generated/client" "github.com/sigstore/rekor/pkg/generated/client"
"github.com/sigstore/rekor/pkg/generated/models" "github.com/sigstore/rekor/pkg/generated/models"
"github.com/sigstore/sigstore/pkg/signature/dsse" "github.com/sigstore/sigstore/pkg/signature/dsse"
"github.com/wagoodman/go-partybus"
signatureoptions "github.com/sigstore/sigstore/pkg/signature/options" signatureoptions "github.com/sigstore/sigstore/pkg/signature/options"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
"github.com/anchore/stereoscope"
"github.com/anchore/stereoscope/pkg/image"
"github.com/anchore/syft/cmd/syft/cli/eventloop"
"github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/cmd/syft/cli/packages"
"github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/config"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/ui"
"github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/event"
"github.com/anchore/syft/syft/formats/cyclonedxjson"
"github.com/anchore/syft/syft/formats/spdx22json"
"github.com/anchore/syft/syft/formats/syftjson"
"github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source"
) )
var ( var (

View File

@ -7,9 +7,10 @@ import (
"os" "os"
"strings" "strings"
"github.com/sigstore/cosign/pkg/cosign"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/sigstore/cosign/pkg/cosign"
) )
func selectPassFunc(keypath, password string) (cosign.PassFunc, error) { func selectPassFunc(keypath, password string) (cosign.PassFunc, error) {

View File

@ -4,22 +4,22 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/anchore/stereoscope"
"github.com/anchore/syft/internal/logger"
"github.com/anchore/syft/syft"
"github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/config"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/version"
"github.com/anchore/syft/syft/event"
cranecmd "github.com/google/go-containerregistry/cmd/crane/cmd" cranecmd "github.com/google/go-containerregistry/cmd/crane/cmd"
"github.com/gookit/color" "github.com/gookit/color"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/wagoodman/go-partybus" "github.com/wagoodman/go-partybus"
"github.com/anchore/stereoscope"
"github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/config"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/logger"
"github.com/anchore/syft/internal/version"
"github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/event"
) )
const indent = " " const indent = " "

View File

@ -4,12 +4,13 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/anchore/syft/cmd/syft/cli/convert" "github.com/anchore/syft/cmd/syft/cli/convert"
"github.com/anchore/syft/cmd/syft/cli/options" "github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/config" "github.com/anchore/syft/internal/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
) )
const ( const (

View File

@ -5,10 +5,11 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/ui"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
"github.com/wagoodman/go-partybus" "github.com/wagoodman/go-partybus"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/ui"
) )
// eventLoop listens to worker errors (from execution path), worker events (from a partybus subscription), and // eventLoop listens to worker errors (from execution path), worker events (from a partybus subscription), and

View File

@ -7,11 +7,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/anchore/syft/internal/ui"
"github.com/anchore/syft/syft/event"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"github.com/wagoodman/go-partybus" "github.com/wagoodman/go-partybus"
"github.com/anchore/syft/internal/ui"
"github.com/anchore/syft/syft/event"
) )
var _ ui.UI = (*uiMock)(nil) var _ ui.UI = (*uiMock)(nil)

View File

@ -3,13 +3,14 @@ package options
import ( import (
"fmt" "fmt"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/anchore/syft/syft" "github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/formats/table" "github.com/anchore/syft/syft/formats/table"
"github.com/anchore/syft/syft/pkg/cataloger" "github.com/anchore/syft/syft/pkg/cataloger"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
) )
type PackagesOptions struct { type PackagesOptions struct {

View File

@ -4,11 +4,12 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/hashicorp/go-multierror"
"github.com/anchore/syft/syft" "github.com/anchore/syft/syft"
"github.com/anchore/syft/syft/formats/table" "github.com/anchore/syft/syft/formats/table"
"github.com/anchore/syft/syft/formats/template" "github.com/anchore/syft/syft/formats/template"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/hashicorp/go-multierror"
) )
// makeWriter creates a sbom.Writer for output or returns an error. this will either return a valid writer // makeWriter creates a sbom.Writer for output or returns an error. this will either return a valid writer

View File

@ -4,13 +4,13 @@ import (
"fmt" "fmt"
"log" "log"
"github.com/anchore/syft/cmd/syft/cli/options" "github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/cmd/syft/cli/packages" "github.com/anchore/syft/cmd/syft/cli/packages"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/config" "github.com/anchore/syft/internal/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
) )
const ( const (

View File

@ -6,6 +6,8 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"github.com/wagoodman/go-partybus"
"github.com/anchore/stereoscope" "github.com/anchore/stereoscope"
"github.com/anchore/syft/cmd/syft/cli/eventloop" "github.com/anchore/syft/cmd/syft/cli/eventloop"
"github.com/anchore/syft/cmd/syft/cli/options" "github.com/anchore/syft/cmd/syft/cli/options"
@ -22,7 +24,6 @@ import (
"github.com/anchore/syft/syft/formats/template" "github.com/anchore/syft/syft/formats/template"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/wagoodman/go-partybus"
) )
func Run(ctx context.Context, app *config.Application, args []string) error { func Run(ctx context.Context, app *config.Application, args []string) error {

View File

@ -3,12 +3,13 @@ package cli
import ( import (
"fmt" "fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/anchore/syft/cmd/syft/cli/options" "github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/cmd/syft/cli/poweruser" "github.com/anchore/syft/cmd/syft/cli/poweruser"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/config" "github.com/anchore/syft/internal/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
) )
const powerUserExample = ` {{.appName}} {{.command}} <image> const powerUserExample = ` {{.appName}} {{.command}} <image>

View File

@ -5,6 +5,9 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/gookit/color"
"github.com/wagoodman/go-partybus"
"github.com/anchore/stereoscope" "github.com/anchore/stereoscope"
"github.com/anchore/syft/cmd/syft/cli/eventloop" "github.com/anchore/syft/cmd/syft/cli/eventloop"
"github.com/anchore/syft/cmd/syft/cli/options" "github.com/anchore/syft/cmd/syft/cli/options"
@ -21,8 +24,6 @@ import (
"github.com/anchore/syft/syft/formats/syftjson" "github.com/anchore/syft/syft/formats/syftjson"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/gookit/color"
"github.com/wagoodman/go-partybus"
) )
func Run(ctx context.Context, app *config.Application, args []string) error { func Run(ctx context.Context, app *config.Application, args []string) error {

View File

@ -6,12 +6,13 @@ import (
"log" "log"
"os" "os"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/anchore/syft/cmd/syft/cli/options" "github.com/anchore/syft/cmd/syft/cli/options"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/config" "github.com/anchore/syft/internal/config"
"github.com/anchore/syft/internal/version" "github.com/anchore/syft/internal/version"
"github.com/spf13/cobra"
"github.com/spf13/viper"
) )
func Version(v *viper.Viper, app *config.Application) *cobra.Command { func Version(v *viper.Viper, app *config.Application) *cobra.Command {

View File

@ -6,14 +6,15 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/antihax/optional"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
"github.com/anchore/client-go/pkg/external" "github.com/anchore/client-go/pkg/external"
"github.com/anchore/stereoscope/pkg/image" "github.com/anchore/stereoscope/pkg/image"
"github.com/anchore/syft/internal/bus" "github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/syft/event" "github.com/anchore/syft/syft/event"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/antihax/optional"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
) )
type ImportConfig struct { type ImportConfig struct {

View File

@ -8,11 +8,11 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/docker/docker/pkg/ioutils"
"github.com/go-test/deep"
"github.com/wagoodman/go-progress" "github.com/wagoodman/go-progress"
"github.com/anchore/client-go/pkg/external" "github.com/anchore/client-go/pkg/external"
"github.com/docker/docker/pkg/ioutils"
"github.com/go-test/deep"
) )
type mockConfigImportAPI struct { type mockConfigImportAPI struct {

View File

@ -8,9 +8,8 @@ import (
"github.com/wagoodman/go-progress" "github.com/wagoodman/go-progress"
"github.com/anchore/syft/internal/log"
"github.com/anchore/client-go/pkg/external" "github.com/anchore/client-go/pkg/external"
"github.com/anchore/syft/internal/log"
) )
type dockerfileImportAPI interface { type dockerfileImportAPI interface {

View File

@ -7,12 +7,11 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/docker/docker/pkg/ioutils"
"github.com/go-test/deep"
"github.com/wagoodman/go-progress" "github.com/wagoodman/go-progress"
"github.com/docker/docker/pkg/ioutils"
"github.com/anchore/client-go/pkg/external" "github.com/anchore/client-go/pkg/external"
"github.com/go-test/deep"
) )
type mockDockerfileImportAPI struct { type mockDockerfileImportAPI struct {

View File

@ -8,11 +8,11 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/docker/docker/pkg/ioutils"
"github.com/go-test/deep"
"github.com/wagoodman/go-progress" "github.com/wagoodman/go-progress"
"github.com/anchore/client-go/pkg/external" "github.com/anchore/client-go/pkg/external"
"github.com/docker/docker/pkg/ioutils"
"github.com/go-test/deep"
) )
type mockManifestImportAPI struct { type mockManifestImportAPI struct {

View File

@ -8,12 +8,13 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"github.com/wagoodman/go-progress"
"github.com/anchore/client-go/pkg/external" "github.com/anchore/client-go/pkg/external"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/formats/syftjson" "github.com/anchore/syft/syft/formats/syftjson"
syftjsonModel "github.com/anchore/syft/syft/formats/syftjson/model" syftjsonModel "github.com/anchore/syft/syft/formats/syftjson/model"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/wagoodman/go-progress"
) )
type packageSBOMImportAPI interface { type packageSBOMImportAPI interface {

View File

@ -8,6 +8,12 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/docker/docker/pkg/ioutils"
"github.com/go-test/deep"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/wagoodman/go-progress"
"github.com/anchore/client-go/pkg/external" "github.com/anchore/client-go/pkg/external"
"github.com/anchore/syft/syft/artifact" "github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/formats/syftjson" "github.com/anchore/syft/syft/formats/syftjson"
@ -15,11 +21,6 @@ import (
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/docker/docker/pkg/ioutils"
"github.com/go-test/deep"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/wagoodman/go-progress"
) )
func must(c pkg.CPE, e error) pkg.CPE { func must(c pkg.CPE, e error) pkg.CPE {

View File

@ -8,16 +8,15 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/anchore/syft/syft/pkg/cataloger"
"github.com/sirupsen/logrus"
"github.com/adrg/xdg" "github.com/adrg/xdg"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log"
"github.com/mitchellh/go-homedir" "github.com/mitchellh/go-homedir"
"github.com/sirupsen/logrus"
"github.com/spf13/viper" "github.com/spf13/viper"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/pkg/cataloger"
) )
var ( var (

View File

@ -1,8 +1,9 @@
package config package config
import ( import (
"github.com/anchore/syft/syft/source"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/anchore/syft/syft/source"
) )
type fileClassification struct { type fileClassification struct {

View File

@ -1,9 +1,10 @@
package config package config
import ( import (
"github.com/spf13/viper"
"github.com/anchore/syft/internal/file" "github.com/anchore/syft/internal/file"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/spf13/viper"
) )
type fileContents struct { type fileContents struct {

View File

@ -1,8 +1,9 @@
package config package config
import ( import (
"github.com/anchore/syft/syft/source"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/anchore/syft/syft/source"
) )
type FileMetadata struct { type FileMetadata struct {

View File

@ -1,8 +1,9 @@
package config package config
import ( import (
"github.com/anchore/syft/syft/pkg/cataloger"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/anchore/syft/syft/pkg/cataloger"
) )
type pkg struct { type pkg struct {

View File

@ -3,9 +3,9 @@ package config
import ( import (
"os" "os"
"github.com/anchore/stereoscope/pkg/image"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/anchore/stereoscope/pkg/image"
) )
type RegistryCredentials struct { type RegistryCredentials struct {

View File

@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/anchore/stereoscope/pkg/image"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/stereoscope/pkg/image"
) )
func TestHasNonEmptyCredentials(t *testing.T) { func TestHasNonEmptyCredentials(t *testing.T) {

View File

@ -1,9 +1,10 @@
package config package config
import ( import (
"github.com/spf13/viper"
"github.com/anchore/syft/internal/file" "github.com/anchore/syft/internal/file"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/spf13/viper"
) )
type secrets struct { type secrets struct {

View File

@ -2,10 +2,10 @@ package main
import ( import (
"encoding/json" "encoding/json"
"github.com/google/go-cmp/cmp"
"os" "os"
"testing" "testing"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

View File

@ -1,9 +1,10 @@
package main package main
import ( import (
"github.com/stretchr/testify/assert"
"strings" "strings"
"testing" "testing"
"github.com/stretchr/testify/assert"
) )
var ( var (

View File

@ -3,8 +3,9 @@ package ui
import ( import (
"fmt" "fmt"
syftEventParsers "github.com/anchore/syft/syft/event/parsers"
"github.com/wagoodman/go-partybus" "github.com/wagoodman/go-partybus"
syftEventParsers "github.com/anchore/syft/syft/event/parsers"
) )
// handleExit is a UI function for processing the Exit bus event, // handleExit is a UI function for processing the Exit bus event,

View File

@ -11,12 +11,13 @@ import (
"os" "os"
"sync" "sync"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/jotframe/pkg/frame"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/logger" "github.com/anchore/syft/internal/logger"
syftEvent "github.com/anchore/syft/syft/event" syftEvent "github.com/anchore/syft/syft/event"
"github.com/anchore/syft/ui" "github.com/anchore/syft/ui"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/jotframe/pkg/frame"
) )
// ephemeralTerminalUI provides an "ephemeral" terminal user interface to display the application state dynamically. // ephemeralTerminalUI provides an "ephemeral" terminal user interface to display the application state dynamically.

View File

@ -9,12 +9,12 @@ import (
"io" "io"
"sync" "sync"
"github.com/anchore/syft/internal"
"github.com/gookit/color" "github.com/gookit/color"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/jotframe/pkg/frame" "github.com/wagoodman/jotframe/pkg/frame"
"github.com/anchore/syft/internal"
syftEventParsers "github.com/anchore/syft/syft/event/parsers" syftEventParsers "github.com/anchore/syft/syft/event/parsers"
"github.com/wagoodman/go-partybus"
) )
// handleAppUpdateAvailable is a UI handler function to display a new application version to the top of the screen. // handleAppUpdateAvailable is a UI handler function to display a new application version to the top of the screen.

View File

@ -1,9 +1,10 @@
package ui package ui
import ( import (
"github.com/wagoodman/go-partybus"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
syftEvent "github.com/anchore/syft/syft/event" syftEvent "github.com/anchore/syft/syft/event"
"github.com/wagoodman/go-partybus"
) )
type loggerUI struct { type loggerUI struct {

View File

@ -11,6 +11,7 @@ import (
"strings" "strings"
"github.com/alecthomas/jsonschema" "github.com/alecthomas/jsonschema"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
syftjsonModel "github.com/anchore/syft/syft/formats/syftjson/model" syftjsonModel "github.com/anchore/syft/syft/formats/syftjson/model"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"

View File

@ -6,11 +6,12 @@ package parsers
import ( import (
"fmt" "fmt"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
"github.com/anchore/syft/syft/event" "github.com/anchore/syft/syft/event"
"github.com/anchore/syft/syft/file" "github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/pkg/cataloger" "github.com/anchore/syft/syft/pkg/cataloger"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
) )
type ErrBadPayload struct { type ErrBadPayload struct {

View File

@ -1,12 +1,14 @@
package file package file
import ( import (
"github.com/anchore/stereoscope/pkg/imagetest" "testing"
"github.com/anchore/syft/syft/source"
"github.com/scylladb/go-set/strset" "github.com/scylladb/go-set/strset"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing"
"github.com/anchore/stereoscope/pkg/imagetest"
"github.com/anchore/syft/syft/source"
) )
func Test_allRegularFiles(t *testing.T) { func Test_allRegularFiles(t *testing.T) {

View File

@ -1,11 +1,12 @@
package file package file
import ( import (
"github.com/anchore/stereoscope/pkg/imagetest"
"testing" "testing"
"github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/stereoscope/pkg/imagetest"
"github.com/anchore/syft/syft/source"
) )
func TestClassifierCataloger_DefaultClassifiers_PositiveCases(t *testing.T) { func TestClassifierCataloger_DefaultClassifiers_PositiveCases(t *testing.T) {

View File

@ -4,8 +4,9 @@ import (
"regexp" "regexp"
"testing" "testing"
"github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/source"
) )
func TestFilepathMatches(t *testing.T) { func TestFilepathMatches(t *testing.T) {

View File

@ -7,7 +7,6 @@ import (
"io" "io"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )

View File

@ -3,8 +3,9 @@ package file
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/source"
) )
func TestContentsCataloger(t *testing.T) { func TestContentsCataloger(t *testing.T) {

View File

@ -8,15 +8,13 @@ import (
"io" "io"
"strings" "strings"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/syft/event"
"github.com/wagoodman/go-partybus" "github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress" "github.com/wagoodman/go-progress"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/event"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )

View File

@ -3,18 +3,16 @@ package file
import ( import (
"crypto" "crypto"
"fmt" "fmt"
"github.com/stretchr/testify/require"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/anchore/stereoscope/pkg/file"
"github.com/anchore/stereoscope/pkg/imagetest"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/anchore/stereoscope/pkg/file"
"github.com/anchore/stereoscope/pkg/imagetest"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )

View File

@ -1,12 +1,13 @@
package file package file
import ( import (
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
"github.com/anchore/syft/internal/bus" "github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/event" "github.com/anchore/syft/syft/event"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
) )
type MetadataCataloger struct { type MetadataCataloger struct {

View File

@ -5,10 +5,11 @@ import (
"os" "os"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/anchore/stereoscope/pkg/file" "github.com/anchore/stereoscope/pkg/file"
"github.com/anchore/stereoscope/pkg/imagetest" "github.com/anchore/stereoscope/pkg/imagetest"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert"
) )
var updateImageGoldenFiles = flag.Bool("update-image", false, "update the golden fixture images used for testing") var updateImageGoldenFiles = flag.Bool("update-image", false, "update the golden fixture images used for testing")

View File

@ -8,14 +8,14 @@ import (
"regexp" "regexp"
"sort" "sort"
"github.com/anchore/syft/internal" "github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/bus" "github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/event" "github.com/anchore/syft/syft/event"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/wagoodman/go-partybus"
"github.com/wagoodman/go-progress"
) )
var DefaultSecretsPatterns = map[string]string{ var DefaultSecretsPatterns = map[string]string{

View File

@ -4,11 +4,10 @@ import (
"regexp" "regexp"
"testing" "testing"
"github.com/anchore/syft/internal/file"
"github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/internal/file"
"github.com/anchore/syft/syft/source"
) )
func TestSecretsCataloger(t *testing.T) { func TestSecretsCataloger(t *testing.T) {

View File

@ -9,7 +9,6 @@ import (
"regexp" "regexp"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )

View File

@ -3,8 +3,9 @@ package cyclonedxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_encodeAuthor(t *testing.T) { func Test_encodeAuthor(t *testing.T) {

View File

@ -3,8 +3,9 @@ package cyclonedxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_encodeDescription(t *testing.T) { func Test_encodeDescription(t *testing.T) {

View File

@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"strings" "strings"
syftFile "github.com/anchore/syft/syft/file"
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
syftFile "github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
) )

View File

@ -4,8 +4,9 @@ import (
"testing" "testing"
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_encodeExternalReferences(t *testing.T) { func Test_encodeExternalReferences(t *testing.T) {

View File

@ -3,8 +3,9 @@ package cyclonedxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_encodeGroup(t *testing.T) { func Test_encodeGroup(t *testing.T) {

View File

@ -2,6 +2,7 @@ package cyclonedxhelpers
import ( import (
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
"github.com/anchore/syft/internal/spdxlicense" "github.com/anchore/syft/internal/spdxlicense"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
) )

View File

@ -4,8 +4,9 @@ import (
"testing" "testing"
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_encodeLicense(t *testing.T) { func Test_encodeLicense(t *testing.T) {

View File

@ -3,8 +3,9 @@ package cyclonedxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_encodePublisher(t *testing.T) { func Test_encodePublisher(t *testing.T) {

View File

@ -3,8 +3,9 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_Description(t *testing.T) { func Test_Description(t *testing.T) {

View File

@ -5,9 +5,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/anchore/syft/syft/source"
"github.com/scylladb/go-set/strset" "github.com/scylladb/go-set/strset"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/source"
) )
func Test_DocumentName(t *testing.T) { func Test_DocumentName(t *testing.T) {

View File

@ -5,9 +5,10 @@ import (
"net/url" "net/url"
"path" "path"
"github.com/google/uuid"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/google/uuid"
) )
func DocumentNameAndNamespace(srcMetadata source.Metadata) (string, string) { func DocumentNameAndNamespace(srcMetadata source.Metadata) (string, string) {

View File

@ -5,9 +5,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/anchore/syft/syft/source"
"github.com/scylladb/go-set/strset" "github.com/scylladb/go-set/strset"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/source"
) )
func Test_documentNamespace(t *testing.T) { func Test_documentNamespace(t *testing.T) {

View File

@ -3,8 +3,9 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_DownloadLocation(t *testing.T) { func Test_DownloadLocation(t *testing.T) {

View File

@ -3,8 +3,9 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_ExternalRefs(t *testing.T) { func Test_ExternalRefs(t *testing.T) {

View File

@ -3,8 +3,9 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_Homepage(t *testing.T) { func Test_Homepage(t *testing.T) {

View File

@ -3,8 +3,9 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_License(t *testing.T) { func Test_License(t *testing.T) {

View File

@ -3,8 +3,9 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func Test_Originator(t *testing.T) { func Test_Originator(t *testing.T) {

View File

@ -3,9 +3,10 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert"
) )
func Test_SourceInfo(t *testing.T) { func Test_SourceInfo(t *testing.T) {

View File

@ -3,11 +3,12 @@ package spdxhelpers
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/source"
"github.com/spdx/tools-golang/spdx" "github.com/spdx/tools-golang/spdx"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/source"
) )
func TestToSyftModel(t *testing.T) { func TestToSyftModel(t *testing.T) {

View File

@ -5,6 +5,9 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/sergi/go-diff/diffmatchpatch"
"github.com/stretchr/testify/assert"
"github.com/anchore/go-testutils" "github.com/anchore/go-testutils"
"github.com/anchore/stereoscope/pkg/filetree" "github.com/anchore/stereoscope/pkg/filetree"
"github.com/anchore/stereoscope/pkg/image" "github.com/anchore/stereoscope/pkg/image"
@ -13,8 +16,6 @@ import (
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/sergi/go-diff/diffmatchpatch"
"github.com/stretchr/testify/assert"
) )
type redactor func(s []byte) []byte type redactor func(s []byte) []byte

View File

@ -4,6 +4,7 @@ import (
"io" "io"
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
"github.com/anchore/syft/syft/formats/common/cyclonedxhelpers" "github.com/anchore/syft/syft/formats/common/cyclonedxhelpers"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
) )

View File

@ -2,6 +2,7 @@ package cyclonedxjson
import ( import (
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
"github.com/anchore/syft/syft/formats/common/cyclonedxhelpers" "github.com/anchore/syft/syft/formats/common/cyclonedxhelpers"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
) )

View File

@ -4,6 +4,7 @@ import (
"io" "io"
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
"github.com/anchore/syft/syft/formats/common/cyclonedxhelpers" "github.com/anchore/syft/syft/formats/common/cyclonedxhelpers"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
) )

View File

@ -2,6 +2,7 @@ package cyclonedxxml
import ( import (
"github.com/CycloneDX/cyclonedx-go" "github.com/CycloneDX/cyclonedx-go"
"github.com/anchore/syft/syft/formats/common/cyclonedxhelpers" "github.com/anchore/syft/syft/formats/common/cyclonedxhelpers"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
) )

View File

@ -5,8 +5,9 @@ import (
"os" "os"
"testing" "testing"
"github.com/anchore/syft/syft/pkg"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/pkg"
) )
func TestSPDXJSONDecoder(t *testing.T) { func TestSPDXJSONDecoder(t *testing.T) {

View File

@ -3,16 +3,14 @@ package spdx22json
import ( import (
"testing" "testing"
"github.com/anchore/syft/syft/pkg" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/artifact" "github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/formats/common/spdxhelpers" "github.com/anchore/syft/syft/formats/common/spdxhelpers"
"github.com/anchore/syft/syft/formats/spdx22json/model" "github.com/anchore/syft/syft/formats/spdx22json/model"
"github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert"
) )
func Test_toFileTypes(t *testing.T) { func Test_toFileTypes(t *testing.T) {

View File

@ -3,8 +3,9 @@ package spdx22tagvalue
import ( import (
"io" "io"
"github.com/anchore/syft/syft/sbom"
"github.com/spdx/tools-golang/tvsaver" "github.com/spdx/tools-golang/tvsaver"
"github.com/anchore/syft/syft/sbom"
) )
func encoder(output io.Writer, s sbom.SBOM) error { func encoder(output io.Writer, s sbom.SBOM) error {

View File

@ -4,13 +4,13 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/anchore/syft/syft/sbom" "github.com/spdx/tools-golang/spdx"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/spdxlicense" "github.com/anchore/syft/internal/spdxlicense"
"github.com/anchore/syft/syft/formats/common/spdxhelpers" "github.com/anchore/syft/syft/formats/common/spdxhelpers"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/spdx/tools-golang/spdx" "github.com/anchore/syft/syft/sbom"
) )
// toFormatModel creates and populates a new JSON document struct that follows the SPDX 2.2 spec from the given cataloging results. // toFormatModel creates and populates a new JSON document struct that follows the SPDX 2.2 spec from the given cataloging results.

View File

@ -5,9 +5,8 @@ import (
"fmt" "fmt"
"io" "io"
"github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/formats/syftjson/model" "github.com/anchore/syft/syft/formats/syftjson/model"
"github.com/anchore/syft/syft/sbom"
) )
func decoder(reader io.Reader) (*sbom.SBOM, error) { func decoder(reader io.Reader) (*sbom.SBOM, error) {

View File

@ -5,9 +5,10 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/anchore/syft/syft/formats/common/testutils"
"github.com/go-test/deep" "github.com/go-test/deep"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/formats/common/testutils"
) )
func TestEncodeDecodeCycle(t *testing.T) { func TestEncodeDecodeCycle(t *testing.T) {

View File

@ -4,16 +4,13 @@ import (
"flag" "flag"
"testing" "testing"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/artifact" "github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/formats/common/testutils"
"github.com/anchore/syft/syft/linux" "github.com/anchore/syft/syft/linux"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/anchore/syft/syft/formats/common/testutils"
) )
var updateJson = flag.Bool("update-json", false, "update the *.golden files for json encoders") var updateJson = flag.Bool("update-json", false, "update the *.golden files for json encoders")

View File

@ -2,7 +2,6 @@ package model
import ( import (
"github.com/anchore/syft/syft/file" "github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )

View File

@ -5,10 +5,9 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/anchore/syft/syft/source"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/source"
) )
var errUnknownMetadataType = errors.New("unknown metadata type") var errUnknownMetadataType = errors.New("unknown metadata type")

View File

@ -2,10 +2,12 @@ package model
import ( import (
"encoding/json" "encoding/json"
"github.com/anchore/syft/syft/pkg" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"testing"
"github.com/anchore/syft/syft/pkg"
) )
func TestUnmarshalPackageGolang(t *testing.T) { func TestUnmarshalPackageGolang(t *testing.T) {

View File

@ -4,11 +4,10 @@ import (
"encoding/json" "encoding/json"
"testing" "testing"
"github.com/anchore/syft/syft/source"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/source"
) )
func TestSource_UnmarshalJSON(t *testing.T) { func TestSource_UnmarshalJSON(t *testing.T) {

View File

@ -5,18 +5,14 @@ import (
"sort" "sort"
"strconv" "strconv"
"github.com/anchore/syft/syft/linux"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/formats/syftjson/model" "github.com/anchore/syft/syft/formats/syftjson/model"
"github.com/anchore/syft/syft/linux"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )

View File

@ -4,11 +4,11 @@ import (
"testing" "testing"
"github.com/scylladb/go-set/strset" "github.com/scylladb/go-set/strset"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/anchore/syft/syft/formats/syftjson/model" "github.com/anchore/syft/syft/formats/syftjson/model"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func Test_toSourceModel(t *testing.T) { func Test_toSourceModel(t *testing.T) {

View File

@ -1,6 +1,8 @@
package syftjson package syftjson
import ( import (
"github.com/google/go-cmp/cmp"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/artifact" "github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/formats/syftjson/model" "github.com/anchore/syft/syft/formats/syftjson/model"
@ -8,7 +10,6 @@ import (
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/google/go-cmp/cmp"
) )
func toSyftModel(doc model.Document) (*sbom.SBOM, error) { func toSyftModel(doc model.Document) (*sbom.SBOM, error) {

View File

@ -3,11 +3,12 @@ package syftjson
import ( import (
"testing" "testing"
"github.com/scylladb/go-set/strset"
"github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/artifact" "github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/formats/syftjson/model" "github.com/anchore/syft/syft/formats/syftjson/model"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/scylladb/go-set/strset"
"github.com/stretchr/testify/assert"
) )
func Test_toSyftSourceData(t *testing.T) { func Test_toSyftSourceData(t *testing.T) {

View File

@ -6,9 +6,9 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/anchore/syft/syft/sbom"
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
"github.com/anchore/syft/syft/sbom"
) )
func encoder(output io.Writer, s sbom.SBOM) error { func encoder(output io.Writer, s sbom.SBOM) error {

View File

@ -4,8 +4,9 @@ import (
"flag" "flag"
"testing" "testing"
"github.com/anchore/syft/syft/formats/common/testutils"
"github.com/go-test/deep" "github.com/go-test/deep"
"github.com/anchore/syft/syft/formats/common/testutils"
) )
var updateTableGoldenFiles = flag.Bool("update-table", false, "update the *.golden files for table format") var updateTableGoldenFiles = flag.Bool("update-table", false, "update the *.golden files for table format")

View File

@ -4,8 +4,9 @@ import (
"flag" "flag"
"testing" "testing"
"github.com/anchore/syft/syft/formats/common/testutils"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/anchore/syft/syft/formats/common/testutils"
) )
var updateTmpl = flag.Bool("update-tmpl", false, "update the *.golden files for json encoders") var updateTmpl = flag.Bool("update-tmpl", false, "update the *.golden files for json encoders")

View File

@ -6,7 +6,6 @@ import (
"text/tabwriter" "text/tabwriter"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
) )

View File

@ -6,6 +6,9 @@ import (
"os" "os"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/anchore/syft/syft/formats/cyclonedxjson" "github.com/anchore/syft/syft/formats/cyclonedxjson"
"github.com/anchore/syft/syft/formats/cyclonedxxml" "github.com/anchore/syft/syft/formats/cyclonedxxml"
"github.com/anchore/syft/syft/formats/github" "github.com/anchore/syft/syft/formats/github"
@ -16,9 +19,6 @@ import (
"github.com/anchore/syft/syft/formats/template" "github.com/anchore/syft/syft/formats/template"
"github.com/anchore/syft/syft/formats/text" "github.com/anchore/syft/syft/formats/text"
"github.com/anchore/syft/syft/sbom" "github.com/anchore/syft/syft/sbom"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
) )
func TestIdentify(t *testing.T) { func TestIdentify(t *testing.T) {

View File

@ -19,16 +19,16 @@ package syft
import ( import (
"fmt" "fmt"
"github.com/anchore/syft/syft/artifact" "github.com/wagoodman/go-partybus"
"github.com/anchore/syft/internal/bus" "github.com/anchore/syft/internal/bus"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/linux" "github.com/anchore/syft/syft/linux"
"github.com/anchore/syft/syft/logger" "github.com/anchore/syft/syft/logger"
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
"github.com/anchore/syft/syft/pkg/cataloger" "github.com/anchore/syft/syft/pkg/cataloger"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/wagoodman/go-partybus"
) )
// CatalogPackages takes an inventory of packages from the given image from a particular perspective // CatalogPackages takes an inventory of packages from the given image from a particular perspective

View File

@ -7,10 +7,11 @@ import (
"strings" "strings"
"github.com/acobaugh/osrelease" "github.com/acobaugh/osrelease"
"github.com/google/go-cmp/cmp"
"github.com/anchore/syft/internal" "github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log" "github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/source" "github.com/anchore/syft/syft/source"
"github.com/google/go-cmp/cmp"
) )
// returns a distro or nil // returns a distro or nil

View File

@ -5,9 +5,10 @@ import (
"os" "os"
"testing" "testing"
"github.com/anchore/syft/syft/source"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/anchore/syft/syft/source"
) )
func TestIdentifyRelease(t *testing.T) { func TestIdentifyRelease(t *testing.T) {

View File

@ -4,10 +4,11 @@ import (
"sort" "sort"
"time" "time"
"github.com/scylladb/go-set/strset"
"github.com/anchore/packageurl-go" "github.com/anchore/packageurl-go"
"github.com/anchore/syft/syft/file" "github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/linux" "github.com/anchore/syft/syft/linux"
"github.com/scylladb/go-set/strset"
) )
const AlpmDBGlob = "**/var/lib/pacman/local/**/desc" const AlpmDBGlob = "**/var/lib/pacman/local/**/desc"

Some files were not shown because too many files have changed in this diff Show More