From d7ca2b113badd731a5122e9fa31a887e26100568 Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Wed, 15 Jun 2016 22:27:57 +0900 Subject: [PATCH] #136 fix links when package is a sub-dir package --- check/utils.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/check/utils.go b/check/utils.go index e7bd2e2..f904485 100644 --- a/check/utils.go +++ b/check/utils.go @@ -149,7 +149,10 @@ outer: pkg = strings.Split(base, "/")[2] } fileURL = fmt.Sprintf("https://github.com/golang/%s/blob/master%s", pkg, strings.TrimPrefix(filename, "/"+base)) - default: + case strings.HasPrefix(base, "github.com/"): + if len(strings.Split(base, "/")) == 4 { + base = strings.Join(strings.Split(base, "/")[0:3], "/") + } fileURL = fmt.Sprintf("https://%s/blob/master%s", base, strings.TrimPrefix(filename, "/"+base)) } fs := fsMap[filename]