@@ -89,7 +89,7 @@ func clearCurlRC() error {
8989// ── git (git config --global) ─────────────────────────────────────────────────
9090
9191func runGit (args ... string ) error {
92- return exec .Command ("git" , args ... ).Run () //nolint:noctx
92+ return exec .Command ("git" , args ... ).Run () //nolint:noctx,gosec
9393}
9494
9595func writeGitProxy (proxyURL string ) error {
@@ -117,7 +117,7 @@ func clearGitProxy() error {
117117// ── npm (npm config set) ──────────────────────────────────────────────────────
118118
119119func runNPM (args ... string ) error {
120- return exec .Command ("npm" , args ... ).Run () //nolint:noctx
120+ return exec .Command ("npm" , args ... ).Run () //nolint:noctx,gosec
121121}
122122
123123func writeNPMProxy (proxyURL string ) error {
@@ -149,7 +149,7 @@ func writePipConf(proxyURL string) error {
149149 if err != nil {
150150 return err
151151 }
152- if err := os .MkdirAll (filepath .Dir (path ), 0700 ); err != nil {
152+ if err := os .MkdirAll (filepath .Dir (path ), 0o700 ); err != nil {
153153 return err
154154 }
155155 return editINIFile (path , "global" , "proxy" , proxyURL )
@@ -322,7 +322,11 @@ func readLines(path string) ([]string, error) {
322322 if err != nil {
323323 return nil , err
324324 }
325- defer f .Close ()
325+ defer func () {
326+ if err := f .Close (); err != nil {
327+ logf ("appconfig: close error: %v" , err )
328+ }
329+ }()
326330 var lines []string
327331 sc := bufio .NewScanner (f )
328332 for sc .Scan () {
@@ -336,5 +340,5 @@ func writeLines(path string, lines []string) error {
336340 if len (lines ) > 0 {
337341 content += "\n "
338342 }
339- return os .WriteFile (path , []byte (content ), 0600 ) //nolint:gosec
343+ return os .WriteFile (path , []byte (content ), 0o600 )
340344}
0 commit comments