Files
moxa/_test/closure7.go
Marc Vertes 49c8c905d2 fix: ensure type computation in ValueSpec statement (#64)
Use nodeType in global var declaration to infer the type,
otherwise it may not be set properly, and failure will occur at use of variable.
2019-01-29 13:39:34 +01:00

29 lines
253 B
Go

package main
import (
"fmt"
)
type Config struct {
A string
}
var conf *Config
func SetConfig() func(*Config) {
return func(cf *Config) {
conf = cf
}
}
func main() {
conf := &Config{
A: "foo",
}
fmt.Println(conf.A)
}
// Output:
// foo