seq

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b interface{}) int

Compare returns 0 if a and b are equal, -1 if a < b, or 1 if a > b. Panics if a and b are not of the same type, or are of a type not listed here.

  • Bools are compared assuming false < true.
  • Strings, integer and float values are compared as Go compares them.
  • Two nil pointers are equal; one nil pointer is treated as smaller than a non-nil pointer.
  • Non-nil pointers are compared by comparing the values they point to.
  • Structures are compared by comparing their fields in order.
  • Slices are compared by comparing elements sequentially. If the slices are of different length and all elements are the same up to the shorter length, the shorter slice is treated as smaller.
  • Maps can only be compared if they have string keys, in which case the ordered list of keys are first compared as string slices, and if they're equal then the values are compared sequentially in key order.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL