go-module-paths

Derive Go import paths from go.mod for module-root relative imports.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/PremModhaOfficial/go-sdk-pipeline --skill go-module-paths
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-module-paths
Source: https://github.com/PremModhaOfficial/go-sdk-pipeline/tree/main/.claude/skills/go-module-paths
Command: npx skills add https://github.com/PremModhaOfficial/go-sdk-pipeline --skill go-module-paths

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Derive Go import paths from go.mod to ensure module-root relative imports and prevent import-path mistakes in monorepos where go.mod is not at repository root.

Core Features & Use Cases

  • Derive import paths from the module root by reading go.mod and computing relative paths for non-root layouts.
  • Validate import paths against typical monorepo structures to prevent common mistakes such as including the module root directory in imports.
  • Provide practical guidance for Docker build contexts and multi-service Go workspaces.

Quick Start

Run the go-module-paths skill to derive module-root relative import paths from the repository's go.mod.

Frequently Asked Questions about go-module-paths

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

FAQPage Schema
How do I derive Go import paths from go.mod when the module is not at the repository root?

To derive Go import paths from go.mod in a non-root layout, locate the module root, read the module path from go.mod, and compute import paths relative to that root. This prevents import-path mistakes in monorepos.

Why does my Go monorepo build fail with incorrect module-root relative imports?

Go monorepo builds fail with incorrect module-root relative imports when the module root directory is mistakenly included in the import path. Deriving paths directly from the go.mod module path ensures builds align with module-based paths.

What is the best way to calculate Go import paths for a multi-service monorepo workspace?

The best way to calculate Go import paths for a multi-service monorepo workspace is to read the module path from go.mod and validate imports against the monorepo structure. This ensures correct module-root relative paths across services.

Can I use go.mod to fix Go import paths for a Docker build context in a monorepo?

Yes, you can use go.mod to fix Go import paths for a Docker build context in a monorepo. By locating the module root and deriving paths relative to it, you ensure Docker builds align with the correct module-based import paths.

When do I need to validate Go import paths against my monorepo structure?

You need to validate Go import paths against your monorepo structure when go.mod is not at the repository root. Validating prevents common mistakes, such as including the module root directory name within the import path itself.

Does go-module-paths work for Docker build contexts and multi-service Go workspaces?

Yes, go-module-paths works for Docker build contexts and multi-service Go workspaces. It provides practical guidance for deriving module-root relative import paths from go.mod, ensuring builds align correctly across different services.