Skip to content

timeCmpSimplify rule is wrong #1257

@ferhatelmas

Description

@ferhatelmas

Rule is wrong because times on the condition can be equal and in this case, not after isn't same with before.

package main

import (
	"fmt"
	"time"
)

func main() {
	t := time.Now()
	fmt.Println(!t.After(t))
	fmt.Println(t.Before(t))
}

https://go.dev/play/p/dAY9FXrxzOA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions