convert to go modules

This commit is contained in:
mappu 2018-11-06 19:21:20 +13:00
parent 8e7bcbe057
commit 3f56aac8c1
6 changed files with 52 additions and 50 deletions

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module code.ivysaur.me/archive
require github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=

22
vendor/github.com/jehiah/go-strftime/.gitignore generated vendored Normal file
View File

@ -0,0 +1,22 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe

View File

@ -1,4 +1,26 @@
go-strftime 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
}
```

View File

@ -1,49 +0,0 @@
package strftime
import (
"fmt"
"testing"
"time"
)
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()
}
}
func TestRubyStrftime(t *testing.T) {
tm := time.Unix(1340244776, 0)
utc, _ := time.LoadLocation("UTC")
tm = tm.In(utc)
result := Format("%H:%M:%S%L", tm)
if result != "02:12:56.000" {
t.Logf("%s != %s", result, "02:12:56.000")
t.Fail()
}
}

2
vendor/modules.txt vendored Normal file
View File

@ -0,0 +1,2 @@
# github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869
github.com/jehiah/go-strftime