File: 0003-Disable-static-files-for-present-cmd.patch

package info (click to toggle)
golang-golang-x-tools 1%3A0.1.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,588 kB
  • sloc: javascript: 2,011; asm: 1,458; sh: 174; yacc: 155; makefile: 21; ansic: 17
file content (62 lines) | stat: -rw-r--r-- 1,613 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
From: Michael Stapelberg <stapelberg@debian.org>
Date: Tue, 17 Nov 2020 02:14:58 +0800
Subject: Disable static files for present cmd

This path is debian-specific, hence this patch cannot go upstream.

Forwarded: not-needed
---
 cmd/present/main.go | 9 +--------
 cmd/present/play.go | 5 -----
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/cmd/present/main.go b/cmd/present/main.go
index cc04c46..d7f5f05 100644
--- a/cmd/present/main.go
+++ b/cmd/present/main.go
@@ -7,7 +7,6 @@ package main
 import (
 	"flag"
 	"fmt"
-	"go/build"
 	"log"
 	"net"
 	"net/http"
@@ -51,13 +50,7 @@ func main() {
 	}
 
 	if *basePath == "" {
-		p, err := build.Default.Import(basePkg, "", build.FindOnly)
-		if err != nil {
-			fmt.Fprintf(os.Stderr, "Couldn't find gopresent files: %v\n", err)
-			fmt.Fprintf(os.Stderr, basePathMessage, basePkg)
-			os.Exit(1)
-		}
-		*basePath = p.Dir
+		*basePath = "/usr/share/golang-golang-x-tools/present"
 	}
 	err := initTemplates(*basePath)
 	if err != nil {
diff --git a/cmd/present/play.go b/cmd/present/play.go
index 6650b94..011f1fc 100644
--- a/cmd/present/play.go
+++ b/cmd/present/play.go
@@ -14,7 +14,6 @@ import (
 	"runtime"
 	"time"
 
-	"golang.org/x/tools/godoc/static"
 	"golang.org/x/tools/playground/socket"
 	"golang.org/x/tools/present"
 
@@ -35,10 +34,6 @@ func playScript(root, transport string) {
 	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)