Skip to content

Commit b137c8e

Browse files
authored
Issue #1631: fix(scripts/buildinputs/) validate TARGETPLATFORM environment variable (#1634)
1 parent 60f71c1 commit b137c8e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/buildinputs/buildinputs.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ import (
99

1010
func main() {
1111
targetPlatform := os.Getenv("TARGETPLATFORM")
12+
if targetPlatform == "" {
13+
panic("TARGETPLATFORM environment variable is required")
14+
}
1215
platformFields := strings.Split(targetPlatform, "/")
1316
if len(platformFields) != 2 {
14-
panic(fmt.Sprint(targetPlatform, "format is invalid, should be os/arch"))
17+
panic(fmt.Sprintf("TARGETPLATFORM format is invalid: %q, should be os/arch", targetPlatform))
1518
}
1619
targetOs := platformFields[0]
1720
targetArch := platformFields[1]
1821

1922
if targetOs != "linux" {
20-
panic(fmt.Sprint(targetOs, "not supported"))
23+
panic(fmt.Sprintf("%s not supported", targetOs))
2124
}
2225

2326
flag.Parse()

0 commit comments

Comments
 (0)