Depenancy upgrades and movign to dep. (#8630)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
bf24f51c4e
Коммит
6e2cb00008
19
vendor/github.com/jehiah/go-strftime/LICENSE
сгенерированный
поставляемый
Обычный файл
19
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.
|
||||
24
vendor/github.com/jehiah/go-strftime/README.md
сгенерированный
поставляемый
24
vendor/github.com/jehiah/go-strftime/README.md
сгенерированный
поставляемый
@@ -1,4 +1,26 @@
|
||||
go-strftime
|
||||
===========
|
||||
|
||||
go implementation of strftime
|
||||
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
|
||||
}
|
||||
```
|
||||
|
||||
13
vendor/github.com/jehiah/go-strftime/strftime.go
сгенерированный
поставляемый
13
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 {
|
||||
|
||||
40
vendor/github.com/jehiah/go-strftime/strftime_test.go
сгенерированный
поставляемый
40
vendor/github.com/jehiah/go-strftime/strftime_test.go
сгенерированный
поставляемый
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user