Skip to content

Commit

Permalink
Improve message for New funcs in pdata (#4402)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Nov 11, 2021
1 parent 12e3b82 commit 7e7323b
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 54 deletions.
5 changes: 3 additions & 2 deletions model/internal/cmd/pdatagen/internal/base_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ func new${structName}(orig *${originName}) ${structName} {
// New${structName} creates a new empty ${structName}.
//
// This must be used only in testing code since no "Set" method available.
// This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
// OR directly access the member if this is embedded in another struct.
func New${structName}() ${structName} {
return new${structName}(&${originName}{})
}
// MoveTo moves all properties from the current struct to dest
// reseting the current instance to its zero value
// resetting the current instance to its zero value
func (ms ${structName}) MoveTo(dest ${structName}) {
*dest.orig = *ms.orig
*ms.orig = ${originName}{}
Expand Down
5 changes: 3 additions & 2 deletions model/pdata/generated_common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions model/pdata/generated_log.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 45 additions & 30 deletions model/pdata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions model/pdata/generated_resource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7e7323b

Please sign in to comment.