I have a structure in Go which looks like this:
type A struct { Name string Type string Time string}
And I want to write a less
function to compare two struct A, such as
func (s A) less(other A) bool { if s.Name < other.Name { return True } if other.Name < s.Name { return False } if s.Type < other.Type { return True } if other.Type < s.Type { return False } return s.Time < other.Time}
I wonder if there is a better way/a simpler way to write this logic? Thanks!