nginxinc / nginx-go-crossplane

A library for working with NGINX configs in Go
Apache License 2.0
58 stars 15 forks source link

Proposal - Make analyze variables and functions public #115

Open rikatz opened 3 months ago

rikatz commented 3 months ago

Is your feature request related to a problem? Please describe

This is a feature request to make analyzer.go constants public and change the generator to allow consuming these constants

Describe the solution you'd like

Using generators to create analyzers is great! This means I can have my own third party, generated consistently from official code (see https://github.com/kubernetes/ingress-nginx/tree/feature-go-crossplane/internal/ingress/controller/template/crossplane/extramodules)

The problem is that the const directives (https://github.com/kubernetes/ingress-nginx/blob/feature-go-crossplane/internal/ingress/controller/template/crossplane/extramodules/analyze.go#L30) are private, meaning I had to partially copy the file to the same place of the generated files.

As a proposal:

Describe alternatives you've considered

See the file above on the alternative approach used

Additional context

Add any other context or screenshots about the feature request here.

ornj commented 3 months ago

@rikatz 100% agree. With the inclusion of the generators and an API evolving to enable the use case you've mentioned I agree that these constants should be exported and well documented.

As far as discovering constants, I'm not sure what that might look like. The constant values that currently exist in crossplane differ from the actual values you will find in the nginx source. Some times the value is different between crossplane and nginx, some times they do not exist in nginx source code at all.

Changes would need to be made to the analyzer code I think to make use of any new constants defined by the generator.