Skip to content

FZambia/gomodifytype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modify Go struct field type. It matches type by its string representation and replaces to another string.

Mostly useful for primitive types or types located in the same package. Maybe can be useful for external package types if followed by goimports.

My use case was replacing []byte type in a Protobuf generated code to custom Raw type.

Like this:

gomodifytype -file proxy.pb.go -all -w -from "[]byte" -to "Raw"

Thanks to https://github.com/fatih/gomodifytags for the AST modification example.

About

Modify type of Go struct

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages