Skip to content
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

go build crashes #2869

Closed
dvyukov opened this issue Feb 3, 2012 · 3 comments
Closed

go build crashes #2869

dvyukov opened this issue Feb 3, 2012 · 3 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Feb 3, 2012

> What steps will reproduce the problem?

// test.go
package main
import (
    "flag"
    "fmt"
    "rand"
    "runtime"
    "sort"
)
func main() {
    fmt.Printf("Hello, World!")
}

$go build test.go

> What is the expected output?
The tool either successfully compiles the program or produces a meaningful error message.

> What do you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x455f80]

goroutine 1 [running]:
runtime.panic(0x669e68, 0xf8401ce7b0)
    /usr/local/google/home/dvyukov/go_select/src/pkg/runtime/proc.c:1406 +0xac
runtime.panicstring(0x82dcb3, 0xf840002570)
    /usr/local/google/home/dvyukov/go_select/src/pkg/runtime/runtime.c:128 +0xa3
runtime.sigpanic()
    /usr/local/google/home/dvyukov/go_select/src/pkg/runtime/thread_linux.c:198 +0x168
go/build.(*Tree).PkgDir(0x0, 0xf8400432c0, 0x0, 0xf8401ad1c0)
    /usr/local/google/home/dvyukov/go_select/src/pkg/go/build/path.go:52 +0xfb
main.(*builder).action(0xf840047000, 0x0, 0xf8401ad1c0, 0x1, 0xf8401ce7a0, ...)
    /usr/local/google/home/dvyukov/go_select/src/cmd/go/build.go:327 +0xb8
main.(*builder).action(0xf840047000, 0x1, 0xf84001ce00, 0x6e69616d00000002,
0xf8401e8b0a, ...)
    /usr/local/google/home/dvyukov/go_select/src/cmd/go/build.go:335 +0x208
main.runBuild(0x82abc0, 0xf840002020, 0x100000001, 0x0)
    /usr/local/google/home/dvyukov/go_select/src/cmd/go/build.go:129 +0x386
main.main()
    /usr/local/google/home/dvyukov/go_select/src/cmd/go/main.go:126 +0x2d8
runtime.main()
    /usr/local/google/home/dvyukov/go_select/src/pkg/runtime/proc.c:231 +0x45
runtime.goexit()
    /usr/local/google/home/dvyukov/go_select/src/pkg/runtime/proc.c:258

>Please use labels and text to provide additional information.
11662:b6e94b31350e tip
@patrickmn
Copy link

Comment 1:

This occurs after the error ErrNotFound ("package could not be found locally") occurs in
loadPackage for rand, and is ignored:
...
builder.action -> p is: &{rand      false false true rand:
/home/patrick/temp/test.go:6:2: package could not be found locally [] [] [] [] [] [] []
[] [] [] [] [] <nil>  <nil> [] [] []  false}
builder.action -> p.t is: <nil>
PkgDir -> t is: <nil>
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x455f8b]
goroutine 1 [running]:
go/build.(*Tree).PkgDir(0x0, 0x200000002, 0xe, 0x0)
    /home/patrick/apps/go-wk/src/pkg/go/build/path.go:54 +0x292
main.(*builder).action(0xf840049000, 0x0, 0xf84019a1c0, 0x1, 0xf840091160, ...)
    /home/patrick/apps/go-wk/src/cmd/go/build.go:330 +0x241
main.(*builder).action(0xf840049000, 0x1, 0xf84001d540, 0x6e69616d00000002,
0xf8401c3daa, ...)
    /home/patrick/apps/go-wk/src/cmd/go/build.go:338 +0x39a
main.runBuild(0x829b70, 0xf840002020, 0x100000001, 0x0)
    /home/patrick/apps/go-wk/src/cmd/go/build.go:129 +0x386
main.main()
    /home/patrick/apps/go-wk/src/cmd/go/main.go:126 +0x2d8

@kylelemons
Copy link
Contributor

Comment 2:

I believe this is a duplicate of issue #2865?  I have a CL out that will fix it if so.
http://golang.org/cl/5624052/

@dvyukov
Copy link
Member Author

dvyukov commented Feb 5, 2012

Comment 3:

Status changed to Duplicate.

Merged into issue #2865.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants