Skip to content

Commit

Permalink
Appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
bwesterb committed Sep 18, 2024
1 parent 368e28d commit 76c8782
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
5 changes: 4 additions & 1 deletion ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,9 @@ func (h *Handle) issueBatch(number uint32, empty bool) error {
"index",
},
)
if err != nil {
return err
}

h.batchNumbersCache = nil // Invalidate cache of existing batches

Expand Down Expand Up @@ -1073,7 +1076,7 @@ func New(path string, opts NewOpts) (*Handle, error) {
unlock := true
defer func() {
if unlock {
h.flock.Unlock()
_ = h.flock.Unlock()
}
}()

Expand Down
2 changes: 0 additions & 2 deletions ca/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ func (h *Index) Search(hash []byte) (*IndexSearchResult, error) {
return nil, nil
}
}

return nil, nil
}

type indexEntry struct {
Expand Down
10 changes: 8 additions & 2 deletions cmd/mtc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ func handleCaShowQueue(cc *cli.Context) error {

func handleCaNew(cc *cli.Context) error {
if cc.Args().Len() != 2 {
cli.ShowSubcommandHelp(cc)
err := cli.ShowSubcommandHelp(cc)
if err != nil {
return err
}
return errArgs
}

Expand Down Expand Up @@ -912,7 +915,10 @@ func main() {
if err != nil {
return fmt.Errorf("create(%s): %w", path, err)
}
pprof.StartCPUProfile(fCpuProfile)
err = pprof.StartCPUProfile(fCpuProfile)
if err != nil {
return fmt.Errorf("StartCPUProfile: %w", err)
}
}
return nil
},
Expand Down
9 changes: 6 additions & 3 deletions mtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ func (c *BikeshedCertificate) MarshalBinary() ([]byte, error) {
b.AddBytes(buf)

buf, err = c.Proof.TrustAnchorIdentifier().MarshalBinary()
if err != nil {
return nil, fmt.Errorf("failed to marshal TAI: %w", err)
}
b.AddBytes(buf)
b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) {
b.AddBytes(c.Proof.Info())
Expand Down Expand Up @@ -616,7 +619,7 @@ func (p *CAParams) newTreeHeads(prevHeads, root []byte) ([]byte, error) {
len(root),
)
}
return append(prevHeads[HashLen:len(prevHeads)], root...), nil
return append(prevHeads[HashLen:], root...), nil
}

func (batch *Batch) Anchor() TrustAnchorIdentifier {
Expand Down Expand Up @@ -989,7 +992,7 @@ func (batch *Batch) ComputeRootFromAuthenticationPath(index uint64,
level++
index >>= 1

batch.hashNode(h, left, right, index, level)
_ = batch.hashNode(h, left, right, index, level)
}

if index != 0 {
Expand Down Expand Up @@ -1630,7 +1633,7 @@ func (oid *RelativeOID) Equal(rhs *RelativeOID) bool {
}

func (tai TrustAnchorIdentifier) MarshalBinary() ([]byte, error) {
if tai.Issuer == nil || len(tai.Issuer) == 0 {
if len(tai.Issuer) == 0 {
return nil, errors.New("can't marshal uninitialized TrustAnchorIdentifier")
}
batch := RelativeOID{}
Expand Down
2 changes: 1 addition & 1 deletion mtc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func createEd25519TestTLSSubject() (*TLSSubject, error) {

h := sha3.NewShake128()
h.Write([]byte("MTC Example"))
h.Read(seed[:])
_, _ = h.Read(seed[:])

privEd := ed25519.NewKeyFromSeed(seed[:])
pubEd := privEd.Public()
Expand Down

0 comments on commit 76c8782

Please sign in to comment.