diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-04-16 05:37:14 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-04-16 08:37:14 -0400 |
commit | 6e2cb00008cbf09e556b00f87603797fcaa47e09 (patch) | |
tree | 3c0eb55ff4226a3f024aad373140d1fb860a6404 /vendor/github.com/jehiah/go-strftime | |
parent | bf24f51c4e1cc6286885460672f7f449e8c6f5ef (diff) | |
download | chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.gz chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.bz2 chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.zip |
Depenancy upgrades and movign to dep. (#8630)
Diffstat (limited to 'vendor/github.com/jehiah/go-strftime')
-rw-r--r-- | vendor/github.com/jehiah/go-strftime/LICENSE | 19 | ||||
-rw-r--r-- | vendor/github.com/jehiah/go-strftime/README.md | 24 | ||||
-rw-r--r-- | vendor/github.com/jehiah/go-strftime/strftime.go | 13 | ||||
-rw-r--r-- | vendor/github.com/jehiah/go-strftime/strftime_test.go | 40 |
4 files changed, 49 insertions, 47 deletions
diff --git a/vendor/github.com/jehiah/go-strftime/LICENSE b/vendor/github.com/jehiah/go-strftime/LICENSE new file mode 100644 index 000000000..a49216f13 --- /dev/null +++ b/vendor/github.com/jehiah/go-strftime/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Jehiah Czebotar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/jehiah/go-strftime/README.md b/vendor/github.com/jehiah/go-strftime/README.md index 8eb240384..10b06f4af 100644 --- a/vendor/github.com/jehiah/go-strftime/README.md +++ b/vendor/github.com/jehiah/go-strftime/README.md @@ -1,4 +1,26 @@ go-strftime =========== -go implementation of strftime
\ No newline at end of file +go implementation of strftime + +## Example + +``` +package main + +import ( + "fmt" + "time" + + strftime "github.com/jehiah/go-strftime" +) + +func main() { + t := time.Unix(1340244776, 0) + utc, _ := time.LoadLocation("UTC") + t = t.In(utc) + fmt.Println(strftime.Format("%Y-%m-%d %H:%M:%S", t)) + // Output: + // 2012-06-21 02:12:56 +} +``` diff --git a/vendor/github.com/jehiah/go-strftime/strftime.go b/vendor/github.com/jehiah/go-strftime/strftime.go index 99e26716f..bf2eeab48 100644 --- a/vendor/github.com/jehiah/go-strftime/strftime.go +++ b/vendor/github.com/jehiah/go-strftime/strftime.go @@ -7,8 +7,8 @@ import ( ) // taken from time/format.go -var conversion = map[rune]string { - /*stdLongMonth */ 'B':"January", +var conversion = map[rune]string{ + /*stdLongMonth */ 'B': "January", /*stdMonth */ 'b': "Jan", // stdNumMonth */ 'm': "1", /*stdZeroMonth */ 'm': "01", @@ -31,12 +31,13 @@ var conversion = map[rune]string { /*stdTZ */ 'Z': "MST", // stdISO8601TZ */ 'z': "Z0700", // prints Z for UTC // stdISO8601ColonTZ */ 'z': "Z07:00", // prints Z for UTC - /*stdNumTZ */ 'z': "-0700", // always numeric + /*stdNumTZ */ 'z': "-0700", // always numeric // stdNumShortTZ */ 'b': "-07", // always numeric // stdNumColonTZ */ 'b': "-07:00", // always numeric + /* nonStdMilli */ 'L': ".000", } -// This is an alternative to time.Format because no one knows +// This is an alternative to time.Format because no one knows // what date 040305 is supposed to create when used as a 'layout' string // this takes standard strftime format options. For a complete list // of format options see http://strftime.org/ @@ -50,8 +51,8 @@ func Format(format string, t time.Time) string { ni += i } retval = append(retval, []byte(format[i:ni])...) - if ni + 1 < len(format) { - c := format[ni + 1] + if ni+1 < len(format) { + c := format[ni+1] if c == '%' { retval = append(retval, '%') } else { diff --git a/vendor/github.com/jehiah/go-strftime/strftime_test.go b/vendor/github.com/jehiah/go-strftime/strftime_test.go deleted file mode 100644 index 45cbca345..000000000 --- a/vendor/github.com/jehiah/go-strftime/strftime_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package strftime - -import ( - "time" - "fmt" - "testing" -) - -func ExampleFormat() { - t := time.Unix(1340244776, 0) - utc, _ := time.LoadLocation("UTC") - t = t.In(utc) - fmt.Println(Format("%Y-%m-%d %H:%M:%S", t)) - // Output: - // 2012-06-21 02:12:56 -} - -func TestNoLeadingPercentSign(t *testing.T) { - tm := time.Unix(1340244776, 0) - utc, _ := time.LoadLocation("UTC") - tm = tm.In(utc) - result := Format("aaabbb0123456789%Y", tm) - if result != "aaabbb01234567892012" { - t.Logf("%s != %s", result, "aaabbb01234567892012") - t.Fail() - } -} - - -func TestUnsupported(t *testing.T) { - tm := time.Unix(1340244776, 0) - utc, _ := time.LoadLocation("UTC") - tm = tm.In(utc) - result := Format("%0%1%%%2", tm) - if result != "%0%1%%2" { - t.Logf("%s != %s", result, "%0%1%%2") - t.Fail() - } -} - |