Skip to content

Commit

Permalink
main.go: Expose field mask paths and remove obsolete method
Browse files Browse the repository at this point in the history
  • Loading branch information
johanstokking committed Dec 8, 2018
1 parent 5ca04af commit 753aba8
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions main.go
Expand Up @@ -547,32 +547,19 @@ func (dst *%s) SetFields(src *%s, paths ...string) error {
sort.Strings(topLevelPaths)

fmt.Fprintf(buf, `
var _%sFieldPathsNested = [...]string{
var %sFieldPathsNested = []string{
%s
}
var _%sFieldPathsTopLevel = [...]string{
var %sFieldPathsTopLevel = []string{
%s
}
func (*%s) FieldMaskPaths(nested bool) []string {
paths := _%sFieldPathsTopLevel[:]
if nested {
paths = _%sFieldPathsNested[:]
}
ret := make([]string, len(paths))
copy(ret, paths)
return ret
}
func (dst *%s) SetFields(src *%s, paths ...string) error {`,
mType, `"`+strings.Join(nestedPaths, `",
"`)+`",`,
mType, `"`+strings.Join(topLevelPaths, `",
"`)+`",`,
mType,
mType,
mType,
mType, mType,
)

Expand Down

0 comments on commit 753aba8

Please sign in to comment.