Please help to understand, how I can return from function not only values from structure but with their names?
Example my arg.go
package flags
import (
"flag"
)
type FlagsStruct struct {
argTest1 string
argTest2 string
}
func GetInitFlags() *FlagsStruct {
Flags := new(FlagsStruct)
flag.StringVar(&Flags.argTest1, "test1", "test1", "c")
flag.StringVar(&Flags.argTest2, "test2", "test2", "t")
flag.Parse()
return Flags
}
It's working only with keys, for example in my main function I trying to print and it's working:
fmt.Print(*inputFlags)
{test1 test2}
But how I can pass taht can print something like this?
fmt.Printf(inputFlags.argTest2)
./main.go:25:24: inputFlags.argTest2 undefined (cannot refer to unexported field or method argTest2)