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>
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 {