diff options
| author | Michael Pratt <mpratt@google.com> | 2024-03-04 13:20:43 -0500 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2024-03-27 17:55:52 +0000 |
| commit | 979b34b37c7af73742550ff128d162d0eb2a5f2d (patch) | |
| tree | 02bcd43f07bf2ea8bee0255e228864f3d1f49e85 /src | |
| parent | a16b4bf30c476aec397a9d63ca60c7f5a5776de1 (diff) | |
| download | go-979b34b37c7af73742550ff128d162d0eb2a5f2d.tar.xz | |
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 #58102.
Change-Id: I01cf9db2cc1dad85c3afd8a6b008c53f26cb877a
Reviewed-on: https://go-review.googlesource.com/c/go/+/569336
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/preprofile/main.go | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/cmd/preprofile/main.go b/src/cmd/preprofile/main.go index ec42ceea22..5b7c564081 100644 --- a/src/cmd/preprofile/main.go +++ b/src/cmd/preprofile/main.go @@ -19,7 +19,6 @@ import ( "internal/profile" "log" "os" - "path/filepath" "strconv" ) @@ -132,21 +131,11 @@ func preprocess(profileFile string, outputFile string, verbose bool) error { if outputFile == "" { fNodeMap = os.Stdout } else { - dirPath := filepath.Dir(outputFile) - _, err := os.Stat(dirPath) - if err != nil { - return fmt.Errorf("directory does not exist: %s", dirPath) - } - base := filepath.Base(outputFile) - outputFile = filepath.Join(dirPath, base) - - // write out NodeMap to a file fNodeMap, err = os.Create(outputFile) if err != nil { return fmt.Errorf("Error creating output file: %w", err) } - - defer fNodeMap.Close() // Close the file when done writing + defer fNodeMap.Close() } w := bufio.NewWriter(fNodeMap) |
