Fixed a problem where an error would not occur
when a negative value was specified for the p flag.
`go build -p=0`
now should throw an error.
this is my first pr to this project.
If there's anything I'm missing, please let me know 🙏
Fixes #46686
Change-Id: I3b19773ef095fad0e0419100d317727c2268699a
GitHub-Last-Rev:
e5c57804d9995f5c858aa42d9de21b25de246eb5
GitHub-Pull-Request: golang/go#47360
Reviewed-on: https://go-review.googlesource.com/c/go/+/336751
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
cfg.BuildPkgdir = p
}
+ if cfg.BuildP <= 0 {
+ base.Fatalf("go: -p must be a positive integer: %v\n", cfg.BuildP)
+ }
+
// Make sure CC, CXX, and FC are absolute paths.
for _, key := range []string{"CC", "CXX", "FC"} {
value := cfg.Getenv(key)
--- /dev/null
+! go build -p=-1 example.go
+stderr 'go: -p must be a positive integer: -1'
+
+-- example.go --
+package example
\ No newline at end of file