1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:44:42 -07:00

go/packages: update doc for name= queries

Change-Id: I2ba387703ae1f31e7dff271007607f377701f7dd
Reviewed-on: https://go-review.googlesource.com/c/155941
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Zac Bergquist 2018-12-31 11:15:34 -07:00 committed by Michael Matloob
parent 7cb465e007
commit 1bc491975c

View File

@ -19,21 +19,20 @@ but all patterns with the prefix "query=", where query is a
non-empty string of letters from [a-z], are reserved and may be
interpreted as query operators.
Only two query operators are currently supported, "file" and "pattern".
Three query operators are currently supported: "file", "pattern", and "name".
The query "file=path/to/file.go" matches the package or packages enclosing
the Go source file path/to/file.go. For example "file=~/go/src/fmt/print.go"
might returns the packages "fmt" and "fmt [fmt.test]".
might return the packages "fmt" and "fmt [fmt.test]".
The query "pattern=string" causes "string" to be passed directly to
the underlying build tool. In most cases this is unnecessary,
but an application can use Load("pattern=" + x) as an escaping mechanism
to ensure that x is not interpreted as a query operator if it contains '='.
A third query "name=identifier" will be added soon.
It will match packages whose package declaration contains the specified identifier.
For example, "name=rand" would match the packages "math/rand" and "crypto/rand",
and "name=main" would match all executables.
The query "name=identifier" matches packages whose package declaration contains
the specified identifier. For example, "name=rand" would match the packages
"math/rand" and "crypto/rand", and "name=main" would match all executables.
All other query operators are reserved for future use and currently
cause Load to report an error.