Skip to content

Move more code out of internal#4515

Open
mozesl-nokia wants to merge 7 commits into
kptdev:mainfrom
nokia:more-exports
Open

Move more code out of internal#4515
mozesl-nokia wants to merge 7 commits into
kptdev:mainfrom
nokia:more-exports

Conversation

@mozesl-nokia
Copy link
Copy Markdown
Contributor

@mozesl-nokia mozesl-nokia commented May 6, 2026

Follow up to #4490

Currently moved:

  • internal/types -> pkg/lib/types (this is a revert)
  • internal/pkg -> pkg/lib/pkg
  • internal/alpha/printers/table -> pkg/printer/table
  • internal/builtins/pkg_context.go -> pkg/lib/builtins/pkg_context.go (builtins already existed here)
  • internal/util/update/ -> pkg/lib/update (merged the two packages)
  • internal/utils/update/merge3 -> pkg/lib/update/merge3
  • removed internal/util/merge
  • internal/util/render -> pkg/lib/kptops (renamed executor.go to render_executor.go)
  • internal/util/diff -> pkg/lib/pkg/diff
  • internal/util/pkgutil -> pkg/lib/pkg
  • internal/util/attribution -> pkg/lib/util/attribution
  • internal/util/stack -> pkg/lib/util/stack
  • internal/util/strings -> pkg/lib/util/strings
  • internal/util/printerutil -> pkg/printer
  • internal/util/argutil -> pkg/lib/util/args
  • internal/util/fetch -> pkg/lib/util/fetch
  • internal/util/get -> pkg/lib/util/get
  • internal/util/git -> pkg/lib/util/git
  • internal/util/man -> pkg/lib/util/man
  • internal/util/pathutil -> pkg/lib/util/path
  • internal/hook -> pkg/lib/kptops (renamed executor.go to hook_executor.go)

Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
…l/update/merge3

Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit 594b4aa
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a0ac6a5b80dc500083042ee
😎 Deploy Preview https://deploy-preview-4515--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@mozesl-nokia mozesl-nokia added cleanup area/fn-runtime KRM function runtime go Pull requests that update Go code labels May 6, 2026
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
@mozesl-nokia mozesl-nokia marked this pull request as ready for review May 14, 2026 12:58
Copilot AI review requested due to automatic review settings May 14, 2026 12:58
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label May 14, 2026
@mozesl-nokia
Copy link
Copy Markdown
Contributor Author

I think is enough for this batch. Wanted to move internal/gitutil as well, but the circular import is not trivial to solve.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is a follow-up to #4490 that continues the effort to expose internal kpt utilities under pkg/lib/ (and pkg/printer) so that they can be consumed by external projects such as Porch. It is largely a mechanical relocation of packages from internal/ to public locations, with a few merges (e.g., internal/util/render + internal/hookpkg/lib/kptops) and renames (executor.gorender_executor.go / hook_executor.go).

Changes:

  • Moved a large number of internal/... packages to pkg/lib/... and pkg/printer/..., updating imports across the codebase.
  • Consolidated previously split packages (e.g., internal/util/update + internal/utils/update/merge3pkg/lib/update, and render/hook executors into pkg/lib/kptops).
  • Renamed internal/util/printerutil into the existing pkg/printer package, removing intra-package import cycles by inlining FromContextOrDie.

Reviewed changes

Copilot reviewed 90 out of 146 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
thirdparty/kyaml/runfn/runfn.go Switch to pkg/lib/types, pkg/lib/pkg, and pkg/printer.PrintFnResultInfo.
thirdparty/cmdconfig/commands/cmdtree/cmdtree.go Replace argutil with pkg/lib/util/args (alias argsutil).
thirdparty/cmdconfig/commands/cmdsource/cmdsource.go Update to pkg/lib/pkg and pkg/lib/util/args.
thirdparty/cmdconfig/commands/cmdeval/cmdeval.go Update to pkg/lib/util/args and pkg/lib/util/path; introduces duplicate import of path.
pkg/test/runner/config.go Switch internal/types to pkg/lib/types.
pkg/printer/util.go Move printerutil into the printer package; drop self-import.
pkg/printer/table/printer.go Switch to genericiooptions from deprecated genericclioptions.IOStreams.
pkg/printer/table/collector.go New file moved from internal/alpha/printers/table; carries over some dead/copy-paste comments.
pkg/printer/printer.go Imports updated to pkg/lib/pkg and pkg/lib/types.
pkg/printer/printer_test.go Test import updated to pkg/lib/pkg.
pkg/printer/fake/fake.go Import updated to pkg/lib/pkg.
pkg/live/rgpath.go Switch to pkg/lib/util/path.
pkg/live/load.go Switch to pkg/lib/pkg, pkg/lib/util/path, and pkg/lib/util/strings.
pkg/lib/util/strings/strings.go New file moved from internal/util/strings.
pkg/lib/util/strings/strings_test.go Test moved alongside the source.
Comments suppressed due to low confidence (4)

pkg/lib/pkg/util.go:16

  • The package doc comment still refers to the old name "Package pkgutil" after the move/rename to pkg/lib/pkg. Update the comment to match the new package name to avoid misleading readers and tooling like go doc.
    pkg/lib/util/git/git.go:56
  • Changing AbsPath from a value receiver to a pointer receiver is an API-visible change for RepoSpec. Callers that hold a non-addressable RepoSpec value (e.g., returned from a function and used inline, or stored in an interface) will no longer compile or will not pick up the method via the value's method set when the value is used through interfaces. Since this type is now under pkg/lib and intended for external consumption, this is a potentially breaking change that should be called out, or kept as a value receiver for consistency with other RepoSpec methods.
    pkg/lib/update/resource-merge.go:135
  • The local variable diff shadows the imported diff package within this function, which makes the code harder to read and brittle to future edits that might want to call another diff.* function below this line. Consider renaming the local variable (e.g., diffResult).
    pkg/lib/update/update_test.go:33
  • Using update2 as an import alias to disambiguate from another update symbol is unidiomatic. Prefer a descriptive alias (e.g., updatepkg) so it's clear what the package is at the call sites.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread thirdparty/cmdconfig/commands/cmdeval/cmdeval.go Outdated
Comment thread pkg/lib/update/pruninglocalpackagereader.go
Comment thread internal/testutil/testutil.go Outdated
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 94 out of 150 changed files in this pull request and generated 1 comment.

Comment thread pkg/live/rgpath.go Outdated
@dosubot dosubot Bot added the lgtm label May 14, 2026
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/fn-runtime KRM function runtime cleanup go Pull requests that update Go code lgtm size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants