go-module-renamer

Rename Go module paths across go.mod, imports, and proto go_package.

Updated Apr 7, 2025
One-click install
npx skills add https://github.com/fsyyft-go/kratos-layout --skill go-module-renamer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-module-renamer
Source: https://github.com/fsyyft-go/kratos-layout/tree/main/.claude/skills/go-module-renamer
Command: npx skills add https://github.com/fsyyft-go/kratos-layout --skill go-module-renamer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Go modules often carry long paths which must be updated when migrating to a new repository, leading to tedious manual edits and potential inconsistencies.

Core Features & Use Cases

  • Automatic detection of current module path and rename type (full vs partial).
  • Deterministic text replacement across go.mod, imports, proto go_package, and documentation to update module references.
  • Built-in validation and rollback support, plus a dry-run option to preview changes before applying.

Quick Start

在 dry-run 模式下执行以预览所有替换,然后再进行正式的重命名。

Frequently Asked Questions about go-module-renamer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I rename a Go module path across a project without breaking imports?

To rename a Go module path safely, use a tool that performs deterministic text replacement across go.mod, source imports, proto go_package, and Makefile references to ensure full consistency across the codebase.

What is the best way to preview changes before applying a Go module path rename?

The best way to preview Go module path changes is to run the renaming process in dry-run mode, which shows all planned text replacements and updates without modifying the actual files.

How does rollback work when a Go module migration goes wrong?

Rollback during a Go module migration works by utilizing built-in backup support that automatically restores the original go.mod, source imports, and project references if the renaming process fails or produces errors.

Does the Go module renamer handle proto go_package and Makefile updates?

Yes, the Go module renamer handles proto go_package and Makefile updates by scanning and applying deterministic text replacements to all project references, ensuring no module paths are missed during migration.

Can I perform a partial rename of a Go module path instead of a full replacement?

Yes, you can perform a partial rename because the tool automatically detects the rename type, allowing you to update specific segments of the module path rather than replacing the entire path.

When do I need to automate Go module renaming for codebase migration?

You need to automate Go module renaming during codebase migration, project restructuring, or when moving to a new repository to avoid tedious manual edits and prevent inconsistencies across long module paths.