Package: dh-make-golang
Version: 0.3.0-1

Background
When invoking 'dh-make-golang' with -allow_unknown_hoster argument the user experiences 'panic: runtime error: slice bounds out of range [:-1]' This is due to the host variable being unassigned prior to slicing.

Output
panic: runtime error: slice bounds out of range [:-1]

Reproduce
dh-make-golang make -allow_unknown_hoster code.cloudfoundry.org/bytefmt

Patch
I have attached a patch that fixes GitHub Issue 120 [0] and corrects this issue.

Thanks!

James


[0]: https://github.com/Debian/dh-make-golang/issues/120
diff --git a/make.go b/make.go
index a2ee71d..e873af3 100644
--- a/make.go
+++ b/make.go
@@ -543,7 +543,7 @@ func shortHostName(gopkg string, allowUnknownHoster bool) (host string, err erro
 	default:
 		if allowUnknownHoster {
 			suffix, _ := publicsuffix.PublicSuffix(host)
-			host = host[:len(host)-len(suffix)-len(".")]
+			host = fqdn[:len(fqdn)-len(suffix)-len(".")]
 			log.Printf("WARNING: Using %q as canonical hostname for %q. If that is not okay, please file a bug against %s.\n", host, fqdn, os.Args[0])
 		} else {
 			err = fmt.Errorf("unknown hoster %q", fqdn)

Reply via email to