First of all, thank you for your brilliant generator!
I'm currently expecting issues while generating setter and getter methods for a struct that relies on two packages that are named identical. While renaming imports is supported in GoLang (see), i'm not sure if this is possible to implement.
So, for example:
//types.go
package main
import (
v1 "example.org/a/v1" // exported as a, but renamed import to v1
v2 "example.org/a/v2" // exported as a, but renamed import to v2
)
//go:generate accessory -type MyStruct -receiver myStruct
type MyStruct struct {
dummy1 *v1.Dummy `accessor:"getter:GetDummy1,setter:SetDummy1"`
dummy2 *v2.Dummy `accessor:"getter:GetDummy2,setter:SetDummy2"`
}
// my_struct_accessor.go
// Code generated by accessory; DO NOT EDIT.
import (
"example.org/a/v1"
"example.org/a/v2"
)
func (myStruct *MyStruct) GetDummy1() *a.Dummy {
if myStruct == nil {
return nil
}
return myStruct.dummy1
}
func (myStruct *MyStruct) SetDummy1(val *a.Dummy) {
if myStruct == nil {
return
}
myStruct.dummy1 = val
}
func (myStruct *MyStruct) GetDummy2() *a.Dummy {
if myStruct == nil {
return nil
}
return myStruct.dummy2
}
func (myStruct *MyStruct) SetDummy2(val *a.Dummy) {
if myStruct == nil {
return
}
myStruct.dummy2 = val
}
First of all, thank you for your brilliant generator!
I'm currently expecting issues while generating setter and getter methods for a struct that relies on two packages that are named identical. While renaming imports is supported in GoLang (see), i'm not sure if this is possible to implement.
So, for example: