Skip to content

the4thamigo-uk/addtags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

addtags

Add arbitrary struct field tags to golang code

Introduction

This code-generation tool allows you to add struct field tags to golang structs that are defined in a configuration file.

To see how it works run the following command :

$ go run ./main.go -t ./examples/gotags.yml -d ./examples | git diff ./examples/
diff --git a/examples/examples.go b/examples/examples.go
index 759fee1..5ca5445 100644
--- a/examples/examples.go
+++ b/examples/examples.go
@@ -1,10 +1,10 @@
 package examples
 
 type MyStruct1 struct {
-       X int
-       Y int `existing:"tag"`
+       X int `new:"tag1"`
+       Y int `existing:"tag" new:"tag2"`
 }
 
 type MyStruct2 struct {
-       Z int
+       Z int `new:"tag3" othernew:"tag4"`
 }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages