diff options
author | Valery Piashchynski <[email protected]> | 2020-09-21 12:41:53 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-09-21 12:41:53 +0300 |
commit | bc8a3ff724c425a31c2c50a7b5f093983ed792ef (patch) | |
tree | a38583c27db0f7893d93c36478d5fa04e4dc4670 | |
parent | 0af502835616774a8b306596e4d1a8c5843b6bc8 (diff) |
Simplify watcher test, fix lgtm warinings and errors
-rwxr-xr-x | service/reload/213977608/file.txt | 0 | ||||
-rwxr-xr-x | service/reload/423382903/file.txt | 0 | ||||
-rw-r--r-- | service/reload/watcher.go | 11 | ||||
-rw-r--r-- | worker.go | 2 |
4 files changed, 2 insertions, 11 deletions
diff --git a/service/reload/213977608/file.txt b/service/reload/213977608/file.txt new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/service/reload/213977608/file.txt diff --git a/service/reload/423382903/file.txt b/service/reload/423382903/file.txt new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/service/reload/423382903/file.txt diff --git a/service/reload/watcher.go b/service/reload/watcher.go index 027d2d0d..721495c3 100644 --- a/service/reload/watcher.go +++ b/service/reload/watcher.go @@ -177,15 +177,6 @@ func (w *Watcher) retrieveFilesSingle(serviceName, path string) (map[string]os.F // so, we will add files with goto pattern outer: for i := 0; i < len(fileInfoList); i++ { - var pathToFile string - // BCE check elimination - // https://go101.org/article/bounds-check-elimination.html - if len(fileInfoList) != 0 && len(fileInfoList) >= i { - pathToFile = filepath.Join(pathToFile, fileInfoList[i].Name()) - } else { - return nil, errors.New("file info list len") - } - // if file in ignored --> continue if _, ignored := w.watcherConfigs[serviceName].ignored[path]; ignored { continue @@ -199,7 +190,7 @@ outer: } } - filesList[pathToFile] = fileInfoList[i] + filesList[fileInfoList[i].Name()] = fileInfoList[i] } return filesList, nil @@ -250,7 +250,7 @@ func (w *Worker) execPayload(rqs *Payload) (rsp *Payload, err error) { } // add streaming support :) - if rsp.Body, pr, err = w.rl.Receive(); err != nil { + if rsp.Body, _, err = w.rl.Receive(); err != nil { return nil, errors.Wrap(err, "worker error") } |