Skip to content

cmd/go/internal/vet: print line numbers appropriately on list errors #36989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/cmd/go/internal/get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int)
// Download if the package is missing, or update if we're using -u.
if p.Dir == "" || *getU {
// The actual download.
stk.Push(arg)
stk.Push(arg, nil)
err := downloadPackage(p)
if err != nil {
base.Errorf("%s", &load.PackageError{ImportStack: stk.Copy(), Err: err})
base.Errorf("%s", load.NewPackageError(stk, err))
stk.Pop()
return
}
Expand Down Expand Up @@ -329,7 +329,7 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int)
if isWildcard {
// Report both the real package and the
// wildcard in any error message.
stk.Push(p.ImportPath)
stk.Push(p.ImportPath, nil)
}

// Process dependencies, now that we know what they are.
Expand All @@ -352,11 +352,9 @@ func download(arg string, parent *load.Package, stk *load.ImportStack, mode int)
orig = p.Internal.Build.Imports[i]
}
if j, ok := load.FindVendor(orig); ok {
stk.Push(path)
err := &load.PackageError{
ImportStack: stk.Copy(),
Err: load.ImportErrorf(path, "%s must be imported as %s", path, path[j+len("vendor/"):]),
}
stk.Push(path, nil)
err := load.NewPackageError(stk,
load.ImportErrorf(path, "%s must be imported as %s", path, path[j+len("vendor/"):]))
stk.Pop()
base.Errorf("%s", err)
continue
Expand Down
Loading