Fixed latest linting issues

This commit is contained in:
Mike Farah 2018-08-06 16:24:06 +10:00
parent e6660e2460
commit 7a6689eb40
3 changed files with 13 additions and 14 deletions

View File

@ -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

View File

@ -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)
}

4
yq.go
View File

@ -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
}