Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Enumall

Go

Enumall is a tool to automate the creation of all const values for given type (enum).

Installation

enumall is installable command line application.

go install github.com/tomaspavlic/enumall

Usage

Add Go's code generator comment to use enumall.

//go:generate go run github.com/tomaspavlic/enumall@latest -type=SeasontypeSeasonuint8const (
SpringSeason=1<<iotaSummerAutumnWinter
)

Run code generator inside your module.

go generate ./...

Generated code is named {$typeName}_all.go. Variable containing all const values is All{$typeName}

// Code generated by "enumall -type=Season"; DO NOT EDIT.package main
varAllSeason= []Season{
Spring,
Summer,
Autumn,
Winter,
}

About

Enumall is a tool to automate the creation of all const values for given type (enum)

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages