diff --git a/internal/command/command.go b/internal/command/command.go index ebda1020d..70f25501a 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -40,7 +40,7 @@ func New() (*Command, error) { var cfg icingadbconfig.Config if err := config.FromYAMLFile(flags.Config, &cfg); err != nil { - if errors.Is(err, config.InvalidArgumentError) { + if errors.Is(err, config.ErrInvalidArgument) { return nil, err } diff --git a/pkg/config/config.go b/pkg/config/config.go index f656be83f..73d62985f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -10,18 +10,18 @@ import ( "reflect" ) -// InvalidArgumentError is the error returned by [ParseFlags] or [FromYAMLFile] if +// ErrInvalidArgument is the error returned by [ParseFlags] or [FromYAMLFile] if // its parsing result cannot be stored in the value pointed to by the designated passed argument which // must be a non-nil pointer. -var InvalidArgumentError = stderrors.New("invalid argument") +var ErrInvalidArgument = stderrors.New("invalid argument") // FromYAMLFile parses the given YAML file and stores the result // in the value pointed to by v. If v is nil or not a pointer, -// FromYAMLFile returns an [InvalidArgumentError]. +// FromYAMLFile returns an [ErrInvalidArgument]. func FromYAMLFile(name string, v Validator) error { rv := reflect.ValueOf(v) if rv.Kind() != reflect.Pointer || rv.IsNil() { - return errors.Wrapf(InvalidArgumentError, "non-nil pointer expected, got %T", v) + return errors.Wrapf(ErrInvalidArgument, "non-nil pointer expected, got %T", v) } f, err := os.Open(name) @@ -50,11 +50,11 @@ func FromYAMLFile(name string, v Validator) error { // ParseFlags parses CLI flags and stores the result // in the value pointed to by v. If v is nil or not a pointer, -// ParseFlags returns an [InvalidArgumentError]. +// ParseFlags returns an [ErrInvalidArgument]. func ParseFlags(v any) error { rv := reflect.ValueOf(v) if rv.Kind() != reflect.Pointer || rv.IsNil() { - return errors.Wrapf(InvalidArgumentError, "non-nil pointer expected, got %T", v) + return errors.Wrapf(ErrInvalidArgument, "non-nil pointer expected, got %T", v) } parser := flags.NewParser(v, flags.Default) diff --git a/pkg/types/unix_milli.go b/pkg/types/unix_milli.go index 7391ec020..bfbb694a4 100644 --- a/pkg/types/unix_milli.go +++ b/pkg/types/unix_milli.go @@ -26,7 +26,7 @@ func (t UnixMilli) MarshalJSON() ([]byte, error) { return []byte("null"), nil } - return []byte(strconv.FormatInt(time.Time(t).UnixMilli(), 10)), nil + return []byte(strconv.FormatInt(t.Time().UnixMilli(), 10)), nil } // UnmarshalJSON implements the json.Unmarshaler interface. @@ -45,7 +45,7 @@ func (t UnixMilli) MarshalText() ([]byte, error) { return []byte{}, nil } - return []byte(strconv.FormatInt(time.Time(t).UnixMilli(), 10)), nil + return []byte(strconv.FormatInt(t.Time().UnixMilli(), 10)), nil } // UnmarshalText implements the encoding.TextUnmarshaler interface.