all: update go directive to 1.18

Done with:

go get go@1.18
go mod tidy
go fix ./...

Using go1.21.3.

Also update code generators to use only the new go:build lines,
not the old +build ones.

For golang/go#60268.

Change-Id: I6aabc42efb6ab3329981100e1db2263aac5e92a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/534222
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Dmitri Shuralyov
2023-10-11 21:54:30 +00:00
committed by Gopher Robot
parent 1d9f0b6d88
commit 1bfbee0e20
418 changed files with 24 additions and 534 deletions
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// +build go1.9
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
// +build gc
#include "textflag.h"
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (freebsd || netbsd || openbsd) && gc
// +build freebsd netbsd openbsd
// +build gc
#include "textflag.h"
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
// +build darwin dragonfly freebsd netbsd openbsd
// +build gc
#include "textflag.h"
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (freebsd || netbsd || openbsd) && gc
// +build freebsd netbsd openbsd
// +build gc
#include "textflag.h"
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
// +build gc
#include "textflag.h"
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
// +build gc
#include "textflag.h"
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
// +build gc
#include "textflag.h"
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
// +build gc
#include "textflag.h"
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
// +build gc
#include "textflag.h"
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
// +build gc
#include "textflag.h"
-3
View File
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && arm64 && gc
// +build linux
// +build arm64
// +build gc
#include "textflag.h"
-3
View File
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && loong64 && gc
// +build linux
// +build loong64
// +build gc
#include "textflag.h"
-3
View File
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (mips64 || mips64le) && gc
// +build linux
// +build mips64 mips64le
// +build gc
#include "textflag.h"
-3
View File
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (mips || mipsle) && gc
// +build linux
// +build mips mipsle
// +build gc
#include "textflag.h"
-3
View File
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (ppc64 || ppc64le) && gc
// +build linux
// +build ppc64 ppc64le
// +build gc
#include "textflag.h"
-2
View File
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build riscv64 && gc
// +build riscv64
// +build gc
#include "textflag.h"
-3
View File
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && s390x && gc
// +build linux
// +build s390x
// +build gc
#include "textflag.h"
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
// +build gc
#include "textflag.h"
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
// +build gc
#include "textflag.h"
-3
View File
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x && gc
// +build zos
// +build s390x
// +build gc
#include "textflag.h"
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build freebsd
// +build freebsd
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux
// +build linux
package unix_test
-1
View File
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build darwin && go1.12
// +build darwin,go1.12
package unix
-1
View File
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build darwin && go1.12
// +build darwin,go1.12
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin && go1.12
// +build darwin,go1.12
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc
// +build aix,ppc
// Functions to access/create device major and minor numbers matching the
// encoding used by AIX.
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc64
// +build aix,ppc64
// Functions to access/create device major and minor numbers matching the
// encoding used AIX.
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build go1.7
// +build go1.7
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
// Functions to access/create device major and minor numbers matching the
// encoding used by z/OS.
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build freebsd || linux || netbsd || openbsd
// +build freebsd linux netbsd openbsd
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//
//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// Unix environment variables.
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin && !ios) || (linux && !android)
// +build darwin,!ios linux,!android
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux || netbsd
// +build linux netbsd
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc)
// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gccgo && !aix && !hurd
// +build gccgo,!aix,!hurd
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gccgo && !aix && !hurd
// +build gccgo,!aix,!hurd
#include <errno.h>
#include <stdint.h>
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gccgo && linux && amd64
// +build gccgo,linux,amd64
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || openbsd || netbsd || zos
// +build darwin dragonfly freebsd openbsd netbsd zos
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || openbsd
// +build darwin dragonfly freebsd openbsd
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux
// +build linux
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux
// +build linux
package unix
+9 -2
View File
@@ -282,7 +282,15 @@ func getCodeSet(src interface{}) (*codeSet, error) {
// Add file level comments
cmap := ast.NewCommentMap(fset, f, f.Comments)
for _, cGrp := range cmap[f] {
set.add(codeElem{token.COMMENT, cGrp.Text()})
text := cGrp.Text()
if text == "" && len(cGrp.List) == 1 && strings.HasPrefix(cGrp.List[0].Text, "//go:build ") {
// ast.CommentGroup.Text doesn't include comment directives like "//go:build"
// in the text. So if a comment group has empty text and a single //go:build
// constraint line, make a custom codeElem. This is enough for mkmerge needs.
set.add(codeElem{token.COMMENT, cGrp.List[0].Text[len("//"):] + "\n"})
continue
}
set.add(codeElem{token.COMMENT, text})
}
return set, nil
@@ -465,7 +473,6 @@ func merge(mergedFile string, archFiles ...string) error {
fmt.Fprintln(buf, "// Code generated by mkmerge; DO NOT EDIT.")
fmt.Fprintln(buf)
fmt.Fprintf(buf, "//go:build %s\n", goos)
fmt.Fprintf(buf, "// +build %s\n", goos)
fmt.Fprintln(buf)
buf.Write(mergedSrc)
+1 -3
View File
@@ -100,7 +100,6 @@ func TestMerge(t *testing.T) {
// build directives for arch{{.}}
//go:build goos && arch{{.}}
// +build goos,arch{{.}}
package main
@@ -186,7 +185,6 @@ const (
// build directives for arch{{.}}
//go:build goos && arch{{.}}
// +build goos,arch{{.}}
package main
@@ -317,7 +315,7 @@ const (
expectedElems := []codeElem{
{token.COMMENT, "Package comments\n"},
{token.COMMENT, "build directives for archA\n"},
{token.COMMENT, "+build goos,archA\n"},
{token.COMMENT, "go:build goos && archA\n"},
{token.CONST, `COMMON_INDEPENDENT = 1234`},
{token.CONST, `UNIQUE_INDEPENDENT_A = "UNIQUE_INDEPENDENT_A"`},
{token.CONST, `COMMON_GROUP = "COMMON_GROUP"`},
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || solaris
// +build aix solaris
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd hurd linux netbsd openbsd
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
package unix
+1 -8
View File
@@ -11,7 +11,6 @@
// go run linux/mkall.go <linux_dir> <glibc_dir>
//go:build ignore
// +build ignore
package main
@@ -629,11 +628,7 @@ func (t *target) matchesMksyscallFile(file string) (bool, error) {
s := bufio.NewScanner(f)
for s.Scan() {
// Keep scanning until a valid constraint is found or we hit EOF.
//
// This only supports single-line constraints such as the //go:build
// convention used in Go 1.17+. Because the old //+build convention
// (which may have multiple lines of build tags) is being deprecated,
// we don't bother looking for multi-line constraints.
// This is sufficient for the single-line //go:build constraints.
if expr, err = constraint.Parse(s.Text()); err == nil {
found = true
break
@@ -752,8 +747,6 @@ func generatePtracePair(arch1, arch2, archName string) error {
fmt.Fprintf(buf, "// Code generated by linux/mkall.go generatePtracePair(%q, %q). DO NOT EDIT.\n", arch1, arch2)
fmt.Fprintf(buf, "\n")
fmt.Fprintf(buf, "//go:build linux && (%s || %s)\n", arch1, arch2)
fmt.Fprintf(buf, "// +build linux\n")
fmt.Fprintf(buf, "// +build %s %s\n", arch1, arch2)
fmt.Fprintf(buf, "\n")
fmt.Fprintf(buf, "package unix\n")
fmt.Fprintf(buf, "\n")
+1 -8
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
package main
@@ -32,11 +31,6 @@ func goBuildTags() string {
return fmt.Sprintf("%s && %s", goarch, goos)
}
// plusBuildTags returns build tags in the +build format.
func plusBuildTags() string {
return fmt.Sprintf("%s,%s", goarch, goos)
}
func format(name string, num int, offset int) (int, string) {
if num > 999 {
// ignore deprecated syscalls that are no longer implemented
@@ -186,14 +180,13 @@ func main() {
for _, num := range nums {
text.WriteString(num.declaration)
}
fmt.Printf(template, cmdLine(), goBuildTags(), plusBuildTags(), text.String())
fmt.Printf(template, cmdLine(), goBuildTags(), text.String())
}
const template = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s
// +build %s
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
/*
Input to cgo -godefs. See README.md
-2
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
// mkasm.go generates assembly trampolines to call library routines from Go.
// This program must be run after mksyscall.go.
@@ -82,7 +81,6 @@ const darwinTestTemplate = `// go run mkasm.go %s
// Code generated by the command above; DO NOT EDIT.
//go:build darwin && go1.12
// +build darwin,go1.12
package unix
-1
View File
@@ -663,7 +663,6 @@ echo '// mkerrors.sh' "$@"
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
echo
echo "//go:build ${GOARCH} && ${GOOS}"
echo "// +build ${GOARCH},${GOOS}"
echo
go tool cgo -godefs -- "$@" _const.go >_error.out
cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
+1 -3
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
// mkpost processes the output of cgo -godefs to
// modify the generated types. It is used to clean up
@@ -218,8 +217,7 @@ func main() {
replacement := fmt.Sprintf(`$1 | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s && %s
// +build %s,%s`, goarch, goos, goarch, goos)
//go:build %s && %s`, goarch, goos)
cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
+1 -8
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
/*
This program reads a file containing function prototypes
@@ -58,11 +57,6 @@ func goBuildTags() string {
return strings.ReplaceAll(*tags, ",", " && ")
}
// plusBuildTags returns build tags in the +build format.
func plusBuildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
@@ -389,14 +383,13 @@ func main() {
}
file.Close()
}
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), text)
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), text)
}
const srcTemplate = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s
// +build %s
package unix
+1 -8
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
/*
This program reads a file containing function prototypes
@@ -48,11 +47,6 @@ func goBuildTags() string {
return strings.ReplaceAll(*tags, ",", " && ")
}
// plusBuildTags returns build tags in the +build format.
func plusBuildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
@@ -392,14 +386,13 @@ func main() {
imp = "import \"golang.org/x/sys/unix\"\n"
}
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), pack, cExtern, imp, text)
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), pack, cExtern, imp, text)
}
const srcTemplate = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s
// +build %s
package %s
+3 -12
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
/*
This program reads a file containing function prototypes
@@ -88,11 +87,6 @@ func goBuildTags() string {
return strings.ReplaceAll(*tags, ",", " && ")
}
// plusBuildTags returns build tags in the +build format.
func plusBuildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
@@ -525,7 +519,7 @@ func main() {
// Print zsyscall_aix_ppc64.go
err := os.WriteFile("zsyscall_aix_ppc64.go",
[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), goBuildTags(), plusBuildTags(), pack, imp, textcommon)),
[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), goBuildTags(), pack, imp, textcommon)),
0644)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
@@ -536,7 +530,7 @@ func main() {
vardecls := "\t" + strings.Join(vars, ",\n\t")
vardecls += " syscallFunc"
err = os.WriteFile("zsyscall_aix_ppc64_gc.go",
[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), goBuildTags(), plusBuildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), goBuildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
0644)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
@@ -545,7 +539,7 @@ func main() {
// Print zsyscall_aix_ppc64_gccgo.go
err = os.WriteFile("zsyscall_aix_ppc64_gccgo.go",
[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), goBuildTags(), plusBuildTags(), pack, cExtern, imp, textgccgo)),
[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), goBuildTags(), pack, cExtern, imp, textgccgo)),
0644)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
@@ -557,7 +551,6 @@ const srcTemplate1 = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s
// +build %s
package %s
@@ -574,7 +567,6 @@ const srcTemplate2 = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s && gc
// +build %s,gc
package %s
@@ -600,7 +592,6 @@ const srcTemplate3 = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s && gccgo
// +build %s,gccgo
package %s
+1 -8
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
/*
This program reads a file containing function prototypes
@@ -49,11 +48,6 @@ func goBuildTags() string {
return strings.ReplaceAll(*tags, ",", " && ")
}
// plusBuildTags returns build tags in the +build format.
func plusBuildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
@@ -322,14 +316,13 @@ func main() {
vardecls := "\t" + strings.Join(vars, ",\n\t")
vardecls += " syscallFunc"
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), pack, syscallimp, imp, dynimports, linknames, vardecls, text)
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), pack, syscallimp, imp, dynimports, linknames, vardecls, text)
}
const srcTemplate = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s
// +build %s
package %s
+1 -8
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
// Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
//
@@ -37,11 +36,6 @@ func goBuildTags() string {
return fmt.Sprintf("%s && %s", goarch, goos)
}
// plusBuildTags returns build tags in the +build format.
func plusBuildTags() string {
return fmt.Sprintf("%s,%s", goarch, goos)
}
// reMatch performs regular expression match and stores the substring slice to value pointed by m.
func reMatch(re *regexp.Regexp, str string, m *[]string) bool {
*m = re.FindStringSubmatch(str)
@@ -336,14 +330,13 @@ func main() {
sort.Strings(sysCtl)
text := strings.Join(sysCtl, "")
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), text)
fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), text)
}
const srcTemplate = `// %s
// Code generated by the command above; DO NOT EDIT.
//go:build %s
// +build %s
package unix
+1 -8
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
// Generate system call table for DragonFly, NetBSD,
// FreeBSD or OpenBSD from master list (for example,
@@ -34,11 +33,6 @@ func goBuildTags() string {
return fmt.Sprintf("%s && %s", goarch, goos)
}
// plusBuildTags returns build tags in the +build format.
func plusBuildTags() string {
return fmt.Sprintf("%s,%s", goarch, goos)
}
func checkErr(err error) {
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
@@ -182,14 +176,13 @@ func main() {
err := s.Err()
checkErr(err)
fmt.Printf(template, cmdLine(), goBuildTags(), plusBuildTags(), text)
fmt.Printf(template, cmdLine(), goBuildTags(), text)
}
const template = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build %s
// +build %s
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris
// +build aix darwin dragonfly freebsd openbsd solaris
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
// +build zos,s390x
// This test is based on mmap_unix_test, but tweaked for z/OS, which does not support memadvise
// or anonymous mmapping.
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux || netbsd
// +build linux netbsd
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux || netbsd
// +build linux netbsd
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build openbsd
// +build openbsd
// This, on the face of it, bizarre testing mechanism is necessary because
// the only reliable way to gauge whether or not a pledge(2) call has succeeded
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// For Unix, get the pagesize from the runtime.
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build dragonfly freebsd linux netbsd openbsd solaris
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin && !ios
// +build darwin,!ios
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ios
// +build ios
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin && race) || (linux && race) || (freebsd && race)
// +build darwin,race linux,race freebsd,race
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos
// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd
// +build aix dragonfly freebsd linux netbsd openbsd
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin
// +build darwin
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin && amd64) || dragonfly || freebsd || linux || solaris
// +build darwin,amd64 dragonfly freebsd linux solaris
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// Socket control messages
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin freebsd linux netbsd openbsd solaris zos
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// Package unix contains an interface to the low-level operating system
// primitives. OS details vary depending on the underlying system, and
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix
// +build aix
// Aix system calls.
// This file is compiled as ordinary Go code,
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc
// +build aix,ppc
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc64
// +build aix,ppc64
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix
// +build aix
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
// BSD system call wrappers shared by *BSD based systems
// including OS X (Darwin) and FreeBSD. Like the other
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package unix_test
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && darwin
// +build amd64,darwin
package unix
-1
View File
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm64 && darwin
// +build arm64,darwin
package unix

Some files were not shown because too many files have changed in this diff Show More