Skip to content

Commit 8a806c4

Browse files
author
Jeff VanDellen
committed
Fixed golinter issues from dependabot
1 parent 0f1e68b commit 8a806c4

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

cmd/authAddContext.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,6 +18,7 @@ package cmd
1818
import (
1919
"fmt"
2020
"os"
21+
"path/filepath"
2122
"strings"
2223

2324
"github.com/spf13/cobra"
@@ -46,7 +47,7 @@ Use this if you've already setup contexts with "auth init".`,
4647
lwCliInst.Die(err)
4748
}
4849
if !utils.FileExists(file) {
49-
f, err := os.Create(file)
50+
f, err := os.Create(filepath.Clean(file))
5051
if err != nil {
5152
lwCliInst.Die(err)
5253
}

cmd/authInit.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
@@ -19,6 +19,7 @@ import (
1919
"bytes"
2020
"fmt"
2121
"os"
22+
"path/filepath"
2223
"strings"
2324
"syscall"
2425

@@ -27,7 +28,7 @@ import (
2728
"github.com/c-bata/go-prompt"
2829
"github.com/spf13/cobra"
2930

30-
"github.com/liquidweb/liquidweb-cli/types/cmd"
31+
cmdTypes "github.com/liquidweb/liquidweb-cli/types/cmd"
3132
"github.com/liquidweb/liquidweb-cli/utils"
3233
"github.com/liquidweb/liquidweb-cli/validate"
3334
)
@@ -256,7 +257,7 @@ WAIT:
256257
if err := os.Remove(cfgFile); err != nil {
257258
lwCliInst.Die(err)
258259
}
259-
f, err := os.Create(cfgFile)
260+
f, err := os.Create(filepath.Clean(cfgFile))
260261
if err != nil {
261262
lwCliInst.Die(err)
262263
}
@@ -325,7 +326,7 @@ func writeEmptyConfig() error {
325326
return err
326327
}
327328

328-
f, err := os.Create(cfgFile)
329+
f, err := os.Create(filepath.Clean(cfgFile))
329330
if err != nil {
330331
return err
331332
}

flags/defaults/core.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"fmt"
66
"os"
7+
"path/filepath"
78
"sort"
89
"strings"
910

@@ -252,7 +253,7 @@ func getFlagsFile() (file string, err error) {
252253

253254
if _, err = os.Stat(file); os.IsNotExist(err) {
254255
err = nil
255-
f, ferr := os.Create(file)
256+
f, ferr := os.Create(filepath.Clean(file))
256257
if ferr != nil {
257258
err = ferr
258259
return

0 commit comments

Comments
 (0)