Skip to content

Commit a659412

Browse files
dmitshurgopherbot
authored andcommitted
go/vcs: deprecate package in favor of go list -json
This package has diverged significantly from actual cmd/go import path resolution behavior. The recommended course of action is for people to start using the go command itself, where this logic is guaranteed to be up to date. cmd/go also has support for modules, while this package does not. I've considered two alternatives to deprecating this package: 1. Not deprecate it, keep it as is. This is not a good option because the package deviates from cmd/go import path resolution behavior and doesn't have all security fixes backported to it. Keeping it in this state without deprecating it can be misleading, since people may think this package implements the stated goal of matching cmd/go behavior and is well supported, which is not the current reality. 2. Not deprecate it, try to make it up to date with cmd/go import path resolution logic. This is not a good option because VCSs are no longer guaranteed to exist for packages located inside modules. To expose the import path to module resolution logic, the API of this package would need to be significantly modified. At this time, my understanding is such work is not in scope and people are encouraged to use the existing go command instead. In 2019, when this CL was mailed, deprecating seemed as the best option. In 2023, when this CL was merged, deprecating seemed as the best option. Fixes golang/go#11490. For golang/go#57051. Change-Id: Id32d2bec5706c4e87126b825de5215fa5d1ba8ac Reviewed-on: https://go-review.googlesource.com/c/tools/+/159818 gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]>
1 parent 9d8d408 commit a659412

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

go/vcs/vcs.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@
66
// and using version control systems, which can be used to
77
// implement behavior similar to the standard "go get" command.
88
//
9-
// This package is a copy of internal code in package cmd/go/internal/get,
10-
// modified to make the identifiers exported. It's provided here
11-
// for developers who want to write tools with similar semantics.
12-
// It needs to be manually kept in sync with upstream when changes are
13-
// made to cmd/go/internal/get; see https://golang.org/issue/11490.
9+
// Deprecated: Use the go list command with -json flag instead,
10+
// which implements up-to-date import path resolution behavior,
11+
// module support, and includes the latest security fixes.
12+
//
13+
// This package was a copy of internal code in package cmd/go/internal/get
14+
// before module support, modified to make the identifiers exported.
15+
// It was provided here for developers who wanted to write tools with similar semantics.
16+
// It needed to be manually kept in sync with upstream when changes were
17+
// made to cmd/go/internal/get, as tracked in go.dev/issue/11490.
18+
// By now, it has diverged significantly from upstream cmd/go/internal/get
19+
// behavior and is not being actively updated.
1420
package vcs // import "golang.org/x/tools/go/vcs"
1521

1622
import (

0 commit comments

Comments
 (0)