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 string = `This is ts, a timestamp tool.
Usage: ts <time string> [<time string>] Usage: ts <time string> [<time string>]
-d --diff Calculate difference between two timestamps (default). -d --diff Calculate difference between two timestamps (default)
-a --add Add two timestamps (second parameter must be a time). -a --add Add two timestamps (second parameter must be a time)
-f --format For diffs: duration, hour, min, sec, msec. -f --format For diffs: duration, hour, min, sec, msec
For timestamps: datetime, rfc3339, date, time, unix, string. For timestamps: datetime, rfc3339, date, time, unix, string
string is a strftime(1) format string. datetime is string is a strftime(1) format string. datetime is
the default. the default
-u --unit Add unit to the output of timestamp diffs. -u --unit Add unit to the output of timestamp diffs
--debug Show debugging output. --debug Show debugging output
-v --version Show program version. -v --version Show program version
-h --help Show this help screen. -h --help Show this help screen
-e --examples Show examples or supported inputs. -e --examples Show examples or supported inputs`
`
Examples string = `Example timestamp inputs: Examples string = `Example timestamp inputs:
now 10:25:30 Last sunday at 5:30pm 2 weeks ago 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 { if conf.Examples {
fmt.Fprintln(output, Examples) _, err := fmt.Fprintln(output, Examples)
if err != nil {
Die(err)
}
os.Exit(0) os.Exit(0)
} }

View File

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