Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

Commit

Permalink
0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Pasztor committed Dec 28, 2020
1 parent fda4b9d commit e271f7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.3: Nil support

In this release we are adding support for `nil` values when unmashalling JSON/YAML into time.Duration structures.

## 0.9.2: More compatibility fixes

This release adds more compatibility fixes with the 0.3 config format and the ability to unserialize durations from string instead of numbers.
Expand Down
6 changes: 4 additions & 2 deletions config_duration.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package docker

import (
"errors"
"fmt"
"time"
)

func parseRawDuration(rawValue interface{}, d *time.Duration) error {
var err error
switch value := rawValue.(type) {
case nil:
*d = time.Duration(0)
case int32:
*d = time.Duration(value)
case int64:
Expand All @@ -23,7 +25,7 @@ func parseRawDuration(rawValue interface{}, d *time.Duration) error {
return err
}
default:
return errors.New("invalid duration")
return fmt.Errorf("invalid duration: %v", rawValue)
}
return nil
}

0 comments on commit e271f7d

Please sign in to comment.