#1147142 lintian: Add check for Go package name matching major API version in import path

#1147142#5
Date:
2026-09-08 07:36:04 UTC
From:
To:
Dear Lintian Maintainers,

Go Team needs help for the Module-Aware Build with new tooling `dh-go`
transition.

Please adding a check to validate Go library (-dev) package names
against their upstream Go import paths from the root go.mod it ships.

Background
==========
In the Go ecosystem, the API version is specify within it's mport path
with a version suffix: eg: "github.com/foo/bar/v3"

When the transition to new tooling `dh-go` that enables Module-Aware
Builds, we want to have a consistent naming style to prevent confusion
for both maintainers and new tooling as the new tooling is hight depends
on filesystem directory structure to maps the modules for offline
building under Go Workspace.

The Transition Guide contains a Packaging Rules for the Package Naming
Conventions. Maintainer should appending the major API version suffix
to both source and binary package names to match with Go Import Path.

For example:

The first line of go.mod file contains: "module github.com/foo/bar/v3"
Package name should be: `golang-github-foo-bar-v3-dev` to match the
upstream import path in go.mod.

The Problem
===========
When maintainers update the version suffix into XS-Go-Import-Path
in debian/control without updating the package names:
- It creates a mismatch between the Debian package name and the Go
  import path.
- It causes structure confusion for both maintainers and `dh-go` and
  may breaks reverse dependency lookups.
- It may blocks/conflicts co-existence of different major API versions
  as build-deps in downstream packages.

Proposed Lintian Check
======================
Add a tag, eg: go-package-name-does-not-match-import-path
That checks:
- Parse the version suffix from the root go.mod file module import
  path from go.mod (or from XS-Go-Import-Path).
- If the import path contains a major API version suffix (e.g., /v3),
  verify that the source package name and the -dev binary package name
  also include the corresponding version suffix (-v3 or -v3-dev).

Note: We have wiki documented `Naming Conventions (Hyphens vs. Dots)`:
 Convert slashes (/) in Go import paths into hyphens (-) rather than
 dots (.) when naming Debian packages (e.g., /v3 becomes -v3, and
 /pkg.v3 becomes -pkg.v3). Because dots are valid characters inside
 domain names and paths, using hyphens avoids naming confusion in the
 future.

For details on the Go team migration ModuleAwareBuilds MigrationGuide:
https://wiki.debian.org/Teams/DebianGoTeam/ModuleAwareBuilds


Best regards,
-Andrew

#1147142#12
Date:
2026-09-08 14:06:40 UTC
From:
To:
Control: tags -1 moreinfo

Lintian maintainer here.

Is it not possible to have this check inside dh-go and have the package not
build if this happens? You could go ahead and ask lucas/sanvila for archive
rebuilds to figure out which packages need fixing.

There are already 2 tags which will be no longer useful after the transition

missing-xs-go-import-path-for-golang-package
xs-go-import-path-differs-from-module-path

I feel adding one more tag which will again go away after the transition is
not a good use of my time.
If it is not possible to have it via dh-go and there is another reason to
add it in lintian, please let me know. Otherwise, please close this bug.