From f4bf0d717d3a847625845f1a5368a47ad91e20a9 Mon Sep 17 00:00:00 2001 From: zhengshuyuan Date: Sat, 9 Jan 2021 10:30:16 +0800 Subject: [PATCH] modbus-go: fix logical exceptions Copy the PR from kubeedge/mappers/modbus-go, modbus-go: fix logical exceptions #2456. --- pkg/modbus/config.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/modbus/config.go b/pkg/modbus/config.go index 89474504..82ca2e2c 100644 --- a/pkg/modbus/config.go +++ b/pkg/modbus/config.go @@ -77,8 +77,7 @@ func (c *Config) parseFlags() error { pflag.StringVar(&c.Mqtt.PrivateKey, "mqtt-priviatekey", c.Mqtt.PrivateKey, "private key file path") pflag.Parse() - if (c.Mqtt.Cert != "" && c.Mqtt.PrivateKey == "") || - (c.Mqtt.Cert == "" && c.Mqtt.PrivateKey != "") { + if c.Mqtt.Cert == "" || c.Mqtt.PrivateKey == "" { return ErrConfigCert } return nil