Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter committed Apr 15, 2024
1 parent 1bb652d commit 483b318
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions internal/feeder/rfc6962/rfc6962_feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ import (
"k8s.io/klog/v2"
)

// signedTreeHead represents the structure returned by the get-sth CT method
// after base64 decoding; see sections 3.5 and 4.3.
type signedTreeHead struct {
Version int `json:"sth_version"` // The version of the protocol to which the STH conforms
TreeSize uint64 `json:"tree_size"` // The number of entries in the new tree
Timestamp uint64 `json:"timestamp"` // The time at which the STH was created
SHA256RootHash []byte `json:"sha256_root_hash"` // The root hash of the log's Merkle tree
TreeHeadSignature []byte `json:"tree_head_signature"` // Log's signature over a TLS-encoded TreeHeadSignature
LogID []byte `json:"log_id"` // The SHA256 hash of the log's public key
}

// proof is a partial representation of the JSON struct returned by the CT
// get-sth-consistency request.
type proof struct {
Expand Down Expand Up @@ -111,7 +100,6 @@ func getJSON(ctx context.Context, c *http.Client, base *url.URL, path string, s
return fmt.Errorf("failed to get: %v", err)
}
if err := json.Unmarshal(raw, s); err != nil {
klog.Infof("Got body:\n%s", string(raw))
return fmt.Errorf("failed to unmarshal JSON: %v", err)
}
return nil
Expand All @@ -133,7 +121,11 @@ func get(ctx context.Context, c *http.Client, base *url.URL, path string) ([]byt
if err != nil {
return nil, fmt.Errorf("failed to make request to %q: %v", u.String(), err)
}
defer rsp.Body.Close()
defer func() {
if err := rsp.Body.Close(); err != nil {
klog.Infof("Close: %v", err)
}
}()

if rsp.StatusCode == 404 {
return nil, os.ErrNotExist
Expand Down

0 comments on commit 483b318

Please sign in to comment.