chore(linters): Enable `time-equal` rule for revive (#15838)
This commit is contained in:
parent
83561960a5
commit
a0755797f5
|
|
@ -277,6 +277,7 @@ linters-settings:
|
|||
- name: string-of-int
|
||||
- name: struct-tag
|
||||
- name: superfluous-else
|
||||
- name: time-equal
|
||||
- name: time-naming
|
||||
- name: unconditional-recursion
|
||||
- name: unexported-naming
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ func updateWindow(start time.Time, roundInterval bool, period time.Duration) (ti
|
|||
var until time.Time
|
||||
if roundInterval {
|
||||
until = internal.AlignTime(start, period)
|
||||
if until == start {
|
||||
if until.Equal(start) {
|
||||
until = internal.AlignTime(start.Add(time.Nanosecond), period)
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ func AlignDuration(tm time.Time, interval time.Duration) time.Duration {
|
|||
// If the current time is aligned the current time is returned.
|
||||
func AlignTime(tm time.Time, interval time.Duration) time.Time {
|
||||
truncated := tm.Truncate(interval)
|
||||
if truncated == tm {
|
||||
if truncated.Equal(tm) {
|
||||
return tm
|
||||
}
|
||||
return truncated.Add(interval)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func (lc *logConnector) checkLogFreshness() error {
|
|||
// - modification time has been changed
|
||||
// - file is not empty
|
||||
// - file doesn't contain clear_log command (it may appear for few milliseconds, just before file is cleared)
|
||||
if lc.lastModTime != currModTime && fileInfo.Size() != 0 && !lc.isClearLogContainedInFile() {
|
||||
if !lc.lastModTime.Equal(currModTime) && fileInfo.Size() != 0 && !lc.isClearLogContainedInFile() {
|
||||
//refreshing succeed
|
||||
lc.lastModTime = currModTime
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ func (e *Endpoint) queryPerformance(ctx context.Context, vsanClient *soap.Client
|
|||
}
|
||||
if len(timeStamps) > 0 {
|
||||
lastSample := timeStamps[len(timeStamps)-1]
|
||||
if lastSample != (time.Time{}) && lastSample.After(latest) {
|
||||
if !lastSample.IsZero() && lastSample.After(latest) {
|
||||
latest = lastSample
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -703,7 +703,7 @@ func Test_annotation(t *testing.T) {
|
|||
t.Run(tt.name, func(t *testing.T) {
|
||||
an := annotation(tt.fields)
|
||||
a := &an
|
||||
if got := a.Timestamp(); got != tt.tm {
|
||||
if got := a.Timestamp(); !got.Equal(tt.tm) {
|
||||
t.Errorf("annotation.Timestamp() = %v, want %v", got, tt.tm)
|
||||
}
|
||||
if got := a.Value(); got != tt.val {
|
||||
|
|
|
|||
Loading…
Reference in New Issue