Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Dec 16, 2020
1 parent 4717181 commit ba6afc8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/v1/hash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func TestGoodHashes(t *testing.T) {
for _, s := range good {
h, err := NewHash(s)
if err != nil {
t.Errorf("Unexpected error parsing hash: %v", err)
t.Error("Unexpected error parsing hash:", err)
}
if got, want := h.String(), s; got != want {
t.Errorf("String(); got %q, want %q", got, want)
}
bytes, err := json.Marshal(h)
if err != nil {
t.Errorf("Unexpected error json.Marshaling hash: %v", err)
t.Error("Unexpected error json.Marshaling hash:", err)
}
if got, want := string(bytes), strconv.Quote(h.String()); got != want {
t.Errorf("json.Marshal(); got %q, want %q", got, want)
Expand All @@ -64,7 +64,7 @@ func TestBadHashes(t *testing.T) {
for _, s := range bad {
h, err := NewHash(s)
if err == nil {
t.Errorf("Expected error, got: %v", h)
t.Error("Expected error, got:", h)
}
}
}
Expand All @@ -73,7 +73,7 @@ func TestSHA256(t *testing.T) {
input := "asdf"
h, n, err := SHA256(strings.NewReader(input))
if err != nil {
t.Errorf("SHA256(asdf) = %v", err)
t.Error("SHA256(asdf) =", err)
}
if got, want := h.Algorithm, "sha256"; got != want {
t.Errorf("Algorithm; got %v, want %v", got, want)
Expand All @@ -92,10 +92,10 @@ func TestTextMarshalling(t *testing.T) {
foo := make(map[Hash]string)
b, err := json.Marshal(foo)
if err != nil {
t.Fatalf("could not marshal: %v", err)
t.Fatal("could not marshal:", err)
}
if err := json.Unmarshal(b, &foo); err != nil {
t.Errorf("could not unmarshal: %v", err)
t.Error("could not unmarshal:", err)
}

h := &Hash{
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestVerificationFailure(t *testing.T) {

verified, err := VerifyReadCloser(ioutil.NopCloser(buf), mustHash("not the same", t))
if err != nil {
t.Fatalf("VerifyReadCloser() = %v", err)
t.Fatal("VerifyReadCloser() =", err)
}
if b, err := ioutil.ReadAll(verified); err == nil {
t.Errorf("ReadAll() = %q; want verification error", string(b))
Expand All @@ -143,10 +143,10 @@ func TestVerification(t *testing.T) {

verified, err := VerifyReadCloser(ioutil.NopCloser(buf), mustHash(want, t))
if err != nil {
t.Fatalf("VerifyReadCloser() = %v", err)
t.Fatal("VerifyReadCloser() =", err)
}
if _, err := ioutil.ReadAll(verified); err != nil {
t.Errorf("ReadAll() = %v", err)
t.Error("ReadAll() =", err)
}
}

Expand Down

0 comments on commit ba6afc8

Please sign in to comment.