blob: e6c06091c4a1baf67797fee2c003bb7e7c347a96 [file] [log] [blame]
Lorenz Brunadb98f92022-07-04 14:09:41 +00001This adds support for workspace-relative Go embeds.
2
3diff --git a/go/tools/builders/compilepkg.go b/go/tools/builders/compilepkg.go
4index 09e3ef6e..4623f803 100644
5--- a/go/tools/builders/compilepkg.go
6+++ b/go/tools/builders/compilepkg.go
7@@ -379,6 +379,13 @@ func compileArchive(
8 }
9 }
10 }
11+ // Sort by length descenting to not get wrong roots
12+ sort.Slice(embedRoots, func(i, j int) bool {
13+ return len(embedRoots[i]) > len(embedRoots[j])
14+ })
15+ for _, root := range embedRoots {
16+ embedRootDirs = append(embedRootDirs, abs(root))
17+ }
18 embedcfgPath, err := buildEmbedcfgFile(srcs.goSrcs, embedSrcs, embedRootDirs, workDir)
19 if err != nil {
20 return err