# example file
$ cat foo.go
package foo
type T struct {
a []A
b string
}
type A struct {
foo string
bar int
}
# generate file
$ deep-copy -pointer-receiver -type=T -o deepycopy.go .
# generated file
$ cat deepycopy.go
// generated by deep-copy -pointer-receiver -type=T -o deepycopy.go . !DO NOT EDIT!
package foo
// DeepCopy generates a deep copy of *T
func (o *T) DeepCopy() *T {
var cp T
cp = *o
if o.a != nil {
cp.a = make([]A, len(o.a))
for i := range o.a {
}
}
return &cp
}
# build fails
$ go build
./deepycopy.go:11:7: i declared but not used
Below is a reproducible case: