structs.go 641 B

123456789101112131415
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Package structs contains the Incomparable type.
  4. package structs
  5. // Incomparable is a zero-width incomparable type. If added as the
  6. // first field in a struct, it marks that struct as not comparable
  7. // (can't do == or be a map key) and usually doesn't add any width to
  8. // the struct (unless the struct has only small fields).
  9. //
  10. // By making a struct incomparable, you can prevent misuse (prevent
  11. // people from using ==), but also you can shrink generated binaries,
  12. // as the compiler can omit equality funcs from the binary.
  13. type Incomparable [0]func()