
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
github.com/dmji/go-stringer
Fork of https://github.com/golang/tools/blob/master/cmd/stringer/stringer.go
Forked on commit: 28cd7188fd2c8f3ede85d4b7a6734cc426422094 ref Unfortunately, I don't know how to fork only cmd/stringer, so there is no direct connection and it seems impossible to synchronize changes automatically.
To extend the generator functional to get automatically the text in the format I need and an additional function that returns enum value by text.
example: originally it generate type PatternRuneWithRange by default as 'patternrunewithrange_string.go' but i want to get it as 'pattern_rune_with_range_string.go'
my pet project required a snake case and I didn't want to do it by hand
Install:
go install github.com/dmji/go-stringer@latest
Information about flags can be query with execution without parameters:
go-stringer
Sample of generage comment:
package main
//go:generate go-stringer -type=SimpleRune -trimprefix=SimpleRune -linecomment=true -nametransform=snake_case_lower -outputtransform=snake_case_lower -extraconstsnamesuffix=_i18n_ID -extraconstsvaluetransform=snake_case_lower -extraconstsvaluesuffix=Presentation
type SimpleRune int16
const (
SimpleRuneFirst SimpleRune = iota
SimpleRuneSecond
SimpleRuneThird
SimpleRuneFourth
)
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
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.