refactor: refactor internal packages#1205
Conversation
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1205 +/- ##
==========================================
- Coverage 76.24% 76.13% -0.12%
==========================================
Files 70 66 -4
Lines 3637 3628 -9
==========================================
- Hits 2773 2762 -11
- Misses 668 669 +1
- Partials 196 197 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
There was a problem hiding this comment.
PR Overview
This PR refactors the internal packages by reorganizing command‐related packages under cmd/notation/internal and moving functional logic into internal. Key changes include updating package names and import paths, consolidating duplicate functionalities, and aligning flag options and display handling with the new package structure.
Reviewed Changes
| File | Description |
|---|---|
| cmd/notation/internal/sign/sign_test.go | Updated package name and import paths to reflect refactoring. |
| cmd/notation/internal/flag/options.go | Renamed package from cmd to flag and updated configuration usage. |
| cmd/notation/cert/list.go | Replaced deprecated ioutil.PrintCertMap with local printCertMap. |
| cmd/notation/internal/sign/sign.go | Updated import paths for flag options and removed unused deps. |
| cmd/notation/internal/display/display.go | Updated package comment and documentation for display handling. |
| (Other files) | Consistent refactoring of flag, signer, display, and command logic. |
Copilot reviewed 52 out of 52 changed files in this pull request and generated 1 comment.
There was a problem hiding this comment.
PR Overview
This PR refactors the internal packages to improve the separation between command‐related and logic/utility packages, as discussed with @JeyJeyGao.
- Relocates packages directly related to commands under cmd/notation/internal (e.g. sign, flag, display) while keeping logic and configuration packages under internal or new subdirectories.
- Updates import paths, flag handling, and test references accordingly, and removes legacy code such as the old output format options.
Reviewed Changes
| File | Description |
|---|---|
| cmd/notation/internal/sign/sign_test.go | Renames package from “signer” to “sign” and updates flag usage to reflect the new path. |
| cmd/notation/cert/list.go | Replaces references to internal cmd with the new flag package and updates certificate printing logic. |
| cmd/notation/internal/flag/options.go | Moves the file from the “cmd” package to the “flag” package and refactors output flag handling. |
| cmd/notation/internal/sign/sign.go | Updates import paths to use the flag package and refactors key resolution logic accordingly. |
| cmd/notation/internal/display/display.go | Revises package documentation/comments and updates the confirmation function implementation. |
| cmd/notation/internal/display/output/format.go | Renames the package from “option” to “output” and defines output format constants. |
| cmd/notation/internal/display/output/print.go | Adjusts comments and renames for improved clarity. |
| cmd/notation/blob/verify.go | Updates import paths and flag usage in preparation for refactored key verification. |
| cmd/notation/inspect.go | Updates flag usage and output format handling for the inspect command. |
| cmd/notation/blob/inspect.go | Replaces usage of legacy option flags with the new flag package for inspection. |
| cmd/notation/internal/flag/flags.go | Adjusts configuration loading to make use of the new config package. |
| cmd/notation/internal/flag/options_test.go | Renames the package to “flag” to reflect the updated internal structure. |
| cmd/notation/inspect_test.go | Updates test expectations to match new error messages and flag parsing behavior. |
| cmd/notation/internal/display/handler.go | Updates the NewInspectHandler and NewBlobInspectHandler functions to use new output formats. |
| cmd/notation/blob/sign_test.go | Refactors test cases to use the updated flag package instead of the legacy cmd package. |
| cmd/notation/blob/sign.go | Replaces internal references (e.g. signer, confirmation routines) with updated flag and display packages and updates error messages accordingly. |
| cmd/notation/cert/show.go | Switches from the internal cmd package to the updated flag package for logging options. |
| cmd/notation/blob/policy/import.go | Updates the confirmation prompt to use the new display package for consistency. |
| cmd/notation/internal/option/format.go | Removes legacy code that has been superseded by the new flag/output refactoring. |
Copilot reviewed 52 out of 52 changed files in this pull request and generated no comments.
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
As discussed with @JeyJeyGao, this PR completes the refactoring work for Notation internal packages.
The idea is, any package directly related to command shall be put under
cmd/notation/internaldir, whereas packages related to functioning and logic shall be put underinternal.Resolves #1151