Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partition /cmd into subfolders #4967

Closed
wants to merge 16 commits into from
Closed

Conversation

tiloKo
Copy link
Member

@tiloKo tiloKo commented Jun 20, 2024

Changes

  • step metadata now has new attribute "package"
  • go generate will - if package is set - generate the step go files in a subfolder of /cmd
  • as the _generated.go files uses heavily functions from /cmd/piper.go they had to be moved to /cmd/piper/GeneralConfig.go to prevent circular imports. The _generated.go files will no longer access the global GeneralConfig structure from /cmd/piper.go but instead create with /cmd/piper/GeneralConfig.go -> CreateGeneralConfigCopyFromFlags() their own local copy of it.
  • /cmd/version.go -> GitCommit is again not accessible due to circular imports, thus as preliminary work around it has been added to the GeneralConfig structure and is passed as new Flag. Cleaner solution would be to move version.go into a subfolder like GeneralConfig but did not want to overload the PR
  • step abapAddonAssemblyKitCheckCVs has been moved to a subfolder "abapAddonAssemblyKit" as example (further will follow if PR is accepted but PR has already enough files so did not want to overload it further). No real change was needed except change of package and the changes in the generated files.
  • as /pkg/generator has been adopted all _generated.go files are updated (>100 times the same change)

Benefits

  • /cmd folder gets smaller
  • faster development possible in subfolder as IDE operations on package level do not have to process hundreds of files
  • faster execution of unit tests as you can group relevant steps in a package and can ignore all the others
  • better encapsulation as functions defined by other steps are no longer in same package
  • piper core functionality better encapsulated in /cmd/piper package

How to Review

  • (5 files) main changes in /pkg/generator (4 Files + 1 File /pkg/config )
  • (2 files) move of /cmd/piper.go functions to /cmd/piper/GeneralConfig.go (only minor adoptions, no real change)
  • (5 files) example /cmd/abapAddonAssemblyKitCheckCVs* as well as /resources/metadata related step yaml file
  • (1 file) /cmd/version.go got a comment
  • other 115 files just generated different now

successor of #4906

@tiloKo tiloKo requested review from a team as code owners June 20, 2024 11:56
@tiloKo tiloKo closed this Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant