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