File: 0005-Disable_static.go.patch

package info (click to toggle)
golang-golang-x-tools 1%3A0.0~git20190125.d66bd3c%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports
  • size: 8,912 kB
  • sloc: asm: 1,394; yacc: 155; makefile: 109; sh: 108; ansic: 17; xml: 11
file content (96 lines) | stat: -rw-r--r-- 3,083 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Description: Disable embedding static files into binaries
 This path is debian-specific, hence this patch cannot go upstream.
Author: Martín Ferrari <tincho@debian.org>
Last-Updated: 2016-10-31
Forwarded: no

---

--- a/cmd/godoc/main.go
+++ b/cmd/godoc/main.go
@@ -38,10 +38,8 @@
 
 	"golang.org/x/tools/godoc"
 	"golang.org/x/tools/godoc/analysis"
-	"golang.org/x/tools/godoc/static"
 	"golang.org/x/tools/godoc/vfs"
 	"golang.org/x/tools/godoc/vfs/gatefs"
-	"golang.org/x/tools/godoc/vfs/mapfs"
 	"golang.org/x/tools/godoc/vfs/zipfs"
 )
 
@@ -192,11 +190,10 @@
 		defer rc.Close() // be nice (e.g., -writeIndex mode)
 		fs.Bind("/", zipfs.New(rc, *zipfile), *goroot, vfs.BindReplace)
 	}
-	if *templateDir != "" {
-		fs.Bind("/lib/godoc", vfs.OS(*templateDir), "/", vfs.BindBefore)
-	} else {
-		fs.Bind("/lib/godoc", mapfs.New(static.Files), "/", vfs.BindReplace)
+	if *templateDir == "" {
+		*templateDir = "/usr/share/golang-golang-x-tools/godoc/static"
 	}
+	fs.Bind("/lib/godoc", vfs.OS(*templateDir), "/", vfs.BindReplace)
 
 	// Bind $GOPATH trees into Go root.
 	for _, p := range filepath.SplitList(build.Default.GOPATH) {
--- a/cmd/present/play.go
+++ b/cmd/present/play.go
@@ -14,7 +14,6 @@
 	"runtime"
 	"time"
 
-	"golang.org/x/tools/godoc/static"
 	"golang.org/x/tools/playground/socket"
 	"golang.org/x/tools/present"
 
@@ -35,10 +34,6 @@
 	modTime := time.Now()
 	var buf bytes.Buffer
 	for _, p := range scripts {
-		if s, ok := static.Files[p]; ok {
-			buf.WriteString(s)
-			continue
-		}
 		b, err := ioutil.ReadFile(filepath.Join(root, "static", p))
 		if err != nil {
 			panic(err)
--- a/cmd/godoc/appinit.go
+++ b/cmd/godoc/appinit.go
@@ -26,7 +26,6 @@
 	"golang.org/x/tools/godoc/proxy"
 	"golang.org/x/tools/godoc/redirect"
 	"golang.org/x/tools/godoc/short"
-	"golang.org/x/tools/godoc/static"
 	"golang.org/x/tools/godoc/vfs"
 	"golang.org/x/tools/godoc/vfs/gatefs"
 	"golang.org/x/tools/godoc/vfs/mapfs"
@@ -72,7 +71,7 @@
 		fs.Bind("/", rootfs, "/", vfs.BindReplace)
 	}
 
-	fs.Bind("/lib/godoc", mapfs.New(static.Files), "/", vfs.BindReplace)
+	fs.Bind("/lib/godoc", vfs.OS("/usr/share/golang-golang-x-tools/godoc/"), "/", vfs.BindReplace)
 
 	corpus := godoc.NewCorpus(fs)
 	corpus.Verbose = false
--- a/cmd/godoc/godoc_test.go
+++ b/cmd/godoc/godoc_test.go
@@ -155,7 +155,7 @@
 	bin, cleanup := buildGodoc(t)
 	defer cleanup()
 	addr := serverAddress(t)
-	args := []string{fmt.Sprintf("-http=%s", addr)}
+	args := []string{fmt.Sprintf("-http=%s", addr), "-templates=../../godoc/static"}
 	if withIndex {
 		args = append(args, "-index", "-index_interval=-1s")
 	}
@@ -379,7 +379,7 @@
 	bin, cleanup := buildGodoc(t)
 	defer cleanup()
 	addr := serverAddress(t)
-	cmd := exec.Command(bin, fmt.Sprintf("-http=%s", addr), "-analysis=type")
+	cmd := exec.Command(bin, fmt.Sprintf("-http=%s", addr), "-analysis=type", "-templates=../../godoc/static")
 	cmd.Env = os.Environ()
 	cmd.Env = append(cmd.Env, fmt.Sprintf("GOROOT=%s", filepath.Join(tmpdir, "goroot")))
 	cmd.Env = append(cmd.Env, fmt.Sprintf("GOPATH=%s", filepath.Join(tmpdir, "gopath")))