celestiaorg / go-header

Go library with all the services needed to request, sync and store blockchain headers.
Apache License 2.0
19 stars 18 forks source link

fix: use errors.New for const errors #181

Closed cristaloleg closed 4 months ago

cristaloleg commented 4 months ago

Overview

Small cleanup PR. Use errors.New when parameter is const (instead of fmt.Errorf).

Wondertan commented 4 months ago

Is there a fundamental difference between those? I always assumed the resulting errors are sort of identical

cristaloleg commented 4 months ago

Nah, underneath, it will be the same error—the only thing why errors.New is better in this context is that nobody in the future will ask: are we missing params here?

(Hmm, I recall one more pro: when we migrated to another error library, we had a smaller diff due to the absence of such patterns).