all: consistently use "%w" formatting in fmt.Errorf for wrapped errors

This commit is contained in:
Aliaksandr Valialkin 2020-09-23 22:46:24 +03:00
parent 265d892a8c
commit 543f3aea97
3 changed files with 3 additions and 3 deletions

View file

@ -41,7 +41,7 @@ func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error {
} }
b, err := yaml.Marshal(g) b, err := yaml.Marshal(g)
if err != nil { if err != nil {
return fmt.Errorf("failed to marshal group configuration for checksum: %s", err) return fmt.Errorf("failed to marshal group configuration for checksum: %w", err)
} }
h := md5.New() h := md5.New()
h.Write(b) h.Write(b)

View file

@ -724,7 +724,7 @@ func (s *Server) processVMSelectTagValueSuffixes(ctx *vmselectRequestCtx) error
tagValuePrefix := append([]byte{}, ctx.dataBuf...) tagValuePrefix := append([]byte{}, ctx.dataBuf...)
delimiter, err := ctx.readByte() delimiter, err := ctx.readByte()
if err != nil { if err != nil {
return fmt.Errorf("cannot read delimiter: %s", err) return fmt.Errorf("cannot read delimiter: %w", err)
} }
// Search for tag value suffixes // Search for tag value suffixes

View file

@ -114,7 +114,7 @@ func TestParseARNCredentialsSuccess(t *testing.T) {
func mustParseRFC3339(s string) time.Time { func mustParseRFC3339(s string) time.Time {
expTime, err := time.Parse(time.RFC3339, s) expTime, err := time.Parse(time.RFC3339, s)
if err != nil { if err != nil {
panic(fmt.Errorf("unexpected error when parsing time from %q: %s", s, err)) panic(fmt.Errorf("unexpected error when parsing time from %q: %w", s, err))
} }
return expTime return expTime
} }