Repository navigation
Remove unused go-generate files #266
Description
Activity
- changed the title
[-]Go Generate not updated since long time[/-][+]App doesn't compile after running go generate[/+]on Sep 13, 2022 Hi, to generate updated models and operations, I suggest you use our
Makefiletargetgenerate. Or if you are doing something custom use this for inspiration: https://github.com/haproxytech/dataplaneapi/blob/master/Makefile#L31We don't use
generate/go-generateto generate config stuff no more. That is why we renamedconfiguration_generated.go=>configuration_storage.go. You have to manually add changes now to it.We should remove the
go-generate.gofile there to remove the confusion.@mjuraga Hi! Actually I did use
make generate-native(as noted in the contrib guide). The reason is that I've some changes inspecificationsinclient-nativeso I generated new models withmake modelsin that repository and did ago mod replaceindataplaneapi.When I ran
make generate-native, theconfiguration_storage.godidn't contain the new models. (I am trying to add support for Nomad service discovery):type configTypeServiceDiscovery struct { Consuls *[]*models.Consul `yaml:"consuls,omitempty" hcl:"consuls,omitempty"` AWSRegions *[]*models.AwsRegion `yaml:"aws_regions,omitempty" hcl:"aws_regions,omitempty"` }
However, when I ran
generate/go-generateI found this to be present:type configTypeServiceDiscovery struct { Consuls *[]*models.Consul `yaml:"consuls,omitempty" hcl:"consuls,omitempty"` Nomads *[]*models.Nomad `yaml:"nomads,omitempty" hcl:"nomads,omitempty"` AWSRegions *[]*models.AwsRegion `yaml:"aws_regions,omitempty" hcl:"aws_regions,omitempty"` }
So, do you suggest I edit the
configuration_storage.gomanually for now? That's totally fine by me, I just was concerned that this file shouldn't get overwritten in future ifgo generateis run again.Thanks!
Yes, you should change the file manually, we won't be running go generate again. It had some issues with these kind of fields, and we decided it was easier to just add stuff manually then to rewrite the
go-generate.gofile.Reacted by Karan SharmaThat would be awsome @mr-karan. Thanks!
- added 2 commits that reference this issue
on Sep 21, 2022 - changed the title
[-]App doesn't compile after running go generate[/-][+]Remove unused go-generate files[/+]on Dec 1, 2022

I ran
go run generate/go-generate.go $(pwd)to generate updated models and configuration files. It generated a fileconfiguration_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.goand ranmake build. I found the app doesn't compile anymore:The old file had this struct:
The new generated file has this struct but the fields are different:
It's also missing the LogTargets from
StorageDataplaneAPIConfigurationstruct.Please let me know if this is a bug or I am doing something wrong!
Thanks