jmattheis / goverter

Generate type-safe Go converters by simply defining an interface
https://goverter.jmattheis.de/
MIT License
487 stars 46 forks source link

Generated Unused variable #82

Closed goghcrow closed 1 year ago

goghcrow commented 1 year ago

Describe the bug

type Struct struct {
    Set map[string]struct{}
}

// goverter:converter
type Bug interface {
    Convert(*Struct) *Struct
}

got

for key, value := range (*source).Set {
        var unnamed struct{}
        mapStringUnnamed[key] = unnamed
}

Expected behavior

for key, _ := range (*source).Set {
        var unnamed struct{}
        mapStringUnnamed[key] = unnamed
}
jmattheis commented 1 year ago

Good catch, thanks for the report.

jmattheis commented 1 year ago

@goghcrow Can you recheck with the latest version (v0.17.5)?