Migrate Api command and Version commands to Kong #589
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
go test ./...)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.