I am writing a quick ssh config to json processor in golang. I have the following stuct:
type SshConfig struct {
Host string
Port string
User string
LocalForward string
...
}
I am currently looping over every line of my ssh config file and splitting the line on spaces and checking which property to update.
if split[0] == "Port" {
sshConfig.Port = strings.Join(split[1:], " ")
}
Is there a way to check a property exists and then set it dynamically?