Skip to content

Make mdtogo an independent Go module#4587

Merged
efiacor merged 1 commit into
kptdev:mainfrom
Nordix:mdtogo-independent-module
Jun 12, 2026
Merged

Make mdtogo an independent Go module#4587
efiacor merged 1 commit into
kptdev:mainfrom
Nordix:mdtogo-independent-module

Conversation

@aravindtga

Copy link
Copy Markdown
Contributor

Description

After the api module extraction, the root go.mod contains a replace directive (github.com/kptdev/kpt/api => ./api).
This breaks external installation of mdtogo package in the repository via go install ...@main because Go does not allow replace directives in modules installed with a version query.

This affects krm-functions-catalog, which uses go install github.com/kptdev/kpt/mdtogo@main to generate function documentation.

Since the api split, that command fails with:

The go.mod file for the module providing named packages contains one or more
replace directives. It must not contain directives that would cause it to be
interpreted differently than if it were the main module.

mdtogo has no dependency on any other kpt package. it only uses golang.org/x/text and testify. Making it its own module allows external go install to resolve it independently of the root go.mod and its replace directives.

Changes

  • Add mdtogo/go.mod and mdtogo/go.sum (new independent module)
  • Update Makefile install target: go install ./mdtogocd mdtogo && go install .

AI Disclosure

  • I have used AI(Kiro CLI) in the creation of this PR.

Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech>
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit e8a08a9
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a2afc52ceaccb000864663b
😎 Deploy Preview https://deploy-preview-4587--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.

@aravindtga aravindtga self-assigned this Jun 11, 2026
@aravindtga aravindtga requested a review from Copilot June 11, 2026 18:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Introduces a dedicated Go submodule for the mdtogo tool and updates build/install wiring to install it from its own module context.

Changes:

  • Added mdtogo/go.mod and mdtogo/go.sum to define mdtogo as an independent Go module.
  • Updated the root Makefile install target to run go install from within mdtogo/.
  • Refreshed root module dependency bookkeeping (go.mod/go.sum) as part of the change.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
mdtogo/go.mod Defines the new mdtogo submodule and its direct/indirect dependencies.
mdtogo/go.sum Adds checksum entries for the new mdtogo submodule dependencies.
go.mod Adjusts dependency classification/order (notably golang.org/x/text as indirect).
go.sum Removes now-unneeded checksum entries after dependency tidy/update.
Makefile Installs mdtogo by changing into the submodule directory before go install.

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

@aravindtga aravindtga marked this pull request as ready for review June 11, 2026 18:27
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. go Pull requests that update Go code labels Jun 11, 2026

@efiacor efiacor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm hoping this will be semi temp given we will move away from generating docs for the fns
#4516

@dosubot dosubot Bot added the lgtm label Jun 11, 2026
@mozesl-nokia

Copy link
Copy Markdown
Contributor

This is not just a problem with mdtogo, we have to remove the replace in order to make it "go install"-able

@efiacor

efiacor commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This is not just a problem with mdtogo, we have to remove the replace in order to make it "go install"-able

Do we merge this anyway so?

@mozesl-nokia

Copy link
Copy Markdown
Contributor

@efiacor
If this is blocking something immediate, sure. Otherwise, we need to establish how to handle the versioning of the API, since it looks like we cannot have the same version for both like this.

@efiacor

efiacor commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

@efiacor If this is blocking something immediate, sure. Otherwise, we need to establish how to handle the versioning of the API, since it looks like we cannot have the same version for both like this.

Not sure, but I think the krm-fn builds/ci are broken given the api change.
@aravindtga could you confirm?
No panic on my side but I am planning to phase the mdtogo in favour of the new sdk api approach.

@aravindtga

Copy link
Copy Markdown
Contributor Author

@efiacor If this is blocking something immediate, sure. Otherwise, we need to establish how to handle the versioning of the API, since it looks like we cannot have the same version for both like this.

Not sure, but I think the krm-fn builds/ci are broken given the api change. @aravindtga could you confirm? No panic on my side but I am planning to phase the mdtogo in favour of the new sdk api approach.

@efiacor / @mozesl-nokia krm-functions-catalog ci/local build is broken with the api change. Also this is a temporary fix only and can be removed once we phase out mdtogo.

@efiacor efiacor merged commit add4215 into kptdev:main Jun 12, 2026
12 checks passed
@efiacor efiacor deleted the mdtogo-independent-module branch June 12, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code lgtm size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants