From c5d15d1d6c2e79f92545cf8e973317deb04b7638 Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Mon, 22 Jan 2024 12:55:30 -0500 Subject: [PATCH] Remove CLI and API deprecations (#2508) * remove api deprecations Signed-off-by: Alex Goodman * remove deprecated NAME cli flag Signed-off-by: Alex Goodman --------- Signed-off-by: Alex Goodman --- cmd/syft/cli/options/catalog.go | 16 ----- syft/pkg/deprecated.go | 9 --- syft/source/deprecated.go | 119 -------------------------------- 3 files changed, 144 deletions(-) delete mode 100644 syft/pkg/deprecated.go delete mode 100644 syft/source/deprecated.go diff --git a/cmd/syft/cli/options/catalog.go b/cmd/syft/cli/options/catalog.go index 3d8baafe2..7a4b580f5 100644 --- a/cmd/syft/cli/options/catalog.go +++ b/cmd/syft/cli/options/catalog.go @@ -46,7 +46,6 @@ type Catalog struct { // configuration for the source (the subject being analyzed) Registry registryConfig `yaml:"registry" json:"registry" mapstructure:"registry"` Platform string `yaml:"platform" json:"platform" mapstructure:"platform"` - Name string `yaml:"name" json:"name" mapstructure:"name"` // deprecated Source sourceConfig `yaml:"source" json:"source" mapstructure:"source"` Exclusions []string `yaml:"exclude" json:"exclude" mapstructure:"exclude"` } @@ -175,14 +174,6 @@ func (cfg *Catalog) AddFlags(flags clio.FlagSet) { flags.StringArrayVarP(&cfg.SelectCatalogers, "select-catalogers", "", "add, remove, and filter the catalogers to be used") - flags.StringVarP(&cfg.Source.Name, "name", "", - "set the name of the target being analyzed") - - if pfp, ok := flags.(fangs.PFlagSetProvider); ok { - flagSet := pfp.PFlagSet() - flagSet.Lookup("name").Deprecated = "use: source-name" - } - flags.StringVarP(&cfg.Source.Name, "source-name", "", "set the name of the target being analyzed") @@ -198,13 +189,6 @@ func (cfg *Catalog) DescribeFields(descriptions fangs.FieldDescriptionSet) { } func (cfg *Catalog) PostLoad() error { - if cfg.Name != "" { - log.Warnf("name parameter is deprecated. please use: source-name. name will be removed in a future version") - if cfg.Source.Name == "" { - cfg.Source.Name = cfg.Name - } - } - usingLegacyCatalogers := len(cfg.Catalogers) > 0 usingNewCatalogers := len(cfg.DefaultCatalogers) > 0 || len(cfg.SelectCatalogers) > 0 diff --git a/syft/pkg/deprecated.go b/syft/pkg/deprecated.go deleted file mode 100644 index c586cfda1..000000000 --- a/syft/pkg/deprecated.go +++ /dev/null @@ -1,9 +0,0 @@ -package pkg - -// Deprecated: use Collection instead -type Catalog = Collection - -// Deprecated: use NewCollection() instead -func NewCatalog(pkgs ...Package) *Catalog { - return NewCollection(pkgs...) -} diff --git a/syft/source/deprecated.go b/syft/source/deprecated.go deleted file mode 100644 index 4b7e35cf1..000000000 --- a/syft/source/deprecated.go +++ /dev/null @@ -1,119 +0,0 @@ -package source - -import ( - "io" - - stereoscopeFile "github.com/anchore/stereoscope/pkg/file" - "github.com/anchore/stereoscope/pkg/image" - "github.com/anchore/syft/syft/file" -) - -// Deprecated: use file.Metadata instead -type FileMetadata = file.Metadata - -type ( - // Deprecated: use file.Coordinates instead - Coordinates = file.Coordinates - - // Deprecated: use file.CoordinateSet instead - CoordinateSet = file.CoordinateSet - - // Deprecated: use file.Resolver instead - FileResolver = file.Resolver - - // Deprecated: use file.ContentResolver instead - FileContentResolver = file.ContentResolver - - // Deprecated: use file.PathResolver instead - FilePathResolver = file.PathResolver - - // Deprecated: use file.LocationResolver instead - FileLocationResolver = file.LocationResolver - - // Deprecated: use file.MetadataResolver instead - FileMetadataResolver = file.MetadataResolver - - // Deprecated: use file.WritableResolver instead - WritableFileResolver = file.WritableResolver - - // Deprecated: use file.MockResolver instead - MockResolver = file.MockResolver - - // Deprecated: use file.Location instead - Location = file.Location - - // Deprecated: use file.LocationData instead - LocationData = file.LocationData - - // Deprecated: use file.LocationMetadata instead - LocationMetadata = file.LocationMetadata - - // Deprecated: use file.LocationSet instead - LocationSet = file.LocationSet - - // Deprecated: use file.Locations instead - Locations = file.Locations - - // Deprecated: use file.LocationReadCloser instead - LocationReadCloser = file.LocationReadCloser -) - -// Deprecated: use file.NewCoordinateSet instead -func NewCoordinateSet(coordinates ...file.Coordinates) file.CoordinateSet { - return file.NewCoordinateSet(coordinates...) -} - -// Deprecated: use file.NewLocationSet instead -func NewLocationSet(locations ...file.Location) file.LocationSet { - return file.NewLocationSet(locations...) -} - -// Deprecated: use file.NewLocation instead -func NewLocation(realPath string) file.Location { - return file.NewLocation(realPath) -} - -// Deprecated: use file.NewVirtualLocation instead -func NewVirtualLocation(realPath, virtualPath string) file.Location { - return file.NewVirtualLocation(realPath, virtualPath) -} - -// Deprecated: use file.NewLocationFromCoordinates instead -func NewLocationFromCoordinates(coordinates file.Coordinates) file.Location { - return file.NewLocationFromCoordinates(coordinates) -} - -// Deprecated: use file.NewVirtualLocationFromCoordinates instead -func NewVirtualLocationFromCoordinates(coordinates file.Coordinates, virtualPath string) file.Location { - return file.NewVirtualLocationFromCoordinates(coordinates, virtualPath) -} - -// Deprecated: use file.NewLocationFromImage instead -func NewLocationFromImage(virtualPath string, ref stereoscopeFile.Reference, img *image.Image) file.Location { - return file.NewLocationFromImage(virtualPath, ref, img) -} - -// Deprecated: use file.NewLocationFromDirectory instead -func NewLocationFromDirectory(responsePath string, ref stereoscopeFile.Reference) file.Location { - return file.NewLocationFromDirectory(responsePath, ref) -} - -// Deprecated: use file.NewVirtualLocationFromDirectory instead -func NewVirtualLocationFromDirectory(responsePath, virtualResponsePath string, ref stereoscopeFile.Reference) file.Location { - return file.NewVirtualLocationFromDirectory(responsePath, virtualResponsePath, ref) -} - -// Deprecated: use file.NewLocationReadCloser instead -func NewLocationReadCloser(location file.Location, reader io.ReadCloser) file.LocationReadCloser { - return file.NewLocationReadCloser(location, reader) -} - -// Deprecated: use file.NewMockResolverForPaths instead -func NewMockResolverForPaths(paths ...string) *file.MockResolver { - return file.NewMockResolverForPaths(paths...) -} - -// Deprecated: use file.NewMockResolverForPathsWithMetadata instead -func NewMockResolverForPathsWithMetadata(metadata map[file.Coordinates]file.Metadata) *file.MockResolver { - return file.NewMockResolverForPathsWithMetadata(metadata) -}