diff options
| author | Guangming Wang <guangming.wang@daocloud.io> | 2019-09-23 23:13:10 +0800 |
|---|---|---|
| committer | Guangming Wang <guangming.wang@daocloud.io> | 2019-09-28 22:03:05 +0800 |
| commit | 7d535c5d85a8136ee42affcae2e5bf2a2a94b393 (patch) | |
| tree | afb24b4d02f619e17d648f23640ff98f9463578d /edge | |
| parent | Merge pull request #616 from edisonxiang/csiproposal (diff) | |
| download | kubeedge-7d535c5d85a8136ee42affcae2e5bf2a2a94b393.tar.gz | |
cleanup: remove or simplification code pieces
default action set to break for loop
reform code to more natural logic
jump to next loop when build message failed
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
Diffstat (limited to 'edge')
| -rw-r--r-- | edge/pkg/devicetwin/dtcontext/dtcontext.go | 5 | ||||
| -rw-r--r-- | edge/pkg/devicetwin/dtmanager/twin_test.go | 1 | ||||
| -rw-r--r-- | edge/pkg/devicetwin/dttype/types.go | 5 | ||||
| -rw-r--r-- | edge/pkg/edged/util/source_ready.go | 4 |
4 files changed, 3 insertions, 12 deletions
diff --git a/edge/pkg/devicetwin/dtcontext/dtcontext.go b/edge/pkg/devicetwin/dtcontext/dtcontext.go index 58f4a7798..7573c6064 100644 --- a/edge/pkg/devicetwin/dtcontext/dtcontext.go +++ b/edge/pkg/devicetwin/dtcontext/dtcontext.go @@ -139,10 +139,7 @@ func (dtc *DTContext) UnlockAll() { //IsDeviceExist judge device is exist func (dtc *DTContext) IsDeviceExist(deviceID string) bool { _, ok := dtc.DeviceList.Load(deviceID) - if ok { - return true - } - return false + return ok } //GetDevice get device diff --git a/edge/pkg/devicetwin/dtmanager/twin_test.go b/edge/pkg/devicetwin/dtmanager/twin_test.go index a25986f7d..214bf12cd 100644 --- a/edge/pkg/devicetwin/dtmanager/twin_test.go +++ b/edge/pkg/devicetwin/dtmanager/twin_test.go @@ -79,7 +79,6 @@ func receiveMsg(commChannel chan interface{}, message *dttype.DTMessage) { return } *message = *msg.(*dttype.DTMessage) - return } // twinValueFunc returns a new TwinValue diff --git a/edge/pkg/devicetwin/dttype/types.go b/edge/pkg/devicetwin/dttype/types.go index e34faca91..50c680536 100644 --- a/edge/pkg/devicetwin/dttype/types.go +++ b/edge/pkg/devicetwin/dttype/types.go @@ -148,10 +148,7 @@ func (tv *TwinVersion) UpdateEdgeVersion() { //CompareWithCloud compare with cloud vershon while dealing cloud update req func (tv TwinVersion) CompareWithCloud(tvCloud TwinVersion) bool { - if tvCloud.EdgeVersion < tv.EdgeVersion { - return false - } - return true + return tvCloud.EdgeVersion >= tv.EdgeVersion } //UpdateCloudVersion update cloud version diff --git a/edge/pkg/edged/util/source_ready.go b/edge/pkg/edged/util/source_ready.go index 4c644dc50..1b861938f 100644 --- a/edge/pkg/edged/util/source_ready.go +++ b/edge/pkg/edged/util/source_ready.go @@ -6,9 +6,7 @@ import ( type sourcesReady struct{} -func (s *sourcesReady) AddSource(source string) { - return -} +func (s *sourcesReady) AddSource(source string) {} func (s *sourcesReady) AllReady() bool { return true |
