Skip to content

Commit

Permalink
internal/gcimporter: add a missing return if objectpath fails
Browse files Browse the repository at this point in the history
The export data encoding was not symmetric in the case where objectpath
fails.

Fixes golang/go#61670

Change-Id: Ifaaa8eaed7ee5e28aa3b5ee7e9600b9e379e1968
Reviewed-on: https://go-review.googlesource.com/c/tools/+/514355
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Robert Findley <rfindley@google.com>
  • Loading branch information
findleyr committed Jul 31, 2023
1 parent c16d0be commit 3d20bbe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/gcimporter/iexport.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,10 +929,11 @@ func (w *exportWriter) objectPath(obj types.Object) {
// that export/import is producing a correct package.
//
// TODO: remove reportf once we have such confidence.
objectPath = ""
w.string("")
if w.p.reportf != nil {
w.p.reportf("unable to encode object %q in package %q: %v", obj.Name(), obj.Pkg().Path(), err)
}
return
}
w.string(string(objectPath))
w.pkg(obj.Pkg())
Expand Down

0 comments on commit 3d20bbe

Please sign in to comment.