mirror of
https://github.com/taigrr/most-specific-period.git
synced 2026-04-02 03:38:41 -07:00
Merge pull request #4 from taigrr/cd/lint-fixes
fix(msp): resolve staticcheck warning and fix typo
This commit is contained in:
@@ -12,7 +12,7 @@ func MostSpecificPeriod(ts time.Time, periods ...Period) (id string, err error)
|
|||||||
return "", ErrNoValidPeriods
|
return "", ErrNoValidPeriods
|
||||||
}
|
}
|
||||||
// find the shortest duration
|
// find the shortest duration
|
||||||
d, err := GetDuration(periods[0].GetStartTime(), periods[0].GetEndTime())
|
d, _ := GetDuration(periods[0].GetStartTime(), periods[0].GetEndTime())
|
||||||
for _, x := range periods {
|
for _, x := range periods {
|
||||||
p, err := GetDuration(x.GetStartTime(), x.GetEndTime())
|
p, err := GetDuration(x.GetStartTime(), x.GetEndTime())
|
||||||
if err == nil && p < d {
|
if err == nil && p < d {
|
||||||
@@ -34,7 +34,7 @@ func MostSpecificPeriod(ts time.Time, periods ...Period) (id string, err error)
|
|||||||
newest = x.GetStartTime()
|
newest = x.GetStartTime()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Determine whichever of these periods have the same start time in addtion to duration
|
// Determine whichever of these periods have the same start time in addition to duration
|
||||||
var matchingDurationsAndStartTimes []Period
|
var matchingDurationsAndStartTimes []Period
|
||||||
for _, x := range matchingDurations {
|
for _, x := range matchingDurations {
|
||||||
if x.GetStartTime() == newest {
|
if x.GetStartTime() == newest {
|
||||||
|
|||||||
Reference in New Issue
Block a user