Skip to content

Conversation

@kpfleming
Copy link
Contributor

@kpfleming kpfleming commented Jan 12, 2026

Change summary

This PR adds the 'service purge' command as a replacement for the 'purge' command. The 'purge' command is still available as an alias, but will issue a deprecation warning when it is used.

This involved a number of changes:

  1. The existing 'pkg/commands/purge' package content was moved to 'pkg/commands/service/purge', and modified to work as expected in that location.
  2. A new 'pkg/commands/alias' package was added to hold alias-only packages.
  3. An alias was added in 'pkg/commands/alias/purge'. This alias uses struct embedding to avoid duplicating any of the code from the `pkg/commands/service/purge' package. The alias command is 'unlisted' and issues a deprecation warning when it is used.

This PR also fixes the make fmt target in the Makefile to work properly.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  • Does your submission pass tests?

User Impact

New deprecation warning for the purge command.

var c RootCommand
c.CmdClause = parent.Command(CommandName, "Invalidate objects in the Fastly cache")
// PurgeCommand calls the Fastly API to purge items from the cache.
type PurgeCommand struct { //revive:disable:exported
Copy link
Contributor Author

@kpfleming kpfleming Jan 12, 2026

Choose a reason for hiding this comment

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

Since this is a new source file Revive complains about this structure name, but I've suppressed the warning since the code is not new, it was just relocated, and this naming is consistent with other existing commands.

@kpfleming kpfleming force-pushed the CDTOOL-1260 branch 2 times, most recently from 719644e to 1166ccb Compare January 12, 2026 16:09
@kpfleming kpfleming marked this pull request as ready for review January 12, 2026 16:09
@kpfleming kpfleming requested a review from a team as a code owner January 12, 2026 16:09
Copy link
Contributor

@anthony-gomez-fastly anthony-gomez-fastly left a comment

Choose a reason for hiding this comment

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

LGTM

This PR adds the 'service purge' command as a replacement for the
'purge' command. The 'purge' command is still available as an alias,
but will issue a deprecation warning when it is used.
Copy link
Contributor

@rcaril rcaril left a comment

Choose a reason for hiding this comment

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

Looks solid!

Copy link
Member

@philippschulte philippschulte left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks!

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.

4 participants