diff --git a/internal/cmd/fingerprint/fingerprint.go b/internal/cmd/fingerprint/fingerprint.go index 4da9e15c..32dcbb4f 100644 --- a/internal/cmd/fingerprint/fingerprint.go +++ b/internal/cmd/fingerprint/fingerprint.go @@ -91,11 +91,13 @@ func RunE(f fingerprint.IFingerprint) func(_ *cobra.Command, args []string) erro if errors.Is(err, &fingerprint.FingerprintFileExistsError{}) { fmt.Println( "Fingerprint file exists and command is configured to not overwrite. ", - "To generate new fingerprint file either remove/rename old file or ", + "To generate a new fingerprint file either remove/rename old file or ", "change flag '--regenerate' to 'true'", ) + return nil } + return err } diff --git a/internal/fingerprint/fingerprint.go b/internal/fingerprint/fingerprint.go index 270e1f81..4697d8bb 100644 --- a/internal/fingerprint/fingerprint.go +++ b/internal/fingerprint/fingerprint.go @@ -91,8 +91,6 @@ func (f *Fingerprinter) FingerprintFiles(options DebrickedOptions) (Fingerprints if !errors.Is(err, os.ErrNotExist) { fingerprintFileExists = true } - fmt.Printf("output path=%s", options.OutputPath) - fmt.Printf("regen=%t, file=%t\n", options.Regenerate, fingerprintFileExists) if !options.Regenerate && fingerprintFileExists { return fingerprints, &FingerprintFileExistsError{} } diff --git a/internal/fingerprint/fingerprint_test.go b/internal/fingerprint/fingerprint_test.go index 08c17c5e..a208b2c6 100644 --- a/internal/fingerprint/fingerprint_test.go +++ b/internal/fingerprint/fingerprint_test.go @@ -184,9 +184,9 @@ func TestFingerprintFiles(t *testing.T) { } func TestFingerprintFilesAlreadyExists(t *testing.T) { - temp, err := os.CreateTemp("testdata/fingerprinter", "temp-fingerprint-*.txt") + temp, _ := os.CreateTemp("testdata/fingerprinter", "temp-fingerprint-*.txt") fingerprinter := NewFingerprinter() - _, err = fingerprinter.FingerprintFiles( + _, err := fingerprinter.FingerprintFiles( DebrickedOptions{ OutputPath: temp.Name(), Path: "testdata/fingerprinter", diff --git a/internal/scan/scanner.go b/internal/scan/scanner.go index d55958c5..13f060c3 100644 --- a/internal/scan/scanner.go +++ b/internal/scan/scanner.go @@ -172,6 +172,7 @@ func (dScanner *DebrickedScanner) scanFingerprint(options DebrickedOptions) erro Inclusions: append(options.Inclusions, fingerprint.DefaultInclusionsFingerprint()...), MinFingerprintContentLength: options.MinFingerprintContentLength, FingerprintCompressedContent: false, + Regenerate: options.Regenerate > 0, }, ) if err != nil {