Skip to content

Conversation

@JoeColeman95
Copy link
Contributor

Description

This PR migrates Api command and Version commands to Kong.

With the version changes, it merges the internal into the cmd, as this doesn't seem like a unnecessary detach. Also, to further this I've removed the import everywhere as it's passed to factory.New(), this can just be imported into the factory itself and then passed as a value directly to the command, rather than passed in at every single use of the func.

Removed internal api.go too, as this wasn't used anywhere.

Changes

Moves api to /cmd/api/api.go
Moves version to /cmd/version/version.go
Removes all imports of version except in factory.go
Removes api.go internal, as it wasn't used anywhere
Moved the internal version to the cmd and then updated goreleaser to update the var directly here instead (tested as working)

Testing

  • [ x ] Tests have run locally (with go test ./...)
  • [ x ] Code is formatted (with go fmt ./...)

Disclosures / Credits

Had to slightly refactor api.go defaulting to GET here as it was using Cobra functionality in State(), functionally the same but should be considered.

Had to rework the default here a little bit as was relying on Cobra to default to GET rather than post with Cobra's Changed()
Required a lot of changes due to imports, had to alias an import in main to avoid conflict
We import version everywhere in order to pass it into useragent via New() in factory, but we can just simply pass this without importing so seems like a waste, avoiding this in favour of DRY
@JoeColeman95 JoeColeman95 requested a review from a team as a code owner December 10, 2025 18:08
Copy link
Contributor

@mcncl mcncl left a comment

Choose a reason for hiding this comment

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

Some nice refactors too (no need for the version passing for a new factory)

@mcncl mcncl merged commit 8b6924c into main Dec 10, 2025
1 check passed
@mcncl mcncl deleted the SUP-5774/Single-commands-to-Kong branch December 10, 2025 22:41
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.

3 participants