Skip to content

Commit 16041e3

Browse files
prattmicMchnan
authored and
Mchnan
committed
cmd/preprofile: drop output directory check
This check serves only to provide a more descriptive error if the output directory doesn't exist. That isn't useless, but I don't see why this tool specifically should do this when no other part of the toolchain does. For golang#58102. Change-Id: I01cf9db2cc1dad85c3afd8a6b008c53f26cb877a Reviewed-on: https://go-review.googlesource.com/c/go/+/569336 Reviewed-by: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent c3ea99c commit 16041e3

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/cmd/preprofile/main.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"internal/profile"
2020
"log"
2121
"os"
22-
"path/filepath"
2322
"strconv"
2423
)
2524

@@ -132,21 +131,11 @@ func preprocess(profileFile string, outputFile string, verbose bool) error {
132131
if outputFile == "" {
133132
fNodeMap = os.Stdout
134133
} else {
135-
dirPath := filepath.Dir(outputFile)
136-
_, err := os.Stat(dirPath)
137-
if err != nil {
138-
return fmt.Errorf("directory does not exist: %s", dirPath)
139-
}
140-
base := filepath.Base(outputFile)
141-
outputFile = filepath.Join(dirPath, base)
142-
143-
// write out NodeMap to a file
144134
fNodeMap, err = os.Create(outputFile)
145135
if err != nil {
146136
return fmt.Errorf("Error creating output file: %w", err)
147137
}
148-
149-
defer fNodeMap.Close() // Close the file when done writing
138+
defer fNodeMap.Close()
150139
}
151140

152141
w := bufio.NewWriter(fNodeMap)

0 commit comments

Comments
 (0)