diff --git a/internal/pkg/types/v1alpha2/source.go b/internal/pkg/types/v1alpha2/source.go index c8632ed..68770bb 100644 --- a/internal/pkg/types/v1alpha2/source.go +++ b/internal/pkg/types/v1alpha2/source.go @@ -108,11 +108,13 @@ func (source *Source) ValidateChecksums(ctx context.Context) (string, string, er ) if actualSHA256 = hex.EncodeToString(s256.Sum(nil)); source.SHA256 != actualSHA256 { - multiErr = multierror.Append(multiErr, fmt.Errorf("source.sha256 does not match: expected %s, got %s", source.SHA256, actualSHA256)) + err = fmt.Errorf("%s sha256 does not match: expected %s, got %s", source.Destination, source.SHA256, actualSHA256) + multiErr = multierror.Append(multiErr, err) } if actualSHA512 = hex.EncodeToString(s512.Sum(nil)); source.SHA512 != actualSHA512 { - multiErr = multierror.Append(multiErr, fmt.Errorf("source.sha512 does not match: expected %s, got %s", source.SHA512, actualSHA512)) + err = fmt.Errorf("%s sha512 does not match: expected %s, got %s", source.Destination, source.SHA512, actualSHA512) + multiErr = multierror.Append(multiErr, err) } return actualSHA256, actualSHA512, multiErr.ErrorOrNil() diff --git a/internal/pkg/types/v1alpha2/source_test.go b/internal/pkg/types/v1alpha2/source_test.go index 8b58061..41f2667 100644 --- a/internal/pkg/types/v1alpha2/source_test.go +++ b/internal/pkg/types/v1alpha2/source_test.go @@ -43,8 +43,8 @@ func TestSourceValidateChecksums(t *testing.T) { actualSHA256, actualSHA512, err = source.ValidateChecksums(context.Background()) assert.EqualError(t, err, `2 errors occurred: - * source.sha256 does not match: expected 0000000000000000000000000000000000000000000000000000000000000000, got 2aa5f088cbb332e73fc3def546800616b38d3bfe6b8713b8a6404060f22503e8 - * source.sha512 does not match: expected 1111111111111111111111111111111111111111111111111111111111111111, got ce64105ff71615f9d235cc7c8656b6409fc40cc90d15a28d355fadd9072d2eab842af379dd8bba0f1181715753143e4a07491e0f9e5f8df806327d7c95a34fae + * go1.12.5.src.tar.gz sha256 does not match: expected 0000000000000000000000000000000000000000000000000000000000000000, got 2aa5f088cbb332e73fc3def546800616b38d3bfe6b8713b8a6404060f22503e8 + * go1.12.5.src.tar.gz sha512 does not match: expected 1111111111111111111111111111111111111111111111111111111111111111, got ce64105ff71615f9d235cc7c8656b6409fc40cc90d15a28d355fadd9072d2eab842af379dd8bba0f1181715753143e4a07491e0f9e5f8df806327d7c95a34fae `) assert.Equal(t, expectedSHA256, actualSHA256)