Package: dh-golang
Version: 1.26
Severity: normal
Tags: patch

Some packages can be imported from several import paths.
XS-Go-Import-Path can reflect this by using a comma-separated list
of known import paths for the package.

For example, the following format would now be valid:
```
XS-Go-Import-Path: github.com/go-mgo/mgo,
                   gopkg.in/mgo.v2,
                   labix.org/v2/mgo,
                   launchpad.net/mgo
```

Would you please apply this patch?

I am willing to make an upload after that if you want. I just wanted
somebody to review the patch.

See the related dh-make-golang bugs:
 - issue: https://github.com/Debian/dh-make-golang/issues/74
 - PR: https://github.com/Debian/dh-make-golang/pull/75

Cheers,

-- 
Alexandre Viau
av...@debian.org
From ee0165985d392d1f6dcb8c169a1fdff039fab0a5 Mon Sep 17 00:00:00 2001
From: aviau <av...@debian.org>
Date: Fri, 29 Dec 2017 15:08:56 -0500
Subject: [PATCH] support comma-separated paths in Go-Import-Path

Some packages can be imported from several import paths.
XS-Go-Import-Path can reflect this by using a comma-separated list
of known import paths for the package.

For example, the following format would now be valid:
```
XS-Go-Import-Path: github.com/go-mgo/mgo,
                   gopkg.in/mgo.v2,
                   labix.org/v2/mgo,
                   launchpad.net/mgo
```
---
 lib/Debian/Debhelper/Buildsystem/golang.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/Debian/Debhelper/Buildsystem/golang.pm b/lib/Debian/Debhelper/Buildsystem/golang.pm
index e13fa4d..ed342db 100644
--- a/lib/Debian/Debhelper/Buildsystem/golang.pm
+++ b/lib/Debian/Debhelper/Buildsystem/golang.pm
@@ -239,7 +239,12 @@ sub _set_dh_gopkg {
 
     my $control = Dpkg::Control::Info->new();
     my $source = $control->get_source();
-    $ENV{DH_GOPKG} = $source->{"XS-Go-Import-Path"};
+    # XS-Go-Import-Path can contain several paths. We use the first one.
+    # Example: XS-Go-Import-Path: github.com/go-mgo/mgo,
+    #                             gopkg.in/mgo.v2,
+    #                             labix.org/v2/mgo,
+    #                             launchpad.net/mgo
+    $ENV{DH_GOPKG} = (split ",", $source->{"XS-Go-Import-Path"})[0];
 }
 
 sub _set_gopath {
-- 
2.14.2

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to