vendor: Update common/model

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-06-16 18:23:43 +05:30
parent 771e5a5d1d
commit f40a5990a0
No known key found for this signature in database
GPG Key ID: F1C217E8E9023CAD
2 changed files with 16 additions and 4 deletions

View File

@ -163,9 +163,21 @@ func (t *Time) UnmarshalJSON(b []byte) error {
// This type should not propagate beyond the scope of input/output processing. // This type should not propagate beyond the scope of input/output processing.
type Duration time.Duration type Duration time.Duration
// Set implements pflag/flag.Value
func (d *Duration) Set(s string) error {
var err error
*d, err = ParseDuration(s)
return err
}
// Type implements pflag.Value
func (d *Duration) Type() string {
return "duration"
}
var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$") var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$")
// StringToDuration parses a string into a time.Duration, assuming that a year // ParseDuration parses a string into a time.Duration, assuming that a year
// always has 365d, a week always has 7d, and a day always has 24h. // always has 365d, a week always has 7d, and a day always has 24h.
func ParseDuration(durationStr string) (Duration, error) { func ParseDuration(durationStr string) (Duration, error) {
matches := durationRE.FindStringSubmatch(durationStr) matches := durationRE.FindStringSubmatch(durationStr)

6
vendor/vendor.json vendored
View File

@ -727,10 +727,10 @@
"revisionTime": "2017-06-16T09:39:39Z" "revisionTime": "2017-06-16T09:39:39Z"
}, },
{ {
"checksumSHA1": "0LL9u9tfv1KPBjNEiMDP6q7lpog=", "checksumSHA1": "3VoqH7TFfzA6Ds0zFzIbKCUvBmw=",
"path": "github.com/prometheus/common/model", "path": "github.com/prometheus/common/model",
"revision": "9e0844febd9e2856f839c9cb974fbd676d1755a8", "revision": "0d0c3d572886e0f2323ed376557f9eb99b97d25b",
"revisionTime": "2017-04-18T15:52:10Z" "revisionTime": "2017-06-16T14:41:04Z"
}, },
{ {
"checksumSHA1": "9aDxDuzZt1l7FQJ9qpn2kPcF7NU=", "checksumSHA1": "9aDxDuzZt1l7FQJ9qpn2kPcF7NU=",