New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/quartercastle/tag

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/quartercastle/tag

  • v0.1.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

tag

DEPRECATED: This project has been moved to github.com/quartercastle/structtag

Version Build Status GoDoc Go Report Card

The motivation behind this package is that the StructTag implementation shipped with Go's standard library is very limited in detecting a malformed StructTag and each time StructTag.Get(key) gets called, it results in the StructTag being parsed again. Another problem is that the StructTag can not be easily manipulated because it is basically a string. This package provides a way to parse the StructTag into a Tag map. This allows fast lookups and easy manipulation of the key value pairs within the Tag.

// Example of struct using tags to append metadata to fields.
type Server struct {
	Host string `json:"host" env:"SERVER_HOST" default:"localhost"`
	Port int    `json:"port" env:"SERVER_PORT" default:"3000"`
}

Install

go get github.com/kvartborg/tag

Usage

t, err := tag.Parse(`json:"host" env:"SERVER_HOST"`)

if err != nil {
  panic(err)
}

fmt.Println(t["json"])

See godoc for full documentation.

License

This project is licensed under the MIT License.

FAQs

Package last updated on 21 Jan 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc