From 7a6689eb40fc8203e4a788621af0c5f7c1fcc8b8 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Mon, 6 Aug 2018 16:24:06 +1000 Subject: [PATCH] Fixed latest linting issues --- README.md | 13 +++++++------ data_navigator.go | 10 ++++------ yq.go | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5abca915..8786e4b5 100644 --- a/README.md +++ b/README.md @@ -84,12 +84,13 @@ Use "yq [command] --help" for more information about a command. ``` ## Contribute -1. `make [local] vendor` -2. add unit tests -3. apply changes (use govendor with a preference to [gopkg](https://gopkg.in/) for package dependencies) -4. `make [local] build` -5. If required, update the user documentation +1. `scripts/devtools.sh` +2. `make [local] vendor` +3. add unit tests +4. apply changes (use govendor with a preference to [gopkg](https://gopkg.in/) for package dependencies) +5. `make [local] build` +6. If required, update the user documentation - Update README.md and/or documentation under the mkdocs folder - `make [local] build-docs` - browse to docs/index.html and check your changes -6. profit +7. profit diff --git a/data_navigator.go b/data_navigator.go index d47fa4b2..589257a5 100644 --- a/data_navigator.go +++ b/data_navigator.go @@ -96,13 +96,11 @@ func writeArray(context interface{}, paths []string, value interface{}) []interf if rawIndex == "+" { index = int64(len(array)) } else { - index, _ = strconv.ParseInt(rawIndex, 10, 64) + index, _ = strconv.ParseInt(rawIndex, 10, 64) // nolint + // writeArray is only called by updatedChildValue which handles parsing the + // index, as such this renders this dead code. } - // writeArray is only called by updatedChildValue which handles parsing the - // index, as such this renders this dead code. - // if err != nil { - // return array, fmt.Errorf("Error accessing array: %v", err) - // } + for index >= int64(len(array)) { array = append(array, nil) } diff --git a/yq.go b/yq.go index b5ffcf56..b21bb01d 100644 --- a/yq.go +++ b/yq.go @@ -564,7 +564,7 @@ func safelyRenameFile(from string, to string) { // thanks https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang func copyFileContents(src, dst string) (err error) { - in, err := os.Open(src) + in, err := os.Open(src) // nolint gosec if err != nil { return err } @@ -606,7 +606,7 @@ func readStream(filename string, yamlDecoder yamlDecoderFn) error { if filename == "-" { stream = bufio.NewReader(os.Stdin) } else { - file, err := os.Open(filename) + file, err := os.Open(filename) // nolint gosec if err != nil { return err }