improve boolean logic

This commit is contained in:
bartfokker 2018-10-25 22:12:17 +02:00
parent 6bee1b7f31
commit 4d48245d7d
2 changed files with 2 additions and 2 deletions

View File

@ -61,7 +61,7 @@ func UpdateSwitch(k string, val bool) {
// Toggle a boolean switch
func Toggle(k string) {
sw := GetSwitch(k)
newVal := sw.Val != true
newVal := !sw.Val
log.Noticef("config change: %s: %t -> %t", k, sw.Val, newVal)
sw.Val = newVal
//log.Errorf("ignoring toggle for non-existant switch: %s", k)

View File

@ -113,7 +113,7 @@ func (cm *Docker) refresh(c *container.Container) {
func (cm *Docker) inspect(id string) *api.Container {
c, err := cm.client.InspectContainer(id)
if err != nil {
if _, ok := err.(*api.NoSuchContainer); ok == false {
if _, ok := err.(*api.NoSuchContainer); !ok {
log.Errorf(err.Error())
}
}