1
0
mirror of https://github.com/golang/go synced 2024-11-26 07:57:57 -07:00

cmd/fix: check type assertion in netipv6zone rule.

Fixes #5461.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9947043
This commit is contained in:
Rémy Oudompheng 2013-06-02 15:39:47 +02:00
parent f8067ad67a
commit 57d89fb659
2 changed files with 5 additions and 1 deletions

View File

@ -51,7 +51,7 @@ func netipv6zone(f *ast.File) bool {
Value: e,
}
case 1:
if e.(*ast.BasicLit).Value == "0" {
if elit, ok := e.(*ast.BasicLit); ok && elit.Value == "0" {
cl.Elts = append(cl.Elts[:i], cl.Elts[i+1:]...)
} else {
cl.Elts[i] = &ast.KeyValueExpr{

View File

@ -20,6 +20,8 @@ func f() net.Addr {
sub(&net.UDPAddr{ip2, 12345})
c := &net.TCPAddr{IP: ip3, Port: 54321}
d := &net.TCPAddr{ip4, 0}
p := 1234
e := &net.TCPAddr{ip4, p}
return &net.TCPAddr{ip5}, nil
}
`,
@ -32,6 +34,8 @@ func f() net.Addr {
sub(&net.UDPAddr{IP: ip2, Port: 12345})
c := &net.TCPAddr{IP: ip3, Port: 54321}
d := &net.TCPAddr{IP: ip4}
p := 1234
e := &net.TCPAddr{IP: ip4, Port: p}
return &net.TCPAddr{IP: ip5}, nil
}
`,