package gentools import "strings" func FlagString[T ~uint32](value T, flags []T, names []string) string { if value == 0 { return "(none)" } parts := make([]string, 0, len(flags)) for i, flag := range flags { if value&flag == flag { parts = append(parts, names[i]) } } return strings.Join(parts, "|") }