bug fix. and test success!

This commit is contained in:
eson 2020-12-09 10:54:13 +08:00
parent 699b863837
commit 14338a3f5a
2 changed files with 11 additions and 2 deletions

View File

@ -26,13 +26,15 @@ func getArgsStartTime() time.Time {
flag.Parse()
date := flag.Arg(0)
if date == "" {
// log.Println(flag.)
log.Println("args", flag.Args())
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 {
panic(err)
}
return start
}

7
main_test.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "testing"
func TestMain(t *testing.T) {
main()
}