fix linting errs

This commit is contained in:
2025-09-24 00:07:00 +02:00
parent 26bca77a03
commit 8d61b1d010
3 changed files with 15 additions and 15 deletions

View File

@@ -18,18 +18,17 @@ const (
Usage string = `This is ts, a timestamp tool.
Usage: ts <time string> [<time string>]
-d --diff Calculate difference between two timestamps (default).
-a --add Add two timestamps (second parameter must be a time).
-f --format For diffs: duration, hour, min, sec, msec.
For timestamps: datetime, rfc3339, date, time, unix, string.
-d --diff Calculate difference between two timestamps (default)
-a --add Add two timestamps (second parameter must be a time)
-f --format For diffs: duration, hour, min, sec, msec
For timestamps: datetime, rfc3339, date, time, unix, string
string is a strftime(1) format string. datetime is
the default.
-u --unit Add unit to the output of timestamp diffs.
--debug Show debugging output.
-v --version Show program version.
-h --help Show this help screen.
-e --examples Show examples or supported inputs.
`
the default
-u --unit Add unit to the output of timestamp diffs
--debug Show debugging output
-v --version Show program version
-h --help Show this help screen
-e --examples Show examples or supported inputs`
Examples string = `Example timestamp inputs:
now 10:25:30 Last sunday at 5:30pm 2 weeks ago

View File

@@ -20,7 +20,10 @@ func Main(output io.Writer) int {
}
if conf.Examples {
fmt.Fprintln(output, Examples)
_, err := fmt.Fprintln(output, Examples)
if err != nil {
Die(err)
}
os.Exit(0)
}

View File

@@ -65,9 +65,7 @@ func (tp *TimestampProccessor) Parse(timestamp string) (time.Time, error) {
}
// now failed, try module dateparse
ts, err = dateparse.ParseAny(timestamp)
return ts, nil
return dateparse.ParseAny(timestamp)
}
func (tp *TimestampProccessor) Calc(timestampA, timestampB string) error {