File: 0010-Workaround_missing_api_symlink.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 (32 lines) | stat: -rw-r--r-- 1,047 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
Description: golang-1.11-src is missing a symlink providing API compatibility
 info (#899298). Add a hardcoded workaround until that bug is fixed.

 This path is debian-specific, hence this patch cannot go upstream.
Author: Martín Ferrari <tincho@debian.org>
Last-Updated: 2019-01-27
Forwarded: no

--- a/godoc/versions.go
+++ b/godoc/versions.go
@@ -202,13 +202,17 @@
 }
 
 func parsePackageAPIInfo() (apiVersions, error) {
-	var apiGlob string
+	var apiPath string
 	if os.Getenv("GOROOT") == "" {
-		apiGlob = filepath.Join(build.Default.GOROOT, "api", "go*.txt")
+		apiPath = filepath.Join(build.Default.GOROOT, "api")
 	} else {
-		apiGlob = filepath.Join(os.Getenv("GOROOT"), "api", "go*.txt")
+		apiPath = filepath.Join(os.Getenv("GOROOT"), "api")
 	}
-
+	// Workaround until Debian bug #899298 is fixed.
+	if _, err := os.Stat(apiPath); err != nil {
+		apiPath = filepath.Join("/", "usr", "share", "go", "api")
+	}
+	apiGlob := filepath.Join(apiPath, "go*.txt")
 	files, err := filepath.Glob(apiGlob)
 	if err != nil {
 		return nil, err