GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codnect/tag: Declarative Struct Tag Parser for Go

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
tag.go
tag.go
 
 
tag_test.go
tag_test.go
 
 
value.go
value.go
 
 

Repository files navigation

tag-logo

Tag — Declarative Struct Tag Parser for Go

Run Tests Quality Gate Status Coverage Go Reference

Tag is a lightweight, zero-dependency library that transforms raw Go struct tag strings into strongly typed, well-structured Go values.

It eliminates repetitive parsing logic, reduces boilerplate, and provides a clean, declarative way to define your tag schema — while keeping performance predictable and implementation overhead minimal.

Installation

To install Tag, run the following command:

go get go.codnect.io/tag

Overview

Go’s reflect.StructTag exposes tag values only as raw strings:

prop:"'database.host',default=5432"

In most projects, this leads to manual string splitting, repetitive parsing logic, custom flag handling, default value handling, and edge cases around typed values. Tag centralizes this logic into a declarative schema. You define a struct that describes your tag, and Tag handles parsing, type inference, nested structures, and value assignment.

Quick Start

Define the structure of your tag and implement the Tagger interface:

type PropTag struct {
    Key      string `option:"value"`
    Optional bool   `option:"optional"`
    Default  int    `option:"default"`
}

// Tag identifies the tag name.
func (t PropTag) Tag() string {
    return "prop"
}

Parse a raw tag string:

propTag := &PropTag{}
err := tag.Parse(`prop:"'database.host',default=5432"`, propTag)
if err != nil {
    // handle error
}

What it supports

  • Primary values with option:"value"
  • Boolean flags such as optional
  • Key/value options such as default=5432
  • Primitive values, slices, maps, and nested structs
  • Typed binding into your own schema structs

Documentation

Read the full documentation at go.codnect.io/tag.

License

Tag is released under version 2.0 of the Apache License.

About

Declarative Struct Tag Parser for Go

Resources

Readme
License

Security policy

Security policy
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.