Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit fda1135

Browse files
dmitrisshantuo
authored andcommitted
internal/wire: fix panic in objectCache.processExpr (#236)
1 parent 578b29e commit fda1135

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
77
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
88
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
99
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
10+
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
11+
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12+
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
1013
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
1114
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b h1:NVD8gBK33xpdqCaZVVtd6OFJp+3dxkXuz7+U7KaVN6s=
1215
golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=

internal/wire/parse.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,14 @@ func (oc *objectCache) processExpr(info *types.Info, pkgPath string, expr ast.Ex
529529
}
530530
if call, ok := expr.(*ast.CallExpr); ok {
531531
fnObj := qualifiedIdentObject(info, call.Fun)
532-
if fnObj == nil || !isWireImport(fnObj.Pkg().Path()) {
532+
if fnObj == nil {
533+
return nil, []error{notePosition(exprPos, errors.New("unknown pattern fnObj nil"))}
534+
}
535+
pkg := fnObj.Pkg()
536+
if pkg == nil {
537+
return nil, []error{notePosition(exprPos, fmt.Errorf("unknown pattern - pkg in fnObj is nil - %s", fnObj))}
538+
}
539+
if !isWireImport(pkg.Path()) {
533540
return nil, []error{notePosition(exprPos, errors.New("unknown pattern"))}
534541
}
535542
switch fnObj.Name() {

0 commit comments

Comments
 (0)