diff options
Diffstat (limited to 'pkg/util')
-rw-r--r-- | pkg/util/camelcase/README.md | 4 | ||||
-rw-r--r-- | pkg/util/camelcase/camelcase.go | 2 | ||||
-rw-r--r-- | pkg/util/utils.go | 7 | ||||
-rw-r--r-- | pkg/util/utils_supported.go | 2 | ||||
-rw-r--r-- | pkg/util/utils_test.go | 2 |
5 files changed, 10 insertions, 7 deletions
diff --git a/pkg/util/camelcase/README.md b/pkg/util/camelcase/README.md index 105a6ae33..ab0da573a 100644 --- a/pkg/util/camelcase/README.md +++ b/pkg/util/camelcase/README.md @@ -1,4 +1,4 @@ -# CamelCase [](http://godoc.org/github.com/fatih/camelcase) [](https://travis-ci.org/fatih/camelcase) +# CamelCase [](https://godoc.org/github.com/fatih/camelcase) [](https://travis-ci.org/fatih/camelcase) CamelCase is a Golang (Go) package to split the words of a camelcase type string into a slice of words. It can be used to convert a camelcase word (lower @@ -33,7 +33,7 @@ fmt.Println(splitted[0], splitted[1]) // prints: "Golang", "Package" ``` Both lower camel case and upper camel case are supported. For more info please -check: [http://en.wikipedia.org/wiki/CamelCase](http://en.wikipedia.org/wiki/CamelCase) +check: [https://en.wikipedia.org/wiki/CamelCase](https://en.wikipedia.org/wiki/CamelCase) Below are some example cases: diff --git a/pkg/util/camelcase/camelcase.go b/pkg/util/camelcase/camelcase.go index 0a82d1005..d27ac00d6 100644 --- a/pkg/util/camelcase/camelcase.go +++ b/pkg/util/camelcase/camelcase.go @@ -9,7 +9,7 @@ import ( // Split splits the camelcase word and returns a list of words. It also // supports digits. Both lower camel case and upper camel case are supported. -// For more info please check: http://en.wikipedia.org/wiki/CamelCase +// For more info please check: https://en.wikipedia.org/wiki/CamelCase // // Examples // diff --git a/pkg/util/utils.go b/pkg/util/utils.go index 63fad0286..208d815d9 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -520,7 +520,7 @@ func WriteStorageConfigFile(storageOpts *stypes.StoreOptions, storageConf string // ParseInputTime takes the users input and to determine if it is valid and // returns a time format and error. The input is compared to known time formats // or a duration which implies no-duration -func ParseInputTime(inputTime string) (time.Time, error) { +func ParseInputTime(inputTime string, since bool) (time.Time, error) { timeFormats := []string{time.RFC3339Nano, time.RFC3339, "2006-01-02T15:04:05", "2006-01-02T15:04:05.999999999", "2006-01-02Z07:00", "2006-01-02"} // iterate the supported time formats @@ -542,7 +542,10 @@ func ParseInputTime(inputTime string) (time.Time, error) { if err != nil { return time.Time{}, errors.Errorf("unable to interpret time value") } - return time.Now().Add(-duration), nil + if since { + return time.Now().Add(-duration), nil + } + return time.Now().Add(duration), nil } // OpenExclusiveFile opens a file for writing and ensure it doesn't already exist diff --git a/pkg/util/utils_supported.go b/pkg/util/utils_supported.go index cb992d8b6..6eba0bc3c 100644 --- a/pkg/util/utils_supported.go +++ b/pkg/util/utils_supported.go @@ -1,4 +1,4 @@ -// +build linux darwin +// +build !windows package util diff --git a/pkg/util/utils_test.go b/pkg/util/utils_test.go index 62de7509f..3d74d4c78 100644 --- a/pkg/util/utils_test.go +++ b/pkg/util/utils_test.go @@ -303,7 +303,7 @@ func TestPeriodAndQuotaToCores(t *testing.T) { } func TestParseInputTime(t *testing.T) { - tm, err := ParseInputTime("1.5") + tm, err := ParseInputTime("1.5", true) if err != nil { t.Errorf("expected error to be nil but was: %v", err) } |