Socket
Book a DemoInstallSign in
Socket

github.com/fabgeyer/estringer

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/fabgeyer/estringer

Source
Go
Version
v0.0.0-20250329091833-7987ed8bab5b
Version published
Created
Source

estringer

An extended version of the stringer tool for go.

This tool extends stringer by adding a StringTo<Type>() function, returning the value corresponding a given string. This function is generated when using the -string-to-type argument.

For example, given this snippet,

package painkiller

type Pill int

const (
	Placebo Pill = iota
	Aspirin
	Ibuprofen
	Paracetamol
	Acetaminophen = Paracetamol
)

running this command

estringer -type=Pill -string-to-type

in the same directory will create the file pill_string.go as for the standard stringer, with addition of the function

func StringToPill(v string) (Pill, bool)

FAQs

Package last updated on 29 Mar 2025

Did you know?

Socket

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.

Install

Related posts