bug fix. and test success!
This commit is contained in:
parent
699b863837
commit
14338a3f5a
6
main.go
6
main.go
|
@ -26,13 +26,15 @@ func getArgsStartTime() time.Time {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
date := flag.Arg(0)
|
date := flag.Arg(0)
|
||||||
if date == "" {
|
if date == "" {
|
||||||
// log.Println(flag.)
|
log.Println("args", flag.Args())
|
||||||
panic("please input date eg. '2020-11-30 16:29:17'")
|
panic("please input date eg. '2020-11-30 16:29:17'")
|
||||||
}
|
}
|
||||||
start, err := time.ParseInLocation("2006-01-02 15:04:03", date, time.Local)
|
|
||||||
|
start, err := time.ParseInLocation("2006-01-02 15:04:05", date, time.Local)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return start
|
return start
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
main_test.go
Normal file
7
main_test.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestMain(t *testing.T) {
|
||||||
|
main()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user