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

vet: Panic on use of implicit interface. #5675

Closed
mewmew opened this issue Jun 10, 2013 · 5 comments
Closed

vet: Panic on use of implicit interface. #5675

mewmew opened this issue Jun 10, 2013 · 5 comments
Assignees

Comments

@mewmew
Copy link
Contributor

@mewmew mewmew commented Jun 10, 2013

What steps will reproduce the problem?
1. go get code.google.com/p/go-tour
2. go vet code.google.com/p/go-tour/prog

What is the expected output?

No panic.

What do you see instead?

INTERNAL PANIC: runtime error: invalid memory address or nil pointer dereference
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x38 pc=0x4eb38c]

goroutine 1 [running]:
code.google.com/p/go.tools/go/types.func·003()
    /home/u/goget/src/code.google.com/p/go.tools/go/types/check.go:113 +0x16a
code.google.com/p/go.tools/go/types.identicalMethods(0xc2101ed380, 0xc2100cffc0,
0xc2100e0310)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/predicates.go:235 +0x28c
code.google.com/p/go.tools/go/types.IsIdentical(0xc21004f200, 0xc2101bdee8,
0xc21004f200, 0xc2100e0310, 0xc21005a800, ...)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/predicates.go:170 +0x974
code.google.com/p/go.tools/go/types.(*operand).isAssignable(0xc2102138c0, 0xc2100d2480,
0xc21004f240, 0xc2100cff60, 0x41e500, ...)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/operand.go:144 +0x172
code.google.com/p/go.tools/go/types.(*checker).assignment(0xc21005b900, 0xc2102138c0,
0xc21004f240, 0xc2100cff60, 0xc21004f240, ...)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/stmt.go:36 +0x1dd
code.google.com/p/go.tools/go/types.(*checker).argument(0xc21005b900, 0xc2100d0600, 0x0,
0xc21005a740, 0xc210098560, ...)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/expr.go:987 +0x23a
code.google.com/p/go.tools/go/types.(*checker).rawExpr(0xc21005b900, 0xc2102138c0,
0xc21005a900, 0xc21009c080, 0x0, ...)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/expr.go:1603 +0x3c3b
code.google.com/p/go.tools/go/types.(*checker).stmt(0xc21005b900, 0xc21005aa00,
0xc210089d60)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/stmt.go:356 +0x545c
code.google.com/p/go.tools/go/types.(*checker).stmtList(0xc21005b900, 0xc21009c0c0, 0x3,
0x4)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/stmt.go:266 +0x68
code.google.com/p/go.tools/go/types.check(0xc2100d2480, 0x601020, 0x1, 0xc21005a540,
0xc2100ce800, ...)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/check.go:159 +0x431
code.google.com/p/go.tools/go/types.(*Context).Check(0xc2100d2480, 0x601020, 0x1,
0xc21005a540, 0xc2100ce800, ...)
    /home/u/goget/src/code.google.com/p/go.tools/go/types/api.go:142 +0x6c
main.(*Package).check(0xc2100d23c0, 0xc21005a540, 0xc2100ce800, 0x42, 0x80, ...)
    /home/u/goget/src/code.google.com/p/go.tools/cmd/vet/types.go:32 +0x168
main.doPackage(0x601020, 0x1, 0xc21000a010, 0x42, 0x42, ...)
    /home/u/goget/src/code.google.com/p/go.tools/cmd/vet/main.go:226 +0x8f5
main.main()
    /home/u/goget/src/code.google.com/p/go.tools/cmd/vet/main.go:144 +0x665

goroutine 2 [runnable]:
exit status 2

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Linux

Which version are you using?  (run 'go version')
go version devel +4aa7943034c5 Thu Jun 06 18:10:42 2013 -0700 linux/amd64

code.google.com/p/go.tools
changeset: 956fb611bffb

Please provide any additional information below.

The file that causes this panic is:
code.google.com/p/go-tour/prog/interfaces-are-satisfied-implicitly.go

Below is a simplified version that still causes the panic. I'll inline the
example since play.golang.org is almost impossible to access from some parts of
Asia.

package main

import (
    "fmt"
    "os"
)

type Writer interface {
    Write(b []byte) (n int, err error)
}

func main() {
    var w Writer

    // os.Stdout implements Writer
    w = os.Stdout

    fmt.Fprintf(w, "hello, writer\n")
}
@robpike
Copy link
Contributor

@robpike robpike commented Jun 10, 2013

Comment 1:

Looks like the same crash as 5664.

Status changed to Duplicate.

Merged into issue #5664.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 10, 2013

Comment 2:

Excellent, thanks for the directly usable test case. Clearly a bug.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 11, 2013

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 11, 2013

Comment 4:

Probably not a duplicate of 5664.

Owner changed to @griesemer.

Status changed to Accepted.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 11, 2013

Comment 5:

This issue was closed by revision golang/tools@0d2f7d4.

Status changed to Fixed.

@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants