func asBool(s string, def bool) bool {
	b, err := strconv.ParseBool(s)
	if err == nil {
		return b
	} else {
		return def
	}
}
The Go YAML parsing is not what you might expect for booleans - you are
apparently unable to set a default of "true" for missing fields. So we read ut
as a string and parse that. The caller also sends in the default value if the string
cannot be decoded.
package config
import (
	"fmt"
	"gopkg.in/yaml.v2"
	"io/ioutil"
	"strconv"
)
type ConfigYGlobal struct {
	UseObjectStatus    string `yaml:"useObjectStatus" default:"true"`
	UseResetQStats     string `yaml:"useResetQStats" default:"false"`
	UsePublications    string `yaml:"usePublications" default:"true"`
	LogLevel           string `yaml:"logLevel"`
	MetaPrefix         string
	PollInterval       string `yaml:"pollInterval"`
	RediscoverInterval string `yaml:"rediscoverInterval"`
	TZOffset           string `yaml:"tzOffset"`
	Locale             string
}
type ConfigYConnection struct {
	QueueManager string `yaml:"queueManager"`
	User         string
	Client       string `yaml:"clientConnection" default:"false"`
	Password     string
	ReplyQueue   string `yaml:"replyQueue"`
	CcdtUrl      string `yaml:"ccdtUrl"`
	ConnName     string `yaml:"connName"`
	Channel      string `yaml:"channel"`
}
type ConfigYObjects struct {
	Queues                    []string
	QueueSubscriptionSelector []string `yaml:"queueSubscriptionSelector"`
	Channels                  []string
	Topics                    []string
	Subscriptions             []string
	ShowInactiveChannels      string `yaml:"showInactiveChannels" default:"false"`
}
func ReadConfigFile(f string, cmy interface{}) error {
	data, e2 := ioutil.ReadFile(f)
	if e2 == nil {
		e2 = yaml.Unmarshal(data, cmy)
	}
	return e2
}