Remove dead code from fitask generator

This commit is contained in:
John Gardiner Myers 2020-07-28 21:36:02 -07:00
parent 67966d5288
commit 3a0fc8ed19
1 changed files with 0 additions and 25 deletions

View File

@ -41,25 +41,6 @@ func extractTag(comments []string) []string {
const perTypeDef = ` const perTypeDef = `
// {{.Name}} // {{.Name}}
// JSON marshaling boilerplate
type real{{.Name}} {{.Name}}
// UnmarshalJSON implements conversion to JSON, supporting an alternate specification of the object as a string
func (o *{{.Name}}) UnmarshalJSON(data []byte) error {
var jsonName string
if err := json.Unmarshal(data, &jsonName); err == nil {
o.Name = &jsonName
return nil
}
var r real{{.Name}}
if err := json.Unmarshal(data, &r); err != nil {
return err
}
*o = {{.Name}}(r)
return nil
}
var _ fi.HasLifecycle = &{{.Name}}{} var _ fi.HasLifecycle = &{{.Name}}{}
// GetLifecycle returns the Lifecycle of the object, implementing fi.HasLifecycle // GetLifecycle returns the Lifecycle of the object, implementing fi.HasLifecycle
@ -79,11 +60,6 @@ func (o *{{.Name}}) GetName() *string {
return o.Name return o.Name
} }
// SetName sets the Name of the object, implementing fi.SetName
func (o *{{.Name}}) SetName(name string) {
o.Name = &name
}
// String is the stringer function for the task, producing readable output using fi.TaskAsString // String is the stringer function for the task, producing readable output using fi.TaskAsString
func (o *{{.Name}}) String() string { func (o *{{.Name}}) String() string {
return fi.TaskAsString(o) return fi.TaskAsString(o)
@ -169,7 +145,6 @@ func (g *genFitask) Filter(c *generator.Context, t *types.Type) bool { return t
func (g *genFitask) Imports(c *generator.Context) (imports []string) { func (g *genFitask) Imports(c *generator.Context) (imports []string) {
return []string{ return []string{
"encoding/json",
"k8s.io/kops/upup/pkg/fi", "k8s.io/kops/upup/pkg/fi",
} }
} }