aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/next/3-tools.md5
-rw-r--r--src/cmd/go/alldocs.go5
-rw-r--r--src/cmd/go/internal/help/helpdoc.go3
-rw-r--r--src/cmd/go/internal/load/pkg.go2
-rw-r--r--src/cmd/go/internal/modfetch/codehost/git_test.go2
-rw-r--r--src/cmd/go/internal/modfetch/codehost/vcs.go86
-rw-r--r--src/cmd/go/internal/modfetch/zip_sum_test/testdata/zip_sums.csv1
-rw-r--r--src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go1
-rw-r--r--src/cmd/go/internal/modget/get.go2
-rw-r--r--src/cmd/go/internal/vcs/vcs.go119
-rw-r--r--src/cmd/go/internal/vcs/vcs_test.go8
-rw-r--r--src/cmd/go/internal/vcweb/bzr.go18
-rw-r--r--src/cmd/go/internal/vcweb/script.go18
-rw-r--r--src/cmd/go/internal/vcweb/vcweb.go3
-rw-r--r--src/cmd/go/scriptconds_test.go12
-rw-r--r--src/cmd/go/testdata/script/README2
-rw-r--r--src/cmd/go/testdata/script/govcs.txt6
-rw-r--r--src/cmd/go/testdata/script/mod_vcs_missing.txt27
-rw-r--r--src/cmd/go/testdata/script/test_multivcs.txt54
-rw-r--r--src/cmd/go/testdata/script/version_buildvcs_bzr.txt129
-rw-r--r--src/cmd/go/testdata/vcstest/bzr/hello.txt34
21 files changed, 17 insertions, 520 deletions
diff --git a/doc/next/3-tools.md b/doc/next/3-tools.md
index 24efd93000..06c74b37fa 100644
--- a/doc/next/3-tools.md
+++ b/doc/next/3-tools.md
@@ -13,5 +13,10 @@ This reports the use of standard library symbols that are too new
for the Go version in force in the referring file,
as determined by `go` directive in `go.mod` and build tags on the file.
+<!-- go.dev/issue/78090 -->
+
+The `go` command no longer has support for the bzr version control system.
+It will no longer be able to directly fetch modules hosted on bzr servers.
+
### Cgo {#cgo}
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 8ded045369..3378968ac9 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -3022,7 +3022,6 @@
// using the named version control system, and then the path inside
// that repository. The supported version control systems are:
//
-// Bazaar .bzr
// Fossil .fossil
// Git .git
// Mercurial .hg
@@ -3072,7 +3071,7 @@
// In particular, it should appear before any raw JavaScript or CSS,
// to avoid confusing the go command's restricted parser.
//
-// The vcs is one of "bzr", "fossil", "git", "hg", "svn".
+// The vcs is one of "fossil", "git", "hg", "svn".
//
// The repo-root is the root of the version control system
// containing a scheme and not containing a .vcs qualifier.
@@ -3711,7 +3710,7 @@
//
// To balance the functionality and security concerns, the go command
// by default will only use git and hg to download code from public servers.
-// But it will use any known version control system (bzr, fossil, git, hg, svn)
+// But it will use any known version control system (fossil, git, hg, svn)
// to download code from private servers, defined as those hosting packages
// matching the GOPRIVATE variable (see 'go help private'). The rationale behind
// allowing only Git and Mercurial is that these two systems have had the most
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index 4b1444ee3b..4f76f7f9c1 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -293,7 +293,6 @@ specifies the given repository, with or without the .vcs suffix,
using the named version control system, and then the path inside
that repository. The supported version control systems are:
- Bazaar .bzr
Fossil .fossil
Git .git
Mercurial .hg
@@ -343,7 +342,7 @@ The meta tag should appear as early in the file as possible.
In particular, it should appear before any raw JavaScript or CSS,
to avoid confusing the go command's restricted parser.
-The vcs is one of "bzr", "fossil", "git", "hg", "svn".
+The vcs is one of "fossil", "git", "hg", "svn".
The repo-root is the root of the version control system
containing a scheme and not containing a .vcs qualifier.
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index f40de7fe12..91282ef9ac 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -2299,6 +2299,8 @@ func isBadEmbedName(name string) bool {
case "":
return true
// Version control directories won't be present in module.
+ // TODO(matloob): Keep .bzr for now since we previously disallowed it
+ // even though bzr is no longer supported.
case ".bzr", ".hg", ".git", ".svn":
return true
}
diff --git a/src/cmd/go/internal/modfetch/codehost/git_test.go b/src/cmd/go/internal/modfetch/codehost/git_test.go
index 1c950686bf..8ea3f9157c 100644
--- a/src/cmd/go/internal/modfetch/codehost/git_test.go
+++ b/src/cmd/go/internal/modfetch/codehost/git_test.go
@@ -44,7 +44,7 @@ var altRepos = func() []string {
}
}
-// TODO: Convert gitrepo1 to svn, bzr, fossil and add tests.
+// TODO: Convert gitrepo1 to svn and fossil and add tests.
// For now, at least the hgrepo1 tests check the general vcs.go logic.
// localGitRepo is like gitrepo1 but allows archive access
diff --git a/src/cmd/go/internal/modfetch/codehost/vcs.go b/src/cmd/go/internal/modfetch/codehost/vcs.go
index dacda2c8b2..0ca1bd1dcb 100644
--- a/src/cmd/go/internal/modfetch/codehost/vcs.go
+++ b/src/cmd/go/internal/modfetch/codehost/vcs.go
@@ -266,36 +266,6 @@ var vcsCmds = map[string]*vcsCmd{
doReadZip: svnReadZip,
},
- "bzr": {
- vcs: "bzr",
- init: func(remote string) []string {
- return []string{"bzr", "branch", "--use-existing-dir", "--", remote, "."}
- },
- fetch: []string{
- "bzr", "pull", "--overwrite-tags",
- },
- tags: func(remote string) []string {
- return []string{"bzr", "tags"}
- },
- tagRE: re(`(?m)^\S+`),
- badLocalRevRE: re(`^revno:-`),
- statLocal: func(rev, remote string) []string {
- return []string{"bzr", "log", "-l1", "--long", "--show-ids", fmt.Sprintf("--revision=%s", rev)}
- },
- parseStat: bzrParseStat,
- latest: "revno:-1",
- readFile: func(rev, file, remote string) []string {
- return []string{"bzr", "cat", fmt.Sprintf("--revision=%s", rev), "--", file}
- },
- readZip: func(rev, subdir, remote, target string) []string {
- extra := []string{}
- if subdir != "" {
- extra = []string{"./" + subdir}
- }
- return str.StringList("bzr", "export", "--format=zip", fmt.Sprintf("--revision=%s", rev), "--root=prefix/", "--", target, extra)
- },
- },
-
"fossil": {
vcs: "fossil",
init: func(remote string) []string {
@@ -734,62 +704,6 @@ func hgParseStat(rev, out string) (*RevInfo, error) {
return info, nil
}
-func bzrParseStat(rev, out string) (*RevInfo, error) {
- var revno int64
- var tm time.Time
- var tags []string
- for line := range strings.SplitSeq(out, "\n") {
- if line == "" || line[0] == ' ' || line[0] == '\t' {
- // End of header, start of commit message.
- break
- }
- if line[0] == '-' {
- continue
- }
- before, after, found := strings.Cut(line, ":")
- if !found {
- // End of header, start of commit message.
- break
- }
- key, val := before, strings.TrimSpace(after)
- switch key {
- case "revno":
- if j := strings.Index(val, " "); j >= 0 {
- val = val[:j]
- }
- i, err := strconv.ParseInt(val, 10, 64)
- if err != nil {
- return nil, vcsErrorf("unexpected revno from bzr log: %q", line)
- }
- revno = i
- case "timestamp":
- j := strings.Index(val, " ")
- if j < 0 {
- return nil, vcsErrorf("unexpected timestamp from bzr log: %q", line)
- }
- t, err := time.Parse("2006-01-02 15:04:05 -0700", val[j+1:])
- if err != nil {
- return nil, vcsErrorf("unexpected timestamp from bzr log: %q", line)
- }
- tm = t.UTC()
- case "tags":
- tags = strings.Split(val, ", ")
- }
- }
- if revno == 0 || tm.IsZero() {
- return nil, vcsErrorf("unexpected response from bzr log: %q", out)
- }
-
- info := &RevInfo{
- Name: strconv.FormatInt(revno, 10),
- Short: fmt.Sprintf("%012d", revno),
- Time: tm,
- Version: rev,
- Tags: tags,
- }
- return info, nil
-}
-
func fossilParseStat(rev, out string) (*RevInfo, error) {
for line := range strings.SplitSeq(out, "\n") {
if strings.HasPrefix(line, "uuid:") || strings.HasPrefix(line, "hash:") {
diff --git a/src/cmd/go/internal/modfetch/zip_sum_test/testdata/zip_sums.csv b/src/cmd/go/internal/modfetch/zip_sum_test/testdata/zip_sums.csv
index 0906975f55..adc692e35a 100644
--- a/src/cmd/go/internal/modfetch/zip_sum_test/testdata/zip_sums.csv
+++ b/src/cmd/go/internal/modfetch/zip_sum_test/testdata/zip_sums.csv
@@ -2076,7 +2076,6 @@ k8s.io/node-api,v0.0.0-20191025232816-761e5a80fde0,h1:V3FaBxwSQWPjPScXd5ioFx9+aR
k8s.io/sample-apiserver,v0.0.0-20191030110742-cbfc6c263d7e,h1:9bsKcUCncu1Qg3A4pB5ZySTM0JMEZW4qgybjVhmaS4A=,91d701af12da2ff6cde6f07d53547885faafa32c2eadfa8d4614b4d814a854b9
k8s.io/sample-controller,v0.0.0-20191025231305-d7b8b8302943,h1:ZYb6if7+Qa5kXFidUsQRLFDyZjCjRyG1sFf6GpZaA70=,07c3e3a95d0fac07a247a98c38448a8fc4ab0069ad599ec06ac9405df88b470b
k8s.io/utils,v0.0.0-20191030222137-2b95a09bc58d,h1:1P0iBJsBzxRmR+dIFnM+Iu4aLxnoa7lBqozW/0uHbT8=,e21be6d971127d4650bd13525a2d2627b2a98dbb8589f168b734a45d50f3ea22
-launchpad.net/gocheck,v0.0.0-20140225173054-000000000087,h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54=,1a1d9b10f2c69564e69993e4340d5299392a518d895ec06502e842e6c69f4857
layeh.com/radius,v0.0.0-20190322222518-890bc1058917,h1:BDXFaFzUt5EIqe/4wrTc4AcYZWP6iC6Ult+jQWLh5eU=,5eb6b6a05a5f89bc114f37085deda268f895a46621aee2e36649b8d80061357e
leb.io/aeshash,v0.0.0-20190627052759-9e6b40329b3b,h1:MG17Tc0pA3XmFTsPwklMMEfcos3pTFnVYM4A0YfVSbU=,a78b48ac18e98ea68dacce16cd94c9074688a0b125f824f047313a33b264ea88
leb.io/hashland,v0.0.0-20171003003232-07375b562dea,h1:s9IkzZTqYqw77voO6taUZHc0C1B096h4T/kQtujGApE=,0698177f24cbde0a7b45495e7fe976fe7623f2b9205995b7d91fd2e7b0f0e243
diff --git a/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go b/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go
index 6b2312cbed..9a7d79c140 100644
--- a/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go
+++ b/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go
@@ -66,7 +66,6 @@ func TestZipSums(t *testing.T) {
testenv.MustHaveGoBuild(t)
testenv.MustHaveExternalNetwork(t)
- testenv.MustHaveExecPath(t, "bzr")
testenv.MustHaveExecPath(t, "git")
// TODO(jayconrod): add hg, svn, and fossil modules to testdata.
// Could not find any for now.
diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go
index 089ce6a2bd..37f0a6eb94 100644
--- a/src/cmd/go/internal/modget/get.go
+++ b/src/cmd/go/internal/modget/get.go
@@ -142,7 +142,7 @@ way to cause the invoked version control command to run unintended code.
To balance the functionality and security concerns, the go command
by default will only use git and hg to download code from public servers.
-But it will use any known version control system (bzr, fossil, git, hg, svn)
+But it will use any known version control system (fossil, git, hg, svn)
to download code from private servers, defined as those hosting packages
matching the GOPRIVATE variable (see 'go help private'). The rationale behind
allowing only Git and Mercurial is that these two systems have had the most
diff --git a/src/cmd/go/internal/vcs/vcs.go b/src/cmd/go/internal/vcs/vcs.go
index 32525946bb..d81e617626 100644
--- a/src/cmd/go/internal/vcs/vcs.go
+++ b/src/cmd/go/internal/vcs/vcs.go
@@ -72,7 +72,6 @@ var (
var defaultSecureScheme = map[string]bool{
"https": true,
"git+ssh": true,
- "bzr+ssh": true,
"svn+ssh": true,
"ssh": true,
}
@@ -122,7 +121,6 @@ var vcsList = []*Cmd{
vcsHg,
vcsGit,
vcsSvn,
- vcsBzr,
vcsFossil,
}
@@ -131,7 +129,7 @@ var vcsList = []*Cmd{
var vcsMod = &Cmd{Name: "mod"}
// vcsByCmd returns the version control system for the given
-// command name (hg, git, svn, bzr).
+// command name (hg, git, svn).
func vcsByCmd(cmd string) *Cmd {
for _, vcs := range vcsList {
if vcs.Cmd == cmd {
@@ -258,76 +256,6 @@ func gitStatus(vcsGit *Cmd, rootDir string) (Status, error) {
}, nil
}
-// vcsBzr describes how to use Bazaar.
-var vcsBzr = &Cmd{
- Name: "Bazaar",
- Cmd: "bzr",
- Roots: []isVCSRoot{
- vcsDirRoot(".bzr"),
- },
-
- Scheme: []string{"https", "http", "bzr", "bzr+ssh"},
- PingCmd: "info -- {scheme}://{repo}",
- Status: bzrStatus,
-}
-
-func bzrStatus(vcsBzr *Cmd, rootDir string) (Status, error) {
- outb, err := vcsBzr.runOutputVerboseOnly(rootDir, "version-info")
- if err != nil {
- return Status{}, err
- }
- out := string(outb)
-
- // Expect (non-empty repositories only):
- //
- // revision-id: gopher@gopher.net-20211021072330-qshok76wfypw9lpm
- // date: 2021-09-21 12:00:00 +1000
- // ...
- var rev string
- var commitTime time.Time
-
- for line := range strings.SplitSeq(out, "\n") {
- i := strings.IndexByte(line, ':')
- if i < 0 {
- continue
- }
- key := line[:i]
- value := strings.TrimSpace(line[i+1:])
-
- switch key {
- case "revision-id":
- rev = value
- case "date":
- var err error
- commitTime, err = time.Parse("2006-01-02 15:04:05 -0700", value)
- if err != nil {
- return Status{}, errors.New("unable to parse output of bzr version-info")
- }
- }
- }
-
- outb, err = vcsBzr.runOutputVerboseOnly(rootDir, "status")
- if err != nil {
- return Status{}, err
- }
-
- // Skip warning when working directory is set to an older revision.
- if bytes.HasPrefix(outb, []byte("working tree is out of date")) {
- i := bytes.IndexByte(outb, '\n')
- if i < 0 {
- i = len(outb)
- }
- outb = outb[:i]
- }
- uncommitted := len(outb) > 0
-
- return Status{
- Revision: rev,
- CommitTime: commitTime,
- Uncommitted: uncommitted,
- }, nil
-}
-
// vcsSvn describes how to use Subversion.
var vcsSvn = &Cmd{
Name: "Subversion",
@@ -859,13 +787,6 @@ func RepoRootForImportPath(importPath string, mod ModuleMode, security web.Secur
err = importErrorf(importPath, "unrecognized import path %q: %v", importPath, err)
}
}
- if err != nil {
- rr1, err1 := repoRootFromVCSPaths(importPath, security, vcsPathsAfterDynamic)
- if err1 == nil {
- rr = rr1
- err = nil
- }
- }
// Should have been taken care of above, but make sure.
if err == nil && strings.Contains(importPath, "...") && strings.Contains(rr.Root, "...") {
@@ -1377,26 +1298,11 @@ var vcsPaths = []*vcsPath{
// General syntax for any server.
// Must be last.
{
- regexp: lazyregexp.New(`(?P<root>(?P<repo>([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[\w.\-]+)+?)\.(?P<vcs>bzr|fossil|git|hg|svn))(/~?[\w.\-]+)*$`),
+ regexp: lazyregexp.New(`(?P<root>(?P<repo>([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[\w.\-]+)+?)\.(?P<vcs>fossil|git|hg|svn))(/~?[\w.\-]+)*$`),
schemelessRepo: true,
},
}
-// vcsPathsAfterDynamic gives additional vcsPaths entries
-// to try after the dynamic HTML check.
-// This gives those sites a chance to introduce <meta> tags
-// as part of a graceful transition away from the hard-coded logic.
-var vcsPathsAfterDynamic = []*vcsPath{
- // Launchpad. See golang.org/issue/11436.
- {
- pathPrefix: "launchpad.net",
- regexp: lazyregexp.New(`^(?P<root>launchpad\.net/((?P<project>[\w.\-]+)(?P<series>/[\w.\-]+)?|~[\w.\-]+/(\+junk|[\w.\-]+)/[\w.\-]+))(/[\w.\-]+)*$`),
- vcs: "bzr",
- repo: "https://{root}",
- check: launchpadVCS,
- },
-}
-
// noVCSSuffix checks that the repository name does not
// end in .foo for any version control system foo.
// The usual culprit is ".git".
@@ -1410,27 +1316,6 @@ func noVCSSuffix(match map[string]string) error {
return nil
}
-// launchpadVCS solves the ambiguity for "lp.net/project/foo". In this case,
-// "foo" could be a series name registered in Launchpad with its own branch,
-// and it could also be the name of a directory within the main project
-// branch one level up.
-func launchpadVCS(match map[string]string) error {
- if match["project"] == "" || match["series"] == "" {
- return nil
- }
- url := &urlpkg.URL{
- Scheme: "https",
- Host: "code.launchpad.net",
- Path: expand(match, "/{project}{series}/.bzr/branch-format"),
- }
- _, err := web.GetBytes(url)
- if err != nil {
- match["root"] = expand(match, "launchpad.net/{project}")
- match["repo"] = expand(match, "https://{root}")
- }
- return nil
-}
-
// importError is a copy of load.importError, made to avoid a dependency cycle
// on cmd/go/internal/load. It just needs to satisfy load.ImportPathError.
type importError struct {
diff --git a/src/cmd/go/internal/vcs/vcs_test.go b/src/cmd/go/internal/vcs/vcs_test.go
index 8da8eb2c11..73ad6de48f 100644
--- a/src/cmd/go/internal/vcs/vcs_test.go
+++ b/src/cmd/go/internal/vcs/vcs_test.go
@@ -24,7 +24,7 @@ func init() {
}
// Test that RepoRootForImportPath determines the correct RepoRoot for a given importPath.
-// TODO(cmang): Add tests for SVN and BZR.
+// TODO(cmang): Add tests for SVN.
func TestRepoRootForImportPath(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
@@ -223,7 +223,6 @@ func TestFromDir(t *testing.T) {
{"hg", "Mercurial", ".hg", mkdir},
{"git_dir", "Git", ".git", mkdir},
{"git_worktree", "Git", ".git", createGitWorktreeFile},
- {"bzr", "Bazaar", ".bzr", mkdir},
{"svn", "Subversion", ".svn", mkdir},
{"fossil_fslckout", "Fossil", ".fslckout", touch},
{"fossil_FOSSIL_", "Fossil", "_FOSSIL_", touch},
@@ -279,8 +278,6 @@ func TestIsSecure(t *testing.T) {
}{
{vcsGit, "http://example.com/foo.git", false},
{vcsGit, "https://example.com/foo.git", true},
- {vcsBzr, "http://example.com/foo.bzr", false},
- {vcsBzr, "https://example.com/foo.bzr", true},
{vcsSvn, "http://example.com/svn", false},
{vcsSvn, "https://example.com/svn", true},
{vcsHg, "http://example.com/foo.hg", false},
@@ -314,8 +311,6 @@ func TestIsSecureGitAllowProtocol(t *testing.T) {
// Same as TestIsSecure to verify same behavior.
{vcsGit, "http://example.com/foo.git", false},
{vcsGit, "https://example.com/foo.git", true},
- {vcsBzr, "http://example.com/foo.bzr", false},
- {vcsBzr, "https://example.com/foo.bzr", true},
{vcsSvn, "http://example.com/svn", false},
{vcsSvn, "https://example.com/svn", true},
{vcsHg, "http://example.com/foo.hg", false},
@@ -332,7 +327,6 @@ func TestIsSecureGitAllowProtocol(t *testing.T) {
{vcsGit, "foo://example.com/bar.git", true},
{vcsHg, "foo://example.com/bar.hg", false},
{vcsSvn, "foo://example.com/svn", false},
- {vcsBzr, "foo://example.com/bar.bzr", false},
}
defer os.Unsetenv("GIT_ALLOW_PROTOCOL")
diff --git a/src/cmd/go/internal/vcweb/bzr.go b/src/cmd/go/internal/vcweb/bzr.go
deleted file mode 100644
index a915fb2b93..0000000000
--- a/src/cmd/go/internal/vcweb/bzr.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2022 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package vcweb
-
-import (
- "log"
- "net/http"
-)
-
-type bzrHandler struct{}
-
-func (*bzrHandler) Available() bool { return true }
-
-func (*bzrHandler) Handler(dir string, env []string, logger *log.Logger) (http.Handler, error) {
- return http.FileServer(http.Dir(dir)), nil
-}
diff --git a/src/cmd/go/internal/vcweb/script.go b/src/cmd/go/internal/vcweb/script.go
index 99f001254b..28917c0ff3 100644
--- a/src/cmd/go/internal/vcweb/script.go
+++ b/src/cmd/go/internal/vcweb/script.go
@@ -40,10 +40,6 @@ func newScriptEngine() *script.Engine {
}
conds[name] = cond
}
- lazyBool := func(summary string, f func() bool) script.Cond {
- return script.OnceCondition(summary, func() (bool, error) { return f(), nil })
- }
- add("bzr", lazyBool("the 'bzr' executable exists and provides the standard CLI", hasWorkingBzr))
add("git-sha256", script.OnceCondition("the local 'git' version is recent enough to support sha256 object/commit hashes", gitSupportsSHA256))
interrupt := func(cmd *exec.Cmd) error { return cmd.Process.Signal(os.Interrupt) }
@@ -51,7 +47,6 @@ func newScriptEngine() *script.Engine {
cmds := script.DefaultCmds()
cmds["at"] = scriptAt()
- cmds["bzr"] = script.Program("bzr", interrupt, gracePeriod)
cmds["fossil"] = script.Program("fossil", interrupt, gracePeriod)
cmds["git"] = script.Program("git", interrupt, gracePeriod)
cmds["hg"] = script.Program("hg", interrupt, gracePeriod)
@@ -266,7 +261,7 @@ func scriptHandle() script.Cmd {
Args: "handler [dir]",
Detail: []string{
"The handler will be passed the script's current working directory and environment as arguments.",
- "Valid handlers include 'dir' (for general http.Dir serving), 'bzr', 'fossil', 'git', and 'hg'",
+ "Valid handlers include 'dir' (for general http.Dir serving), 'fossil', 'git', and 'hg'",
},
},
func(st *script.State, args ...string) (script.WaitFunc, error) {
@@ -387,17 +382,6 @@ func scriptUnquote() script.Cmd {
})
}
-func hasWorkingBzr() bool {
- bzr, err := exec.LookPath("bzr")
- if err != nil {
- return false
- }
- // Check that 'bzr help' exits with code 0.
- // See go.dev/issue/71504 for an example where 'bzr' exists in PATH but doesn't work.
- err = exec.Command(bzr, "help").Run()
- return err == nil
-}
-
// Capture the major, minor and (optionally) patch version, but ignore anything later
var gitVersLineExtract = regexp.MustCompile(`git version\s+(\d+\.\d+(?:\.\d+)?)`)
diff --git a/src/cmd/go/internal/vcweb/vcweb.go b/src/cmd/go/internal/vcweb/vcweb.go
index 98d39a3b1f..204d4d9235 100644
--- a/src/cmd/go/internal/vcweb/vcweb.go
+++ b/src/cmd/go/internal/vcweb/vcweb.go
@@ -15,7 +15,7 @@
// until the script is modified.
//
// The script engine includes all of the engine's default commands and
-// conditions, as well as commands for each supported VCS binary (bzr, fossil,
+// conditions, as well as commands for each supported VCS binary (fossil,
// git, hg, and svn), a "handle" command that informs the script which protocol
// or handler to use to serve the request, and utilities "at" (which sets
// environment variables for Git timestamps) and "unquote" (which unquotes its
@@ -129,7 +129,6 @@ func NewServer(scriptDir, workDir string, logger *log.Logger) (*Server, error) {
vcsHandlers: map[string]vcsHandler{
"auth": new(authHandler),
"dir": new(dirHandler),
- "bzr": new(bzrHandler),
"fossil": new(fossilHandler),
"git": new(gitHandler),
"hg": new(hgHandler),
diff --git a/src/cmd/go/scriptconds_test.go b/src/cmd/go/scriptconds_test.go
index 6bf8eb0953..60a3c123aa 100644
--- a/src/cmd/go/scriptconds_test.go
+++ b/src/cmd/go/scriptconds_test.go
@@ -41,7 +41,6 @@ func scriptConditions(t *testing.T) map[string]script.Cond {
}
add("abscc", script.Condition("default $CC path is absolute and exists", defaultCCIsAbsolute))
- add("bzr", lazyBool("the 'bzr' executable exists and provides the standard CLI", hasWorkingBzr))
add("case-sensitive", script.OnceCondition("$WORK filesystem is case-sensitive", isCaseSensitive))
add("cc", script.PrefixCondition("go env CC = <suffix> (ignoring the go/env file)", ccIs))
add("git", lazyBool("the 'git' executable exists and provides the standard CLI", hasWorkingGit))
@@ -186,17 +185,6 @@ func gitSupportsSHA256() (bool, error) {
return hasAtLeastGitVersion("v2.29")
}
-func hasWorkingBzr() bool {
- bzr, err := exec.LookPath("bzr")
- if err != nil {
- return false
- }
- // Check that 'bzr help' exits with code 0.
- // See go.dev/issue/71504 for an example where 'bzr' exists in PATH but doesn't work.
- err = exec.Command(bzr, "help").Run()
- return err == nil
-}
-
func defaultCgo() bool {
return buildcfg.DefaultCGO_ENABLED == "1" || buildcfg.DefaultCGO_ENABLED == "0"
}
diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README
index 89ce561f89..9fa2c92c0b 100644
--- a/src/cmd/go/testdata/script/README
+++ b/src/cmd/go/testdata/script/README
@@ -377,8 +377,6 @@ The available conditions are:
GOOS/GOARCH supports -asan
[buildmode:*]
go supports -buildmode=<suffix>
-[bzr]
- the 'bzr' executable exists and provides the standard CLI
[case-sensitive]
$WORK filesystem is case-sensitive
[cc:*]
diff --git a/src/cmd/go/testdata/script/govcs.txt b/src/cmd/go/testdata/script/govcs.txt
index 876f6065bc..7479a2b1f7 100644
--- a/src/cmd/go/testdata/script/govcs.txt
+++ b/src/cmd/go/testdata/script/govcs.txt
@@ -58,12 +58,6 @@ env GOVCS=
! go get rsc.io/nonexist.fossil/hello
stderr '^go: rsc.io/nonexist.fossil/hello: GOVCS disallows using fossil for public rsc.io/nonexist.fossil; see ''go help vcs''$'
-# bzr is disallowed by default
-env GOPRIVATE=
-env GOVCS=
-! go get rsc.io/nonexist.bzr/hello
-stderr '^go: rsc.io/nonexist.bzr/hello: GOVCS disallows using bzr for public rsc.io/nonexist.bzr; see ''go help vcs''$'
-
# git is OK by default
env GOVCS=
env GONOSUMDB='*'
diff --git a/src/cmd/go/testdata/script/mod_vcs_missing.txt b/src/cmd/go/testdata/script/mod_vcs_missing.txt
deleted file mode 100644
index 1f218c8d95..0000000000
--- a/src/cmd/go/testdata/script/mod_vcs_missing.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[exec:bzr] skip 'tests NOT having bzr'
-[short] skip
-
-env GOPROXY=direct
-
-cd empty
-! go get vcs-test.golang.org/foo.bzr
-stderr '"bzr": executable file not found'
-cd ..
-
-# 1.11 used to give the cryptic error "cannot find module for path" here, but
-# only for a main package.
-cd main
-! go build -mod=mod
-stderr '"bzr": executable file not found'
-cd ..
-
--- empty/go.mod --
-module m
--- main/go.mod --
-module m
--- main/main.go --
-package main
-
-import _ "vcs-test.golang.org/foo.bzr"
-
-func main() {}
diff --git a/src/cmd/go/testdata/script/test_multivcs.txt b/src/cmd/go/testdata/script/test_multivcs.txt
deleted file mode 100644
index 538cbf700b..0000000000
--- a/src/cmd/go/testdata/script/test_multivcs.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# To avoid VCS injection attacks, we should not accept multiple different VCS metadata
-# folders within a single module (either in the same directory, or nested in different
-# directories.)
-#
-# This behavior should be disabled by setting the allowmultiplevcs GODEBUG.
-
-[short] skip
-[!git] skip
-
-cd samedir
-
-exec git init .
-
-# Without explicitly requesting buildvcs, the go command should silently continue
-# without determining the correct VCS.
-go test -c -o $devnull .
-
-# If buildvcs is explicitly requested, we expect the go command to fail
-! go test -buildvcs -c -o $devnull .
-stderr '^error obtaining VCS status: multiple VCS detected:'
-
-env GODEBUG=allowmultiplevcs=1
-go test -buildvcs -c -o $devnull .
-
-env GODEBUG=
-cd ../nested
-exec git init .
-# cd a
-go test -c -o $devnull ./a
-! go test -buildvcs -c -o $devnull ./a
-stderr '^error obtaining VCS status: multiple VCS detected:'
-# allowmultiplevcs doesn't disable the check that the current directory, package, and
-# module are in the same repository.
-env GODEBUG=allowmultiplevcs=1
-! go test -buildvcs -c -o $devnull ./a
-stderr '^error obtaining VCS status: main package is in repository'
-
--- samedir/go.mod --
-module example
-
-go 1.18
--- samedir/example.go --
-package main
--- samedir/.bzr/test --
-hello
-
--- nested/go.mod --
-module example
-
-go 1.18
--- nested/a/example.go --
-package main
--- nested/a/.bzr/test --
-hello
diff --git a/src/cmd/go/testdata/script/version_buildvcs_bzr.txt b/src/cmd/go/testdata/script/version_buildvcs_bzr.txt
deleted file mode 100644
index fd0b80c40a..0000000000
--- a/src/cmd/go/testdata/script/version_buildvcs_bzr.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-# This test checks that VCS information is stamped into Go binaries by default,
-# controlled with -buildvcs. This test focuses on Bazaar specifics.
-# The Git test covers common functionality.
-
-[short] skip
-[!bzr] skip 'requires a working bzr client'
-env GOBIN=$WORK/gopath/bin
-env oldpath=$PATH
-env HOME=$WORK
-cd repo/a
-exec bzr whoami 'J.R. Gopher <gopher@golang.org>'
-
-# If there's no local repository, there's no VCS info.
-go install
-go version -m $GOBIN/a$GOEXE
-! stdout bzrrevision
-stdout '^\tmod\texample.com/a\t\(devel\)'
-rm $GOBIN/a$GOEXE
-
-# If there is a repository, but it can't be used for some reason,
-# there should be an error. It should hint about -buildvcs=false.
-cd ..
-mkdir .bzr
-env PATH=$WORK${/}fakebin${:}$oldpath
-chmod 0755 $WORK/fakebin/bzr
-! exec bzr help
-cd a
-! go install
-stderr '^error obtaining VCS status: exit status 1\n\tUse -buildvcs=false to disable VCS stamping.$'
-rm $GOBIN/a$GOEXE
-cd ..
-env PATH=$oldpath
-rm .bzr
-
-# If there is an empty repository in a parent directory, only "modified" is tagged.
-exec bzr init
-cd a
-go install
-go version -m $GOBIN/a$GOEXE
-stdout '^\tbuild\tvcs=bzr$'
-! stdout vcs.revision
-! stdout vcs.time
-stdout '^\tbuild\tvcs.modified=true$'
-cd ..
-
-# Revision and commit time are tagged for repositories with commits.
-exec bzr add a README go.mod
-exec bzr commit -m 'initial commit'
-cd a
-go install
-go version -m $GOBIN/a$GOEXE
-stdout '^\tbuild\tvcs=bzr$'
-stdout '^\tbuild\tvcs.revision='
-stdout '^\tbuild\tvcs.time='
-stdout '^\tbuild\tvcs.modified=false$'
-stdout '^\tmod\texample.com/a\tv0.0.0-\d+-\d+\t+'
-rm $GOBIN/a$GOEXE
-
-# Tag is reflected in the version.
-cd ..
-cp README README2
-exec bzr add a README2
-exec bzr commit -m 'second commit'
-exec bzr tag a/v1.2.3
-cd a
-go install
-go version -m $GOBIN/a$GOEXE
-stdout '^\tbuild\tvcs=bzr$'
-stdout '^\tbuild\tvcs.revision='
-stdout '^\tbuild\tvcs.time='
-stdout '^\tbuild\tvcs.modified=false$'
-stdout '^\tmod\texample.com/a\tv1.2.3\t+'
-rm $GOBIN/a$GOEXE
-
-# Building an earlier commit should still build clean.
-cp ../../outside/empty.txt ../NEWS
-exec bzr add ../NEWS
-exec bzr commit -m 'add NEWS'
-exec bzr update -r1
-go install
-go version -m $GOBIN/a$GOEXE
-stdout '^\tbuild\tvcs=bzr$'
-stdout '^\tbuild\tvcs.revision='
-stdout '^\tbuild\tvcs.time='
-stdout '^\tbuild\tvcs.modified=false$'
-
-# Building with -buildvcs=false suppresses the info.
-go install -buildvcs=false
-go version -m $GOBIN/a$GOEXE
-! stdout vcs.revision
-rm $GOBIN/a$GOEXE
-
-# An untracked file is shown as modified, even if it isn't part of the build.
-cp ../../outside/empty.txt .
-go install
-go version -m $GOBIN/a$GOEXE
-stdout '^\tbuild\tvcs.modified=true$'
-rm empty.txt
-rm $GOBIN/a$GOEXE
-
-# An edited file is shown as modified, even if it isn't part of the build.
-cp ../../outside/empty.txt ../README
-go install
-go version -m $GOBIN/a$GOEXE
-stdout '^\tbuild\tvcs.modified=true$'
-exec bzr revert ../README
-rm $GOBIN/a$GOEXE
-
--- $WORK/fakebin/bzr --
-#!/bin/sh
-exit 1
--- $WORK/fakebin/bzr.bat --
-exit 1
--- repo/README --
-Far out in the uncharted backwaters of the unfashionable end of the western
-spiral arm of the Galaxy lies a small, unregarded yellow sun.
--- repo/go.mod --
-module example.com
-
-go 1.18
--- repo/a/go.mod --
-module example.com/a
-
-go 1.18
--- repo/a/a.go --
-package main
-
-func main() {}
--- outside/empty.txt --
diff --git a/src/cmd/go/testdata/vcstest/bzr/hello.txt b/src/cmd/go/testdata/vcstest/bzr/hello.txt
deleted file mode 100644
index 68465ec553..0000000000
--- a/src/cmd/go/testdata/vcstest/bzr/hello.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-[!bzr] skip 'requires a working bzr client'
-handle bzr
-
-env BZR_EMAIL='Russ Cox <rsc@google.com>'
-env EMAIL='Russ Cox <rsc@google.com>'
-
-bzr init-repo .
-
-bzr init b
-cd b
-cp ../hello.go .
-bzr add hello.go
-bzr commit --commit-time='2017-09-21 21:20:12 -0400' -m 'hello world'
-bzr push ..
-cd ..
-rm b
-
-bzr log
-cmp stdout .bzr-log
-
--- .bzr-log --
-------------------------------------------------------------
-revno: 1
-committer: Russ Cox <rsc@google.com>
-branch nick: b
-timestamp: Thu 2017-09-21 21:20:12 -0400
-message:
- hello world
--- hello.go --
-package main
-
-func main() {
- println("hello, world")
-}