internal/worker: modify issue template

The issue template is changed to:

- Do not quote the module path in the title
- Put the last sentence on the same line
- Add commit and PR links to the intro paragraph, so that they are clickable

Change-Id: Ie58a0582f80c75b024358bca7ecedb78870e2fbb
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/376474
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/internal/worker/worker.go b/internal/worker/worker.go
index baf3188..b839547 100644
--- a/internal/worker/worker.go
+++ b/internal/worker/worker.go
@@ -211,7 +211,7 @@
 
 		// Create the issue.
 		iss := &issues.Issue{
-			Title: fmt.Sprintf("x/vulndb: potential Go vuln in %q: %s", cr.Module, cr.ID),
+			Title: fmt.Sprintf("x/vulndb: potential Go vuln in %s: %s", cr.Module, cr.ID),
 			Body:  body,
 		}
 		if err := issueRateLimiter.Wait(ctx); err != nil {
@@ -224,7 +224,7 @@
 		// If we crashed here, we would have filed an issue without recording
 		// that fact in the DB. That can lead to duplicate issues, but nothing
 		// worse (we won't miss a CVE).
-		// TODO(golang/go#49733): look for the issue title to avoid duplications.
+		// TODO(https://go.dev/issue/49733): look for the issue title to avoid duplications.
 		ref := ic.Reference(num)
 		log.With("CVE", cr.ID).Infof(ctx, "created issue %s for %s", ref, cr.ID)
 
@@ -262,10 +262,18 @@
 	if err != nil {
 		return "", err
 	}
+
+	intro := fmt.Sprintf(
+		"In [%s](%s/tree/%s/%s), the reference URL [%s](%s) (and possibly others) refers to something in Go.",
+		cr.ID, cvelistrepo.URL, cr.CommitHash, cr.Path, cr.Module, cr.Module)
+	if r.Links.Commit != "" {
+		intro += fmt.Sprintf("\n- Commit: %s", r.Links.Commit)
+	}
+	if r.Links.PR != "" {
+		intro += fmt.Sprintf("\n- PR: %s", r.Links.PR)
+	}
 	if err := issueTemplate.Execute(&b, issueTemplateData{
-		Heading: fmt.Sprintf(
-			"In [%s](%s/tree/%s/%s), the reference URL [%s](%s) (and possibly others) refers to something in Go.",
-			cr.ID, cvelistrepo.URL, cr.CommitHash, cr.Path, cr.Module, cr.Module),
+		Intro:  intro,
 		Report: string(out),
 		Pre:    "```",
 	}); err != nil {
@@ -275,19 +283,18 @@
 }
 
 type issueTemplateData struct {
-	Heading string
-	Report  string
-	Pre     string // markdown string for a <pre> block
+	Intro  string
+	Report string
+	Pre    string // markdown string for a <pre> block
 	*store.CVERecord
 }
 
 var issueTemplate = template.Must(template.New("issue").Parse(`
-{{- .Heading}}
+{{- .Intro}}
 
 {{.Pre}}
 {{.Report}}
 {{.Pre}}
 
-See [doc/triage.md](https://github.com/golang/vulndb/blob/master/doc/triage.md)
-for instructions on how to triage this report.
+See [doc/triage.md](https://github.com/golang/vulndb/blob/master/doc/triage.md) for instructions on how to triage this report.
 `))
diff --git a/internal/worker/worker_test.go b/internal/worker/worker_test.go
index 5c1a3cb..f10fbfd 100644
--- a/internal/worker/worker_test.go
+++ b/internal/worker/worker_test.go
@@ -185,8 +185,7 @@
 
 ` + "```" + `
 
-See [doc/triage.md](https://github.com/golang/vulndb/blob/master/doc/triage.md)
-for instructions on how to triage this report.
+See [doc/triage.md](https://github.com/golang/vulndb/blob/master/doc/triage.md) for instructions on how to triage this report.
 `
 	if diff := cmp.Diff(unindent(want), got); diff != "" {
 		t.Errorf("mismatch (-want, +got):\n%s", diff)