This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git
commit 5535cc7de9241090d86a817d2f4ea0c6081aafb9 Author: kezhenxu94 <kezhenx...@163.com> AuthorDate: Sat Nov 9 21:58:53 2019 +0800 Polish if-else branches --- commands/interceptor/duration.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/commands/interceptor/duration.go b/commands/interceptor/duration.go index def8e20..4207011 100644 --- a/commands/interceptor/duration.go +++ b/commands/interceptor/duration.go @@ -104,27 +104,17 @@ func ParseDuration(start string, end string) (time.Time, time.Time, schema.Step) } return startTime, endTime, step - } - - // end is absent - if len(end) == 0 { + } else if len(end) <= 0 { // end is absent if step, startTime, err = tryParseTime(start); err != nil { logger.Log.Fatalln("Unsupported time format:", start, err) } return startTime, startTime.Add(30 * stepDuration[step]), step - } - - // start is present - if len(start) == 0 { + } else { // start is present if step, endTime, err = tryParseTime(end); err != nil { logger.Log.Fatalln("Unsupported time format:", end, err) } return endTime.Add(-30 * stepDuration[step]), endTime, step } - - logger.Log.Fatalln("Should never happen") - - return startTime, endTime, step } // AlignPrecision aligns the two time strings to same precision