structs.go 730 B

12345678910111213141516
  1. // Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package structs contains the Incomparable type.
  5. package structs
  6. // Incomparable is a zero-width incomparable type. If added as the
  7. // first field in a struct, it marks that struct as not comparable
  8. // (can't do == or be a map key) and usually doesn't add any width to
  9. // the struct (unless the struct has only small fields).
  10. //
  11. // Be making a struct incomparable, you can prevent misuse (prevent
  12. // people from using ==), but also you can shrink generated binaries,
  13. // as the compiler can omit equality funcs from the binary.
  14. type Incomparable [0]func()