diff options
author | Vincent Ambo <tazjin@google.com> | 2019-12-12T22·58+0000 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2019-12-13T00·39+0000 |
commit | bbf3a418a5a119e2ab6aaaf1e04f42caa1b683a8 (patch) | |
tree | 05adc65bda71f963918d0f5038c52e0d0e7e874f /external | |
parent | 1fd80fb20175c28bc500e6d889594d1a5ebb6be7 (diff) |
feat(external): Add fully qualified import path to analyser output
This is used by Nix to build the derivation names for individual packages.
Diffstat (limited to 'external')
-rw-r--r-- | external/main.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/external/main.go b/external/main.go index 028703e38cad..aac966172b34 100644 --- a/external/main.go +++ b/external/main.go @@ -29,7 +29,8 @@ var stdlibList string // Return information includes the local (relative from project root) // and external (none-stdlib) dependencies of this package. type pkg struct { - Name []string `json:"name"` + Name string `json:"name"` + Locator []string `json:"locator"` Files []string `json:"files"` LocalDeps [][]string `json:"localDeps"` ForeignDeps []string `json:"foreignDeps"` @@ -95,12 +96,12 @@ func analysePackage(root, source, importpath string, stdlib map[string]bool) (pk prefix := strings.TrimPrefix(source, root+"/") - name := []string{} + locator := []string{} if len(prefix) != len(source) { - name = strings.Split(prefix, "/") + locator = strings.Split(prefix, "/") } else { - // Otherwise, the name is empty since its the root package and no - // prefix should be added to files. + // Otherwise, the locator is empty since its the root package and + // no prefix should be added to files. prefix = "" } @@ -110,7 +111,8 @@ func analysePackage(root, source, importpath string, stdlib map[string]bool) (pk } return pkg{ - Name: name, + Name: path.Join(importpath, prefix), + Locator: locator, Files: files, LocalDeps: local, ForeignDeps: foreign, |