chore: use errors.New to replace fmt.Errorf will much better (#3789)

This commit is contained in:
Cheng
2024-04-21 10:11:06 +08:00
committed by GitHub
parent 56f8aa6912
commit 62be2050dd
3 changed files with 5 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package api
import (
"encoding/json"
"errors"
"fmt"
"math"
"os"
@@ -307,7 +308,7 @@ func (m *Metrics) Summary() {
}
}
var ErrInvalidOpts = fmt.Errorf("invalid options")
var ErrInvalidOpts = errors.New("invalid options")
func (opts *Options) FromMap(m map[string]interface{}) error {
valueOpts := reflect.ValueOf(opts).Elem() // names of the fields in the options struct