From d61661a98f1b2ca441b9c07e5e2ca16a2b11000b Mon Sep 17 00:00:00 2001 From: James Phillips Date: Tue, 22 Dec 2015 10:43:32 -0800 Subject: [PATCH] Adds a Bool helper function. --- command/agent/config.go | 5 +++++ command/agent/config_test.go | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/command/agent/config.go b/command/agent/config.go index 76149d31f8..d0c68df4c4 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -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 { diff --git a/command/agent/config_test.go b/command/agent/config_test.go index 99a5b398ea..72af551ab2 100644 --- a/command/agent/config_test.go +++ b/command/agent/config_test.go @@ -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)