if target == "nacl" {
continue
}
- var buf bytes.Buffer
- fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n")
+ var tags []string
if target == "linux" {
- fmt.Fprintf(&buf, "// +build !android\n") // must explicitly exclude android for linux
+ tags = append(tags, "!android") // must explicitly exclude android for linux
}
if target == "solaris" {
- fmt.Fprintf(&buf, "// +build !illumos\n") // must explicitly exclude illumos for solaris
+ tags = append(tags, "!illumos") // must explicitly exclude illumos for solaris
}
if target == "darwin" {
- fmt.Fprintf(&buf, "// +build !ios\n") // must explicitly exclude ios for darwin
+ tags = append(tags, "!ios") // must explicitly exclude ios for darwin
}
- fmt.Fprintf(&buf, "// +build %s\n\n", target) // must explicitly include target for bootstrapping purposes
+ tags = append(tags, target) // must explicitly include target for bootstrapping purposes
+ var buf bytes.Buffer
+ fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n")
+ fmt.Fprintf(&buf, "//go:build %s\n", strings.Join(tags, " && "))
+ fmt.Fprintf(&buf, "// +build %s\n\n", strings.Join(tags, ","))
fmt.Fprintf(&buf, "package sys\n\n")
fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target)
for _, goos := range gooses {
}
var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n")
+ fmt.Fprintf(&buf, "//go:build %s\n", target)
fmt.Fprintf(&buf, "// +build %s\n\n", target) // must explicitly include target for bootstrapping purposes
fmt.Fprintf(&buf, "package sys\n\n")
fmt.Fprintf(&buf, "const GOARCH = `%s`\n\n", target)