@@ -95,15 +95,22 @@ func otherVersions(mod string) (mods []string) {
95
95
}
96
96
97
97
// findOtherVersion search in m for potential other versions of the given
98
- // module and returns the number of the major version found, 0 if not.
99
- func findOtherVersion (m map [string ]string , mod string ) int {
98
+ // module and returns the number of the major version found, 0 if not,
99
+ // along with the corresponding package name.
100
+ func findOtherVersion (m map [string ]string , mod string ) (int , string ) {
100
101
versions := otherVersions (mod )
101
102
for i , version := range versions {
102
- if _ , ok := m [version ]; ok {
103
- return len (versions ) - i
103
+ if pkg , ok := m [version ]; ok {
104
+ return len (versions ) - i , pkg
104
105
}
105
106
}
106
- return 0
107
+ return 0 , ""
108
+ }
109
+
110
+ // trackerLink generates an OSC 8 hyperlink to the tracker for the given Debian
111
+ // package name.
112
+ func trackerLink (pkg string ) string {
113
+ return fmt .Sprintf ("\033 ]8;;https://tracker.debian.org/pkg/%[1]s\033 \\ %[1]s\033 ]8;;\033 \\ " , pkg )
107
114
}
108
115
109
116
func estimate (importpath , revision string ) error {
@@ -238,24 +245,24 @@ func estimate(importpath, revision string) error {
238
245
repoRoot = rr .Root
239
246
}
240
247
// Check for potential other major versions already in Debian.
241
- v := findOtherVersion (golangBinaries , mod )
248
+ v , pkg := findOtherVersion (golangBinaries , mod )
242
249
if v != 0 {
243
250
// Log info to indicate that it is an approximate match
244
251
// but consider that it is packaged and skip the children.
245
252
if v == 1 {
246
- log .Printf ("%s has no version string in Debian" , mod )
253
+ log .Printf ("%s has no version string in Debian (%s) " , mod , trackerLink ( pkg ) )
247
254
} else {
248
- log .Printf ("%s is v%d in Debian" , mod , v )
255
+ log .Printf ("%s is v%d in Debian (%s) " , mod , v , trackerLink ( pkg ) )
249
256
}
250
257
return
251
258
}
252
259
// When multiple modules are developped in the same repo,
253
260
// the repo root is often used as the import path metadata
254
261
// in Debian, so we do a last try with that.
255
- if _ , ok := golangBinaries [repoRoot ]; ok {
262
+ if pkg , ok := golangBinaries [repoRoot ]; ok {
256
263
// Log info to indicate that it is an approximate match
257
264
// but consider that it is packaged and skip the children.
258
- log .Printf ("%s is packaged as %s in Debian" , mod , repoRoot )
265
+ log .Printf ("%s is packaged as %s in Debian (%s) " , mod , repoRoot , trackerLink ( pkg ) )
259
266
return
260
267
}
261
268
// Ignore modules from the blocklist.
0 commit comments