![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
github.com/ajjensen13/go-enumerator
go-enumerator
is a code generation tool designed for making constants behave more
like enums. The generated methods allow users to:
fmt.Print(x)
fmt.Scan("Name", &x)
x.Defined()
x.Next()
go-enumerator
is designed to be invoked by go generate
,
but it can be used as a command-line tool as well.
Additional documentation available at pkg.go.dev
Installation is easy, just install the package using the go install
tool.
go install github.com/ajjensen13/go-enumerator
Below is an example of the intended use for go-enumerate
.
All command line arguments are optional go generate
.
The tool will use the $GOFILE
, $GOPACKAGE
, and $GOLINE
environment variables
to find the type declaration immediately following to //go:generate
comment.
//go:generate go-enumerator
type Kind int
const (
Kind1
Kind2
)
In this case, we found the Kind
type, which is a suitable type for generating an enum definition for.
The following methods are created in a new file with the default file name.
// String implements fmt.Stringer
func (k Kind) String() string { /* omitted for brevity */ }
// Scan implements fmt.Scanner
func (k *Kind) Scan(ss fmt.ScanState, verb rune) error { /* omitted for brevity */ }
// Defined returns true if k holds a defined value
func (k Kind) Defined() bool { /* omitted for brevity */ }
// Next returns the next defined value after k
func (k Kind) Next() Kind { /* omitted for brevity */ }
String()
and Scan()
can be used in conjunction with the fmt
package to parse
and encode values into human-friendly representations.
Next()
can be used to loop through all defined values for an enum.
Defined()
can be used to ensure that a given variable holds a defined value.
go-enumerator
was inspired by stringer, which is a better String()
generator. If all you need is a String()
method for a numeric constant, consider using that tool instead.FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.