mirror of
https://github.com/golang/go.git
synced 2025-05-05 07:33:00 +00:00
go/packages: fix failing Windows TryBots for adhoc packages test
It looks like the package paths for adhoc package on Windows now keep the file path's original backslashes, rather than switching to forward slashes. Remove the filepath.ToSlash call to handle this. Also, a small change to fix something suggested by staticcheck. Change-Id: I56bd57ed2448dbc724acb9730673fc9d17f16d06 Reviewed-on: https://go-review.googlesource.com/c/tools/+/206677 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
74addff584
commit
dce577ffce
@ -270,10 +270,7 @@ func addNeededOverlayPackages(cfg *Config, driver driver, response *responseDedu
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addNeededOverlayPackages(cfg, driver, response, needPkgs, getGoInfo); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return addNeededOverlayPackages(cfg, driver, response, needPkgs, getGoInfo)
|
||||
}
|
||||
|
||||
func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, queries []string, goInfo func() *goInfo) error {
|
||||
@ -373,7 +370,8 @@ func adHocPackage(cfg *Config, driver driver, pattern, query string) (*driverRes
|
||||
// Special case to handle issue #33482:
|
||||
// If this is a file= query for ad-hoc packages where the file only exists on an overlay,
|
||||
// and exists outside of a module, add the file in for the package.
|
||||
if len(dirResponse.Packages) == 1 && (dirResponse.Packages[0].ID == "command-line-arguments" || dirResponse.Packages[0].PkgPath == filepath.ToSlash(query)) {
|
||||
if len(dirResponse.Packages) == 1 && (dirResponse.Packages[0].ID == "command-line-arguments" ||
|
||||
filepath.ToSlash(dirResponse.Packages[0].PkgPath) == filepath.ToSlash(query)) {
|
||||
if len(dirResponse.Packages[0].GoFiles) == 0 {
|
||||
filename := filepath.Join(pattern, filepath.Base(query)) // avoid recomputing abspath
|
||||
// TODO(matloob): check if the file is outside of a root dir?
|
||||
|
Loading…
x
Reference in New Issue
Block a user