From 01ddbb43974afd3fd4e40db2677b03c7a544a11b Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 3 Jun 2020 03:42:59 +0000 Subject: [PATCH] fix(nix/buildGo/external): Properly match import path prefixes Prior to this patch, github.com/hashicorp/terraform-svchost is erroneously considered a sub-package of github.com/hashicorp/terraform, breaking dependency searching: error: missing local dependency 'github.com.hashicorp.terraform-svchost' in 'github.com/hashicorp/terraform' Change-Id: Ibcf0f3a9b1742ce46f84cbbf84e90127b8c1df0d Reviewed-on: https://cl.tvl.fyi/c/depot/+/122 Reviewed-by: tazjin --- nix/buildGo/external/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/buildGo/external/main.go b/nix/buildGo/external/main.go index b89fea732..50c6c8589 100644 --- a/nix/buildGo/external/main.go +++ b/nix/buildGo/external/main.go @@ -97,7 +97,7 @@ func analysePackage(root, source, importpath string, stdlib map[string]bool) (pk if i == importpath { local = append(local, []string{}) - } else if strings.HasPrefix(i, importpath) { + } else if strings.HasPrefix(i, importpath+"/") { local = append(local, strings.Split(strings.TrimPrefix(i, importpath+"/"), "/")) } else { foreign = append(foreign, i)