Skip to content

A tool to tag golang structs.

License

GPL-3.0, BSD-3-Clause licenses found

Licenses found

GPL-3.0
LICENSE
BSD-3-Clause
LICENSE-golang
Notifications You must be signed in to change notification settings

brycereitano/gotag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Go Tag

The gotag command adds tags to existing go structs in go files.

Run with -help for usage information.

Example

Input: sample.go

package main

type Foo struct {
	Foo string `json:"-"`
	Bar map[int]interface{}
	baz int

	Nax struct {
		Hello string
	}
}

Execution:

$ gotag -offset sample.go:#50 -tag json -suffix ",omitempty"

Will result sample.go to change to:

package main

type Foo struct {
    Foo string              `json:"-"`
    Bar map[int]interface{} `json:"Bar,omitempty"`
    baz int

    Nax struct {
        Hello string
    } `json:"Nax,omitempty"`
}

Attribution

Based off of the gorename tool.

Copyright 2014 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE-golang file.

Modified source of https://github.com/golang/tools/blob/master/refactor/rename

About

A tool to tag golang structs.

Resources

License

GPL-3.0, BSD-3-Clause licenses found

Licenses found

GPL-3.0
LICENSE
BSD-3-Clause
LICENSE-golang

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages