Skip to content
rlsbl.go_identity
On this page

Does a go.mod's module path still name where the repository lives? The expected path is origin plus the module's directory, major-version suffix included.

#rlsbl.go_identity

#rlsbl.go_identity

Does a go.mod's module path still name where the repository lives?

A Go module path is not decoration: it is the URL the toolchain fetches from. When a repository is renamed, moved between owners, or absorbed into a monorepo under a new subdirectory, every go.mod in it keeps declaring the OLD path until someone rewrites it -- and a module published under a path that no longer resolves is a module nobody can go get. rlsbl rewrite go-module-path exists to perform that rewrite; this check is what notices it is owed.

What the expected path is -------------------------

The repository's own origin remote, plus the module's directory inside the repository::

git@github.com:owner/repo.git + services/api -> github.com/owner/repo/services/api

Two spellings of the same remote (https://github.com/owner/repo.git and git@github.com:owner/repo.git) normalize to the same identity, so the comparison never depends on how the remote was cloned.

A major-version suffix is part of the module path, not a mismatch: Go requires /v2 and up on the module path itself, so github.com/owner/repo/v2 is accepted where github.com/owner/repo is expected. Go's other major-version layout -- a v2/ DIRECTORY inside the repository -- already puts that element in the expected path, and the suffix is then not accepted a second time.

What it refuses to guess ------------------------

  • No origin remote -- there is no identity to compare against, so the check

SKIPS and says so. Inventing one from the directory name is exactly the wrong answer, because the directory name is not the published identity.

  • An SSH host alias (git@gp:owner/repo.git, where gp is a

~/.ssh/config Host entry, not a domain) names no host that a module path could start with. Rather than guessing github.com, the host segment is left unverified and only the OWNER/REPO/SUBDIRECTORY tail is compared -- the part that actually moves when a repository is renamed. The outcome message says the host was not verified, so a passing result never claims more than it checked.

#RepoIdentity

Where a repository lives, as its origin remote states it.

#host_is_a_domain

python
def host_is_a_domain(self)

True when the remote names something a module path can start with.

An SSH alias (gp) has no dot; every real forge host does.

#parse_remote

python
def parse_remote(url)

Return the :class:RepoIdentity a remote URL states, or None.

Both spellings are normalized to the same (host, owner/repo): an SCP remote (git@github.com:owner/repo.git) and a URL remote (https://github.com/owner/repo.git, ssh://git@github.com/owner/repo).

#expected_module_path

python
def expected_module_path(identity, subdirectory)

The module path a module at subdirectory of this repository owns.

#strip_major_suffix

python
def strip_major_suffix(module_path)

module_path without its trailing /vN (N >= 2), if it has one.

#module_matches

python
def module_matches(actual, expected_full, expected_tail, *, host_verified)

Does actual declare the expected identity?

When the host could not be derived from the remote (an SSH alias), the module's own first segment is accepted as the host and only the tail is compared -- see the module docstring.

A /vN element is accepted on top of the expected path, because Go requires it on the module path and the repository layout does not have to carry it. It is NOT accepted twice: when the module already sits in a vN/ DIRECTORY the expected path ends in that element already, and .../repo/v2/v2 is not a spelling of anything.

#with_major_suffix

python
def with_major_suffix(expected, actual)

expected carrying the /vN element actual declares, if it may.

The suffix is Go's, not the repository's, so a rewrite has to preserve it -- unless the expected path already ends in one, which is the major subdirectory layout and would otherwise be doubled.

#GoIdentityVerdict

Result of comparing every Go module in one repository against origin.

#ok

python
def ok(self)

#read_module_line

python
def read_module_line(go_mod_path)

The module directive of go_mod_path, or None when it has none.

#evaluate_go_module_identity

python
def evaluate_go_module_identity(repo_root, module_dirs, remote_url)

Compare each module's declared path against the repository's identity.

module_dirs are absolute directories expected to contain a go.mod. remote_url is the origin remote URL, or None when the repository has no origin -- which skips, rather than guessing an identity.

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
  • wesktop A Python framework that turns an ASGI web app into a desktop application, serving it from a local Granian server and displaying it in a native OS window via pywebview
Search