Skip to content

Commit 88041c7

Browse files
committed
cmd/relnote: remove dead code
For golang/go#64169. Change-Id: I838a45104af33a973f2a3742eda2045386e9b66d Reviewed-on: https://go-review.googlesource.com/c/build/+/584301 Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent f5330cc commit 88041c7

File tree

1 file changed

+0
-111
lines changed

1 file changed

+0
-111
lines changed

cmd/relnote/relnote.go

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -12,76 +12,14 @@ import (
1212
"fmt"
1313
"log"
1414
"os"
15-
"path"
1615
"path/filepath"
1716
"regexp"
1817
"runtime"
19-
"strings"
2018
"time"
21-
22-
"golang.org/x/build/maintner"
23-
"golang.org/x/build/repos"
2419
)
2520

2621
var verbose = flag.Bool("v", false, "print verbose logging")
2722

28-
// change is a change that was noted via a RELNOTE= comment.
29-
type change struct {
30-
CL *maintner.GerritCL
31-
Note string // the part after RELNOTE=
32-
Issue *maintner.GitHubIssue
33-
}
34-
35-
func (c change) ID() string {
36-
switch {
37-
default:
38-
panic("invalid change")
39-
case c.CL != nil:
40-
return fmt.Sprintf("CL %d", c.CL.Number)
41-
case c.Issue != nil:
42-
return fmt.Sprintf("https://go.dev/issue/%d", c.Issue.Number)
43-
}
44-
}
45-
46-
func (c change) URL() string {
47-
switch {
48-
default:
49-
panic("invalid change")
50-
case c.CL != nil:
51-
return fmt.Sprint("https://go.dev/cl/", c.CL.Number)
52-
case c.Issue != nil:
53-
return fmt.Sprint("https://go.dev/issue/", c.Issue.Number)
54-
}
55-
}
56-
57-
func (c change) Subject() string {
58-
switch {
59-
default:
60-
panic("invalid change")
61-
case c.CL != nil:
62-
subj := c.CL.Subject()
63-
subj = strings.TrimPrefix(subj, clPackage(c.CL)+":")
64-
return strings.TrimSpace(subj)
65-
case c.Issue != nil:
66-
return issueSubject(c.Issue)
67-
}
68-
}
69-
70-
func (c change) TextLine() string {
71-
switch {
72-
default:
73-
panic("invalid change")
74-
case c.CL != nil:
75-
subj := c.CL.Subject()
76-
if c.Note != "yes" && c.Note != "y" {
77-
subj += "; " + c.Note
78-
}
79-
return subj
80-
case c.Issue != nil:
81-
return issueSubject(c.Issue)
82-
}
83-
}
84-
8523
func usage() {
8624
out := flag.CommandLine.Output()
8725
fmt.Fprintf(out, "usage:\n")
@@ -141,52 +79,3 @@ func main() {
14179
log.Fatal("missing subcommand")
14280
}
14381
}
144-
145-
// packagePrefix returns the package prefix at the start of s.
146-
// For example packagePrefix("net/http: add HTTP 5 support") == "net/http".
147-
// If there's no package prefix, packagePrefix returns "".
148-
func packagePrefix(s string) string {
149-
i := strings.Index(s, ":")
150-
if i < 0 {
151-
return ""
152-
}
153-
s = s[:i]
154-
if strings.Trim(s, "abcdefghijklmnopqrstuvwxyz0123456789/") != "" {
155-
return ""
156-
}
157-
return s
158-
}
159-
160-
// clPackage returns the package import path from the CL's commit message,
161-
// or "??" if it's formatted unconventionally.
162-
func clPackage(cl *maintner.GerritCL) string {
163-
pkg := packagePrefix(cl.Subject())
164-
if pkg == "" {
165-
return "??"
166-
}
167-
if r := repos.ByGerritProject[cl.Project.Project()]; r == nil {
168-
return "??"
169-
} else {
170-
pkg = path.Join(r.ImportPath, pkg)
171-
}
172-
return pkg
173-
}
174-
175-
// issuePackage returns the package import path from the issue's title,
176-
// or "??" if it's formatted unconventionally.
177-
func issuePackage(issue *maintner.GitHubIssue) string {
178-
pkg := packagePrefix(issue.Title)
179-
if pkg == "" {
180-
return "??"
181-
}
182-
return pkg
183-
}
184-
185-
// issueSubject returns the issue's title with the package prefix removed.
186-
func issueSubject(issue *maintner.GitHubIssue) string {
187-
pkg := packagePrefix(issue.Title)
188-
if pkg == "" {
189-
return issue.Title
190-
}
191-
return strings.TrimSpace(strings.TrimPrefix(issue.Title, pkg+":"))
192-
}

0 commit comments

Comments
 (0)