Standard library / reflect

reflect.StructTag

Conventional key/value metadata attached to a struct field. Lookup distinguishes a missing key from an explicitly empty value. Expected stdout: 'id\n'.

Formal Syntax & Structure

go syntaxgo
type StructTag string

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { tag := reflect.StructTag(`json:"id"`); fmt.Println(tag.Get("json")) }
Go Reference