Skip to content

Commit 990c0fa

Browse files
committed
ignore side-effect-only _ imports
1 parent e564e5c commit 990c0fa

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

interfacegen.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ func (app *application) parse(lpkgs []*packages.Package) error {
129129
name = importSpec.Name.Name
130130
}
131131

132+
if name == "_" {
133+
continue
134+
}
135+
132136
importDefs[importDef{
133137
Path: strings.Trim(importSpec.Path.Value, `"`),
134138
Name: name,

interfacegen_test.go

100644100755
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,16 @@ import (
9797
r9 "github.com/redis/go-redis/v9"
9898
9999
"golang.org/x/tools/imports"
100+
101+
_ "embed"
100102
)
101103
102104
func main() {
103105
}
104106
107+
//go:embed response_codes.json
108+
var responseCodes []byte
109+
105110
type FooClient struct {
106111
v8 *r8.Client
107112
v9 *r9.Client

0 commit comments

Comments
 (0)