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 #4906

Closed
wants to merge 12 commits into from
Closed

Conversation

tiloKo
Copy link
Member

@tiloKo tiloKo commented Apr 23, 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

@tiloKo tiloKo requested review from a team as code owners April 23, 2024 13:31
@tiloKo tiloKo added enhancement question discussion REVIEW Pull-Request needs a review config feature go Pull requests that update Go code labels Apr 23, 2024
@tiloKo tiloKo requested a review from a team as a code owner May 13, 2024 09:43
Copy link

sonarcloud bot commented May 13, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@bluesbrother84 bluesbrother84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tiloKo tiloKo closed this Jun 20, 2024
@tiloKo tiloKo deleted the cmdSubfolder branch June 20, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config discussion enhancement feature go Pull requests that update Go code question REVIEW Pull-Request needs a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants