aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Podtserkovskii <michaelpo@meta.com>2024-04-05 13:58:35 +0100
committerGopher Robot <gobot@golang.org>2024-04-15 22:43:52 +0000
commit1488bb6c4c6487f9ef3c6d59a84a29fea9ec9266 (patch)
tree6a2ffff81692a37a17b219774f2a6f473beff57c /src
parentca94e9e223888d6d99a8f7b559f08bb59d2cc5fd (diff)
downloadgo-1488bb6c4c6487f9ef3c6d59a84a29fea9ec9266.tar.xz
cmd/cgo: create -objdir if not exist
Currently the directory is created only if -objdir is omited. Creating the directory here is useful to avoid doing this in each build system. And also this is consistent with similar flags of other tools like `-o`. Change-Id: Ic39d6eb3e003bc4884089f80f790e30df4a54b01 Reviewed-on: https://go-review.googlesource.com/c/go/+/576815 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/cgo/main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go
index fce2671c2c..a9095dee3d 100644
--- a/src/cmd/cgo/main.go
+++ b/src/cmd/cgo/main.go
@@ -385,11 +385,11 @@ func main() {
cPrefix = fmt.Sprintf("_%x", h.Sum(nil)[0:6])
if *objDir == "" {
- // make sure that _obj directory exists, so that we can write
- // all the output files there.
- os.Mkdir("_obj", 0777)
*objDir = "_obj"
}
+ // make sure that `objDir` directory exists, so that we can write
+ // all the output files there.
+ os.MkdirAll(*objDir, 0o700)
*objDir += string(filepath.Separator)
for i, input := range goFiles {