prefixtitle: dmitri.shuralyov.com/go/prefixtitle Index | Files

package prefixtitle

import "dmitri.shuralyov.com/go/prefixtitle"

Package prefixtitle parses prefixed issue and change titles for Go packages.

It uses the conventions set by the Go project. These conventions are documented on https://golang.org/wiki/HandlingIssues, https://golang.org/wiki/Gardening, https://golang.org/wiki/CommitMessage, and https://golang.org/wiki/MinorReleases wiki pages.

Index

Package Files

parse.go

func ParseChange Uses

func ParseChange(module, prefixedTitle string) (paths []string, title string)

ParseChange parses a prefixed change title. It returns 1 or more paths from the prefix joined with module, and the remaining change title. It does not try to verify whether each path is an existing Go package.

The value of module is expected to be the empty string for CLs in the "go.googlesource.com/go" repository and PRs in its "github.com/golang/go" GitHub mirror. It should be the module path for all other repositories.

Supported forms include:

"",    "import/path: change title"   -> ["import/path"],            "change title"
"",    "path1, path2: change title"  -> ["path1", "path2"],         "change title"  # Multiple comma-separated paths.
"mod", "import/path: change title"   -> ["mod/import/path"],        "change title"
"mod", "path1, path2: change title"  -> ["mod/path1", "mod/path2"], "change title"  # Multiple comma-separated paths.

If there's no path prefix (preceded by ": "), prefixedTitle is returned unmodified:

"",    "change title"                -> [""],    "change title"
"mod", "change title"                -> ["mod"], "change title"

If there's a branch prefix in square brackets, title is returned with said prefix:

"",    "[branch] path: change title" -> ["path"],     "[branch] change title"
"mod", "[branch] path: change title" -> ["mod/path"], "[branch] change title"

func ParseIssue Uses

func ParseIssue(module, prefixedTitle string) (paths []string, title string)

ParseIssue parses a prefixed issue title. It returns 1 or more paths from the prefix joined with module, and the remaining issue title. It does not try to verify whether each path is an existing Go package.

The value of module is expected to be the empty string for issues in the "github.com/golang/go" repository. It should be the module path for all other repositories.

Supported forms include:

"",    "import/path: issue title"    -> ["import/path"],            "issue title"
"",    "proposal: path: issue title" -> ["path"],                   "issue title"  # Proposal.
"",    "Proposal: path: issue title" -> ["path"],                   "issue title"  # Proposal.
"",    "x/path: issue title"         -> ["golang.org/x/path"],      "issue title"  # "x/..." refers to "golang.org/x/...".
"",    "path1, path2: issue title"   -> ["path1", "path2"],         "issue title"  # Multiple comma-separated paths.
"mod", "import/path: issue title"    -> ["mod/import/path"],        "issue title"
"mod", "path1, path2: issue title"   -> ["mod/path1", "mod/path2"], "issue title"  # Multiple comma-separated paths.

If there's no path prefix (preceded by ": "), prefixedTitle is returned unmodified:

"",    "issue title"                 -> [""],    "issue title"
"mod", "issue title"                 -> ["mod"], "issue title"

Package prefixtitle imports 2 packages (graph) and is imported by 2 packages. Updated 2019-07-19. Refresh now. Tools for package owners.