func (f FieldList) Compare(rhs FieldList) int {
	i := 0
	for {
		if i >= len(f) && i >= len(rhs) {
			return 0
		}
		if i >= len(f) {
			return -1
		}
		if i >= len(rhs) {
			return 1
		}
		if c := strings.Compare(f[i].Name, rhs[i].Name); c != 0 {
			return c
		}
		if c := Compare(f[i].Value, rhs[i].Value); c != 0 {
			return c
		}
		i++
	}
}
Compare compares two lists lexically. The result will be 0 if f==rhs, -1
if f < rhs, and +1 if f > rhs.
package value
import (
	"sort"
	"strings"
)
type Field struct {
	Name  string
	Value Value
}
type FieldList []Field
func (f FieldList) Sort() {
	if len(f) < 2 {
		return
	}
	if len(f) == 2 {
		if f[1].Name < f[0].Name {
			f[0], f[1] = f[1], f[0]
		}
		return
	}
	sort.SliceStable(f, func(i, j int) bool {
		return f[i].Name < f[j].Name
	})
}
func (f FieldList) Less(rhs FieldList) bool {
	return f.Compare(rhs) == -1
}