#How can I pass a variable by reference so functions can modify or even reassign it?

6 messages · Page 1 of 1 (latest)

limber valve
#

in setConfig it should be

*config = Config{
  Val: "new val",
}
#

Or just config.Val = "new val"

#

You wanna change the value of what config points to, not assign it to a new struct

#

also in printJsonConfig you'd want to check if config == nil, before trying to marshal, and then printing "nil"

#

@wild sedge

verbal rune