Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2052)

Issue 5624052: code review 5624052: cmd/go: build: print import errors when inv...

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 3 months ago by Kyle E. Lemons
Modified:
12 years, 3 months ago
Reviewers:
r
CC:
rsc, dvyukov, r, golang-dev
Visibility:
Public.

Description

cmd/go: build: print import errors when invoked on files This fix makes the goFilesPackage helper function print the errors from package imports and exit similar to how the packagesForBuild function does. Without this change, when invoking "go build *.go" with, for example, an old import path, the following stack trace is generated: panic: runtime error: invalid memory address or nil pointer dereference goroutine 1 [running]: go/build.(*Tree).PkgDir(...) /opt/go/src/pkg/go/build/path.go:52 +0xfb main.(*builder).action(...) /opt/go/src/cmd/go/build.go:327 +0xb8 main.(*builder).action(...) /opt/go/src/cmd/go/build.go:335 +0x208 main.runBuild(...) /opt/go/src/cmd/go/build.go:129 +0x386 main.main() /opt/go/src/cmd/go/main.go:126 +0x2d8 Fixes issue 2865.

Patch Set 1 #

Patch Set 2 : diff -r d920eda8b6ac https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r d920eda8b6ac https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -0 lines) Patch
M src/cmd/go/build.go View 1 2 chunks +12 lines, -0 lines 0 comments Download

Messages

Total messages: 4
Kyle E. Lemons
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 3 months ago (2012-02-04 20:12:25 UTC) #1
dvyukov
Works for me! I was updating a set of old Go programs, and 'go build' ...
12 years, 3 months ago (2012-02-05 09:26:59 UTC) #2
r
LGTM
12 years, 3 months ago (2012-02-06 03:08:23 UTC) #3
r
12 years, 3 months ago (2012-02-06 03:10:09 UTC) #4
*** Submitted as http://code.google.com/p/go/source/detail?r=56308de7f5e8 ***

            cmd/go: build: print import errors when invoked on files

      This fix makes the goFilesPackage helper function print the errors from
      package imports and exit similar to how the packagesForBuild function
does.


      Without this change, when invoking "go build *.go" with, for example,
      an old import path, the following stack trace is generated:

      panic: runtime error: invalid memory address or nil pointer dereference

      goroutine 1 [running]:
      go/build.(*Tree).PkgDir(...)
              /opt/go/src/pkg/go/build/path.go:52 +0xfb
      main.(*builder).action(...)
              /opt/go/src/cmd/go/build.go:327 +0xb8
      main.(*builder).action(...)
              /opt/go/src/cmd/go/build.go:335 +0x208
      main.runBuild(...)
              /opt/go/src/cmd/go/build.go:129 +0x386
      main.main()
              /opt/go/src/cmd/go/main.go:126 +0x2d8

Fixes issue 2865.

R=rsc, dvyukov, r
CC=golang-dev
http://codereview.appspot.com/5624052

Committer: Rob Pike <r@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b