fixed struct alignment && refactor linter (#369)
All checks were successful
test / test (push) Successful in 42s

## Pull Request template
Please, go through these steps before clicking submit on this PR.

1. Give a descriptive title to your PR.
2. Provide a description of your changes.
3. Make sure you have some relevant tests.
4. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if applicable).

**PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING**

Reviewed-on: #369
Co-authored-by: Evstigneev Denis <danteevstigneev@yandex.ru>
Co-committed-by: Evstigneev Denis <danteevstigneev@yandex.ru>
This commit is contained in:
2024-12-09 16:23:25 +03:00
parent b6a0e4d983
commit 38c5fe8b5a
67 changed files with 480 additions and 398 deletions

View File

@@ -2,7 +2,6 @@ package time
import (
"encoding/json"
"errors"
"fmt"
"strconv"
"time"
@@ -14,7 +13,7 @@ type Duration int64
func ParseDuration(s string) (time.Duration, error) {
if s == "" {
return 0, errors.New(`time: invalid duration "` + s + `"`)
return 0, fmt.Errorf(`time: invalid duration "%s"`, s)
}
var p int
@@ -27,21 +26,21 @@ loop:
case 'h':
d, err := strconv.Atoi(s[p:i])
if err != nil {
return 0, errors.New("time: invalid duration " + s)
return 0, fmt.Errorf(`time: invalid duration "%s"`, s)
}
hours += d
p = i + 1
case 'd':
d, err := strconv.Atoi(s[p:i])
if err != nil {
return 0, errors.New("time: invalid duration " + s)
return 0, fmt.Errorf(`time: invalid duration "%s"`, s)
}
hours += d * 24
p = i + 1
case 'y':
n, err := strconv.Atoi(s[p:i])
if err != nil {
return 0, errors.New("time: invalid duration " + s)
return 0, fmt.Errorf(`time: invalid duration "%s"`, s)
}
var d int
for j := n - 1; j >= 0; j-- {