internal/links: improve links parser, no protocol specification

The existing implementation has no consideration of links with no
protocol specification, so "example.com/comments" now it's trated as
"https://example.com/comments"

"Fixes golang/go#33505"

Corrects the regexp definition

Change-Id: I587d611f26a3f3c5ea89eda7b2c3ccf369e8bb2f
GitHub-Last-Rev: 740ffca04dd16b36a96f03781d58ff727e39ae79
GitHub-Pull-Request: golang/tools#154
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194661
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/internal/lsp/link.go b/internal/lsp/link.go
index 86e6084..90d152f 100644
--- a/internal/lsp/link.go
+++ b/internal/lsp/link.go
@@ -91,13 +91,15 @@
 	if err != nil {
 		return nil, errors.Errorf("cannot create regexp for links: %s", err.Error())
 	}
-	for _, urlIndex := range re.FindAllIndex([]byte(src), -1) {
+	indexUrl := re.FindAllIndex([]byte(src), -1)
+	for _, urlIndex := range indexUrl {
+		var target string
 		start := urlIndex[0]
 		end := urlIndex[1]
 		startPos := token.Pos(int(pos) + start)
 		endPos := token.Pos(int(pos) + end)
-		target := src[start:end]
-		l, err := toProtocolLink(view, mapper, target, startPos, endPos)
+	        target = src[start:end]
+	        l, err := toProtocolLink(view, mapper, target, startPos, endPos)
 		if err != nil {
 			return nil, err
 		}
@@ -106,7 +108,7 @@
 	return links, nil
 }
 
-const urlRegexpString = "(http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?"
+const urlRegexpString = "((http|ftp|https)://)?([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?"
 
 var (
 	urlRegexp  *regexp.Regexp