Skip to content

Remove unused go-generate files #266

Open
@mr-karan

Description

@mr-karan

I ran go run generate/go-generate.go $(pwd) to generate updated models and configuration files. It generated a file configuration_generated.go (as it seems to be hardcoded here: https://github.com/haproxytech/dataplaneapi/blob/master/generate/go-generate.go#L356)

I manually renamed configuration_generated.go => configuration_storage.go and ran make build. I found the app doesn't compile anymore:

configuration/configuration_storage.go:65:14: undefined: log
configuration/configuration_storage.go:187:16: cfgStorage.LogTargets undefined (type *StorageDataplaneAPIConfiguration has no field or method LogTargets)
configuration/configuration_storage.go:188:18: cfg.LogTargets.Store undefined (type "github.com/haproxytech/dataplaneapi/log".Targets has no field or method Store)
configuration/configuration_storage.go:188:36: cfgStorage.LogTargets undefined (type *StorageDataplaneAPIConfiguration has no field or method LogTargets)
configuration/configuration_storage.go:362:13: cfgStorage.LogTargets undefined (type *StorageDataplaneAPIConfiguration has no field or method LogTargets)
configuration/configuration.go:292:7: cfg.LogTargets undefined (type *StorageDataplaneAPIConfiguration has no field or method LogTargets)
configuration/file-storage-hcl.go:79:37: invalid argument: localCopy.Cluster.ClusterLogTargets (variable of type *[]*models.ClusterLogTarget) for len
configuration/file-storage-hcl.go:81:29: cannot range over localCopy.Cluster.ClusterLogTargets (variable of type *[]*models.ClusterLogTarget)
configuration/file-storage-hcl.go:82:39: invalid operation: cannot index localCopy.Cluster.ClusterLogTargets (variable of type *[]*models.ClusterLogTarget)
configuration/file-storage-hcl.go:85:15: localCopy.LogTargets undefined (type StorageDataplaneAPIConfiguration has no field or method LogTargets)
configuration/file-storage-hcl.go:85:15: too many errors
make: *** [Makefile:24: build] Error 2

The old file had this struct:

type configTypeLog struct {
	LogTo     *string           `yaml:"log_to,omitempty" hcl:"log_to,omitempty"`
	LogFile   *string           `yaml:"log_file,omitempty" hcl:"log_file,omitempty"`
	LogLevel  *string           `yaml:"log_level,omitempty" hcl:"log_level,omitempty"`
	LogFormat *string           `yaml:"log_format,omitempty" hcl:"log_format,omitempty"`
	ACLFormat *string           `yaml:"apache_common_log_format,omitempty" hcl:"apache_common_log_format,omitempty"`
	Syslog    *configTypeSyslog `yaml:"syslog,omitempty" hcl:"syslog,omitempty"`
}

The new generated file has this struct but the fields are different:

type configTypeLog struct {
	LogTargets *log.Targets `yaml:"log_targets,omitempty" hcl:"log_targets,omitempty"`
}

It's also missing the LogTargets from StorageDataplaneAPIConfiguration struct.

Please let me know if this is a bug or I am doing something wrong!

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions