go/loader: document that package is deprecated

By now, go/packages is ready for widespread use and has obsoleted
go/loader. CL 141684 and CL 155237 removed warnings from go/packages
documentation. Add a deprecation notice to go/loader for visibility.

Modify the deprecation notice in other packages to be consistent with
the deprecation convention as documented at golang.org/wiki/Deprecated.

Change-Id: Iaa93205a6e5beb3ec95f87a6d9d42f0b8ffe8e80
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183418
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Dmitri Shuralyov 2019-06-21 21:59:57 -04:00
parent 663943adaa
commit 7f22187876
3 changed files with 7 additions and 6 deletions

View File

@ -7,7 +7,8 @@
// of dependencies. The ASTs and the derived facts are retained for // of dependencies. The ASTs and the derived facts are retained for
// later use. // later use.
// //
// THIS INTERFACE IS EXPERIMENTAL AND IS LIKELY TO CHANGE. // Deprecated: This is an older API and does not have support
// for modules. Use golang.org/x/tools/go/packages instead.
// //
// The package defines two primary types: Config, which specifies a // The package defines two primary types: Config, which specifies a
// set of initial packages to load and various other options; and // set of initial packages to load and various other options; and
@ -201,5 +202,3 @@ package loader
// the error. // the error.
// //
// The result of using concurrency is about a 2.5x speedup for stdlib_test. // The result of using concurrency is about a 2.5x speedup for stdlib_test.
// TODO(adonovan): overhaul the package documentation.

View File

@ -101,7 +101,7 @@ func doPackages(initial []*packages.Package, mode ssa.BuilderMode, deps bool) (*
// //
// The mode parameter controls diagnostics and checking during SSA construction. // The mode parameter controls diagnostics and checking during SSA construction.
// //
// Deprecated: use golang.org/x/tools/go/packages and the Packages // Deprecated: Use golang.org/x/tools/go/packages and the Packages
// function instead; see ssa.ExampleLoadPackages. // function instead; see ssa.ExampleLoadPackages.
// //
func CreateProgram(lprog *loader.Program, mode ssa.BuilderMode) *ssa.Program { func CreateProgram(lprog *loader.Program, mode ssa.BuilderMode) *ssa.Program {

View File

@ -27,7 +27,8 @@ import (
// (as defined by "go test") defined in the specified package, // (as defined by "go test") defined in the specified package,
// and its TestMain function, if any. // and its TestMain function, if any.
// //
// Deprecated: use x/tools/go/packages to access synthetic testmain packages. // Deprecated: Use golang.org/x/tools/go/packages to access synthetic
// testmain packages.
func FindTests(pkg *Package) (tests, benchmarks, examples []*Function, main *Function) { func FindTests(pkg *Package) (tests, benchmarks, examples []*Function, main *Function) {
prog := pkg.Prog prog := pkg.Prog
@ -112,7 +113,8 @@ func isTest(name, prefix string) bool {
// Subsequent calls to prog.AllPackages include the new package. // Subsequent calls to prog.AllPackages include the new package.
// The package pkg must belong to the program prog. // The package pkg must belong to the program prog.
// //
// Deprecated: use x/tools/go/packages to access synthetic testmain packages. // Deprecated: Use golang.org/x/tools/go/packages to access synthetic
// testmain packages.
func (prog *Program) CreateTestMainPackage(pkg *Package) *Package { func (prog *Program) CreateTestMainPackage(pkg *Package) *Package {
if pkg.Prog != prog { if pkg.Prog != prog {
log.Fatal("Package does not belong to Program") log.Fatal("Package does not belong to Program")