Adds a Bool helper function.

This commit is contained in:
James Phillips 2015-12-22 10:43:32 -08:00
parent e80d1a58fb
commit d61661a98f
2 changed files with 6 additions and 2 deletions

View File

@ -430,6 +430,11 @@ type Config struct {
Reap *bool `mapstructure:"reap"`
}
// Bool is used to initialize bool pointers in struct literals.
func Bool(b bool) *bool {
return &b
}
// UnixSocketPermissions contains information about a unix socket, and
// implements the FilePermissions interface.
type UnixSocketPermissions struct {

View File

@ -1287,9 +1287,8 @@ func TestMergeConfig(t *testing.T) {
RPC: &net.TCPAddr{},
RPCRaw: "127.0.0.5:1233",
},
Reap: new(bool),
Reap: Bool(true),
}
*b.Reap = true
c := MergeConfig(a, b)