this post was submitted on 15 Nov 2024
196 points (93.8% liked)

Programmer Humor

32475 readers
1376 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] akkajdh999@programming.dev 14 points 11 hours ago

In Go "==" operator works for everything by default, I like it more:

type A struct {
	Name string
	Quality int
}
func main() {
	var x A
	var y A
	fmt.Printf("%v", x == y)
}

(if all you want is to compare all corresponding fields which you usually want)