Skip to content

Commit dcca225

Browse files
authored
Merge pull request #284 from arduino/fix_tmpdir_cleanup
Fix arduino-lint-report temp dir cleanup
2 parents c21e5b7 + 83294b3 commit dcca225

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

internal/libraries/lint.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ package libraries
2626
import (
2727
"encoding/json"
2828
"fmt"
29-
"io/ioutil"
3029
"os"
3130
"os/exec"
3231
"path/filepath"
@@ -55,12 +54,12 @@ func RunArduinoLint(arduinoLintPath string, folder string, metadata *Repo) ([]by
5554
arduinoLintPath = "arduino-lint"
5655
}
5756

58-
JSONReportFolder, err := ioutil.TempDir("", "arduino-lint-report-")
57+
JSONReportFolder, err := os.MkdirTemp("", "arduino-lint-report-")
5958
if err != nil {
6059
panic(err)
6160
}
61+
defer os.RemoveAll(JSONReportFolder)
6262
JSONReportPath := filepath.Join(JSONReportFolder, "report.json")
63-
defer os.RemoveAll(JSONReportPath)
6463

6564
// See: https://arduino.github.io/arduino-lint/latest/commands/arduino-lint/
6665
cmd := exec.Command(
@@ -82,7 +81,7 @@ func RunArduinoLint(arduinoLintPath string, folder string, metadata *Repo) ([]by
8281
}
8382

8483
// Read report.
85-
rawJSONReport, err := ioutil.ReadFile(JSONReportPath)
84+
rawJSONReport, err := os.ReadFile(JSONReportPath)
8685
if err != nil {
8786
panic(err)
8887
}

0 commit comments

Comments
 (0)