enums

package
v1.12.0-fork.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package enums collects allowed values of enum-like types: named types with a builtin underlying type and a const block, e.g.

type ModeEnum int

const (
	ModeUnknown ModeEnum = iota // unknown
	ModeFast    ModeEnum = iota // fast
)

A const value is its line comment (stringer -linecomment), or its string literal for string types. A type is an enum only if every const of it has one of those, so typed constants like sizes or timeouts are not listed. The `unknown` value and unexported consts of an exported type are skipped: they mark an unset value or a bound, not a valid one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Values

type Values map[string][]string

Values maps `pkg.Type` (package name, as the resolver uses) to enum values.

func Collect

func Collect(dirs []string) (Values, error)

Collect parses go files in dirs and their subdirs, test files excluded.

func (Values) Get

func (v Values) Get(pkg, name string) []string

Get returns values of type name in package pkg.

Jump to

Keyboard shortcuts

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