summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Rakoczy <alex@golang.org>2020-12-14 11:42:42 -0500
committerAlexander Rakoczy <alex@golang.org>2020-12-14 11:42:42 -0500
commit267975dc4732b6f6a62a7d33a85de34efef180b7 (patch)
treefd69c51067a279d959b233b94bccf2bf969317a7
parent63bc23b5452f6605df3e40ce7ecdd8b0348792af (diff)
parent6c64b6db6802818dd9a4789cdd564f19b70b6b4c (diff)
downloadgo-git-267975dc4732b6f6a62a7d33a85de34efef180b7.tar.gz
Merge branch 'master' into dev.regabi
Change-Id: I098acdbc5e2676aeb8700d935e796a9c29d04b88
-rw-r--r--doc/go1.16.html385
-rw-r--r--misc/cgo/testsanitizers/msan_test.go1
-rw-r--r--misc/cgo/testsanitizers/testdata/msan7.go38
-rw-r--r--src/archive/tar/reader_test.go3
-rw-r--r--src/archive/tar/tar_test.go3
-rw-r--r--src/archive/tar/writer_test.go3
-rw-r--r--src/archive/zip/reader_test.go11
-rw-r--r--src/archive/zip/writer_test.go4
-rw-r--r--src/cmd/addr2line/addr2line_test.go7
-rw-r--r--src/cmd/api/goapi.go3
-rw-r--r--src/cmd/api/goapi_test.go3
-rw-r--r--src/cmd/compile/internal/gc/builtin.go42
-rw-r--r--src/cmd/compile/internal/gc/builtin/runtime.go1
-rw-r--r--src/cmd/compile/internal/gc/go.go1
-rw-r--r--src/cmd/compile/internal/gc/ssa.go85
-rw-r--r--src/cmd/compile/internal/logopt/logopt_test.go2
-rw-r--r--src/cmd/compile/internal/ssa/gen/386.rules1
-rw-r--r--src/cmd/compile/internal/ssa/gen/ARM.rules4
-rw-r--r--src/cmd/compile/internal/ssa/gen/ARM64.rules16
-rw-r--r--src/cmd/compile/internal/ssa/gen/MIPS.rules8
-rw-r--r--src/cmd/compile/internal/ssa/gen/MIPS64.rules8
-rw-r--r--src/cmd/compile/internal/ssa/gen/PPC64.rules1
-rw-r--r--src/cmd/compile/internal/ssa/gen/Wasm.rules1
-rw-r--r--src/cmd/compile/internal/ssa/rewrite386.go13
-rw-r--r--src/cmd/compile/internal/ssa/rewriteARM.go8
-rw-r--r--src/cmd/compile/internal/ssa/rewriteARM64.go32
-rw-r--r--src/cmd/compile/internal/ssa/rewriteMIPS.go16
-rw-r--r--src/cmd/compile/internal/ssa/rewriteMIPS64.go16
-rw-r--r--src/cmd/compile/internal/ssa/rewritePPC64.go14
-rw-r--r--src/cmd/compile/internal/ssa/rewriteWasm.go14
-rw-r--r--src/cmd/compile/internal/wasm/ssa.go6
-rw-r--r--src/cmd/cover/cover.go3
-rw-r--r--src/cmd/cover/cover_test.go31
-rw-r--r--src/cmd/cover/html.go5
-rw-r--r--src/cmd/fix/main.go3
-rw-r--r--src/cmd/fix/typecheck.go7
-rw-r--r--src/cmd/go.mod7
-rw-r--r--src/cmd/go.sum17
-rw-r--r--src/cmd/go/go_test.go19
-rw-r--r--src/cmd/go/go_windows_test.go5
-rw-r--r--src/cmd/go/help_test.go4
-rw-r--r--src/cmd/go/internal/auth/netrc.go3
-rw-r--r--src/cmd/go/internal/bug/bug.go5
-rw-r--r--src/cmd/go/internal/cache/cache.go5
-rw-r--r--src/cmd/go/internal/cache/cache_test.go13
-rw-r--r--src/cmd/go/internal/cache/default.go3
-rw-r--r--src/cmd/go/internal/cache/hash_test.go3
-rw-r--r--src/cmd/go/internal/cfg/cfg.go3
-rw-r--r--src/cmd/go/internal/clean/clean.go3
-rw-r--r--src/cmd/go/internal/envcmd/env.go7
-rw-r--r--src/cmd/go/internal/fsys/fsys.go2
-rw-r--r--src/cmd/go/internal/fsys/fsys_test.go3
-rw-r--r--src/cmd/go/internal/generate/generate.go3
-rw-r--r--src/cmd/go/internal/imports/scan_test.go8
-rw-r--r--src/cmd/go/internal/load/pkg.go28
-rw-r--r--src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go5
-rw-r--r--src/cmd/go/internal/lockedfile/lockedfile_test.go9
-rw-r--r--src/cmd/go/internal/modcmd/vendor.go13
-rw-r--r--src/cmd/go/internal/modcmd/verify.go3
-rw-r--r--src/cmd/go/internal/modconv/convert_test.go5
-rw-r--r--src/cmd/go/internal/modconv/modconv_test.go6
-rw-r--r--src/cmd/go/internal/modfetch/cache.go3
-rw-r--r--src/cmd/go/internal/modfetch/cache_test.go3
-rw-r--r--src/cmd/go/internal/modfetch/codehost/codehost.go5
-rw-r--r--src/cmd/go/internal/modfetch/codehost/git_test.go3
-rw-r--r--src/cmd/go/internal/modfetch/codehost/shell.go3
-rw-r--r--src/cmd/go/internal/modfetch/codehost/vcs.go3
-rw-r--r--src/cmd/go/internal/modfetch/coderepo.go3
-rw-r--r--src/cmd/go/internal/modfetch/coderepo_test.go13
-rw-r--r--src/cmd/go/internal/modfetch/fetch.go5
-rw-r--r--src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go3
-rw-r--r--src/cmd/go/internal/modload/init.go25
-rw-r--r--src/cmd/go/internal/modload/load.go8
-rw-r--r--src/cmd/go/internal/modload/modfile.go13
-rw-r--r--src/cmd/go/internal/modload/query_test.go3
-rw-r--r--src/cmd/go/internal/modload/vendor.go4
-rw-r--r--src/cmd/go/internal/renameio/renameio.go4
-rw-r--r--src/cmd/go/internal/renameio/renameio_test.go3
-rw-r--r--src/cmd/go/internal/renameio/umask_test.go3
-rw-r--r--src/cmd/go/internal/robustio/robustio.go2
-rw-r--r--src/cmd/go/internal/robustio/robustio_flaky.go5
-rw-r--r--src/cmd/go/internal/robustio/robustio_other.go3
-rw-r--r--src/cmd/go/internal/test/test.go16
-rw-r--r--src/cmd/go/internal/txtar/archive.go4
-rw-r--r--src/cmd/go/internal/vcs/vcs_test.go3
-rw-r--r--src/cmd/go/internal/web/file_test.go3
-rw-r--r--src/cmd/go/internal/work/action.go3
-rw-r--r--src/cmd/go/internal/work/build_test.go9
-rw-r--r--src/cmd/go/internal/work/buildid.go3
-rw-r--r--src/cmd/go/internal/work/exec.go17
-rw-r--r--src/cmd/go/internal/work/gc.go7
-rw-r--r--src/cmd/go/internal/work/gccgo.go3
-rw-r--r--src/cmd/go/proxy_test.go7
-rw-r--r--src/cmd/go/script_test.go23
-rw-r--r--src/cmd/go/testdata/addmod.go13
-rw-r--r--src/cmd/go/testdata/savedir.go3
-rw-r--r--src/cmd/go/testdata/script/build_issue6480.txt5
-rw-r--r--src/cmd/go/testdata/script/build_trimpath.txt3
-rw-r--r--src/cmd/go/testdata/script/cover_error.txt5
-rw-r--r--src/cmd/go/testdata/script/gopath_moved_repo.txt5
-rw-r--r--src/cmd/go/testdata/script/mod_download_concurrent_read.txt3
-rw-r--r--src/cmd/go/testdata/script/mod_modinfo.txt3
-rw-r--r--src/cmd/go/testdata/script/mod_test_cached.txt7
-rw-r--r--src/cmd/go/testdata/script/test_compile_tempfile.txt2
-rw-r--r--src/cmd/go/testdata/script/test_generated_main.txt3
-rw-r--r--src/cmd/go/testdata/script/test_race_install_cgo.txt8
-rw-r--r--src/cmd/gofmt/gofmt.go5
-rw-r--r--src/cmd/gofmt/gofmt_test.go13
-rw-r--r--src/cmd/nm/nm_test.go9
-rw-r--r--src/cmd/objdump/objdump_test.go5
-rw-r--r--src/cmd/pack/pack_test.go13
-rw-r--r--src/cmd/trace/annotations_test.go4
-rw-r--r--src/cmd/trace/pprof.go3
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go24
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go17
-rw-r--r--src/cmd/vendor/github.com/ianlancetaylor/demangle/ast.go378
-rw-r--r--src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go501
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_386.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_386.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_386.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_amd64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_linux_s390x.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_386.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_386.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/endian_big.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/endian_little.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go13
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go87
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go142
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go142
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go141
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go142
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go10
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go18
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/dll_windows.go3
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/security_windows.go14
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/service.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/setupapierrors_windows.go100
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/types_windows.go48
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go103
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/passes/framepointer/framepointer.go91
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert/ifaceassert.go4
-rw-r--r--src/cmd/vendor/modules.txt10
-rw-r--r--src/cmd/vet/main.go2
-rw-r--r--src/cmd/vet/vet_test.go5
-rw-r--r--src/compress/bzip2/bzip2_test.go4
-rw-r--r--src/compress/flate/deflate_test.go6
-rw-r--r--src/compress/flate/huffman_bit_writer_test.go29
-rw-r--r--src/compress/flate/reader_test.go4
-rw-r--r--src/compress/lzw/reader_test.go4
-rw-r--r--src/compress/lzw/writer_test.go3
-rw-r--r--src/compress/zlib/writer_test.go3
-rw-r--r--src/crypto/md5/gen.go4
-rw-r--r--src/crypto/tls/handshake_test.go3
-rw-r--r--src/crypto/tls/link_test.go3
-rw-r--r--src/crypto/tls/tls.go6
-rw-r--r--src/crypto/x509/name_constraints_test.go3
-rw-r--r--src/crypto/x509/root_ios_gen.go4
-rw-r--r--src/crypto/x509/root_plan9.go3
-rw-r--r--src/crypto/x509/root_unix.go25
-rw-r--r--src/crypto/x509/root_unix_test.go5
-rw-r--r--src/debug/dwarf/dwarf5ranges_test.go4
-rw-r--r--src/debug/gosym/pclntab_test.go5
-rw-r--r--src/debug/pe/file_test.go13
-rw-r--r--src/embed/embed.go5
-rw-r--r--src/embed/internal/embedtest/embed_test.go23
-rw-r--r--src/embed/internal/embedtest/embedx_test.go4
-rw-r--r--src/embed/internal/embedtest/testdata/.hidden/.more/tip.txt1
-rw-r--r--src/embed/internal/embedtest/testdata/.hidden/_more/tip.txt1
-rw-r--r--src/embed/internal/embedtest/testdata/.hidden/fortune.txt2
-rw-r--r--src/embed/internal/embedtest/testdata/.hidden/more/tip.txt1
-rw-r--r--src/embed/internal/embedtest/testdata/_hidden/fortune.txt2
-rw-r--r--src/go.mod2
-rw-r--r--src/go.sum4
-rw-r--r--src/go/build/build_test.go11
-rw-r--r--src/go/build/deps_test.go3
-rw-r--r--src/go/doc/doc_test.go6
-rw-r--r--src/go/format/benchmark_test.go4
-rw-r--r--src/go/format/format_test.go6
-rw-r--r--src/go/importer/importer_test.go3
-rw-r--r--src/go/internal/gccgoimporter/importer_test.go5
-rw-r--r--src/go/internal/gcimporter/gcimporter_test.go11
-rw-r--r--src/go/internal/srcimporter/srcimporter.go3
-rw-r--r--src/go/internal/srcimporter/srcimporter_test.go3
-rw-r--r--src/go/parser/error_test.go10
-rw-r--r--src/go/parser/interface.go44
-rw-r--r--src/go/parser/performance_test.go4
-rw-r--r--src/go/printer/performance_test.go4
-rw-r--r--src/go/printer/printer_test.go12
-rw-r--r--src/go/scanner/scanner_test.go3
-rw-r--r--src/go/types/check.go1
-rw-r--r--src/go/types/check_test.go14
-rw-r--r--src/go/types/decl.go35
-rw-r--r--src/go/types/errors.go20
-rw-r--r--src/go/types/hilbert_test.go4
-rw-r--r--src/go/types/issues_test.go26
-rw-r--r--src/go/types/predicates.go16
-rw-r--r--src/go/types/resolver.go15
-rw-r--r--src/go/types/stdlib_test.go11
-rw-r--r--src/go/types/testdata/constdecl.src31
-rw-r--r--src/hash/crc32/gen_const_ppc64le.go4
-rw-r--r--src/html/template/examplefiles_test.go3
-rw-r--r--src/html/template/template.go4
-rw-r--r--src/image/color/palette/gen.go4
-rw-r--r--src/image/gif/reader_test.go4
-rw-r--r--src/image/internal/imageutil/gen.go3
-rw-r--r--src/image/jpeg/reader_test.go7
-rw-r--r--src/image/png/reader_test.go3
-rw-r--r--src/index/suffixarray/gen.go6
-rw-r--r--src/index/suffixarray/suffixarray_test.go6
-rw-r--r--src/internal/cpu/cpu_arm64.go97
-rw-r--r--src/internal/cpu/cpu_arm64_android.go (renamed from src/internal/cpu/cpu_linux.go)6
-rw-r--r--src/internal/cpu/cpu_arm64_darwin.go34
-rw-r--r--src/internal/cpu/cpu_arm64_freebsd.go45
-rw-r--r--src/internal/cpu/cpu_arm64_hwcap.go63
-rw-r--r--src/internal/cpu/cpu_arm64_linux.go (renamed from src/internal/cpu/cpu_other.go)8
-rw-r--r--src/internal/cpu/cpu_arm64_other.go17
-rw-r--r--src/internal/cpu/cpu_s390x_test.go4
-rw-r--r--src/internal/cpu/cpu_test.go7
-rw-r--r--src/internal/cpu/cpu_x86.go11
-rw-r--r--src/internal/obscuretestdata/obscuretestdata.go3
-rw-r--r--src/internal/poll/read_test.go3
-rw-r--r--src/internal/testenv/testenv_windows.go3
-rw-r--r--src/internal/trace/gc_test.go6
-rw-r--r--src/internal/trace/parser_test.go9
-rw-r--r--src/io/fs/readdir_test.go12
-rw-r--r--src/io/fs/readfile_test.go16
-rw-r--r--src/io/fs/sub.go127
-rw-r--r--src/io/fs/sub_test.go57
-rw-r--r--src/log/syslog/syslog_test.go5
-rw-r--r--src/math/big/arith_s390x.s192
-rw-r--r--src/math/big/arith_test.go55
-rw-r--r--src/math/big/link_test.go4
-rw-r--r--src/math/bits/make_examples.go4
-rw-r--r--src/math/bits/make_tables.go4
-rw-r--r--src/mime/multipart/formdata.go11
-rw-r--r--src/mime/multipart/formdata_test.go14
-rw-r--r--src/net/dnsclient_unix_test.go3
-rw-r--r--src/net/error_test.go3
-rw-r--r--src/net/http/filetransport_test.go5
-rw-r--r--src/net/http/fs_test.go8
-rw-r--r--src/net/http/request_test.go5
-rw-r--r--src/net/http/transfer_test.go3
-rw-r--r--src/net/http/transport.go22
-rw-r--r--src/net/http/transport_test.go3
-rw-r--r--src/net/mockserver_test.go5
-rw-r--r--src/net/net_windows_test.go7
-rw-r--r--src/net/unixsock_test.go3
-rw-r--r--src/os/error_test.go9
-rw-r--r--src/os/exec/exec_test.go5
-rw-r--r--src/os/exec/lp_unix_test.go3
-rw-r--r--src/os/exec/lp_windows_test.go7
-rw-r--r--src/os/fifo_test.go3
-rw-r--r--src/os/file.go7
-rw-r--r--src/os/os_test.go42
-rw-r--r--src/os/os_unix_test.go4
-rw-r--r--src/os/os_windows_test.go29
-rw-r--r--src/os/path_test.go4
-rw-r--r--src/os/path_windows_test.go3
-rw-r--r--src/os/pipe_test.go3
-rw-r--r--src/os/readfrom_linux_test.go4
-rw-r--r--src/os/removeall_test.go20
-rw-r--r--src/os/signal/signal_test.go3
-rw-r--r--src/os/signal/signal_windows_test.go3
-rw-r--r--src/os/stat_test.go9
-rw-r--r--src/os/timeout_test.go3
-rw-r--r--src/os/user/lookup_plan9.go3
-rw-r--r--src/path/filepath/example_unix_walk_test.go3
-rw-r--r--src/path/filepath/match_test.go7
-rw-r--r--src/path/filepath/path_test.go33
-rw-r--r--src/path/filepath/path_windows_test.go19
-rw-r--r--src/reflect/type.go16
-rw-r--r--src/runtime/cgo/linux_syscall.c2
-rw-r--r--src/runtime/crash_test.go3
-rw-r--r--src/runtime/crash_unix_test.go5
-rw-r--r--src/runtime/debug/heapdump_test.go5
-rw-r--r--src/runtime/debug_test.go4
-rw-r--r--src/runtime/env_plan9.go4
-rw-r--r--src/runtime/internal/sys/gengoos.go8
-rw-r--r--src/runtime/memmove_linux_amd64_test.go3
-rw-r--r--src/runtime/metrics/description_test.go16
-rw-r--r--src/runtime/mkduff.go4
-rw-r--r--src/runtime/mkfastlog2table.go4
-rw-r--r--src/runtime/mksizeclasses.go3
-rw-r--r--src/runtime/msan.go6
-rw-r--r--src/runtime/msan_amd64.s9
-rw-r--r--src/runtime/msan_arm64.s10
-rw-r--r--src/runtime/os_darwin.go12
-rw-r--r--src/runtime/os_linux_be64.go1
-rw-r--r--src/runtime/os_linux_generic.go1
-rw-r--r--src/runtime/os_linux_mips64x.go1
-rw-r--r--src/runtime/os_linux_mipsx.go1
-rw-r--r--src/runtime/pprof/pprof_test.go5
-rw-r--r--src/runtime/pprof/proto.go4
-rw-r--r--src/runtime/pprof/proto_test.go3
-rw-r--r--src/runtime/proc.go4
-rw-r--r--src/runtime/race/output_test.go5
-rw-r--r--src/runtime/race/testdata/io_test.go3
-rw-r--r--src/runtime/runtime-gdb_test.go25
-rw-r--r--src/runtime/runtime-lldb_test.go9
-rw-r--r--src/runtime/signal_unix.go10
-rw-r--r--src/runtime/signal_windows_test.go5
-rw-r--r--src/runtime/sys_darwin.go10
-rw-r--r--src/runtime/sys_darwin_amd64.s20
-rw-r--r--src/runtime/sys_darwin_arm64.s18
-rw-r--r--src/runtime/sys_openbsd_mips64.s4
-rw-r--r--src/runtime/syscall_windows_test.go25
-rw-r--r--src/runtime/testdata/testprog/memprof.go3
-rw-r--r--src/runtime/testdata/testprog/syscalls_linux.go3
-rw-r--r--src/runtime/testdata/testprog/timeprof.go3
-rw-r--r--src/runtime/testdata/testprog/vdso.go3
-rw-r--r--src/runtime/testdata/testprogcgo/pprof.go3
-rw-r--r--src/runtime/testdata/testprogcgo/threadpprof.go3
-rw-r--r--src/runtime/time.go33
-rw-r--r--src/runtime/trace/trace_test.go3
-rw-r--r--src/runtime/wincallback.go7
-rw-r--r--src/sort/genzfunc.go4
-rw-r--r--src/strconv/makeisprint.go4
-rw-r--r--src/syscall/dirent_test.go9
-rw-r--r--src/syscall/exec_linux_test.go15
-rw-r--r--src/syscall/getdirentries_test.go5
-rw-r--r--src/syscall/mkasm_darwin.go9
-rw-r--r--src/syscall/syscall_linux_test.go11
-rw-r--r--src/syscall/syscall_unix_test.go7
-rw-r--r--src/syscall/syscall_windows.go2
-rw-r--r--src/syscall/syscall_windows_test.go3
-rw-r--r--src/syscall/zsyscall_windows.go2
-rw-r--r--src/testing/fstest/mapfs.go10
-rw-r--r--src/testing/fstest/testfs.go42
-rw-r--r--src/testing/testing.go5
-rw-r--r--src/testing/testing_test.go7
-rw-r--r--src/text/template/examplefiles_test.go3
-rw-r--r--src/text/template/helper.go4
-rw-r--r--src/text/template/link_test.go7
-rw-r--r--src/time/genzabbrs.go4
-rw-r--r--src/time/internal_test.go52
-rw-r--r--src/time/sleep.go2
-rw-r--r--src/time/sleep_test.go23
-rw-r--r--src/time/tzdata/generate_zipdata.go3
-rw-r--r--src/time/zoneinfo_read.go2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/cpu_arm64.s2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/cpu_s390x.s2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/cpu_x86.s2
-rw-r--r--src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go2
-rw-r--r--src/vendor/modules.txt2
-rw-r--r--test/assign.go4
-rw-r--r--test/fixedbugs/bug487.go4
-rw-r--r--test/fixedbugs/bug510.dir/a.go13
-rw-r--r--test/fixedbugs/bug510.dir/b.go (renamed from src/internal/cpu/cpu_freebsd.go)11
-rw-r--r--test/fixedbugs/bug510.go (renamed from src/internal/cpu/cpu_android.go)6
-rw-r--r--test/fixedbugs/issue42944.go24
-rw-r--r--test/fixedbugs/issue43099.go34
-rw-r--r--test/fixedbugs/issue6977.go8
-rw-r--r--test/method2.go4
399 files changed, 3511 insertions, 2228 deletions
diff --git a/doc/go1.16.html b/doc/go1.16.html
index 6618240ed1..504165f3ea 100644
--- a/doc/go1.16.html
+++ b/doc/go1.16.html
@@ -26,12 +26,12 @@ Do not send CLs removing the interior tags from such phrases.
<h2 id="language">Changes to the language</h2>
<p>
- TODO
+ There are no changes to the language.
</p>
<h2 id="ports">Ports</h2>
-<h3 id="darwin">Darwin</h3>
+<h3 id="darwin">Darwin and iOS</h3>
<p><!-- golang.org/issue/38485, golang.org/issue/41385, CL 266373, more CLs -->
Go 1.16 adds support of 64-bit ARM architecture on macOS (also known as
@@ -43,15 +43,24 @@ Do not send CLs removing the interior tags from such phrases.
</p>
<p><!-- CL 254740 -->
- The iOS port, which was previously <code>darwin/arm64</code>, is now
- moved to <code>ios/arm64</code>. <code>GOOS=ios</code> implies the
+ The iOS port, which was previously <code>darwin/arm64</code>, has
+ been renamed to <code>ios/arm64</code>. <code>GOOS=ios</code>
+ implies the
<code>darwin</code> build tag, just as <code>GOOS=android</code>
- implies the <code>linux</code> build tag.
+ implies the <code>linux</code> build tag. This change should be
+ transparent to anyone using gomobile to build iOS apps.
</p>
<p><!-- golang.org/issue/42100, CL 263798 -->
- The <code>ios/amd64</code> port is added, targetting the iOS simulator
- running on AMD64-based macOS.
+ Go 1.16 adds an <code>ios/amd64</code> port, which targets the iOS
+ simulator running on AMD64-based macOS. Previously this was
+ unofficially supported through <code>darwin/amd64</code> with
+ the <code>ios</code> build tag set.
+</p>
+
+<p><!-- golang.org/issue/23011 -->
+ Go 1.16 is the last release that will run on macOS 10.12 Sierra.
+ Go 1.17 will require macOS 10.13 High Sierra or later.
</p>
<h3 id="netbsd">NetBSD</h3>
@@ -61,6 +70,14 @@ Do not send CLs removing the interior tags from such phrases.
<code>netbsd/arm64</code> port).
</p>
+<h3 id="openbsd">OpenBSD</h3>
+
+<p><!-- golang.org/issue/40995 -->
+ Go now supports the MIPS64 architecture on OpenBSD
+ (the <code>openbsd/mips64</code> port). This port does not yet
+ support cgo.
+</p>
+
<h3 id="386">386</h3>
<p><!-- golang.org/issue/40255, golang.org/issue/41848, CL 258957, and CL 260017 -->
@@ -72,6 +89,14 @@ Do not send CLs removing the interior tags from such phrases.
with <code>GO386=softfloat</code>.
</p>
+<h3 id="riscv">RISC-V</h3>
+
+<p><!-- golang.org/issue/36641, CL 267317 -->
+ The <code>linux/riscv64</code> port now supports cgo and
+ <code>-buildmode=pie</code>. This release also includes performance
+ optimizations and code generation improvements for RISC-V.
+</p>
+
<h2 id="tools">Tools</h2>
<p>
@@ -85,7 +110,7 @@ Do not send CLs removing the interior tags from such phrases.
<p><!-- golang.org/issue/41330 -->
Module-aware mode is enabled by default, regardless of whether a
<code>go.mod</code> file is present in the current working directory or a
- parent directory. Specifically, the <code>GO111MODULE</code> environment
+ parent directory. More precisely, the <code>GO111MODULE</code> environment
variable now defaults to <code>on</code>. To switch to the previous behavior,
set <code>GO111MODULE</code> to <code>auto</code>.
</p>
@@ -141,6 +166,17 @@ Do not send CLs removing the interior tags from such phrases.
non-reproducible builds.
</p>
+<h4 id="embed">Embedding Files</h4>
+
+<p>
+ The <code>go</code> command now supports including
+ static files and file trees as part of the final executable,
+ using the new <code>//go:embed</code> directive.
+ See the documentation for the new
+ <a href="/pkg/embed/"><code>embed</code></a>
+ package for details.
+</p>
+
<h4 id="go-test"><code>go</code> <code>test</code></h4>
<p><!-- golang.org/issue/29062 -->
@@ -166,7 +202,7 @@ Do not send CLs removing the interior tags from such phrases.
The <code>go</code> <code>get</code> <code>-insecure</code> flag is
deprecated and will be removed in a future version. This flag permits
fetching from repositories and resolving custom domains using insecure
- schemes such as HTTP, and also bypassess module sum validation using the
+ schemes such as HTTP, and also bypasses module sum validation using the
checksum database. To permit the use of insecure schemes, use the
<code>GOINSECURE</code> environment variable instead. To bypass module
sum validation, use <code>GOPRIVATE</code> or <code>GONOSUMDB</code>.
@@ -257,10 +293,41 @@ Do not send CLs removing the interior tags from such phrases.
<!-- CL 235677: https://golang.org/cl/235677: cmd/vet: bring in pass to catch invalid uses of testing.T in goroutines -->
</p>
+<p><!-- CL 248686, CL 276372 -->
+ The vet tool now warns about amd64 assembly that clobbers the BP
+ register (the frame pointer) without saving and restoring it,
+ contrary to the calling convention. Code that doesn't preserve the
+ BP register must be modified to either not use BP at all or preserve
+ BP by saving and restoring it. An easy way to preserve BP is to set
+ the frame size to a nonzero value, which causes the generated
+ prologue and epilogue to preserve the BP register for you.
+ See <a href="https://golang.org/cl/248260">CL 248260</a> for example
+ fixes.
+</p>
+
<h2 id="runtime">Runtime</h2>
<p>
- TODO
+ The new <a href="/pkg/runtime/metrics/"><code>runtime/metrics</code></a> package
+ introduces a stable interface for reading
+ implementation-defined metrics from the Go runtime.
+ It supersedes existing functions like
+ <a href="/pkg/runtime/#ReadMemStats"><code>runtime.ReadMemStats</code></a>
+ and
+ <a href="/pkg/runtime/debug/#GCStats"><code>debug.GCStats</code></a>
+ and is significantly more general and efficient.
+ See the package documentation for more details.
+</p>
+
+<p><!-- CL 254659 -->
+ Setting the <code>GODEBUG</code> environment variable
+ to <code>inittrace=1</code> now causes the runtime to emit a single
+ line to standard error for each package <code>init</code>,
+ summarizing its execution time and memory allocation. This trace can
+ be used to find bottlenecks or regressions in Go startup
+ performance.
+ The <a href="/pkg/runtime/#hdr-Environment_Variables"><code>GODEBUG</code><
+ documentation</a> describes the format.
</p>
<p><!-- CL 267100 -->
@@ -275,10 +342,21 @@ Do not send CLs removing the interior tags from such phrases.
variable.
</p>
+<p><!-- CL 220419, CL 271987 -->
+ Go 1.16 fixes a discrepancy between the race detector and
+ the <a href="/ref/mem">Go memory model</a>. The race detector now
+ more precisely follows the channel synchronization rules of the
+ memory model. As a result, the detector may now report races it
+ previously missed.
+</p>
+
<h2 id="compiler">Compiler</h2>
-<p>
- TODO
+<p><!-- CL 256459, CL 264837, CL 266203, CL 256460 -->
+ The compiler can now inline functions with
+ non-labeled <code>for</code> loops, method values, and type
+ switches. The inliner can also detect more indirect calls where
+ inlining is possible.
</p>
<h2 id="linker">Linker</h2>
@@ -297,13 +375,10 @@ Do not send CLs removing the interior tags from such phrases.
supported architecture/OS combinations (the 1.15 performance improvements
were primarily focused on <code>ELF</code>-based OSes and
<code>amd64</code> architectures). For a representative set of
- large Go programs, linking is 20-35% faster than 1.15 and requires
+ large Go programs, linking is 20-25% faster than 1.15 and requires
5-15% less memory on average for <code>linux/amd64</code>, with larger
- improvements for other architectures and OSes.
-</p>
-
-<p>
- TODO: update with final numbers later in the release.
+ improvements for other architectures and OSes. Most binaries are
+ also smaller as a result of more aggressive symbol pruning.
</p>
<p><!-- CL 255259 -->
@@ -313,9 +388,54 @@ Do not send CLs removing the interior tags from such phrases.
<h2 id="library">Core library</h2>
+<h3 id="library-embed">Embedded Files</h3>
+
<p>
- TODO: mention significant additions like new packages (<code>io/fs</code>),
- new proposal-scoped features (<code>//go:embed</code>), and so on
+ The new <a href="/pkg/embed/"><code>embed</code></a> package
+ provides access to files embedded in the program during compilation
+ using the new <a href="#embed"><code>//go:embed</code> directive</a>.
+</p>
+
+<h3 id="fs">File Systems</h3>
+
+<p>
+ The new <a href="/pkg/io/fs/"><code>io/fs</code></a> package
+ defines an abstraction for read-only trees of files,
+ the <a href="/pkg/io/fs/#FS"><code>fs.FS</code></a> interface,
+ and the standard library packages have
+ been adapted to make use of the interface as appropriate.
+</p>
+
+<p>
+ On the producer side of the interface,
+ the new <a href="/pkg/embed/#FS">embed.FS</code></a> type
+ implements <code>fs.FS</code>, as does
+ <a href="/pkg/archive/zip/#Reader"><code>zip.Reader</code></a>.
+ The new <a href="/pkg/os/#DirFS"><code>os.DirFS</code></a> function
+ provides an implementation of <code>fs.FS</code> backed by a tree
+ of operating system files.
+</p>
+
+<p>
+ On the consumer side,
+ the new <a href="/pkg/net/http/#FS"><code>http.FS</code></a>
+ function converts an <code>fs.FS</code> to an
+ <a href="/pkg/net/http/#Handler"><code>http.Handler</code></a>.
+ Also, the <a href="/pkg/html/template/"><code>html/template</code></a>
+ and <a href="/pkg/text/template/"><code>text/template</code></a>
+ packages’ <a href="/pkg/html/template/#ParseFS"><code>ParseFS</code></a>
+ functions and methods read templates from an <code>fs.FS</code>.
+</p>
+
+<p>
+ For testing code that implements <code>fs.FS</code>,
+ the new <a href="/pkg/testing/fstest/"><code>testing/fstest</code></a>
+ package provides a <a href="/pkg/testing/fstest/#TestFS"><code>TestFS</code></a>
+ function that checks for and reports common mistakes.
+ It also provides a simple in-memory file system implementation,
+ <a href="/pkg/testing/fstest/#MapFS"><code>MapFS</code></a>,
+ which can be useful for testing code that accepts <code>fs.FS</code>
+ implementations.
</p>
<p>
@@ -347,9 +467,10 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="crypto/hmac"><dt><a href="/pkg/crypto/hmac/">crypto/hmac</a></dt>
<dd>
<p><!-- CL 261960 -->
- <a href="/pkg/crypto/hmac/#New">New</a> will now panic if separate calls to
- the hash generation function fail to return new values. Previously, the
- behavior was undefined and invalid outputs were sometimes generated.
+ <a href="/pkg/crypto/hmac/#New"><code>New</code></a> will now panic if
+ separate calls to the hash generation function fail to return new values.
+ Previously, the behavior was undefined and invalid outputs were sometimes
+ generated.
</p>
</dd>
</dl><!-- crypto/hmac -->
@@ -357,82 +478,83 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
<dd>
<p><!-- CL 256897 -->
- I/O operations on closing or closed TLS connections can now be detected using
- the new <a href="/pkg/net/#ErrClosed">ErrClosed</a> error. A typical use
- would be <code>errors.Is(err, net.ErrClosed)</code>. In earlier releases
- the only way to reliably detect this case was to match the string returned
- by the <code>Error</code> method with <code>"tls: use of closed connection"</code>.
+ I/O operations on closing or closed TLS connections can now be detected
+ using the new <a href="/pkg/net/#ErrClosed"><code>net.ErrClosed</code></a>
+ error. A typical use would be <code>errors.Is(err, net.ErrClosed)</code>.
</p>
<p><!-- CL 266037 -->
- A default deadline is set in <a href="/pkg/crypto/tls/#Conn.Close">Close</a>
- before sending the close notify alert, in order to prevent blocking
+ A default write deadline is now set in
+ <a href="/pkg/crypto/tls/#Conn.Close"><code>Conn.Close</code></a>
+ before sending the "close notify" alert, in order to prevent blocking
indefinitely.
</p>
<p><!-- CL 246338 -->
- <a href="/pkg/crypto/tls#Conn.HandshakeContext">(*Conn).HandshakeContext</a> was added to
- allow the user to control cancellation of an in-progress TLS Handshake.
- The context provided is propagated into the
- <a href="/pkg/crypto/tls#ClientHelloInfo">ClientHelloInfo</a>
- and <a href="/pkg/crypto/tls#CertificateRequestInfo">CertificateRequestInfo</a>
- structs and accessible through the new
- <a href="/pkg/crypto/tls#ClientHelloInfo.Context">(*ClientHelloInfo).Context</a>
- and
- <a href="/pkg/crypto/tls#CertificateRequestInfo.Context">
- (*CertificateRequestInfo).Context
- </a> methods respectively. Canceling the context after the handshake has finished
- has no effect.
+ The new <a href="/pkg/crypto/tls#Conn.HandshakeContext"><code>Conn.HandshakeContext</code></a>
+ method allows cancellation of an in-progress handshake. The provided
+ context is accessible through the new
+ <a href="/pkg/crypto/tls#ClientHelloInfo.Context"><code>ClientHelloInfo.Context</code></a>
+ and <a href="/pkg/crypto/tls#CertificateRequestInfo.Context">
+ <code>CertificateRequestInfo.Context</code></a> methods. Canceling the
+ context after the handshake has finished has no effect.
</p>
<p><!-- CL 239748 -->
- Clients now ensure that the server selects
+ Clients now return a handshake error if the server selects
<a href="/pkg/crypto/tls/#ConnectionState.NegotiatedProtocol">
- an ALPN protocol</a> from
+ an ALPN protocol</a> that was not in
<a href="/pkg/crypto/tls/#Config.NextProtos">
the list advertised by the client</a>.
</p>
<p><!-- CL 262857 -->
- TLS servers will now prefer other AEAD cipher suites (such as ChaCha20Poly1305)
+ Servers will now prefer other available AEAD cipher suites (such as ChaCha20Poly1305)
over AES-GCM cipher suites if either the client or server doesn't have AES hardware
- support, unless the application set both
- <a href="/pkg/crypto/tls/#Config.PreferServerCipherSuites"><code>Config.PreferServerCipherSuites</code></a>
+ support, unless both <a href="/pkg/crypto/tls/#Config.PreferServerCipherSuites">
+ <code>Config.PreferServerCipherSuites</code></a>
and <a href="/pkg/crypto/tls/#Config.CipherSuites"><code>Config.CipherSuites</code></a>
- or there are no other AEAD cipher suites supported.
- The client is assumed not to have AES hardware support if it does not signal a
- preference for AES-GCM cipher suites.
+ are set. The client is assumed not to have AES hardware support if it does
+ not signal a preference for AES-GCM cipher suites.
</p>
<p><!-- CL 246637 -->
- <a href="/pkg/crypto/tls/#Config.Clone"><code>Config.Clone</code></a> now returns
- a nil <code>*Config</code> if the source is nil, rather than panicking.
+ <a href="/pkg/crypto/tls/#Config.Clone"><code>Config.Clone</code></a> now
+ returns nil if the receiver is nil, rather than panicking.
</p>
</dd>
</dl><!-- crypto/tls -->
<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
<dd>
+ <p>
+ The <code>GODEBUG=x509ignoreCN=0</code> flag will be removed in Go 1.17.
+ It enables the legacy behavior of treating the <code>CommonName</code>
+ field on X.509 certificates as a host name when no Subject Alternative
+ Names are present.
+ </p>
+
<p><!-- CL 235078 -->
- <a href="/pkg/crypto/x509/#ParseCertificate">ParseCertificate</a> and
- <a href="/pkg/crypto/x509/#CreateCertificate">CreateCertificate</a> both
- now enforce string encoding restrictions for the fields <code>DNSNames</code>,
- <code>EmailAddresses</code>, and <code>URIs</code>. These fields can only
- contain strings with characters within the ASCII range.
+ <a href="/pkg/crypto/x509/#ParseCertificate"><code>ParseCertificate</code></a> and
+ <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
+ now enforce string encoding restrictions for the <code>DNSNames</code>,
+ <code>EmailAddresses</code>, and <code>URIs</code> fields. These fields
+ can only contain strings with characters within the ASCII range.
</p>
<p><!-- CL 259697 -->
- <a href="/pkg/crypto/x509/#CreateCertificate">CreateCertificate</a> now
- verifies the generated certificate's signature using the signer's
- public key. If the signature is invalid, an error is returned, instead
- of a malformed certificate.
+ <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
+ now verifies the generated certificate's signature using the signer's
+ public key. If the signature is invalid, an error is returned, instead of
+ a malformed certificate.
</p>
<p><!-- CL 233163 -->
A number of additional fields have been added to the
- <a href="/pkg/crypto/x509/#CertificateRequest">CertificateRequest</a> type.
- These fields are now parsed in <a href="/pkg/crypto/x509/#ParseCertificateRequest">ParseCertificateRequest</a>
- and marshalled in <a href="/pkg/crypto/x509/#CreateCertificateRequest">CreateCertificateRequest</a>.
+ <a href="/pkg/crypto/x509/#CertificateRequest"><code>CertificateRequest</code></a> type.
+ These fields are now parsed in <a href="/pkg/crypto/x509/#ParseCertificateRequest">
+ <code>ParseCertificateRequest</code></a> and marshalled in
+ <a href="/pkg/crypto/x509/#CreateCertificateRequest"><code>CreateCertificateRequest</code></a>.
</p>
<p><!-- CL 257939 -->
@@ -448,7 +570,9 @@ Do not send CLs removing the interior tags from such phrases.
</p>
<p><!-- CL 262343 -->
- TODO: <a href="https://golang.org/cl/262343">https://golang.org/cl/262343</a>: add Unwrap to SystemRootsError
+ The new <a href="/pkg/crypto/x509/#SystemRootsError.Unwrap"><code>SystemRootsError.Unwrap</code></a>
+ method allows accessing the <a href="/pkg/crypto/x509/#SystemRootsError.Err"><code>Err</code></a>
+ field through the <a href="/pkg/errors"><code>errors</code></a> package functions.
</p>
</dd>
</dl><!-- crypto/x509 -->
@@ -456,11 +580,11 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1">encoding/asn1</a></dt>
<dd>
<p><!-- CL 255881 -->
- <a href="/pkg/encoding/asn1/#Unmarshal">Unmarshal</a> and
- <a href="/pkg/encoding/asn1/#UnmarshalWithParams">UnmarshalWithParams</a>
- now return an error instead of panic when the argument is not
+ <a href="/pkg/encoding/asn1/#Unmarshal"><code>Unmarshal</code></a> and
+ <a href="/pkg/encoding/asn1/#UnmarshalWithParams"><code>UnmarshalWithParams</code></a>
+ now return an error instead of panicking when the argument is not
a pointer or is nil. This change matches the behavior of other
- encoding packages such as <a href="/pkg/encoding/json">encoding/json</a>.
+ encoding packages such as <a href="/pkg/encoding/json"><code>encoding/json</code></a>.
</p>
</dd>
</dl>
@@ -494,7 +618,10 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
<dd>
<p><!-- CL 240014 -->
- TODO: <a href="https://golang.org/cl/240014">https://golang.org/cl/240014</a>: add Func
+ The new <a href="/pkg/flag/#Func"><code>Func</code></a> function
+ allows registering a flag implemented by calling a function,
+ as a lighter-weight alternative to implementing the
+ <a href="/pkg/flag/#Value"><code>Value</code></a> interface.
</p>
</dd>
</dl><!-- flag -->
@@ -502,7 +629,8 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="io"><dt><a href="/pkg/io/">io</a></dt>
<dd>
<p><!-- CL 261577 -->
- TODO: <a href="https://golang.org/cl/261577">https://golang.org/cl/261577</a>: add a new ReadSeekCloser interface
+ The package now defines a
+ <a href="/pkg/io/#ReadSeekCloser"><code>ReadSeekCloser</code></a> interface.
</p>
</dd>
</dl><!-- io -->
@@ -510,7 +638,8 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="log"><dt><a href="/pkg/log/">log</a></dt>
<dd>
<p><!-- CL 264460 -->
- TODO: <a href="https://golang.org/cl/264460">https://golang.org/cl/264460</a>: expose std via new Default function
+ The new <a href="/pkg/log/#Default"><code>Default</code></a> function
+ provides access to the default <a href="/pkg/log/#Logger"><code>Logger</code></a>.
</p>
</dd>
</dl><!-- log -->
@@ -518,7 +647,11 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="log/syslog"><dt><a href="/pkg/log/syslog/">log/syslog</a></dt>
<dd>
<p><!-- CL 264297 -->
- TODO: <a href="https://golang.org/cl/264297">https://golang.org/cl/264297</a>: set local to true if network is any of &#34;unix&#34;, or &#34;unixgram&#34;
+ The <a href="/pkg/log/syslog/#Writer"><code>Writer</code></a>
+ now uses the local message format
+ (omitting the host name and using a shorter time stamp)
+ when logging to custom Unix domain sockets,
+ matching the format already used for the default log socket.
</p>
</dd>
</dl><!-- log/syslog -->
@@ -526,7 +659,10 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
<dd>
<p><!-- CL 247477 -->
- TODO: <a href="https://golang.org/cl/247477">https://golang.org/cl/247477</a>: return overflow errors in Reader.ReadForm
+ The <a href="/pkg/mime/multipart/#Reader"><code>Reader</code></a>'s
+ <a href="/pkg/mime/multipart/#Reader.ReadForm"><code>ReadForm</code></a>
+ method no longer rejects form data
+ when passed the maximum int64 value as a limit.
</p>
</dd>
</dl><!-- mime/multipart -->
@@ -550,7 +686,10 @@ Do not send CLs removing the interior tags from such phrases.
</p>
<p><!-- CL 238629 -->
- TODO: <a href="https://golang.org/cl/238629">https://golang.org/cl/238629</a>: prefer /etc/hosts over DNS when no /etc/nsswitch.conf is present
+ On Linux, host name lookups no longer use DNS before checking
+ <code>/etc/hosts</code> when <code>/etc/nsswitch.conf</code>
+ is missing; this is common on musl-based systems and makes
+ Go programs match the behavior of C programs on those systems.
</p>
</dd>
</dl><!-- net -->
@@ -578,23 +717,29 @@ Do not send CLs removing the interior tags from such phrases.
</p>
<p><!-- CL 256498, golang.org/issue/36990 -->
- Cookies set with <code>SameSiteDefaultMode</code> now behave according to the current
- spec (no attribute is set) instead of generating a SameSite key without a value.
+ Cookies set with <a href="/pkg/net/http/#SameSiteDefaultMode"><code>SameSiteDefaultMode</code></a>
+ now behave according to the current spec (no attribute is set) instead of
+ generating a SameSite key without a value.
</p>
<p><!-- CL 246338 -->
- The <a href="/pkg/net/http/"><code>net/http</code></a> package now uses the new
- <a href="/pkg/crypto/tls#Conn.HandshakeContext"><code>(*tls.Conn).HandshakeContext</code></a>
- with the <a href="/pkg/net/http/#Request"><code>Request</code></a> context
- when performing TLS handshakes in the client or server.
+ The <a href="/pkg/net/http/"><code>net/http</code></a> package now passes the
+ <a href="/pkg/net/http/#Request.Context"><code>Request</code> context</a> to
+ <a href="/pkg/crypto/tls#Conn.HandshakeContext"><code>tls.Conn.HandshakeContext</code></a>
+ when performing TLS handshakes.
</p>
<p><!-- CL 250039 -->
- TODO: <a href="https://golang.org/cl/250039">https://golang.org/cl/250039</a>: set Content-Length:0 for empty PATCH requests as with POST, PATCH
+ The <a href="/pkg/net/http/#Client">Client</a> now sends
+ an explicit <code>Content-Length:</code> <code>0</code>
+ header in <code>PATCH</code> requests with empty bodies,
+ matching the existing behavior of <code>POST</code> and <code>PUT</code>.
</p>
<p><!-- CL 249440 -->
- TODO: <a href="https://golang.org/cl/249440">https://golang.org/cl/249440</a>: match http scheme when selecting http_proxy
+ The <a href="/pkg/net/http/#ProxyFromEnvironment">ProxyFromEnvironment</a> function
+ no longer returns the setting of the <code>HTTP_PROXY</code> environment
+ variable for <code>https://</code> URLs when <code>HTTPS_PROXY</code> is unset.
</p>
</dd>
</dl><!-- net/http -->
@@ -602,7 +747,9 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
<dd>
<p><!-- CL 260637 -->
- TODO: <a href="https://golang.org/cl/260637">https://golang.org/cl/260637</a>: flush ReverseProxy immediately if Content-Length is -1
+ The <a href="/pkg/net/http/httputil/#ReverseProxy">ReverseProxy</a>
+ now flushes buffered data more aggressively when proxying
+ streamed responses with unknown body lengths.
</p>
</dd>
</dl><!-- net/http/httputil -->
@@ -610,7 +757,10 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="net/smtp"><dt><a href="/pkg/net/smtp/">net/smtp</a></dt>
<dd>
<p><!-- CL 247257 -->
- TODO: <a href="https://golang.org/cl/247257">https://golang.org/cl/247257</a>: adds support for the SMTPUTF8 extension
+ The <a href="/pkg/net/smtp/#Client">Client</a>'s
+ <a href="/pkg/net/smtp/#Client.Mail"><code>Mail</code></a>
+ method now sends the <code>SMTPUTF8</code> directive to
+ servers that support it, signaling that addresses are encoded in UTF-8.
</p>
</dd>
</dl><!-- net/smtp -->
@@ -629,55 +779,52 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="os/signal"><dt><a href="/pkg/os/signal/">os/signal</a></dt>
<dd>
<p><!-- CL 219640 -->
- TODO: <a href="https://golang.org/cl/219640">https://golang.org/cl/219640</a>: add NotifyContext to cancel context using system signals
+ The new
+ <a href="/pkg/os/signal/#NotifyContext"><code>NotifyContext</code></a>
+ function allows creating contexts that are canceled upon arrival of
+ specific signals.
</p>
</dd>
</dl><!-- os/signal -->
<dl id="path"><dt><a href="/pkg/path/">path</a></dt>
<dd>
- <p><!-- CL 264397 -->
- TODO: <a href="https://golang.org/cl/264397">https://golang.org/cl/264397</a>: validate patterns in Match, Glob
+ <p><!-- CL 264397, golang.org/issues/28614 -->
+ The <code>Match</code> and <code>Glob</code> functions now
+ return an error if the unmatched part of the pattern has a
+ syntax error. Previously, the functions returned early on a failed
+ match, and thus did not report any later syntax error in the
+ pattern.
</p>
</dd>
</dl><!-- path -->
<dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
<dd>
- <p><!-- CL 264397 -->
- TODO: <a href="https://golang.org/cl/264397">https://golang.org/cl/264397</a>: validate patterns in Match, Glob
+ <p><!-- CL 264397, golang.org/issues/28614 -->
+ The <code>Match</code> and <code>Glob</code> functions now
+ return an error if the unmatched part of the pattern has a
+ syntax error. Previously, the functions returned early on a failed
+ match, and thus did not report any later syntax error in the
+ pattern.
</p>
</dd>
</dl><!-- path/filepath -->
<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
<dd>
- <p><!-- CL 248341 -->
- TODO: <a href="https://golang.org/cl/248341">https://golang.org/cl/248341</a>: support multiple keys in struct tags
+ <p><!-- CL 248341, golang.org/issues/40281 -->
+ <code>StructTag</code> now allows multiple space-separated keys
+ in key:value pairs, as in <code>`json xml:"field1"`</code>
+ (equivalent to <code>`json:"field1" xml:"field1"`</code>).
</p>
</dd>
</dl><!-- reflect -->
-<dl id="runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
- <dd>
- <p><!-- CL 37222 -->
- TODO: <a href="https://golang.org/cl/37222">https://golang.org/cl/37222</a>: make stack traces of endless recursion print only top and bottom 50
- </p>
-
- <p><!-- CL 242258 -->
- TODO: <a href="https://golang.org/cl/242258">https://golang.org/cl/242258</a>: add 24 byte allocation size class
- </p>
-
- <p><!-- CL 254659 -->
- TODO: <a href="https://golang.org/cl/254659">https://golang.org/cl/254659</a>: implement GODEBUG=inittrace=1 support
- </p>
- </dd>
-</dl><!-- runtime -->
-
<dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt>
<dd>
<p><!-- CL 249677 -->
- The <a href="/pkg/runtime#Error"><code>runtime.Error</code> values
+ The <a href="/pkg/runtime#Error"><code>runtime.Error</code></a> values
used when <code>SetPanicOnFault</code> is enabled may now have an
<code>Addr</code> method. If that method exists, it returns the memory
address that triggered the fault.
@@ -700,16 +847,30 @@ Do not send CLs removing the interior tags from such phrases.
<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
<dd>
+ <p><!-- CL 263271 -->
+ <a href="/pkg/syscall/?GOOS=windows#NewCallback"><code>NewCallback</code></a>
+ and
+ <a href="/pkg/syscall/?GOOS=windows#NewCallbackCDecl"><code>NewCallbackCDecl</code></a>
+ now correctly support callback functions with multiple
+ sub-<code>uintptr</code>-sized arguments in a row. This may
+ require changing uses of these functions to eliminate manual
+ padding between small arguments.
+ </p>
+
<p><!-- CL 261917 -->
- <a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> on Windows has a new NoInheritHandles field that disables inheriting handles when creating a new process.
+ <a href="/pkg/syscall/?GOOS=windows#SysProcAttr"><code>SysProcAttr</code></a> on Windows has a new NoInheritHandles field that disables inheriting handles when creating a new process.
</p>
<p><!-- CL 269761, golang.org/issue/42584 -->
- <a href="/pkg/syscall/#DLLError"><code>DLLError</code></a> on Windows now has an Unwrap function for unwrapping its underlying error.
+ <a href="/pkg/syscall/?GOOS=windows#DLLError"><code>DLLError</code></a> on Windows now has an Unwrap function for unwrapping its underlying error.
</p>
<p><!-- CL 210639 -->
- TODO: <a href="https://golang.org/cl/210639">https://golang.org/cl/210639</a>: support POSIX semantics for Linux syscalls
+ On Linux,
+ <a href="/pkg/syscall/#Setgid"><code>Setgid</code></a>,
+ <a href="/pkg/syscall/#Setuid"><code>Setuid</code></a>,
+ and related calls are now implemented.
+ Previously, they returned an <code>syscall.EOPNOTSUPP</code> error.
</p>
</dd>
</dl><!-- syscall -->
diff --git a/misc/cgo/testsanitizers/msan_test.go b/misc/cgo/testsanitizers/msan_test.go
index 88b90d3d70..5e2f9759ba 100644
--- a/misc/cgo/testsanitizers/msan_test.go
+++ b/misc/cgo/testsanitizers/msan_test.go
@@ -28,6 +28,7 @@ func TestMSAN(t *testing.T) {
{src: "msan4.go"},
{src: "msan5.go"},
{src: "msan6.go"},
+ {src: "msan7.go"},
{src: "msan_fail.go", wantErr: true},
}
for _, tc := range cases {
diff --git a/misc/cgo/testsanitizers/testdata/msan7.go b/misc/cgo/testsanitizers/testdata/msan7.go
new file mode 100644
index 0000000000..2f29fd21b2
--- /dev/null
+++ b/misc/cgo/testsanitizers/testdata/msan7.go
@@ -0,0 +1,38 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+// Test passing C struct to exported Go function.
+
+/*
+#include <stdint.h>
+#include <stdlib.h>
+
+// T is a C struct with alignment padding after b.
+// The padding bytes are not considered initialized by MSAN.
+// It is big enough to be passed on stack in C ABI (and least
+// on AMD64).
+typedef struct { char b; uintptr_t x, y; } T;
+
+extern void F(T);
+
+// Use weak as a hack to permit defining a function even though we use export.
+void CF(int x) __attribute__ ((weak));
+void CF(int x) {
+ T *t = malloc(sizeof(T));
+ t->b = (char)x;
+ t->x = x;
+ t->y = x;
+ F(*t);
+}
+*/
+import "C"
+
+//export F
+func F(t C.T) { println(t.b, t.x, t.y) }
+
+func main() {
+ C.CF(C.int(0))
+}
diff --git a/src/archive/tar/reader_test.go b/src/archive/tar/reader_test.go
index 411d1e0b99..789ddc1bc0 100644
--- a/src/archive/tar/reader_test.go
+++ b/src/archive/tar/reader_test.go
@@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"math"
"os"
"path"
@@ -773,7 +772,7 @@ func TestReadTruncation(t *testing.T) {
"testdata/pax-path-hdr.tar",
"testdata/sparse-formats.tar",
} {
- buf, err := ioutil.ReadFile(p)
+ buf, err := os.ReadFile(p)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
diff --git a/src/archive/tar/tar_test.go b/src/archive/tar/tar_test.go
index d4a3d42312..91b38401b6 100644
--- a/src/archive/tar/tar_test.go
+++ b/src/archive/tar/tar_test.go
@@ -11,7 +11,6 @@ import (
"internal/testenv"
"io"
"io/fs"
- "io/ioutil"
"math"
"os"
"path"
@@ -263,7 +262,7 @@ func TestFileInfoHeaderDir(t *testing.T) {
func TestFileInfoHeaderSymlink(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpdir, err := ioutil.TempDir("", "TestFileInfoHeaderSymlink")
+ tmpdir, err := os.MkdirTemp("", "TestFileInfoHeaderSymlink")
if err != nil {
t.Fatal(err)
}
diff --git a/src/archive/tar/writer_test.go b/src/archive/tar/writer_test.go
index 30556d27d0..a00f02d8fa 100644
--- a/src/archive/tar/writer_test.go
+++ b/src/archive/tar/writer_test.go
@@ -9,7 +9,6 @@ import (
"encoding/hex"
"errors"
"io"
- "io/ioutil"
"os"
"path"
"reflect"
@@ -520,7 +519,7 @@ func TestWriter(t *testing.T) {
}
if v.file != "" {
- want, err := ioutil.ReadFile(v.file)
+ want, err := os.ReadFile(v.file)
if err != nil {
t.Fatalf("ReadFile() = %v, want nil", err)
}
diff --git a/src/archive/zip/reader_test.go b/src/archive/zip/reader_test.go
index b7a7d7a757..34e96f7da4 100644
--- a/src/archive/zip/reader_test.go
+++ b/src/archive/zip/reader_test.go
@@ -11,7 +11,6 @@ import (
"internal/obscuretestdata"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"regexp"
@@ -629,7 +628,7 @@ func readTestFile(t *testing.T, zt ZipTest, ft ZipTestFile, f *File) {
var c []byte
if ft.Content != nil {
c = ft.Content
- } else if c, err = ioutil.ReadFile("testdata/" + ft.File); err != nil {
+ } else if c, err = os.ReadFile("testdata/" + ft.File); err != nil {
t.Error(err)
return
}
@@ -685,7 +684,7 @@ func TestInvalidFiles(t *testing.T) {
}
func messWith(fileName string, corrupter func(b []byte)) (r io.ReaderAt, size int64) {
- data, err := ioutil.ReadFile(filepath.Join("testdata", fileName))
+ data, err := os.ReadFile(filepath.Join("testdata", fileName))
if err != nil {
panic("Error reading " + fileName + ": " + err.Error())
}
@@ -792,17 +791,17 @@ func returnRecursiveZip() (r io.ReaderAt, size int64) {
//
// func main() {
// bigZip := makeZip("big.file", io.LimitReader(zeros{}, 1<<32-1))
-// if err := ioutil.WriteFile("/tmp/big.zip", bigZip, 0666); err != nil {
+// if err := os.WriteFile("/tmp/big.zip", bigZip, 0666); err != nil {
// log.Fatal(err)
// }
//
// biggerZip := makeZip("big.zip", bytes.NewReader(bigZip))
-// if err := ioutil.WriteFile("/tmp/bigger.zip", biggerZip, 0666); err != nil {
+// if err := os.WriteFile("/tmp/bigger.zip", biggerZip, 0666); err != nil {
// log.Fatal(err)
// }
//
// biggestZip := makeZip("bigger.zip", bytes.NewReader(biggerZip))
-// if err := ioutil.WriteFile("/tmp/biggest.zip", biggestZip, 0666); err != nil {
+// if err := os.WriteFile("/tmp/biggest.zip", biggestZip, 0666); err != nil {
// log.Fatal(err)
// }
// }
diff --git a/src/archive/zip/writer_test.go b/src/archive/zip/writer_test.go
index 2c32eaf4a5..5985144e5c 100644
--- a/src/archive/zip/writer_test.go
+++ b/src/archive/zip/writer_test.go
@@ -10,8 +10,8 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"math/rand"
+ "os"
"strings"
"testing"
"time"
@@ -237,7 +237,7 @@ func TestWriterTime(t *testing.T) {
t.Fatalf("unexpected Close error: %v", err)
}
- want, err := ioutil.ReadFile("testdata/time-go.zip")
+ want, err := os.ReadFile("testdata/time-go.zip")
if err != nil {
t.Fatalf("unexpected ReadFile error: %v", err)
}
diff --git a/src/cmd/addr2line/addr2line_test.go b/src/cmd/addr2line/addr2line_test.go
index 7973aa2fe1..992d7ac11e 100644
--- a/src/cmd/addr2line/addr2line_test.go
+++ b/src/cmd/addr2line/addr2line_test.go
@@ -8,7 +8,6 @@ import (
"bufio"
"bytes"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -98,8 +97,8 @@ func testAddr2Line(t *testing.T, exepath, addr string) {
if !os.SameFile(fi1, fi2) {
t.Fatalf("addr2line_test.go and %s are not same file", srcPath)
}
- if srcLineNo != "107" {
- t.Fatalf("line number = %v; want 107", srcLineNo)
+ if srcLineNo != "106" {
+ t.Fatalf("line number = %v; want 106", srcLineNo)
}
}
@@ -107,7 +106,7 @@ func testAddr2Line(t *testing.T, exepath, addr string) {
func TestAddr2Line(t *testing.T) {
testenv.MustHaveGoBuild(t)
- tmpDir, err := ioutil.TempDir("", "TestAddr2Line")
+ tmpDir, err := os.MkdirTemp("", "TestAddr2Line")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go
index b14d57c236..ba42812fa6 100644
--- a/src/cmd/api/goapi.go
+++ b/src/cmd/api/goapi.go
@@ -17,7 +17,6 @@ import (
"go/token"
"go/types"
"io"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -342,7 +341,7 @@ func fileFeatures(filename string) []string {
if filename == "" {
return nil
}
- bs, err := ioutil.ReadFile(filename)
+ bs, err := os.ReadFile(filename)
if err != nil {
log.Fatalf("Error reading file %s: %v", filename, err)
}
diff --git a/src/cmd/api/goapi_test.go b/src/cmd/api/goapi_test.go
index 24620a94af..16e0058e5e 100644
--- a/src/cmd/api/goapi_test.go
+++ b/src/cmd/api/goapi_test.go
@@ -9,7 +9,6 @@ import (
"flag"
"fmt"
"go/build"
- "io/ioutil"
"os"
"path/filepath"
"sort"
@@ -75,7 +74,7 @@ func TestGolden(t *testing.T) {
f.Close()
}
- bs, err := ioutil.ReadFile(goldenFile)
+ bs, err := os.ReadFile(goldenFile)
if err != nil {
t.Fatalf("opening golden.txt for package %q: %v", fi.Name(), err)
}
diff --git a/src/cmd/compile/internal/gc/builtin.go b/src/cmd/compile/internal/gc/builtin.go
index 07e864dd2e..d3e3f9ade6 100644
--- a/src/cmd/compile/internal/gc/builtin.go
+++ b/src/cmd/compile/internal/gc/builtin.go
@@ -187,16 +187,17 @@ var runtimeDecls = [...]struct {
{"racewriterange", funcTag, 121},
{"msanread", funcTag, 121},
{"msanwrite", funcTag, 121},
- {"checkptrAlignment", funcTag, 122},
- {"checkptrArithmetic", funcTag, 124},
- {"libfuzzerTraceCmp1", funcTag, 126},
- {"libfuzzerTraceCmp2", funcTag, 128},
- {"libfuzzerTraceCmp4", funcTag, 129},
- {"libfuzzerTraceCmp8", funcTag, 130},
- {"libfuzzerTraceConstCmp1", funcTag, 126},
- {"libfuzzerTraceConstCmp2", funcTag, 128},
- {"libfuzzerTraceConstCmp4", funcTag, 129},
- {"libfuzzerTraceConstCmp8", funcTag, 130},
+ {"msanmove", funcTag, 122},
+ {"checkptrAlignment", funcTag, 123},
+ {"checkptrArithmetic", funcTag, 125},
+ {"libfuzzerTraceCmp1", funcTag, 127},
+ {"libfuzzerTraceCmp2", funcTag, 129},
+ {"libfuzzerTraceCmp4", funcTag, 130},
+ {"libfuzzerTraceCmp8", funcTag, 131},
+ {"libfuzzerTraceConstCmp1", funcTag, 127},
+ {"libfuzzerTraceConstCmp2", funcTag, 129},
+ {"libfuzzerTraceConstCmp4", funcTag, 130},
+ {"libfuzzerTraceConstCmp8", funcTag, 131},
{"x86HasPOPCNT", varTag, 6},
{"x86HasSSE41", varTag, 6},
{"x86HasFMA", varTag, 6},
@@ -205,7 +206,7 @@ var runtimeDecls = [...]struct {
}
func runtimeTypes() []*types.Type {
- var typs [131]*types.Type
+ var typs [132]*types.Type
typs[0] = types.ByteType
typs[1] = types.NewPtr(typs[0])
typs[2] = types.Types[types.TANY]
@@ -328,14 +329,15 @@ func runtimeTypes() []*types.Type {
typs[119] = functype(nil, []*ir.Field{anonfield(typs[65])}, []*ir.Field{anonfield(typs[20])})
typs[120] = functype(nil, []*ir.Field{anonfield(typs[26]), anonfield(typs[26])}, []*ir.Field{anonfield(typs[26])})
typs[121] = functype(nil, []*ir.Field{anonfield(typs[5]), anonfield(typs[5])}, nil)
- typs[122] = functype(nil, []*ir.Field{anonfield(typs[7]), anonfield(typs[1]), anonfield(typs[5])}, nil)
- typs[123] = types.NewSlice(typs[7])
- typs[124] = functype(nil, []*ir.Field{anonfield(typs[7]), anonfield(typs[123])}, nil)
- typs[125] = types.Types[types.TUINT8]
- typs[126] = functype(nil, []*ir.Field{anonfield(typs[125]), anonfield(typs[125])}, nil)
- typs[127] = types.Types[types.TUINT16]
- typs[128] = functype(nil, []*ir.Field{anonfield(typs[127]), anonfield(typs[127])}, nil)
- typs[129] = functype(nil, []*ir.Field{anonfield(typs[65]), anonfield(typs[65])}, nil)
- typs[130] = functype(nil, []*ir.Field{anonfield(typs[24]), anonfield(typs[24])}, nil)
+ typs[122] = functype(nil, []*ir.Field{anonfield(typs[5]), anonfield(typs[5]), anonfield(typs[5])}, nil)
+ typs[123] = functype(nil, []*ir.Field{anonfield(typs[7]), anonfield(typs[1]), anonfield(typs[5])}, nil)
+ typs[124] = types.NewSlice(typs[7])
+ typs[125] = functype(nil, []*ir.Field{anonfield(typs[7]), anonfield(typs[124])}, nil)
+ typs[126] = types.Types[types.TUINT8]
+ typs[127] = functype(nil, []*ir.Field{anonfield(typs[126]), anonfield(typs[126])}, nil)
+ typs[128] = types.Types[types.TUINT16]
+ typs[129] = functype(nil, []*ir.Field{anonfield(typs[128]), anonfield(typs[128])}, nil)
+ typs[130] = functype(nil, []*ir.Field{anonfield(typs[65]), anonfield(typs[65])}, nil)
+ typs[131] = functype(nil, []*ir.Field{anonfield(typs[24]), anonfield(typs[24])}, nil)
return typs[:]
}
diff --git a/src/cmd/compile/internal/gc/builtin/runtime.go b/src/cmd/compile/internal/gc/builtin/runtime.go
index aac2de38c6..acb69c7b28 100644
--- a/src/cmd/compile/internal/gc/builtin/runtime.go
+++ b/src/cmd/compile/internal/gc/builtin/runtime.go
@@ -237,6 +237,7 @@ func racewriterange(addr, size uintptr)
// memory sanitizer
func msanread(addr, size uintptr)
func msanwrite(addr, size uintptr)
+func msanmove(dst, src, size uintptr)
func checkptrAlignment(unsafe.Pointer, *byte, uintptr)
func checkptrArithmetic(unsafe.Pointer, []unsafe.Pointer)
diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go
index 041073f117..5d4e880742 100644
--- a/src/cmd/compile/internal/gc/go.go
+++ b/src/cmd/compile/internal/gc/go.go
@@ -209,6 +209,7 @@ var (
growslice,
msanread,
msanwrite,
+ msanmove,
newobject,
newproc,
panicdivide,
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index 9539e9cc8a..f13c45c2a6 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -82,6 +82,7 @@ func initssaconfig() {
growslice = sysfunc("growslice")
msanread = sysfunc("msanread")
msanwrite = sysfunc("msanwrite")
+ msanmove = sysfunc("msanmove")
newobject = sysfunc("newobject")
newproc = sysfunc("newproc")
panicdivide = sysfunc("panicdivide")
@@ -965,8 +966,46 @@ func (s *state) newValueOrSfCall2(op ssa.Op, t *types.Type, arg0, arg1 *ssa.Valu
return s.newValue2(op, t, arg0, arg1)
}
-func (s *state) instrument(t *types.Type, addr *ssa.Value, wr bool) {
- if !s.curfn.InstrumentBody() {
+type instrumentKind uint8
+
+const (
+ instrumentRead = iota
+ instrumentWrite
+ instrumentMove
+)
+
+func (s *state) instrument(t *types.Type, addr *ssa.Value, kind instrumentKind) {
+ s.instrument2(t, addr, nil, kind)
+}
+
+// instrumentFields instruments a read/write operation on addr.
+// If it is instrumenting for MSAN and t is a struct type, it instruments
+// operation for each field, instead of for the whole struct.
+func (s *state) instrumentFields(t *types.Type, addr *ssa.Value, kind instrumentKind) {
+ if !base.Flag.MSan || !t.IsStruct() {
+ s.instrument(t, addr, kind)
+ return
+ }
+ for _, f := range t.Fields().Slice() {
+ if f.Sym.IsBlank() {
+ continue
+ }
+ offptr := s.newValue1I(ssa.OpOffPtr, types.NewPtr(f.Type), f.Offset, addr)
+ s.instrumentFields(f.Type, offptr, kind)
+ }
+}
+
+func (s *state) instrumentMove(t *types.Type, dst, src *ssa.Value) {
+ if base.Flag.MSan {
+ s.instrument2(t, dst, src, instrumentMove)
+ } else {
+ s.instrument(t, src, instrumentRead)
+ s.instrument(t, dst, instrumentWrite)
+ }
+}
+
+func (s *state) instrument2(t *types.Type, addr, addr2 *ssa.Value, kind instrumentKind) {
+ if !s.curfn.Func().InstrumentBody() {
return
}
@@ -982,33 +1021,54 @@ func (s *state) instrument(t *types.Type, addr *ssa.Value, wr bool) {
var fn *obj.LSym
needWidth := false
+ if addr2 != nil && kind != instrumentMove {
+ panic("instrument2: non-nil addr2 for non-move instrumentation")
+ }
+
if base.Flag.MSan {
- fn = msanread
- if wr {
+ switch kind {
+ case instrumentRead:
+ fn = msanread
+ case instrumentWrite:
fn = msanwrite
+ case instrumentMove:
+ fn = msanmove
+ default:
+ panic("unreachable")
}
needWidth = true
} else if base.Flag.Race && t.NumComponents(types.CountBlankFields) > 1 {
// for composite objects we have to write every address
// because a write might happen to any subobject.
// composites with only one element don't have subobjects, though.
- fn = racereadrange
- if wr {
+ switch kind {
+ case instrumentRead:
+ fn = racereadrange
+ case instrumentWrite:
fn = racewriterange
+ default:
+ panic("unreachable")
}
needWidth = true
} else if base.Flag.Race {
// for non-composite objects we can write just the start
// address, as any write must write the first byte.
- fn = raceread
- if wr {
+ switch kind {
+ case instrumentRead:
+ fn = raceread
+ case instrumentWrite:
fn = racewrite
+ default:
+ panic("unreachable")
}
} else {
panic("unreachable")
}
args := []*ssa.Value{addr}
+ if addr2 != nil {
+ args = append(args, addr2)
+ }
if needWidth {
args = append(args, s.constInt(types.Types[types.TUINTPTR], w))
}
@@ -1016,7 +1076,7 @@ func (s *state) instrument(t *types.Type, addr *ssa.Value, wr bool) {
}
func (s *state) load(t *types.Type, src *ssa.Value) *ssa.Value {
- s.instrument(t, src, false)
+ s.instrumentFields(t, src, instrumentRead)
return s.rawLoad(t, src)
}
@@ -1029,15 +1089,14 @@ func (s *state) store(t *types.Type, dst, val *ssa.Value) {
}
func (s *state) zero(t *types.Type, dst *ssa.Value) {
- s.instrument(t, dst, true)
+ s.instrument(t, dst, instrumentWrite)
store := s.newValue2I(ssa.OpZero, types.TypeMem, t.Size(), dst, s.mem())
store.Aux = t
s.vars[memVar] = store
}
func (s *state) move(t *types.Type, dst, src *ssa.Value) {
- s.instrument(t, src, false)
- s.instrument(t, dst, true)
+ s.instrumentMove(t, dst, src)
store := s.newValue3I(ssa.OpMove, types.TypeMem, t.Size(), dst, src, s.mem())
store.Aux = t
s.vars[memVar] = store
@@ -5263,7 +5322,7 @@ func (s *state) rtcall(fn *obj.LSym, returns bool, results []*types.Type, args .
// do *left = right for type t.
func (s *state) storeType(t *types.Type, left, right *ssa.Value, skip skipMask, leftIsStmt bool) {
- s.instrument(t, left, true)
+ s.instrument(t, left, instrumentWrite)
if skip == 0 && (!t.HasPointers() || ssa.IsStackAddr(left)) {
// Known to not have write barrier. Store the whole type.
diff --git a/src/cmd/compile/internal/logopt/logopt_test.go b/src/cmd/compile/internal/logopt/logopt_test.go
index 4a6ed2fac9..71976174b0 100644
--- a/src/cmd/compile/internal/logopt/logopt_test.go
+++ b/src/cmd/compile/internal/logopt/logopt_test.go
@@ -51,7 +51,7 @@ func want(t *testing.T, out string, desired string) {
func wantN(t *testing.T, out string, desired string, n int) {
if strings.Count(out, desired) != n {
- t.Errorf("expected exactly %d occurences of %s in \n%s", n, desired, out)
+ t.Errorf("expected exactly %d occurrences of %s in \n%s", n, desired, out)
}
}
diff --git a/src/cmd/compile/internal/ssa/gen/386.rules b/src/cmd/compile/internal/ssa/gen/386.rules
index 537705c681..fbc12fd672 100644
--- a/src/cmd/compile/internal/ssa/gen/386.rules
+++ b/src/cmd/compile/internal/ssa/gen/386.rules
@@ -531,6 +531,7 @@
// fold ADDL into LEAL
(ADDLconst [c] (LEAL [d] {s} x)) && is32Bit(int64(c)+int64(d)) => (LEAL [c+d] {s} x)
(LEAL [c] {s} (ADDLconst [d] x)) && is32Bit(int64(c)+int64(d)) => (LEAL [c+d] {s} x)
+(ADDLconst [c] x:(SP)) => (LEAL [c] x) // so it is rematerializeable
(LEAL [c] {s} (ADDL x y)) && x.Op != OpSB && y.Op != OpSB => (LEAL1 [c] {s} x y)
(ADDL x (LEAL [c] {s} y)) && x.Op != OpSB && y.Op != OpSB => (LEAL1 [c] {s} x y)
diff --git a/src/cmd/compile/internal/ssa/gen/ARM.rules b/src/cmd/compile/internal/ssa/gen/ARM.rules
index 6637c6cae4..11c36b5da3 100644
--- a/src/cmd/compile/internal/ssa/gen/ARM.rules
+++ b/src/cmd/compile/internal/ssa/gen/ARM.rules
@@ -760,8 +760,8 @@
(MUL (MOVWconst [c]) (MOVWconst [d])) => (MOVWconst [c*d])
(MULA (MOVWconst [c]) (MOVWconst [d]) a) => (ADDconst [c*d] a)
(MULS (MOVWconst [c]) (MOVWconst [d]) a) => (SUBconst [c*d] a)
-(Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [int32(uint32(c)/uint32(d))])
-(Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [int32(uint32(c)%uint32(d))])
+(Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) && d != 0 => (MOVWconst [int32(uint32(c)/uint32(d))])
+(Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d]))) && d != 0 => (MOVWconst [int32(uint32(c)%uint32(d))])
(ANDconst [c] (MOVWconst [d])) => (MOVWconst [c&d])
(ANDconst [c] (ANDconst [d] x)) => (ANDconst [c&d] x)
(ORconst [c] (MOVWconst [d])) => (MOVWconst [c|d])
diff --git a/src/cmd/compile/internal/ssa/gen/ARM64.rules b/src/cmd/compile/internal/ssa/gen/ARM64.rules
index 9edc0c94b0..3f4d0c1c52 100644
--- a/src/cmd/compile/internal/ssa/gen/ARM64.rules
+++ b/src/cmd/compile/internal/ssa/gen/ARM64.rules
@@ -1372,14 +1372,14 @@
(MADDW a (MOVDconst [c]) (MOVDconst [d])) => (ADDconst [int64(int32(c)*int32(d))] a)
(MSUB a (MOVDconst [c]) (MOVDconst [d])) => (SUBconst [c*d] a)
(MSUBW a (MOVDconst [c]) (MOVDconst [d])) => (SUBconst [int64(int32(c)*int32(d))] a)
-(DIV (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [c/d])
-(UDIV (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [int64(uint64(c)/uint64(d))])
-(DIVW (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [int64(int32(c)/int32(d))])
-(UDIVW (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [int64(uint32(c)/uint32(d))])
-(MOD (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [c%d])
-(UMOD (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [int64(uint64(c)%uint64(d))])
-(MODW (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [int64(int32(c)%int32(d))])
-(UMODW (MOVDconst [c]) (MOVDconst [d])) => (MOVDconst [int64(uint32(c)%uint32(d))])
+(DIV (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [c/d])
+(UDIV (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [int64(uint64(c)/uint64(d))])
+(DIVW (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [int64(int32(c)/int32(d))])
+(UDIVW (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [int64(uint32(c)/uint32(d))])
+(MOD (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [c%d])
+(UMOD (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [int64(uint64(c)%uint64(d))])
+(MODW (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [int64(int32(c)%int32(d))])
+(UMODW (MOVDconst [c]) (MOVDconst [d])) && d != 0 => (MOVDconst [int64(uint32(c)%uint32(d))])
(ANDconst [c] (MOVDconst [d])) => (MOVDconst [c&d])
(ANDconst [c] (ANDconst [d] x)) => (ANDconst [c&d] x)
(ANDconst [c] (MOVWUreg x)) => (ANDconst [c&(1<<32-1)] x)
diff --git a/src/cmd/compile/internal/ssa/gen/MIPS.rules b/src/cmd/compile/internal/ssa/gen/MIPS.rules
index 470cc66869..8ad2c90ac3 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPS.rules
+++ b/src/cmd/compile/internal/ssa/gen/MIPS.rules
@@ -626,10 +626,10 @@
(MUL (MOVWconst [c]) (MOVWconst [d])) => (MOVWconst [c*d])
(Select1 (MULTU (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [int32(uint32(c)*uint32(d))])
(Select0 (MULTU (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [int32((int64(uint32(c))*int64(uint32(d)))>>32)])
-(Select1 (DIV (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [c/d])
-(Select1 (DIVU (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [int32(uint32(c)/uint32(d))])
-(Select0 (DIV (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [c%d])
-(Select0 (DIVU (MOVWconst [c]) (MOVWconst [d]))) => (MOVWconst [int32(uint32(c)%uint32(d))])
+(Select1 (DIV (MOVWconst [c]) (MOVWconst [d]))) && d != 0 => (MOVWconst [c/d])
+(Select1 (DIVU (MOVWconst [c]) (MOVWconst [d]))) && d != 0 => (MOVWconst [int32(uint32(c)/uint32(d))])
+(Select0 (DIV (MOVWconst [c]) (MOVWconst [d]))) && d != 0 => (MOVWconst [c%d])
+(Select0 (DIVU (MOVWconst [c]) (MOVWconst [d]))) && d != 0 => (MOVWconst [int32(uint32(c)%uint32(d))])
(ANDconst [c] (MOVWconst [d])) => (MOVWconst [c&d])
(ANDconst [c] (ANDconst [d] x)) => (ANDconst [c&d] x)
(ORconst [c] (MOVWconst [d])) => (MOVWconst [c|d])
diff --git a/src/cmd/compile/internal/ssa/gen/MIPS64.rules b/src/cmd/compile/internal/ssa/gen/MIPS64.rules
index 9af0f93333..088c9b1ac4 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPS64.rules
+++ b/src/cmd/compile/internal/ssa/gen/MIPS64.rules
@@ -617,10 +617,10 @@
(SRLVconst [c] (MOVVconst [d])) => (MOVVconst [int64(uint64(d)>>uint64(c))])
(SRAVconst [c] (MOVVconst [d])) => (MOVVconst [d>>uint64(c)])
(Select1 (MULVU (MOVVconst [c]) (MOVVconst [d]))) => (MOVVconst [c*d])
-(Select1 (DIVV (MOVVconst [c]) (MOVVconst [d]))) => (MOVVconst [c/d])
-(Select1 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) => (MOVVconst [int64(uint64(c)/uint64(d))])
-(Select0 (DIVV (MOVVconst [c]) (MOVVconst [d]))) => (MOVVconst [c%d]) // mod
-(Select0 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) => (MOVVconst [int64(uint64(c)%uint64(d))]) // mod
+(Select1 (DIVV (MOVVconst [c]) (MOVVconst [d]))) && d != 0 => (MOVVconst [c/d])
+(Select1 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) && d != 0 => (MOVVconst [int64(uint64(c)/uint64(d))])
+(Select0 (DIVV (MOVVconst [c]) (MOVVconst [d]))) && d != 0 => (MOVVconst [c%d]) // mod
+(Select0 (DIVVU (MOVVconst [c]) (MOVVconst [d]))) && d != 0 => (MOVVconst [int64(uint64(c)%uint64(d))]) // mod
(ANDconst [c] (MOVVconst [d])) => (MOVVconst [c&d])
(ANDconst [c] (ANDconst [d] x)) => (ANDconst [c&d] x)
(ORconst [c] (MOVVconst [d])) => (MOVVconst [c|d])
diff --git a/src/cmd/compile/internal/ssa/gen/PPC64.rules b/src/cmd/compile/internal/ssa/gen/PPC64.rules
index 31b186d167..c064046172 100644
--- a/src/cmd/compile/internal/ssa/gen/PPC64.rules
+++ b/src/cmd/compile/internal/ssa/gen/PPC64.rules
@@ -845,6 +845,7 @@
(SUB x (MOVDconst [c])) && is32Bit(-c) => (ADDconst [-c] x)
(ADDconst [c] (MOVDaddr [d] {sym} x)) && is32Bit(c+int64(d)) => (MOVDaddr [int32(c+int64(d))] {sym} x)
+(ADDconst [c] x:(SP)) && is32Bit(c) => (MOVDaddr [int32(c)] x) // so it is rematerializeable
(MULL(W|D) x (MOVDconst [c])) && is16Bit(c) => (MULL(W|D)const [int32(c)] x)
diff --git a/src/cmd/compile/internal/ssa/gen/Wasm.rules b/src/cmd/compile/internal/ssa/gen/Wasm.rules
index ea12c5d617..fc45cd3ed5 100644
--- a/src/cmd/compile/internal/ssa/gen/Wasm.rules
+++ b/src/cmd/compile/internal/ssa/gen/Wasm.rules
@@ -399,6 +399,7 @@
// folding offset into address
(I64AddConst [off] (LoweredAddr {sym} [off2] base)) && isU32Bit(off+int64(off2)) =>
(LoweredAddr {sym} [int32(off)+off2] base)
+(I64AddConst [off] x:(SP)) && isU32Bit(off) => (LoweredAddr [int32(off)] x) // so it is rematerializeable
// transforming readonly globals into constants
(I64Load [off] (LoweredAddr {sym} [off2] (SB)) _) && symIsRO(sym) && isU32Bit(off+int64(off2)) => (I64Const [int64(read64(sym, off+int64(off2), config.ctxt.Arch.ByteOrder))])
diff --git a/src/cmd/compile/internal/ssa/rewrite386.go b/src/cmd/compile/internal/ssa/rewrite386.go
index eca4817b9b..2acdccd568 100644
--- a/src/cmd/compile/internal/ssa/rewrite386.go
+++ b/src/cmd/compile/internal/ssa/rewrite386.go
@@ -1027,6 +1027,19 @@ func rewriteValue386_Op386ADDLconst(v *Value) bool {
v.AddArg(x)
return true
}
+ // match: (ADDLconst [c] x:(SP))
+ // result: (LEAL [c] x)
+ for {
+ c := auxIntToInt32(v.AuxInt)
+ x := v_0
+ if x.Op != OpSP {
+ break
+ }
+ v.reset(Op386LEAL)
+ v.AuxInt = int32ToAuxInt(c)
+ v.AddArg(x)
+ return true
+ }
// match: (ADDLconst [c] (LEAL1 [d] {s} x y))
// cond: is32Bit(int64(c)+int64(d))
// result: (LEAL1 [c+d] {s} x y)
diff --git a/src/cmd/compile/internal/ssa/rewriteARM.go b/src/cmd/compile/internal/ssa/rewriteARM.go
index 68495c558c..d9d439fa63 100644
--- a/src/cmd/compile/internal/ssa/rewriteARM.go
+++ b/src/cmd/compile/internal/ssa/rewriteARM.go
@@ -15599,6 +15599,7 @@ func rewriteValueARM_OpSelect0(v *Value) bool {
return true
}
// match: (Select0 (CALLudiv (MOVWconst [c]) (MOVWconst [d])))
+ // cond: d != 0
// result: (MOVWconst [int32(uint32(c)/uint32(d))])
for {
if v_0.Op != OpARMCALLudiv {
@@ -15615,6 +15616,9 @@ func rewriteValueARM_OpSelect0(v *Value) bool {
break
}
d := auxIntToInt32(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARMMOVWconst)
v.AuxInt = int32ToAuxInt(int32(uint32(c) / uint32(d)))
return true
@@ -15661,6 +15665,7 @@ func rewriteValueARM_OpSelect1(v *Value) bool {
return true
}
// match: (Select1 (CALLudiv (MOVWconst [c]) (MOVWconst [d])))
+ // cond: d != 0
// result: (MOVWconst [int32(uint32(c)%uint32(d))])
for {
if v_0.Op != OpARMCALLudiv {
@@ -15677,6 +15682,9 @@ func rewriteValueARM_OpSelect1(v *Value) bool {
break
}
d := auxIntToInt32(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARMMOVWconst)
v.AuxInt = int32ToAuxInt(int32(uint32(c) % uint32(d)))
return true
diff --git a/src/cmd/compile/internal/ssa/rewriteARM64.go b/src/cmd/compile/internal/ssa/rewriteARM64.go
index 353696bf39..5d5e526add 100644
--- a/src/cmd/compile/internal/ssa/rewriteARM64.go
+++ b/src/cmd/compile/internal/ssa/rewriteARM64.go
@@ -3396,6 +3396,7 @@ func rewriteValueARM64_OpARM64DIV(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
// match: (DIV (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [c/d])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -3406,6 +3407,9 @@ func rewriteValueARM64_OpARM64DIV(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(c / d)
return true
@@ -3416,6 +3420,7 @@ func rewriteValueARM64_OpARM64DIVW(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
// match: (DIVW (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [int64(int32(c)/int32(d))])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -3426,6 +3431,9 @@ func rewriteValueARM64_OpARM64DIVW(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(int64(int32(c) / int32(d)))
return true
@@ -6165,6 +6173,7 @@ func rewriteValueARM64_OpARM64MOD(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
// match: (MOD (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [c%d])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -6175,6 +6184,9 @@ func rewriteValueARM64_OpARM64MOD(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(c % d)
return true
@@ -6185,6 +6197,7 @@ func rewriteValueARM64_OpARM64MODW(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
// match: (MODW (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [int64(int32(c)%int32(d))])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -6195,6 +6208,9 @@ func rewriteValueARM64_OpARM64MODW(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(int64(int32(c) % int32(d)))
return true
@@ -20423,6 +20439,7 @@ func rewriteValueARM64_OpARM64UDIV(v *Value) bool {
return true
}
// match: (UDIV (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [int64(uint64(c)/uint64(d))])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -20433,6 +20450,9 @@ func rewriteValueARM64_OpARM64UDIV(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(int64(uint64(c) / uint64(d)))
return true
@@ -20475,6 +20495,7 @@ func rewriteValueARM64_OpARM64UDIVW(v *Value) bool {
return true
}
// match: (UDIVW (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [int64(uint32(c)/uint32(d))])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -20485,6 +20506,9 @@ func rewriteValueARM64_OpARM64UDIVW(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(int64(uint32(c) / uint32(d)))
return true
@@ -20539,6 +20563,7 @@ func rewriteValueARM64_OpARM64UMOD(v *Value) bool {
return true
}
// match: (UMOD (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [int64(uint64(c)%uint64(d))])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -20549,6 +20574,9 @@ func rewriteValueARM64_OpARM64UMOD(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(int64(uint64(c) % uint64(d)))
return true
@@ -20608,6 +20636,7 @@ func rewriteValueARM64_OpARM64UMODW(v *Value) bool {
return true
}
// match: (UMODW (MOVDconst [c]) (MOVDconst [d]))
+ // cond: d != 0
// result: (MOVDconst [int64(uint32(c)%uint32(d))])
for {
if v_0.Op != OpARM64MOVDconst {
@@ -20618,6 +20647,9 @@ func rewriteValueARM64_OpARM64UMODW(v *Value) bool {
break
}
d := auxIntToInt64(v_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpARM64MOVDconst)
v.AuxInt = int64ToAuxInt(int64(uint32(c) % uint32(d)))
return true
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go
index bbc331014f..3fc5527955 100644
--- a/src/cmd/compile/internal/ssa/rewriteMIPS.go
+++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go
@@ -6421,6 +6421,7 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool {
break
}
// match: (Select0 (DIV (MOVWconst [c]) (MOVWconst [d])))
+ // cond: d != 0
// result: (MOVWconst [c%d])
for {
if v_0.Op != OpMIPSDIV {
@@ -6437,11 +6438,15 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool {
break
}
d := auxIntToInt32(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPSMOVWconst)
v.AuxInt = int32ToAuxInt(c % d)
return true
}
// match: (Select0 (DIVU (MOVWconst [c]) (MOVWconst [d])))
+ // cond: d != 0
// result: (MOVWconst [int32(uint32(c)%uint32(d))])
for {
if v_0.Op != OpMIPSDIVU {
@@ -6458,6 +6463,9 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool {
break
}
d := auxIntToInt32(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPSMOVWconst)
v.AuxInt = int32ToAuxInt(int32(uint32(c) % uint32(d)))
return true
@@ -6609,6 +6617,7 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool {
break
}
// match: (Select1 (DIV (MOVWconst [c]) (MOVWconst [d])))
+ // cond: d != 0
// result: (MOVWconst [c/d])
for {
if v_0.Op != OpMIPSDIV {
@@ -6625,11 +6634,15 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool {
break
}
d := auxIntToInt32(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPSMOVWconst)
v.AuxInt = int32ToAuxInt(c / d)
return true
}
// match: (Select1 (DIVU (MOVWconst [c]) (MOVWconst [d])))
+ // cond: d != 0
// result: (MOVWconst [int32(uint32(c)/uint32(d))])
for {
if v_0.Op != OpMIPSDIVU {
@@ -6646,6 +6659,9 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool {
break
}
d := auxIntToInt32(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPSMOVWconst)
v.AuxInt = int32ToAuxInt(int32(uint32(c) / uint32(d)))
return true
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS64.go b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
index 29e3a8a363..d78f6089af 100644
--- a/src/cmd/compile/internal/ssa/rewriteMIPS64.go
+++ b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
@@ -6887,6 +6887,7 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool {
return true
}
// match: (Select0 (DIVV (MOVVconst [c]) (MOVVconst [d])))
+ // cond: d != 0
// result: (MOVVconst [c%d])
for {
if v_0.Op != OpMIPS64DIVV {
@@ -6903,11 +6904,15 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool {
break
}
d := auxIntToInt64(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPS64MOVVconst)
v.AuxInt = int64ToAuxInt(c % d)
return true
}
// match: (Select0 (DIVVU (MOVVconst [c]) (MOVVconst [d])))
+ // cond: d != 0
// result: (MOVVconst [int64(uint64(c)%uint64(d))])
for {
if v_0.Op != OpMIPS64DIVVU {
@@ -6924,6 +6929,9 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool {
break
}
d := auxIntToInt64(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPS64MOVVconst)
v.AuxInt = int64ToAuxInt(int64(uint64(c) % uint64(d)))
return true
@@ -7099,6 +7107,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool {
break
}
// match: (Select1 (DIVV (MOVVconst [c]) (MOVVconst [d])))
+ // cond: d != 0
// result: (MOVVconst [c/d])
for {
if v_0.Op != OpMIPS64DIVV {
@@ -7115,11 +7124,15 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool {
break
}
d := auxIntToInt64(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPS64MOVVconst)
v.AuxInt = int64ToAuxInt(c / d)
return true
}
// match: (Select1 (DIVVU (MOVVconst [c]) (MOVVconst [d])))
+ // cond: d != 0
// result: (MOVVconst [int64(uint64(c)/uint64(d))])
for {
if v_0.Op != OpMIPS64DIVVU {
@@ -7136,6 +7149,9 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool {
break
}
d := auxIntToInt64(v_0_1.AuxInt)
+ if !(d != 0) {
+ break
+ }
v.reset(OpMIPS64MOVVconst)
v.AuxInt = int64ToAuxInt(int64(uint64(c) / uint64(d)))
return true
diff --git a/src/cmd/compile/internal/ssa/rewritePPC64.go b/src/cmd/compile/internal/ssa/rewritePPC64.go
index 7d4cf73fd8..455f9b1388 100644
--- a/src/cmd/compile/internal/ssa/rewritePPC64.go
+++ b/src/cmd/compile/internal/ssa/rewritePPC64.go
@@ -4195,6 +4195,20 @@ func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool {
v.AddArg(x)
return true
}
+ // match: (ADDconst [c] x:(SP))
+ // cond: is32Bit(c)
+ // result: (MOVDaddr [int32(c)] x)
+ for {
+ c := auxIntToInt64(v.AuxInt)
+ x := v_0
+ if x.Op != OpSP || !(is32Bit(c)) {
+ break
+ }
+ v.reset(OpPPC64MOVDaddr)
+ v.AuxInt = int32ToAuxInt(int32(c))
+ v.AddArg(x)
+ return true
+ }
// match: (ADDconst [c] (SUBFCconst [d] x))
// cond: is32Bit(c+d)
// result: (SUBFCconst [c+d] x)
diff --git a/src/cmd/compile/internal/ssa/rewriteWasm.go b/src/cmd/compile/internal/ssa/rewriteWasm.go
index 52b6f6bfc7..c8ecefc736 100644
--- a/src/cmd/compile/internal/ssa/rewriteWasm.go
+++ b/src/cmd/compile/internal/ssa/rewriteWasm.go
@@ -3693,6 +3693,20 @@ func rewriteValueWasm_OpWasmI64AddConst(v *Value) bool {
v.AddArg(base)
return true
}
+ // match: (I64AddConst [off] x:(SP))
+ // cond: isU32Bit(off)
+ // result: (LoweredAddr [int32(off)] x)
+ for {
+ off := auxIntToInt64(v.AuxInt)
+ x := v_0
+ if x.Op != OpSP || !(isU32Bit(off)) {
+ break
+ }
+ v.reset(OpWasmLoweredAddr)
+ v.AuxInt = int32ToAuxInt(int32(off))
+ v.AddArg(x)
+ return true
+ }
return false
}
func rewriteValueWasm_OpWasmI64And(v *Value) bool {
diff --git a/src/cmd/compile/internal/wasm/ssa.go b/src/cmd/compile/internal/wasm/ssa.go
index 01ba721556..c9a52a5f73 100644
--- a/src/cmd/compile/internal/wasm/ssa.go
+++ b/src/cmd/compile/internal/wasm/ssa.go
@@ -232,6 +232,12 @@ func ssaGenValueOnStack(s *gc.SSAGenState, v *ssa.Value, extend bool) {
}
case ssa.OpWasmLoweredAddr:
+ if v.Aux == nil { // address of off(SP), no symbol
+ getValue64(s, v.Args[0])
+ i64Const(s, v.AuxInt)
+ s.Prog(wasm.AI64Add)
+ break
+ }
p := s.Prog(wasm.AGet)
p.From.Type = obj.TYPE_ADDR
switch v.Aux.(type) {
diff --git a/src/cmd/cover/cover.go b/src/cmd/cover/cover.go
index 360f9aeb06..7ee000861b 100644
--- a/src/cmd/cover/cover.go
+++ b/src/cmd/cover/cover.go
@@ -12,7 +12,6 @@ import (
"go/parser"
"go/token"
"io"
- "io/ioutil"
"log"
"os"
"sort"
@@ -304,7 +303,7 @@ func (f *File) Visit(node ast.Node) ast.Visitor {
func annotate(name string) {
fset := token.NewFileSet()
- content, err := ioutil.ReadFile(name)
+ content, err := os.ReadFile(name)
if err != nil {
log.Fatalf("cover: %s: %s", name, err)
}
diff --git a/src/cmd/cover/cover_test.go b/src/cmd/cover/cover_test.go
index 1c252e6e45..86c95d15c5 100644
--- a/src/cmd/cover/cover_test.go
+++ b/src/cmd/cover/cover_test.go
@@ -13,7 +13,6 @@ import (
"go/parser"
"go/token"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -81,7 +80,7 @@ var debug = flag.Bool("debug", false, "keep rewritten files for debugging")
// We use TestMain to set up a temporary directory and remove it when
// the tests are done.
func TestMain(m *testing.M) {
- dir, err := ioutil.TempDir("", "go-testcover")
+ dir, err := os.MkdirTemp("", "go-testcover")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
@@ -173,7 +172,7 @@ func TestCover(t *testing.T) {
buildCover(t)
// Read in the test file (testTest) and write it, with LINEs specified, to coverInput.
- file, err := ioutil.ReadFile(testTest)
+ file, err := os.ReadFile(testTest)
if err != nil {
t.Fatal(err)
}
@@ -192,7 +191,7 @@ func TestCover(t *testing.T) {
[]byte("}"))
lines = append(lines, []byte("func unFormatted2(b bool) {if b{}else{}}"))
- if err := ioutil.WriteFile(coverInput, bytes.Join(lines, []byte("\n")), 0666); err != nil {
+ if err := os.WriteFile(coverInput, bytes.Join(lines, []byte("\n")), 0666); err != nil {
t.Fatal(err)
}
@@ -208,11 +207,11 @@ func TestCover(t *testing.T) {
// Copy testmain to testTempDir, so that it is in the same directory
// as coverOutput.
- b, err := ioutil.ReadFile(testMain)
+ b, err := os.ReadFile(testMain)
if err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(tmpTestMain, b, 0444); err != nil {
+ if err := os.WriteFile(tmpTestMain, b, 0444); err != nil {
t.Fatal(err)
}
@@ -220,7 +219,7 @@ func TestCover(t *testing.T) {
cmd = exec.Command(testenv.GoToolPath(t), "run", tmpTestMain, coverOutput)
run(cmd, t)
- file, err = ioutil.ReadFile(coverOutput)
+ file, err = os.ReadFile(coverOutput)
if err != nil {
t.Fatal(err)
}
@@ -251,7 +250,7 @@ func TestDirectives(t *testing.T) {
// Read the source file and find all the directives. We'll keep
// track of whether each one has been seen in the output.
testDirectives := filepath.Join(testdata, "directives.go")
- source, err := ioutil.ReadFile(testDirectives)
+ source, err := os.ReadFile(testDirectives)
if err != nil {
t.Fatal(err)
}
@@ -398,7 +397,7 @@ func TestCoverHTML(t *testing.T) {
// Extract the parts of the HTML with comment markers,
// and compare against a golden file.
- entireHTML, err := ioutil.ReadFile(htmlHTML)
+ entireHTML, err := os.ReadFile(htmlHTML)
if err != nil {
t.Fatal(err)
}
@@ -420,7 +419,7 @@ func TestCoverHTML(t *testing.T) {
if scan.Err() != nil {
t.Error(scan.Err())
}
- golden, err := ioutil.ReadFile(htmlGolden)
+ golden, err := os.ReadFile(htmlGolden)
if err != nil {
t.Fatalf("reading golden file: %v", err)
}
@@ -457,7 +456,7 @@ func TestHtmlUnformatted(t *testing.T) {
t.Fatal(err)
}
- if err := ioutil.WriteFile(filepath.Join(htmlUDir, "go.mod"), []byte("module htmlunformatted\n"), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(htmlUDir, "go.mod"), []byte("module htmlunformatted\n"), 0666); err != nil {
t.Fatal(err)
}
@@ -474,10 +473,10 @@ lab:
const htmlUTestContents = `package htmlunformatted`
- if err := ioutil.WriteFile(htmlU, []byte(htmlUContents), 0444); err != nil {
+ if err := os.WriteFile(htmlU, []byte(htmlUContents), 0444); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(htmlUTest, []byte(htmlUTestContents), 0444); err != nil {
+ if err := os.WriteFile(htmlUTest, []byte(htmlUTestContents), 0444); err != nil {
t.Fatal(err)
}
@@ -540,13 +539,13 @@ func TestFuncWithDuplicateLines(t *testing.T) {
t.Fatal(err)
}
- if err := ioutil.WriteFile(filepath.Join(lineDupDir, "go.mod"), []byte("module linedup\n"), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(lineDupDir, "go.mod"), []byte("module linedup\n"), 0666); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(lineDupGo, []byte(lineDupContents), 0444); err != nil {
+ if err := os.WriteFile(lineDupGo, []byte(lineDupContents), 0444); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(lineDupTestGo, []byte(lineDupTestContents), 0444); err != nil {
+ if err := os.WriteFile(lineDupTestGo, []byte(lineDupTestContents), 0444); err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/cover/html.go b/src/cmd/cover/html.go
index f76ea03cf5..b2865c427c 100644
--- a/src/cmd/cover/html.go
+++ b/src/cmd/cover/html.go
@@ -11,7 +11,6 @@ import (
"fmt"
"html/template"
"io"
- "io/ioutil"
"math"
"os"
"path/filepath"
@@ -43,7 +42,7 @@ func htmlOutput(profile, outfile string) error {
if err != nil {
return err
}
- src, err := ioutil.ReadFile(file)
+ src, err := os.ReadFile(file)
if err != nil {
return fmt.Errorf("can't read %q: %v", fn, err)
}
@@ -62,7 +61,7 @@ func htmlOutput(profile, outfile string) error {
var out *os.File
if outfile == "" {
var dir string
- dir, err = ioutil.TempDir("", "cover")
+ dir, err = os.MkdirTemp("", "cover")
if err != nil {
return err
}
diff --git a/src/cmd/fix/main.go b/src/cmd/fix/main.go
index 1cedf992cf..d055929aac 100644
--- a/src/cmd/fix/main.go
+++ b/src/cmd/fix/main.go
@@ -15,7 +15,6 @@ import (
"go/token"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"sort"
@@ -217,7 +216,7 @@ func processFile(filename string, useStdin bool) error {
return nil
}
- return ioutil.WriteFile(f.Name(), newSrc, 0)
+ return os.WriteFile(f.Name(), newSrc, 0)
}
func gofmt(n interface{}) string {
diff --git a/src/cmd/fix/typecheck.go b/src/cmd/fix/typecheck.go
index f45155b06d..40b2287f26 100644
--- a/src/cmd/fix/typecheck.go
+++ b/src/cmd/fix/typecheck.go
@@ -9,7 +9,6 @@ import (
"go/ast"
"go/parser"
"go/token"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -162,12 +161,12 @@ func typecheck(cfg *TypeConfig, f *ast.File) (typeof map[interface{}]string, ass
if err != nil {
return err
}
- dir, err := ioutil.TempDir(os.TempDir(), "fix_cgo_typecheck")
+ dir, err := os.MkdirTemp(os.TempDir(), "fix_cgo_typecheck")
if err != nil {
return err
}
defer os.RemoveAll(dir)
- err = ioutil.WriteFile(filepath.Join(dir, "in.go"), txt, 0600)
+ err = os.WriteFile(filepath.Join(dir, "in.go"), txt, 0600)
if err != nil {
return err
}
@@ -176,7 +175,7 @@ func typecheck(cfg *TypeConfig, f *ast.File) (typeof map[interface{}]string, ass
if err != nil {
return err
}
- out, err := ioutil.ReadFile(filepath.Join(dir, "_cgo_gotypes.go"))
+ out, err := os.ReadFile(filepath.Join(dir, "_cgo_gotypes.go"))
if err != nil {
return err
}
diff --git a/src/cmd/go.mod b/src/cmd/go.mod
index bfee2c7f06..c7d43873ef 100644
--- a/src/cmd/go.mod
+++ b/src/cmd/go.mod
@@ -3,11 +3,10 @@ module cmd
go 1.16
require (
- github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7
- github.com/ianlancetaylor/demangle v0.0.0-20200414190113-039b1ae3a340 // indirect
+ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
golang.org/x/mod v0.4.0
- golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65 // indirect
- golang.org/x/tools v0.0.0-20201110201400-7099162a900a
+ golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
+ golang.org/x/tools v0.0.0-20201208211828-de58e7c01d49
)
diff --git a/src/cmd/go.sum b/src/cmd/go.sum
index 7a743d9f73..30edf77282 100644
--- a/src/cmd/go.sum
+++ b/src/cmd/go.sum
@@ -1,11 +1,10 @@
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
-github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7 h1:qYWTuM6SUNWgtvkhV8oH6GFHCpU+rKQOxPcepM3xKi0=
-github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
-github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
-github.com/ianlancetaylor/demangle v0.0.0-20200414190113-039b1ae3a340 h1:S1+yTUaFPXuDZnPDbO+TrDFIjPzQraYH8/CwSlu9Fac=
-github.com/ianlancetaylor/demangle v0.0.0-20200414190113-039b1ae3a340/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2 h1:HyOHhUtuB/Ruw/L5s5pG2D0kckkN2/IzBs9OClGHnHI=
+github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=
+github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff h1:XmKBi9R6duxOB3lfc72wyrwiOY7X2Jl1wuI+RFOyMDE=
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
@@ -26,14 +25,14 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65 h1:Qo9oJ566/Sq7N4hrGftVXs8GI2CXBCuOd4S2wHE/e0M=
-golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso=
+golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20201110201400-7099162a900a h1:5E6TPwSBG74zT8xSrVc8W59K4ch4NFobVTnh2BYzHyU=
-golang.org/x/tools v0.0.0-20201110201400-7099162a900a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.0.0-20201208211828-de58e7c01d49 h1:K1QAOVIWIvmQ66F1Z3AEa9Wzp0bj+xU3YzLkvROk2Ds=
+golang.org/x/tools v0.0.0-20201208211828-de58e7c01d49/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index 1b8a21ecfa..19764bfc60 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -17,7 +17,6 @@ import (
"internal/testenv"
"io"
"io/fs"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -100,7 +99,7 @@ func TestMain(m *testing.M) {
// Run with a temporary TMPDIR to check that the tests don't
// leave anything behind.
- topTmpdir, err := ioutil.TempDir("", "cmd-go-test-")
+ topTmpdir, err := os.MkdirTemp("", "cmd-go-test-")
if err != nil {
log.Fatal(err)
}
@@ -109,7 +108,7 @@ func TestMain(m *testing.M) {
}
os.Setenv(tempEnvName(), topTmpdir)
- dir, err := ioutil.TempDir(topTmpdir, "tmpdir")
+ dir, err := os.MkdirTemp(topTmpdir, "tmpdir")
if err != nil {
log.Fatal(err)
}
@@ -616,7 +615,7 @@ func (tg *testgoData) makeTempdir() {
tg.t.Helper()
if tg.tempdir == "" {
var err error
- tg.tempdir, err = ioutil.TempDir("", "gotest")
+ tg.tempdir, err = os.MkdirTemp("", "gotest")
tg.must(err)
}
}
@@ -633,7 +632,7 @@ func (tg *testgoData) tempFile(path, contents string) {
bytes = formatted
}
}
- tg.must(ioutil.WriteFile(filepath.Join(tg.tempdir, path), bytes, 0644))
+ tg.must(os.WriteFile(filepath.Join(tg.tempdir, path), bytes, 0644))
}
// tempDir adds a temporary directory for a run of testgo.
@@ -833,7 +832,7 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
return err
}
dest := filepath.Join("goroot", copydir, srcrel)
- data, err := ioutil.ReadFile(path)
+ data, err := os.ReadFile(path)
if err != nil {
return err
}
@@ -850,18 +849,18 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
tg.setenv("GOROOT", tg.path("goroot"))
addVar := func(name string, idx int) (restore func()) {
- data, err := ioutil.ReadFile(name)
+ data, err := os.ReadFile(name)
if err != nil {
t.Fatal(err)
}
old := data
data = append(data, fmt.Sprintf("var DummyUnusedVar%d bool\n", idx)...)
- if err := ioutil.WriteFile(name, append(data, '\n'), 0666); err != nil {
+ if err := os.WriteFile(name, append(data, '\n'), 0666); err != nil {
t.Fatal(err)
}
tg.sleep()
return func() {
- if err := ioutil.WriteFile(name, old, 0666); err != nil {
+ if err := os.WriteFile(name, old, 0666); err != nil {
t.Fatal(err)
}
}
@@ -2674,7 +2673,7 @@ echo $* >>`+tg.path("pkg-config.out"))
tg.setenv("GOPATH", tg.path("."))
tg.setenv("PKG_CONFIG", tg.path("pkg-config.sh"))
tg.run("build", "x")
- out, err := ioutil.ReadFile(tg.path("pkg-config.out"))
+ out, err := os.ReadFile(tg.path("pkg-config.out"))
tg.must(err)
out = bytes.TrimSpace(out)
want := "--cflags --static --static -- a a\n--libs --static --static -- a a"
diff --git a/src/cmd/go/go_windows_test.go b/src/cmd/go/go_windows_test.go
index 02634f19f5..3094212bae 100644
--- a/src/cmd/go/go_windows_test.go
+++ b/src/cmd/go/go_windows_test.go
@@ -5,7 +5,6 @@
package main_test
import (
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -20,14 +19,14 @@ func TestAbsolutePath(t *testing.T) {
defer tg.cleanup()
tg.parallel()
- tmp, err := ioutil.TempDir("", "TestAbsolutePath")
+ tmp, err := os.MkdirTemp("", "TestAbsolutePath")
if err != nil {
t.Fatal(err)
}
defer robustio.RemoveAll(tmp)
file := filepath.Join(tmp, "a.go")
- err = ioutil.WriteFile(file, []byte{}, 0644)
+ err = os.WriteFile(file, []byte{}, 0644)
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/help_test.go b/src/cmd/go/help_test.go
index 78d63ff05e..abfc3db993 100644
--- a/src/cmd/go/help_test.go
+++ b/src/cmd/go/help_test.go
@@ -6,7 +6,7 @@ package main_test
import (
"bytes"
- "io/ioutil"
+ "os"
"testing"
"cmd/go/internal/help"
@@ -23,7 +23,7 @@ func TestDocsUpToDate(t *testing.T) {
buf := new(bytes.Buffer)
// Match the command in mkalldocs.sh that generates alldocs.go.
help.Help(buf, []string{"documentation"})
- data, err := ioutil.ReadFile("alldocs.go")
+ data, err := os.ReadFile("alldocs.go")
if err != nil {
t.Fatalf("error reading alldocs.go: %v", err)
}
diff --git a/src/cmd/go/internal/auth/netrc.go b/src/cmd/go/internal/auth/netrc.go
index 7a9bdbb72c..0107f20d7a 100644
--- a/src/cmd/go/internal/auth/netrc.go
+++ b/src/cmd/go/internal/auth/netrc.go
@@ -5,7 +5,6 @@
package auth
import (
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -99,7 +98,7 @@ func readNetrc() {
return
}
- data, err := ioutil.ReadFile(path)
+ data, err := os.ReadFile(path)
if err != nil {
if !os.IsNotExist(err) {
netrcErr = err
diff --git a/src/cmd/go/internal/bug/bug.go b/src/cmd/go/internal/bug/bug.go
index 07e3516855..1085feaaee 100644
--- a/src/cmd/go/internal/bug/bug.go
+++ b/src/cmd/go/internal/bug/bug.go
@@ -10,7 +10,6 @@ import (
"context"
"fmt"
"io"
- "io/ioutil"
urlpkg "net/url"
"os"
"os/exec"
@@ -117,7 +116,7 @@ func printOSDetails(w io.Writer) {
case "illumos", "solaris":
// Be sure to use the OS-supplied uname, in "/usr/bin":
printCmdOut(w, "uname -srv: ", "/usr/bin/uname", "-srv")
- out, err := ioutil.ReadFile("/etc/release")
+ out, err := os.ReadFile("/etc/release")
if err == nil {
fmt.Fprintf(w, "/etc/release: %s\n", out)
} else {
@@ -177,7 +176,7 @@ func printGlibcVersion(w io.Writer) {
src := []byte(`int main() {}`)
srcfile := filepath.Join(tempdir, "go-bug.c")
outfile := filepath.Join(tempdir, "go-bug")
- err := ioutil.WriteFile(srcfile, src, 0644)
+ err := os.WriteFile(srcfile, src, 0644)
if err != nil {
return
}
diff --git a/src/cmd/go/internal/cache/cache.go b/src/cmd/go/internal/cache/cache.go
index 5464fe5685..41f921641d 100644
--- a/src/cmd/go/internal/cache/cache.go
+++ b/src/cmd/go/internal/cache/cache.go
@@ -13,7 +13,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -239,7 +238,7 @@ func (c *Cache) GetBytes(id ActionID) ([]byte, Entry, error) {
if err != nil {
return nil, entry, err
}
- data, _ := ioutil.ReadFile(c.OutputFile(entry.OutputID))
+ data, _ := os.ReadFile(c.OutputFile(entry.OutputID))
if sha256.Sum256(data) != entry.OutputID {
return nil, entry, &entryNotFoundError{Err: errors.New("bad checksum")}
}
@@ -378,7 +377,7 @@ func (c *Cache) putIndexEntry(id ActionID, out OutputID, size int64, allowVerify
// Truncate the file only *after* writing it.
// (This should be a no-op, but truncate just in case of previous corruption.)
//
- // This differs from ioutil.WriteFile, which truncates to 0 *before* writing
+ // This differs from os.WriteFile, which truncates to 0 *before* writing
// via os.O_TRUNC. Truncating only after writing ensures that a second write
// of the same content to the same file is idempotent, and does not — even
// temporarily! — undo the effect of the first write.
diff --git a/src/cmd/go/internal/cache/cache_test.go b/src/cmd/go/internal/cache/cache_test.go
index 1988c34502..a865b97018 100644
--- a/src/cmd/go/internal/cache/cache_test.go
+++ b/src/cmd/go/internal/cache/cache_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"encoding/binary"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"testing"
@@ -20,7 +19,7 @@ func init() {
}
func TestBasic(t *testing.T) {
- dir, err := ioutil.TempDir("", "cachetest-")
+ dir, err := os.MkdirTemp("", "cachetest-")
if err != nil {
t.Fatal(err)
}
@@ -65,7 +64,7 @@ func TestBasic(t *testing.T) {
}
func TestGrowth(t *testing.T) {
- dir, err := ioutil.TempDir("", "cachetest-")
+ dir, err := os.MkdirTemp("", "cachetest-")
if err != nil {
t.Fatal(err)
}
@@ -118,7 +117,7 @@ func TestVerifyPanic(t *testing.T) {
t.Fatal("initEnv did not set verify")
}
- dir, err := ioutil.TempDir("", "cachetest-")
+ dir, err := os.MkdirTemp("", "cachetest-")
if err != nil {
t.Fatal(err)
}
@@ -151,7 +150,7 @@ func dummyID(x int) [HashSize]byte {
}
func TestCacheTrim(t *testing.T) {
- dir, err := ioutil.TempDir("", "cachetest-")
+ dir, err := os.MkdirTemp("", "cachetest-")
if err != nil {
t.Fatal(err)
}
@@ -207,7 +206,7 @@ func TestCacheTrim(t *testing.T) {
t.Fatal(err)
}
c.OutputFile(entry.OutputID)
- data, err := ioutil.ReadFile(filepath.Join(dir, "trim.txt"))
+ data, err := os.ReadFile(filepath.Join(dir, "trim.txt"))
if err != nil {
t.Fatal(err)
}
@@ -220,7 +219,7 @@ func TestCacheTrim(t *testing.T) {
t.Fatal(err)
}
c.OutputFile(entry.OutputID)
- data2, err := ioutil.ReadFile(filepath.Join(dir, "trim.txt"))
+ data2, err := os.ReadFile(filepath.Join(dir, "trim.txt"))
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/cache/default.go b/src/cmd/go/internal/cache/default.go
index 9f8dd8af4b..0b1c1e0c20 100644
--- a/src/cmd/go/internal/cache/default.go
+++ b/src/cmd/go/internal/cache/default.go
@@ -6,7 +6,6 @@ package cache
import (
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"sync"
@@ -49,7 +48,7 @@ func initDefaultCache() {
}
if _, err := os.Stat(filepath.Join(dir, "README")); err != nil {
// Best effort.
- ioutil.WriteFile(filepath.Join(dir, "README"), []byte(cacheREADME), 0666)
+ os.WriteFile(filepath.Join(dir, "README"), []byte(cacheREADME), 0666)
}
c, err := Open(dir)
diff --git a/src/cmd/go/internal/cache/hash_test.go b/src/cmd/go/internal/cache/hash_test.go
index 3bf7143039..a0356771ca 100644
--- a/src/cmd/go/internal/cache/hash_test.go
+++ b/src/cmd/go/internal/cache/hash_test.go
@@ -6,7 +6,6 @@ package cache
import (
"fmt"
- "io/ioutil"
"os"
"testing"
)
@@ -28,7 +27,7 @@ func TestHash(t *testing.T) {
}
func TestHashFile(t *testing.T) {
- f, err := ioutil.TempFile("", "cmd-go-test-")
+ f, err := os.CreateTemp("", "cmd-go-test-")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index 9bc48132ae..c48904eacc 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -12,7 +12,6 @@ import (
"go/build"
"internal/cfg"
"io"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -187,7 +186,7 @@ func initEnvCache() {
if file == "" {
return
}
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err != nil {
return
}
diff --git a/src/cmd/go/internal/clean/clean.go b/src/cmd/go/internal/clean/clean.go
index 87933f04f3..b1d40feb27 100644
--- a/src/cmd/go/internal/clean/clean.go
+++ b/src/cmd/go/internal/clean/clean.go
@@ -9,7 +9,6 @@ import (
"context"
"fmt"
"io"
- "io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -244,7 +243,7 @@ func clean(p *load.Package) {
base.Errorf("%v", p.Error)
return
}
- dirs, err := ioutil.ReadDir(p.Dir)
+ dirs, err := os.ReadDir(p.Dir)
if err != nil {
base.Errorf("go clean %s: %v", p.Dir, err)
return
diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
index 46af36eb11..6937187522 100644
--- a/src/cmd/go/internal/envcmd/env.go
+++ b/src/cmd/go/internal/envcmd/env.go
@@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"go/build"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -452,7 +451,7 @@ func updateEnvFile(add map[string]string, del map[string]bool) {
if file == "" {
base.Fatalf("go env: cannot find go env config: %v", err)
}
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err != nil && (!os.IsNotExist(err) || len(add) == 0) {
base.Fatalf("go env: reading go env config: %v", err)
}
@@ -506,11 +505,11 @@ func updateEnvFile(add map[string]string, del map[string]bool) {
}
data = []byte(strings.Join(lines, ""))
- err = ioutil.WriteFile(file, data, 0666)
+ err = os.WriteFile(file, data, 0666)
if err != nil {
// Try creating directory.
os.MkdirAll(filepath.Dir(file), 0777)
- err = ioutil.WriteFile(file, data, 0666)
+ err = os.WriteFile(file, data, 0666)
if err != nil {
base.Fatalf("go env: writing go env config: %v", err)
}
diff --git a/src/cmd/go/internal/fsys/fsys.go b/src/cmd/go/internal/fsys/fsys.go
index 0264786e5b..7b06c3c7f3 100644
--- a/src/cmd/go/internal/fsys/fsys.go
+++ b/src/cmd/go/internal/fsys/fsys.go
@@ -86,7 +86,7 @@ func Init(wd string) error {
return nil
}
- b, err := ioutil.ReadFile(OverlayFile)
+ b, err := os.ReadFile(OverlayFile)
if err != nil {
return fmt.Errorf("reading overlay file: %v", err)
}
diff --git a/src/cmd/go/internal/fsys/fsys_test.go b/src/cmd/go/internal/fsys/fsys_test.go
index 90a69de14a..7f175c7031 100644
--- a/src/cmd/go/internal/fsys/fsys_test.go
+++ b/src/cmd/go/internal/fsys/fsys_test.go
@@ -8,7 +8,6 @@ import (
"internal/testenv"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -47,7 +46,7 @@ func initOverlay(t *testing.T, config string) {
if err := os.MkdirAll(filepath.Dir(name), 0777); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(name, f.Data, 0666); err != nil {
+ if err := os.WriteFile(name, f.Data, 0666); err != nil {
t.Fatal(err)
}
}
diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go
index 98c17bba8c..c7401948b8 100644
--- a/src/cmd/go/internal/generate/generate.go
+++ b/src/cmd/go/internal/generate/generate.go
@@ -13,7 +13,6 @@ import (
"go/parser"
"go/token"
"io"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -201,7 +200,7 @@ func runGenerate(ctx context.Context, cmd *base.Command, args []string) {
// generate runs the generation directives for a single file.
func generate(absFile string) bool {
- src, err := ioutil.ReadFile(absFile)
+ src, err := os.ReadFile(absFile)
if err != nil {
log.Fatalf("generate: %s", err)
}
diff --git a/src/cmd/go/internal/imports/scan_test.go b/src/cmd/go/internal/imports/scan_test.go
index e424656cae..2d245ee787 100644
--- a/src/cmd/go/internal/imports/scan_test.go
+++ b/src/cmd/go/internal/imports/scan_test.go
@@ -7,7 +7,7 @@ package imports
import (
"bytes"
"internal/testenv"
- "io/ioutil"
+ "os"
"path"
"path/filepath"
"runtime"
@@ -57,7 +57,7 @@ func TestScan(t *testing.T) {
func TestScanDir(t *testing.T) {
testenv.MustHaveGoBuild(t)
- dirs, err := ioutil.ReadDir("testdata")
+ dirs, err := os.ReadDir("testdata")
if err != nil {
t.Fatal(err)
}
@@ -66,7 +66,7 @@ func TestScanDir(t *testing.T) {
continue
}
t.Run(dir.Name(), func(t *testing.T) {
- tagsData, err := ioutil.ReadFile(filepath.Join("testdata", dir.Name(), "tags.txt"))
+ tagsData, err := os.ReadFile(filepath.Join("testdata", dir.Name(), "tags.txt"))
if err != nil {
t.Fatalf("error reading tags: %v", err)
}
@@ -75,7 +75,7 @@ func TestScanDir(t *testing.T) {
tags[t] = true
}
- wantData, err := ioutil.ReadFile(filepath.Join("testdata", dir.Name(), "want.txt"))
+ wantData, err := os.ReadFile(filepath.Join("testdata", dir.Name(), "want.txt"))
if err != nil {
t.Fatalf("error reading want: %v", err)
}
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index 30ca33b663..6f95af4f7e 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -15,7 +15,6 @@ import (
"go/scanner"
"go/token"
"io/fs"
- "io/ioutil"
"os"
"path"
pathpkg "path"
@@ -1147,7 +1146,7 @@ var (
// goModPath returns the module path in the go.mod in dir, if any.
func goModPath(dir string) (path string) {
return goModPathCache.Do(dir, func() interface{} {
- data, err := ioutil.ReadFile(filepath.Join(dir, "go.mod"))
+ data, err := os.ReadFile(filepath.Join(dir, "go.mod"))
if err != nil {
return ""
}
@@ -1296,9 +1295,9 @@ HaveGoMod:
// Otherwise it is not possible to vendor just a/b/c and still import the
// non-vendored a/b. See golang.org/issue/13832.
func hasGoFiles(dir string) bool {
- fis, _ := ioutil.ReadDir(dir)
- for _, fi := range fis {
- if !fi.IsDir() && strings.HasSuffix(fi.Name(), ".go") {
+ files, _ := os.ReadDir(dir)
+ for _, f := range files {
+ if !f.IsDir() && strings.HasSuffix(f.Name(), ".go") {
return true
}
}
@@ -1728,7 +1727,7 @@ func (p *Package) load(ctx context.Context, path string, stk *ImportStack, impor
// not work for any package that lacks a Target — such as a non-main
// package in module mode. We should probably fix that.
shlibnamefile := p.Target[:len(p.Target)-2] + ".shlibname"
- shlib, err := ioutil.ReadFile(shlibnamefile)
+ shlib, err := os.ReadFile(shlibnamefile)
if err != nil && !os.IsNotExist(err) {
base.Fatalf("reading shlibname: %v", err)
}
@@ -1998,6 +1997,16 @@ func (p *Package) resolveEmbed(patterns []string) (files []string, pmap map[stri
return err
}
rel := filepath.ToSlash(path[len(p.Dir)+1:])
+ name := info.Name()
+ if path != file && (isBadEmbedName(name) || name[0] == '.' || name[0] == '_') {
+ // Ignore bad names, assuming they won't go into modules.
+ // Also avoid hidden files that user may not know about.
+ // See golang.org/issue/42328.
+ if info.IsDir() {
+ return fs.SkipDir
+ }
+ return nil
+ }
if info.IsDir() {
if _, err := fsys.Stat(filepath.Join(path, "go.mod")); err == nil {
return filepath.SkipDir
@@ -2007,10 +2016,6 @@ func (p *Package) resolveEmbed(patterns []string) (files []string, pmap map[stri
if !info.Mode().IsRegular() {
return nil
}
- if isBadEmbedName(info.Name()) {
- // Ignore bad names, assuming they won't go into modules.
- return nil
- }
count++
if have[rel] != pid {
have[rel] = pid
@@ -2050,6 +2055,9 @@ func validEmbedPattern(pattern string) bool {
// as existing for embedding.
func isBadEmbedName(name string) bool {
switch name {
+ // Empty string should be impossible but make it bad.
+ case "":
+ return true
// Version control directories won't be present in module.
case ".bzr", ".hg", ".git", ".svn":
return true
diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go
index 8301fb6b6e..2ac2052b8f 100644
--- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go
+++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go
@@ -9,7 +9,6 @@ package filelock_test
import (
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -51,9 +50,9 @@ func mustTempFile(t *testing.T) (f *os.File, remove func()) {
t.Helper()
base := filepath.Base(t.Name())
- f, err := ioutil.TempFile("", base)
+ f, err := os.CreateTemp("", base)
if err != nil {
- t.Fatalf(`ioutil.TempFile("", %q) = %v`, base, err)
+ t.Fatalf(`os.CreateTemp("", %q) = %v`, base, err)
}
t.Logf("fd %d = %s", f.Fd(), f.Name())
diff --git a/src/cmd/go/internal/lockedfile/lockedfile_test.go b/src/cmd/go/internal/lockedfile/lockedfile_test.go
index 416c69d83b..34327dd841 100644
--- a/src/cmd/go/internal/lockedfile/lockedfile_test.go
+++ b/src/cmd/go/internal/lockedfile/lockedfile_test.go
@@ -10,7 +10,6 @@ package lockedfile_test
import (
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -23,7 +22,7 @@ import (
func mustTempDir(t *testing.T) (dir string, remove func()) {
t.Helper()
- dir, err := ioutil.TempDir("", filepath.Base(t.Name()))
+ dir, err := os.MkdirTemp("", filepath.Base(t.Name()))
if err != nil {
t.Fatal(err)
}
@@ -155,8 +154,8 @@ func TestCanLockExistingFile(t *testing.T) {
defer remove()
path := filepath.Join(dir, "existing.txt")
- if err := ioutil.WriteFile(path, []byte("ok"), 0777); err != nil {
- t.Fatalf("ioutil.WriteFile: %v", err)
+ if err := os.WriteFile(path, []byte("ok"), 0777); err != nil {
+ t.Fatalf("os.WriteFile: %v", err)
}
f, err := lockedfile.Edit(path)
@@ -201,7 +200,7 @@ func TestSpuriousEDEADLK(t *testing.T) {
}
defer b.Close()
- if err := ioutil.WriteFile(filepath.Join(dir, "locked"), []byte("ok"), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(dir, "locked"), []byte("ok"), 0666); err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
index 38c473d36b..1bbb57d353 100644
--- a/src/cmd/go/internal/modcmd/vendor.go
+++ b/src/cmd/go/internal/modcmd/vendor.go
@@ -10,7 +10,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"sort"
@@ -155,7 +154,7 @@ func runVendor(ctx context.Context, cmd *base.Command, args []string) {
base.Fatalf("go mod vendor: %v", err)
}
- if err := ioutil.WriteFile(filepath.Join(vdir, "modules.txt"), buf.Bytes(), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(vdir, "modules.txt"), buf.Bytes(), 0666); err != nil {
base.Fatalf("go mod vendor: %v", err)
}
}
@@ -244,7 +243,7 @@ var metaPrefixes = []string{
}
// matchMetadata reports whether info is a metadata file.
-func matchMetadata(dir string, info fs.FileInfo) bool {
+func matchMetadata(dir string, info fs.DirEntry) bool {
name := info.Name()
for _, p := range metaPrefixes {
if strings.HasPrefix(name, p) {
@@ -255,7 +254,7 @@ func matchMetadata(dir string, info fs.FileInfo) bool {
}
// matchPotentialSourceFile reports whether info may be relevant to a build operation.
-func matchPotentialSourceFile(dir string, info fs.FileInfo) bool {
+func matchPotentialSourceFile(dir string, info fs.DirEntry) bool {
if strings.HasSuffix(info.Name(), "_test.go") {
return false
}
@@ -281,8 +280,8 @@ func matchPotentialSourceFile(dir string, info fs.FileInfo) bool {
}
// copyDir copies all regular files satisfying match(info) from src to dst.
-func copyDir(dst, src string, match func(dir string, info fs.FileInfo) bool) {
- files, err := ioutil.ReadDir(src)
+func copyDir(dst, src string, match func(dir string, info fs.DirEntry) bool) {
+ files, err := os.ReadDir(src)
if err != nil {
base.Fatalf("go mod vendor: %v", err)
}
@@ -290,7 +289,7 @@ func copyDir(dst, src string, match func(dir string, info fs.FileInfo) bool) {
base.Fatalf("go mod vendor: %v", err)
}
for _, file := range files {
- if file.IsDir() || !file.Mode().IsRegular() || !match(src, file) {
+ if file.IsDir() || !file.Type().IsRegular() || !match(src, file) {
continue
}
r, err := os.Open(filepath.Join(src, file.Name()))
diff --git a/src/cmd/go/internal/modcmd/verify.go b/src/cmd/go/internal/modcmd/verify.go
index ce24793929..c83e70076a 100644
--- a/src/cmd/go/internal/modcmd/verify.go
+++ b/src/cmd/go/internal/modcmd/verify.go
@@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"io/fs"
- "io/ioutil"
"os"
"runtime"
@@ -87,7 +86,7 @@ func verifyMod(mod module.Version) []error {
_, zipErr = os.Stat(zip)
}
dir, dirErr := modfetch.DownloadDir(mod)
- data, err := ioutil.ReadFile(zip + "hash")
+ data, err := os.ReadFile(zip + "hash")
if err != nil {
if zipErr != nil && errors.Is(zipErr, fs.ErrNotExist) &&
dirErr != nil && errors.Is(dirErr, fs.ErrNotExist) {
diff --git a/src/cmd/go/internal/modconv/convert_test.go b/src/cmd/go/internal/modconv/convert_test.go
index faa2b4c606..66b9ff4f38 100644
--- a/src/cmd/go/internal/modconv/convert_test.go
+++ b/src/cmd/go/internal/modconv/convert_test.go
@@ -9,7 +9,6 @@ import (
"context"
"fmt"
"internal/testenv"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -37,7 +36,7 @@ func testMain(m *testing.M) int {
return 0
}
- dir, err := ioutil.TempDir("", "modconv-test-")
+ dir, err := os.MkdirTemp("", "modconv-test-")
if err != nil {
log.Fatal(err)
}
@@ -167,7 +166,7 @@ func TestConvertLegacyConfig(t *testing.T) {
for name := range Converters {
file := filepath.Join(dir, name)
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err == nil {
f := new(modfile.File)
f.AddModuleStmt(tt.path)
diff --git a/src/cmd/go/internal/modconv/modconv_test.go b/src/cmd/go/internal/modconv/modconv_test.go
index ccc4f3d576..750525d404 100644
--- a/src/cmd/go/internal/modconv/modconv_test.go
+++ b/src/cmd/go/internal/modconv/modconv_test.go
@@ -7,7 +7,7 @@ package modconv
import (
"bytes"
"fmt"
- "io/ioutil"
+ "os"
"path/filepath"
"testing"
)
@@ -42,7 +42,7 @@ func Test(t *testing.T) {
if Converters[extMap[ext]] == nil {
t.Fatalf("Converters[%q] == nil", extMap[ext])
}
- data, err := ioutil.ReadFile(test)
+ data, err := os.ReadFile(test)
if err != nil {
t.Fatal(err)
}
@@ -50,7 +50,7 @@ func Test(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- want, err := ioutil.ReadFile(test[:len(test)-len(ext)] + ".out")
+ want, err := os.ReadFile(test[:len(test)-len(ext)] + ".out")
if err != nil {
t.Error(err)
}
diff --git a/src/cmd/go/internal/modfetch/cache.go b/src/cmd/go/internal/modfetch/cache.go
index 7572ff24f8..3a2ff63721 100644
--- a/src/cmd/go/internal/modfetch/cache.go
+++ b/src/cmd/go/internal/modfetch/cache.go
@@ -11,7 +11,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -598,7 +597,7 @@ func rewriteVersionList(dir string) {
}
defer unlock()
- infos, err := ioutil.ReadDir(dir)
+ infos, err := os.ReadDir(dir)
if err != nil {
return
}
diff --git a/src/cmd/go/internal/modfetch/cache_test.go b/src/cmd/go/internal/modfetch/cache_test.go
index 241c800e69..722c984e37 100644
--- a/src/cmd/go/internal/modfetch/cache_test.go
+++ b/src/cmd/go/internal/modfetch/cache_test.go
@@ -5,14 +5,13 @@
package modfetch
import (
- "io/ioutil"
"os"
"path/filepath"
"testing"
)
func TestWriteDiskCache(t *testing.T) {
- tmpdir, err := ioutil.TempDir("", "go-writeCache-test-")
+ tmpdir, err := os.MkdirTemp("", "go-writeCache-test-")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/modfetch/codehost/codehost.go b/src/cmd/go/internal/modfetch/codehost/codehost.go
index 286d3f7220..86c1c14d4a 100644
--- a/src/cmd/go/internal/modfetch/codehost/codehost.go
+++ b/src/cmd/go/internal/modfetch/codehost/codehost.go
@@ -12,7 +12,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -189,7 +188,7 @@ func WorkDir(typ, name string) (dir, lockfile string, err error) {
}
defer unlock()
- data, err := ioutil.ReadFile(dir + ".info")
+ data, err := os.ReadFile(dir + ".info")
info, err2 := os.Stat(dir)
if err == nil && err2 == nil && info.IsDir() {
// Info file and directory both already exist: reuse.
@@ -211,7 +210,7 @@ func WorkDir(typ, name string) (dir, lockfile string, err error) {
if err := os.MkdirAll(dir, 0777); err != nil {
return "", "", err
}
- if err := ioutil.WriteFile(dir+".info", []byte(key), 0666); err != nil {
+ if err := os.WriteFile(dir+".info", []byte(key), 0666); err != nil {
os.RemoveAll(dir)
return "", "", err
}
diff --git a/src/cmd/go/internal/modfetch/codehost/git_test.go b/src/cmd/go/internal/modfetch/codehost/git_test.go
index 981e3fe91f..89a73baad9 100644
--- a/src/cmd/go/internal/modfetch/codehost/git_test.go
+++ b/src/cmd/go/internal/modfetch/codehost/git_test.go
@@ -12,7 +12,6 @@ import (
"internal/testenv"
"io"
"io/fs"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -54,7 +53,7 @@ func testMain(m *testing.M) int {
return 0
}
- dir, err := ioutil.TempDir("", "gitrepo-test-")
+ dir, err := os.MkdirTemp("", "gitrepo-test-")
if err != nil {
log.Fatal(err)
}
diff --git a/src/cmd/go/internal/modfetch/codehost/shell.go b/src/cmd/go/internal/modfetch/codehost/shell.go
index b9525adf5e..ce8b501d53 100644
--- a/src/cmd/go/internal/modfetch/codehost/shell.go
+++ b/src/cmd/go/internal/modfetch/codehost/shell.go
@@ -15,7 +15,6 @@ import (
"flag"
"fmt"
"io"
- "io/ioutil"
"log"
"os"
"strings"
@@ -124,7 +123,7 @@ func main() {
}
if f[3] != "-" {
- if err := ioutil.WriteFile(f[3], data, 0666); err != nil {
+ if err := os.WriteFile(f[3], data, 0666); err != nil {
fmt.Fprintf(os.Stderr, "?%s\n", err)
continue
}
diff --git a/src/cmd/go/internal/modfetch/codehost/vcs.go b/src/cmd/go/internal/modfetch/codehost/vcs.go
index e67ee94ad8..c2cca084e3 100644
--- a/src/cmd/go/internal/modfetch/codehost/vcs.go
+++ b/src/cmd/go/internal/modfetch/codehost/vcs.go
@@ -10,7 +10,6 @@ import (
"internal/lazyregexp"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"sort"
@@ -433,7 +432,7 @@ func (r *vcsRepo) ReadZip(rev, subdir string, maxSize int64) (zip io.ReadCloser,
if rev == "latest" {
rev = r.cmd.latest
}
- f, err := ioutil.TempFile("", "go-readzip-*.zip")
+ f, err := os.CreateTemp("", "go-readzip-*.zip")
if err != nil {
return nil, err
}
diff --git a/src/cmd/go/internal/modfetch/coderepo.go b/src/cmd/go/internal/modfetch/coderepo.go
index b6bcf83f1a..2dcbb99b18 100644
--- a/src/cmd/go/internal/modfetch/coderepo.go
+++ b/src/cmd/go/internal/modfetch/coderepo.go
@@ -11,7 +11,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"os"
"path"
"sort"
@@ -966,7 +965,7 @@ func (r *codeRepo) Zip(dst io.Writer, version string) error {
subdir = strings.Trim(subdir, "/")
// Spool to local file.
- f, err := ioutil.TempFile("", "go-codehost-")
+ f, err := os.CreateTemp("", "go-codehost-")
if err != nil {
dl.Close()
return err
diff --git a/src/cmd/go/internal/modfetch/coderepo_test.go b/src/cmd/go/internal/modfetch/coderepo_test.go
index 53b048dbdf..02e399f352 100644
--- a/src/cmd/go/internal/modfetch/coderepo_test.go
+++ b/src/cmd/go/internal/modfetch/coderepo_test.go
@@ -11,7 +11,6 @@ import (
"hash"
"internal/testenv"
"io"
- "io/ioutil"
"log"
"os"
"reflect"
@@ -38,7 +37,7 @@ func testMain(m *testing.M) int {
// code, bypass the sum database.
cfg.GOSUMDB = "off"
- dir, err := ioutil.TempDir("", "gitrepo-test-")
+ dir, err := os.MkdirTemp("", "gitrepo-test-")
if err != nil {
log.Fatal(err)
}
@@ -424,7 +423,7 @@ var codeRepoTests = []codeRepoTest{
func TestCodeRepo(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- tmpdir, err := ioutil.TempDir("", "modfetch-test-")
+ tmpdir, err := os.MkdirTemp("", "modfetch-test-")
if err != nil {
t.Fatal(err)
}
@@ -491,9 +490,9 @@ func TestCodeRepo(t *testing.T) {
needHash := !testing.Short() && (tt.zipFileHash != "" || tt.zipSum != "")
if tt.zip != nil || tt.zipErr != "" || needHash {
- f, err := ioutil.TempFile(tmpdir, tt.version+".zip.")
+ f, err := os.CreateTemp(tmpdir, tt.version+".zip.")
if err != nil {
- t.Fatalf("ioutil.TempFile: %v", err)
+ t.Fatalf("os.CreateTemp: %v", err)
}
zipfile := f.Name()
defer func() {
@@ -655,7 +654,7 @@ var codeRepoVersionsTests = []struct {
func TestCodeRepoVersions(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- tmpdir, err := ioutil.TempDir("", "vgo-modfetch-test-")
+ tmpdir, err := os.MkdirTemp("", "vgo-modfetch-test-")
if err != nil {
t.Fatal(err)
}
@@ -729,7 +728,7 @@ var latestTests = []struct {
func TestLatest(t *testing.T) {
testenv.MustHaveExternalNetwork(t)
- tmpdir, err := ioutil.TempDir("", "vgo-modfetch-test-")
+ tmpdir, err := os.MkdirTemp("", "vgo-modfetch-test-")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go
index 2ee78de5b2..debeb3f319 100644
--- a/src/cmd/go/internal/modfetch/fetch.go
+++ b/src/cmd/go/internal/modfetch/fetch.go
@@ -12,7 +12,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"sort"
@@ -136,7 +135,7 @@ func download(ctx context.Context, mod module.Version) (dir string, err error) {
if err := os.MkdirAll(parentDir, 0777); err != nil {
return "", err
}
- if err := ioutil.WriteFile(partialPath, nil, 0666); err != nil {
+ if err := os.WriteFile(partialPath, nil, 0666); err != nil {
return "", err
}
if err := modzip.Unzip(dir, mod, zipfile); err != nil {
@@ -223,7 +222,7 @@ func downloadZip(ctx context.Context, mod module.Version, zipfile string) (err e
// contents of the file (by hashing it) before we commit it. Because the file
// is zip-compressed, we need an actual file — or at least an io.ReaderAt — to
// validate it: we can't just tee the stream as we write it.
- f, err := ioutil.TempFile(filepath.Dir(zipfile), filepath.Base(renameio.Pattern(zipfile)))
+ f, err := os.CreateTemp(filepath.Dir(zipfile), filepath.Base(renameio.Pattern(zipfile)))
if err != nil {
return err
}
diff --git a/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go b/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go
index 82398ebfed..d9ba8ef2da 100644
--- a/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go
+++ b/src/cmd/go/internal/modfetch/zip_sum_test/zip_sum_test.go
@@ -24,7 +24,6 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -81,7 +80,7 @@ func TestZipSums(t *testing.T) {
if *modCacheDir != "" {
cfg.BuildContext.GOPATH = *modCacheDir
} else {
- tmpDir, err := ioutil.TempDir("", "TestZipSums")
+ tmpDir, err := os.MkdirTemp("", "TestZipSums")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go
index 1c31a5f90a..3f70d04145 100644
--- a/src/cmd/go/internal/modload/init.go
+++ b/src/cmd/go/internal/modload/init.go
@@ -12,7 +12,6 @@ import (
"fmt"
"go/build"
"internal/lazyregexp"
- "io/ioutil"
"os"
"path"
"path/filepath"
@@ -445,13 +444,13 @@ func CreateModFile(ctx context.Context, modPath string) {
// this is an existing project. Walking the tree for packages would be more
// accurate, but could take much longer.
empty := true
- fis, _ := ioutil.ReadDir(modRoot)
- for _, fi := range fis {
- name := fi.Name()
+ files, _ := os.ReadDir(modRoot)
+ for _, f := range files {
+ name := f.Name()
if strings.HasPrefix(name, ".") || strings.HasPrefix(name, "_") {
continue
}
- if strings.HasSuffix(name, ".go") || fi.IsDir() {
+ if strings.HasSuffix(name, ".go") || f.IsDir() {
empty = false
break
}
@@ -632,7 +631,7 @@ func setDefaultBuildMod() {
func convertLegacyConfig(modPath string) (from string, err error) {
for _, name := range altConfigs {
cfg := filepath.Join(modRoot, name)
- data, err := ioutil.ReadFile(cfg)
+ data, err := os.ReadFile(cfg)
if err == nil {
convert := modconv.Converters[name]
if convert == nil {
@@ -731,9 +730,9 @@ func findModulePath(dir string) (string, error) {
// Cast about for import comments,
// first in top-level directory, then in subdirectories.
- list, _ := ioutil.ReadDir(dir)
+ list, _ := os.ReadDir(dir)
for _, info := range list {
- if info.Mode().IsRegular() && strings.HasSuffix(info.Name(), ".go") {
+ if info.Type().IsRegular() && strings.HasSuffix(info.Name(), ".go") {
if com := findImportComment(filepath.Join(dir, info.Name())); com != "" {
return com, nil
}
@@ -741,9 +740,9 @@ func findModulePath(dir string) (string, error) {
}
for _, info1 := range list {
if info1.IsDir() {
- files, _ := ioutil.ReadDir(filepath.Join(dir, info1.Name()))
+ files, _ := os.ReadDir(filepath.Join(dir, info1.Name()))
for _, info2 := range files {
- if info2.Mode().IsRegular() && strings.HasSuffix(info2.Name(), ".go") {
+ if info2.Type().IsRegular() && strings.HasSuffix(info2.Name(), ".go") {
if com := findImportComment(filepath.Join(dir, info1.Name(), info2.Name())); com != "" {
return path.Dir(com), nil
}
@@ -753,7 +752,7 @@ func findModulePath(dir string) (string, error) {
}
// Look for Godeps.json declaring import path.
- data, _ := ioutil.ReadFile(filepath.Join(dir, "Godeps/Godeps.json"))
+ data, _ := os.ReadFile(filepath.Join(dir, "Godeps/Godeps.json"))
var cfg1 struct{ ImportPath string }
json.Unmarshal(data, &cfg1)
if cfg1.ImportPath != "" {
@@ -761,7 +760,7 @@ func findModulePath(dir string) (string, error) {
}
// Look for vendor.json declaring import path.
- data, _ = ioutil.ReadFile(filepath.Join(dir, "vendor/vendor.json"))
+ data, _ = os.ReadFile(filepath.Join(dir, "vendor/vendor.json"))
var cfg2 struct{ RootPath string }
json.Unmarshal(data, &cfg2)
if cfg2.RootPath != "" {
@@ -813,7 +812,7 @@ var (
)
func findImportComment(file string) string {
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err != nil {
return ""
}
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index 732c4af92b..a0f93d028a 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -61,8 +61,8 @@ package modload
// Similarly, if the LoadTests flag is set but the "all" pattern does not close
// over test dependencies, then when we load the test of a package that is in
// "all" but outside the main module, the dependencies of that test will not
-// necessarily themselves be in "all". That configuration does not arise in Go
-// 1.11–1.15, but it will be possible with lazy loading in Go 1.16+.
+// necessarily themselves be in "all". (That configuration does not arise in Go
+// 1.11–1.15, but it will be possible in Go 1.16+.)
//
// Loading proceeds from the roots, using a parallel work-queue with a limit on
// the amount of active work (to avoid saturating disks, CPU cores, and/or
@@ -158,8 +158,8 @@ type PackageOpts struct {
// UseVendorAll causes the "all" package pattern to be interpreted as if
// running "go mod vendor" (or building with "-mod=vendor").
//
- // Once lazy loading is implemented, this will be a no-op for modules that
- // declare 'go 1.16' or higher.
+ // This is a no-op for modules that declare 'go 1.16' or higher, for which this
+ // is the default (and only) interpretation of the "all" pattern in module mode.
UseVendorAll bool
// AllowErrors indicates that LoadPackages should not terminate the process if
diff --git a/src/cmd/go/internal/modload/modfile.go b/src/cmd/go/internal/modload/modfile.go
index ede07be4bf..eb05e9f9c9 100644
--- a/src/cmd/go/internal/modload/modfile.go
+++ b/src/cmd/go/internal/modload/modfile.go
@@ -25,10 +25,11 @@ import (
"golang.org/x/mod/semver"
)
-// lazyLoadingVersion is the Go version (plus leading "v") at which lazy module
-// loading takes effect.
-const lazyLoadingVersionV = "v1.16"
-const go116EnableLazyLoading = true
+// narrowAllVersionV is the Go version (plus leading "v") at which the
+// module-module "all" pattern no longer closes over the dependencies of
+// tests outside of the main module.
+const narrowAllVersionV = "v1.16"
+const go116EnableNarrowAll = true
var modFile *modfile.File
@@ -296,10 +297,10 @@ func indexModFile(data []byte, modFile *modfile.File, needsFix bool) *modFileInd
// (Otherwise — as in Go 1.16+ — the "all" pattern includes only the packages
// transitively *imported by* the packages and tests in the main module.)
func (i *modFileIndex) allPatternClosesOverTests() bool {
- if !go116EnableLazyLoading {
+ if !go116EnableNarrowAll {
return true
}
- if i != nil && semver.Compare(i.goVersionV, lazyLoadingVersionV) < 0 {
+ if i != nil && semver.Compare(i.goVersionV, narrowAllVersionV) < 0 {
// The module explicitly predates the change in "all" for lazy loading, so
// continue to use the older interpretation. (If i == nil, we not in any
// module at all and should use the latest semantics.)
diff --git a/src/cmd/go/internal/modload/query_test.go b/src/cmd/go/internal/modload/query_test.go
index 777a56b977..e225a0e71e 100644
--- a/src/cmd/go/internal/modload/query_test.go
+++ b/src/cmd/go/internal/modload/query_test.go
@@ -7,7 +7,6 @@ package modload
import (
"context"
"internal/testenv"
- "io/ioutil"
"log"
"os"
"path"
@@ -27,7 +26,7 @@ func TestMain(m *testing.M) {
func testMain(m *testing.M) int {
cfg.GOPROXY = "direct"
- dir, err := ioutil.TempDir("", "modload-test-")
+ dir, err := os.MkdirTemp("", "modload-test-")
if err != nil {
log.Fatal(err)
}
diff --git a/src/cmd/go/internal/modload/vendor.go b/src/cmd/go/internal/modload/vendor.go
index ab29d4d014..80d49053c6 100644
--- a/src/cmd/go/internal/modload/vendor.go
+++ b/src/cmd/go/internal/modload/vendor.go
@@ -8,7 +8,7 @@ import (
"errors"
"fmt"
"io/fs"
- "io/ioutil"
+ "os"
"path/filepath"
"strings"
"sync"
@@ -40,7 +40,7 @@ func readVendorList() {
vendorPkgModule = make(map[string]module.Version)
vendorVersion = make(map[string]string)
vendorMeta = make(map[module.Version]vendorMetadata)
- data, err := ioutil.ReadFile(filepath.Join(ModRoot(), "vendor/modules.txt"))
+ data, err := os.ReadFile(filepath.Join(ModRoot(), "vendor/modules.txt"))
if err != nil {
if !errors.Is(err, fs.ErrNotExist) {
base.Fatalf("go: %s", err)
diff --git a/src/cmd/go/internal/renameio/renameio.go b/src/cmd/go/internal/renameio/renameio.go
index 60a7138a76..9788171d6e 100644
--- a/src/cmd/go/internal/renameio/renameio.go
+++ b/src/cmd/go/internal/renameio/renameio.go
@@ -25,7 +25,7 @@ func Pattern(filename string) string {
return filepath.Join(filepath.Dir(filename), filepath.Base(filename)+patternSuffix)
}
-// WriteFile is like ioutil.WriteFile, but first writes data to an arbitrary
+// WriteFile is like os.WriteFile, but first writes data to an arbitrary
// file in the same directory as filename, then renames it atomically to the
// final name.
//
@@ -67,7 +67,7 @@ func WriteToFile(filename string, data io.Reader, perm fs.FileMode) (err error)
return robustio.Rename(f.Name(), filename)
}
-// ReadFile is like ioutil.ReadFile, but on Windows retries spurious errors that
+// ReadFile is like os.ReadFile, but on Windows retries spurious errors that
// may occur if the file is concurrently replaced.
//
// Errors are classified heuristically and retries are bounded, so even this
diff --git a/src/cmd/go/internal/renameio/renameio_test.go b/src/cmd/go/internal/renameio/renameio_test.go
index e6d2025a0e..5b2ed83624 100644
--- a/src/cmd/go/internal/renameio/renameio_test.go
+++ b/src/cmd/go/internal/renameio/renameio_test.go
@@ -10,7 +10,6 @@ import (
"encoding/binary"
"errors"
"internal/testenv"
- "io/ioutil"
"math/rand"
"os"
"path/filepath"
@@ -30,7 +29,7 @@ func TestConcurrentReadsAndWrites(t *testing.T) {
testenv.SkipFlaky(t, 33041)
}
- dir, err := ioutil.TempDir("", "renameio")
+ dir, err := os.MkdirTemp("", "renameio")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/renameio/umask_test.go b/src/cmd/go/internal/renameio/umask_test.go
index 19e217c548..65e4fa587b 100644
--- a/src/cmd/go/internal/renameio/umask_test.go
+++ b/src/cmd/go/internal/renameio/umask_test.go
@@ -8,7 +8,6 @@ package renameio
import (
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"syscall"
@@ -16,7 +15,7 @@ import (
)
func TestWriteFileModeAppliesUmask(t *testing.T) {
- dir, err := ioutil.TempDir("", "renameio")
+ dir, err := os.MkdirTemp("", "renameio")
if err != nil {
t.Fatalf("Failed to create temporary directory: %v", err)
}
diff --git a/src/cmd/go/internal/robustio/robustio.go b/src/cmd/go/internal/robustio/robustio.go
index 76e47ad1ff..ce3dbbde6d 100644
--- a/src/cmd/go/internal/robustio/robustio.go
+++ b/src/cmd/go/internal/robustio/robustio.go
@@ -22,7 +22,7 @@ func Rename(oldpath, newpath string) error {
return rename(oldpath, newpath)
}
-// ReadFile is like ioutil.ReadFile, but on Windows retries errors that may
+// ReadFile is like os.ReadFile, but on Windows retries errors that may
// occur if the file is concurrently replaced.
//
// (See golang.org/issue/31247 and golang.org/issue/32188.)
diff --git a/src/cmd/go/internal/robustio/robustio_flaky.go b/src/cmd/go/internal/robustio/robustio_flaky.go
index d4cb7e6457..5bd44bd345 100644
--- a/src/cmd/go/internal/robustio/robustio_flaky.go
+++ b/src/cmd/go/internal/robustio/robustio_flaky.go
@@ -8,7 +8,6 @@ package robustio
import (
"errors"
- "io/ioutil"
"math/rand"
"os"
"syscall"
@@ -70,11 +69,11 @@ func rename(oldpath, newpath string) (err error) {
})
}
-// readFile is like ioutil.ReadFile, but retries ephemeral errors.
+// readFile is like os.ReadFile, but retries ephemeral errors.
func readFile(filename string) ([]byte, error) {
var b []byte
err := retry(func() (err error, mayRetry bool) {
- b, err = ioutil.ReadFile(filename)
+ b, err = os.ReadFile(filename)
// Unlike in rename, we do not retry errFileNotFound here: it can occur
// as a spurious error, but the file may also genuinely not exist, so the
diff --git a/src/cmd/go/internal/robustio/robustio_other.go b/src/cmd/go/internal/robustio/robustio_other.go
index 907b556858..6fe7b7e4e4 100644
--- a/src/cmd/go/internal/robustio/robustio_other.go
+++ b/src/cmd/go/internal/robustio/robustio_other.go
@@ -7,7 +7,6 @@
package robustio
import (
- "io/ioutil"
"os"
)
@@ -16,7 +15,7 @@ func rename(oldpath, newpath string) error {
}
func readFile(filename string) ([]byte, error) {
- return ioutil.ReadFile(filename)
+ return os.ReadFile(filename)
}
func removeAll(path string) error {
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index 24601dc061..e8a7aacb85 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -13,7 +13,6 @@ import (
"go/build"
"io"
"io/fs"
- "io/ioutil"
"os"
"os/exec"
"path"
@@ -884,7 +883,7 @@ func builderTest(b *work.Builder, ctx context.Context, p *load.Package) (buildAc
if !cfg.BuildN {
// writeTestmain writes _testmain.go,
// using the test description gathered in t.
- if err := ioutil.WriteFile(testDir+"_testmain.go", *pmain.Internal.TestmainGo, 0666); err != nil {
+ if err := os.WriteFile(testDir+"_testmain.go", *pmain.Internal.TestmainGo, 0666); err != nil {
return nil, nil, nil, err
}
}
@@ -1561,13 +1560,18 @@ func hashOpen(name string) (cache.ActionID, error) {
}
hashWriteStat(h, info)
if info.IsDir() {
- names, err := ioutil.ReadDir(name)
+ files, err := os.ReadDir(name)
if err != nil {
fmt.Fprintf(h, "err %v\n", err)
}
- for _, f := range names {
+ for _, f := range files {
fmt.Fprintf(h, "file %s ", f.Name())
- hashWriteStat(h, f)
+ finfo, err := f.Info()
+ if err != nil {
+ fmt.Fprintf(h, "err %v\n", err)
+ } else {
+ hashWriteStat(h, finfo)
+ }
}
} else if info.Mode().IsRegular() {
// Because files might be very large, do not attempt
@@ -1616,7 +1620,7 @@ func (c *runCache) saveOutput(a *work.Action) {
}
// See comment about two-level lookup in tryCacheWithID above.
- testlog, err := ioutil.ReadFile(a.Objdir + "testlog.txt")
+ testlog, err := os.ReadFile(a.Objdir + "testlog.txt")
if err != nil || !bytes.HasPrefix(testlog, testlogMagic) || testlog[len(testlog)-1] != '\n' {
if cache.DebugTest {
if err != nil {
diff --git a/src/cmd/go/internal/txtar/archive.go b/src/cmd/go/internal/txtar/archive.go
index c384f33bdf..1796684877 100644
--- a/src/cmd/go/internal/txtar/archive.go
+++ b/src/cmd/go/internal/txtar/archive.go
@@ -34,7 +34,7 @@ package txtar
import (
"bytes"
"fmt"
- "io/ioutil"
+ "os"
"strings"
)
@@ -66,7 +66,7 @@ func Format(a *Archive) []byte {
// ParseFile parses the named file as an archive.
func ParseFile(file string) (*Archive, error) {
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err != nil {
return nil, err
}
diff --git a/src/cmd/go/internal/vcs/vcs_test.go b/src/cmd/go/internal/vcs/vcs_test.go
index 72d74a01e3..c5c7a3283b 100644
--- a/src/cmd/go/internal/vcs/vcs_test.go
+++ b/src/cmd/go/internal/vcs/vcs_test.go
@@ -7,7 +7,6 @@ package vcs
import (
"errors"
"internal/testenv"
- "io/ioutil"
"os"
"path"
"path/filepath"
@@ -208,7 +207,7 @@ func TestRepoRootForImportPath(t *testing.T) {
// Test that vcsFromDir correctly inspects a given directory and returns the right VCS and root.
func TestFromDir(t *testing.T) {
- tempDir, err := ioutil.TempDir("", "vcstest")
+ tempDir, err := os.MkdirTemp("", "vcstest")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/web/file_test.go b/src/cmd/go/internal/web/file_test.go
index a1bb080e07..3734df5c4e 100644
--- a/src/cmd/go/internal/web/file_test.go
+++ b/src/cmd/go/internal/web/file_test.go
@@ -7,7 +7,6 @@ package web
import (
"errors"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"testing"
@@ -16,7 +15,7 @@ import (
func TestGetFileURL(t *testing.T) {
const content = "Hello, file!\n"
- f, err := ioutil.TempFile("", "web-TestGetFileURL")
+ f, err := os.CreateTemp("", "web-TestGetFileURL")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go
index f461c5780f..9d141ae233 100644
--- a/src/cmd/go/internal/work/action.go
+++ b/src/cmd/go/internal/work/action.go
@@ -14,7 +14,6 @@ import (
"debug/elf"
"encoding/json"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -253,7 +252,7 @@ func (b *Builder) Init() {
if cfg.BuildN {
b.WorkDir = "$WORK"
} else {
- tmp, err := ioutil.TempDir(cfg.Getenv("GOTMPDIR"), "go-build")
+ tmp, err := os.MkdirTemp(cfg.Getenv("GOTMPDIR"), "go-build")
if err != nil {
base.Fatalf("go: creating work dir: %v", err)
}
diff --git a/src/cmd/go/internal/work/build_test.go b/src/cmd/go/internal/work/build_test.go
index e941729734..eaf2639e9e 100644
--- a/src/cmd/go/internal/work/build_test.go
+++ b/src/cmd/go/internal/work/build_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"fmt"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -170,7 +169,7 @@ func TestSharedLibName(t *testing.T) {
for _, data := range testData {
func() {
if data.rootedAt != "" {
- tmpGopath, err := ioutil.TempDir("", "gopath")
+ tmpGopath, err := os.MkdirTemp("", "gopath")
if err != nil {
t.Fatal(err)
}
@@ -238,7 +237,7 @@ func TestRespectSetgidDir(t *testing.T) {
return cmdBuf.WriteString(fmt.Sprint(a...))
}
- setgiddir, err := ioutil.TempDir("", "SetGroupID")
+ setgiddir, err := os.MkdirTemp("", "SetGroupID")
if err != nil {
t.Fatal(err)
}
@@ -258,9 +257,9 @@ func TestRespectSetgidDir(t *testing.T) {
t.Fatal(err)
}
- pkgfile, err := ioutil.TempFile("", "pkgfile")
+ pkgfile, err := os.CreateTemp("", "pkgfile")
if err != nil {
- t.Fatalf("ioutil.TempFile(\"\", \"pkgfile\"): %v", err)
+ t.Fatalf("os.CreateTemp(\"\", \"pkgfile\"): %v", err)
}
defer os.Remove(pkgfile.Name())
defer pkgfile.Close()
diff --git a/src/cmd/go/internal/work/buildid.go b/src/cmd/go/internal/work/buildid.go
index 3c7be5a3e3..d76988145b 100644
--- a/src/cmd/go/internal/work/buildid.go
+++ b/src/cmd/go/internal/work/buildid.go
@@ -7,7 +7,6 @@ package work
import (
"bytes"
"fmt"
- "io/ioutil"
"os"
"os/exec"
"strings"
@@ -344,7 +343,7 @@ func (b *Builder) gccgoBuildIDFile(a *Action) (string, error) {
}
}
- if err := ioutil.WriteFile(sfile, buf.Bytes(), 0666); err != nil {
+ if err := os.WriteFile(sfile, buf.Bytes(), 0666); err != nil {
return "", err
}
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
index 6ce56dd6f4..336751df27 100644
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
@@ -16,7 +16,6 @@ import (
"internal/lazyregexp"
"io"
"io/fs"
- "io/ioutil"
"log"
"math/rand"
"os"
@@ -94,7 +93,7 @@ func (b *Builder) Do(ctx context.Context, root *Action) {
base.Fatalf("go: refusing to write action graph to %v\n", file)
}
js := actionGraphJSON(root)
- if err := ioutil.WriteFile(file, []byte(js), 0666); err != nil {
+ if err := os.WriteFile(file, []byte(js), 0666); err != nil {
fmt.Fprintf(os.Stderr, "go: writing action graph: %v\n", err)
base.SetExitStatus(1)
}
@@ -636,7 +635,7 @@ OverlayLoop:
sfiles, gccfiles = filter(sfiles, sfiles[:0], gccfiles)
} else {
for _, sfile := range sfiles {
- data, err := ioutil.ReadFile(filepath.Join(a.Package.Dir, sfile))
+ data, err := os.ReadFile(filepath.Join(a.Package.Dir, sfile))
if err == nil {
if bytes.HasPrefix(data, []byte("TEXT")) || bytes.Contains(data, []byte("\nTEXT")) ||
bytes.HasPrefix(data, []byte("DATA")) || bytes.Contains(data, []byte("\nDATA")) ||
@@ -1471,7 +1470,7 @@ func (b *Builder) installShlibname(ctx context.Context, a *Action) error {
// TODO: BuildN
a1 := a.Deps[0]
- err := ioutil.WriteFile(a.Target, []byte(filepath.Base(a1.Target)+"\n"), 0666)
+ err := os.WriteFile(a.Target, []byte(filepath.Base(a1.Target)+"\n"), 0666)
if err != nil {
return err
}
@@ -1788,7 +1787,7 @@ func (b *Builder) writeFile(file string, text []byte) error {
if cfg.BuildN {
return nil
}
- return ioutil.WriteFile(file, text, 0666)
+ return os.WriteFile(file, text, 0666)
}
// Install the cgo export header file, if there is one.
@@ -2537,7 +2536,7 @@ func (b *Builder) gccSupportsFlag(compiler []string, flag string) bool {
tmp := os.DevNull
if runtime.GOOS == "windows" {
- f, err := ioutil.TempFile(b.WorkDir, "")
+ f, err := os.CreateTemp(b.WorkDir, "")
if err != nil {
return false
}
@@ -2840,7 +2839,7 @@ func (b *Builder) cgo(a *Action, cgoExe, objdir string, pcCFLAGS, pcLDFLAGS, cgo
continue
}
- src, err := ioutil.ReadFile(f)
+ src, err := os.ReadFile(f)
if err != nil {
return nil, nil, err
}
@@ -3070,7 +3069,7 @@ func (b *Builder) swigDoIntSize(objdir string) (intsize string, err error) {
return "$INTBITS", nil
}
src := filepath.Join(b.WorkDir, "swig_intsize.go")
- if err = ioutil.WriteFile(src, []byte(swigIntSizeCode), 0666); err != nil {
+ if err = os.WriteFile(src, []byte(swigIntSizeCode), 0666); err != nil {
return
}
srcs := []string{src}
@@ -3230,7 +3229,7 @@ func passLongArgsInResponseFiles(cmd *exec.Cmd) (cleanup func()) {
return
}
- tf, err := ioutil.TempFile("", "args")
+ tf, err := os.CreateTemp("", "args")
if err != nil {
log.Fatalf("error writing long arguments to response file: %v", err)
}
diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go
index 3a53c714e3..cc4e2b2b2b 100644
--- a/src/cmd/go/internal/work/gc.go
+++ b/src/cmd/go/internal/work/gc.go
@@ -9,7 +9,6 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"log"
"os"
"path/filepath"
@@ -426,11 +425,11 @@ func toolVerify(a *Action, b *Builder, p *load.Package, newTool string, ofile st
if err := b.run(a, p.Dir, p.ImportPath, nil, newArgs...); err != nil {
return err
}
- data1, err := ioutil.ReadFile(ofile)
+ data1, err := os.ReadFile(ofile)
if err != nil {
return err
}
- data2, err := ioutil.ReadFile(ofile + ".new")
+ data2, err := os.ReadFile(ofile + ".new")
if err != nil {
return err
}
@@ -580,7 +579,7 @@ func pluginPath(a *Action) string {
}
fmt.Fprintf(h, "build ID: %s\n", buildID)
for _, file := range str.StringList(p.GoFiles, p.CgoFiles, p.SFiles) {
- data, err := ioutil.ReadFile(filepath.Join(p.Dir, file))
+ data, err := os.ReadFile(filepath.Join(p.Dir, file))
if err != nil {
base.Fatalf("go: %s", err)
}
diff --git a/src/cmd/go/internal/work/gccgo.go b/src/cmd/go/internal/work/gccgo.go
index 01d2b89159..3ffd01c473 100644
--- a/src/cmd/go/internal/work/gccgo.go
+++ b/src/cmd/go/internal/work/gccgo.go
@@ -6,7 +6,6 @@ package work
import (
"fmt"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -271,7 +270,7 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
}
readCgoFlags := func(flagsFile string) error {
- flags, err := ioutil.ReadFile(flagsFile)
+ flags, err := os.ReadFile(flagsFile)
if err != nil {
return err
}
diff --git a/src/cmd/go/proxy_test.go b/src/cmd/go/proxy_test.go
index 3ed42face2..e390c73a9c 100644
--- a/src/cmd/go/proxy_test.go
+++ b/src/cmd/go/proxy_test.go
@@ -13,7 +13,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"log"
"net"
"net/http"
@@ -75,12 +74,12 @@ func StartProxy() {
var modList []module.Version
func readModList() {
- infos, err := ioutil.ReadDir("testdata/mod")
+ files, err := os.ReadDir("testdata/mod")
if err != nil {
log.Fatal(err)
}
- for _, info := range infos {
- name := info.Name()
+ for _, f := range files {
+ name := f.Name()
if !strings.HasSuffix(name, ".txt") {
continue
}
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index aee3742f13..dfaa40548e 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -15,7 +15,6 @@ import (
"go/build"
"internal/testenv"
"io/fs"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -220,7 +219,7 @@ func (ts *testScript) run() {
for _, f := range a.Files {
name := ts.mkabs(ts.expand(f.Name, false))
ts.check(os.MkdirAll(filepath.Dir(name), 0777))
- ts.check(ioutil.WriteFile(name, f.Data, 0666))
+ ts.check(os.WriteFile(name, f.Data, 0666))
}
// With -v or -testwork, start log with full environment.
@@ -377,19 +376,19 @@ var (
func isCaseSensitive(t *testing.T) bool {
onceCaseSensitive.Do(func() {
- tmpdir, err := ioutil.TempDir("", "case-sensitive")
+ tmpdir, err := os.MkdirTemp("", "case-sensitive")
if err != nil {
t.Fatal("failed to create directory to determine case-sensitivity:", err)
}
defer os.RemoveAll(tmpdir)
fcap := filepath.Join(tmpdir, "FILE")
- if err := ioutil.WriteFile(fcap, []byte{}, 0644); err != nil {
+ if err := os.WriteFile(fcap, []byte{}, 0644); err != nil {
t.Fatal("error writing file to determine case-sensitivity:", err)
}
flow := filepath.Join(tmpdir, "file")
- _, err = ioutil.ReadFile(flow)
+ _, err = os.ReadFile(flow)
switch {
case err == nil:
caseSensitive = false
@@ -450,9 +449,9 @@ func (ts *testScript) cmdAddcrlf(want simpleStatus, args []string) {
for _, file := range args {
file = ts.mkabs(file)
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
ts.check(err)
- ts.check(ioutil.WriteFile(file, bytes.ReplaceAll(data, []byte("\n"), []byte("\r\n")), 0666))
+ ts.check(os.WriteFile(file, bytes.ReplaceAll(data, []byte("\n"), []byte("\r\n")), 0666))
}
}
@@ -557,12 +556,12 @@ func (ts *testScript) doCmdCmp(args []string, env, quiet bool) {
} else if name1 == "stderr" {
text1 = ts.stderr
} else {
- data, err := ioutil.ReadFile(ts.mkabs(name1))
+ data, err := os.ReadFile(ts.mkabs(name1))
ts.check(err)
text1 = string(data)
}
- data, err := ioutil.ReadFile(ts.mkabs(name2))
+ data, err := os.ReadFile(ts.mkabs(name2))
ts.check(err)
text2 = string(data)
@@ -614,14 +613,14 @@ func (ts *testScript) cmdCp(want simpleStatus, args []string) {
info, err := os.Stat(src)
ts.check(err)
mode = info.Mode() & 0777
- data, err = ioutil.ReadFile(src)
+ data, err = os.ReadFile(src)
ts.check(err)
}
targ := dst
if dstDir {
targ = filepath.Join(dst, filepath.Base(src))
}
- err := ioutil.WriteFile(targ, data, mode)
+ err := os.WriteFile(targ, data, mode)
switch want {
case failure:
if err == nil {
@@ -897,7 +896,7 @@ func scriptMatch(ts *testScript, want simpleStatus, args []string, text, name st
isGrep := name == "grep"
if isGrep {
name = args[1] // for error messages
- data, err := ioutil.ReadFile(ts.mkabs(args[1]))
+ data, err := os.ReadFile(ts.mkabs(args[1]))
ts.check(err)
text = string(data)
}
diff --git a/src/cmd/go/testdata/addmod.go b/src/cmd/go/testdata/addmod.go
index 71ac47fdc1..58376b7ed4 100644
--- a/src/cmd/go/testdata/addmod.go
+++ b/src/cmd/go/testdata/addmod.go
@@ -23,7 +23,6 @@ import (
"flag"
"fmt"
"io/fs"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -58,7 +57,7 @@ func main() {
log.SetFlags(0)
var err error
- tmpdir, err = ioutil.TempDir("", "addmod-")
+ tmpdir, err = os.MkdirTemp("", "addmod-")
if err != nil {
log.Fatal(err)
}
@@ -82,7 +81,7 @@ func main() {
exitCode := 0
for _, arg := range flag.Args() {
- if err := ioutil.WriteFile(filepath.Join(tmpdir, "go.mod"), []byte("module m\n"), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(tmpdir, "go.mod"), []byte("module m\n"), 0666); err != nil {
fatalf("%v", err)
}
run(goCmd, "get", "-d", arg)
@@ -98,13 +97,13 @@ func main() {
continue
}
path, vers, dir := f[0], f[1], f[2]
- mod, err := ioutil.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".mod"))
+ mod, err := os.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".mod"))
if err != nil {
log.Printf("%s: %v", arg, err)
exitCode = 1
continue
}
- info, err := ioutil.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".info"))
+ info, err := os.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".info"))
if err != nil {
log.Printf("%s: %v", arg, err)
exitCode = 1
@@ -128,7 +127,7 @@ func main() {
}
name := info.Name()
if name == "go.mod" || strings.HasSuffix(name, ".go") {
- data, err := ioutil.ReadFile(path)
+ data, err := os.ReadFile(path)
if err != nil {
return err
}
@@ -144,7 +143,7 @@ func main() {
data := txtar.Format(a)
target := filepath.Join("mod", strings.ReplaceAll(path, "/", "_")+"_"+vers+".txt")
- if err := ioutil.WriteFile(target, data, 0666); err != nil {
+ if err := os.WriteFile(target, data, 0666); err != nil {
log.Printf("%s: %v", arg, err)
exitCode = 1
continue
diff --git a/src/cmd/go/testdata/savedir.go b/src/cmd/go/testdata/savedir.go
index 75895ee279..d469c31a91 100644
--- a/src/cmd/go/testdata/savedir.go
+++ b/src/cmd/go/testdata/savedir.go
@@ -18,7 +18,6 @@ import (
"flag"
"fmt"
"io/fs"
- "io/ioutil"
"log"
"os"
"path/filepath"
@@ -63,7 +62,7 @@ func main() {
if !info.Type().IsRegular() {
return nil
}
- data, err := ioutil.ReadFile(path)
+ data, err := os.ReadFile(path)
if err != nil {
log.Fatal(err)
}
diff --git a/src/cmd/go/testdata/script/build_issue6480.txt b/src/cmd/go/testdata/script/build_issue6480.txt
index ae99c60d99..cf1e9ea6c2 100644
--- a/src/cmd/go/testdata/script/build_issue6480.txt
+++ b/src/cmd/go/testdata/script/build_issue6480.txt
@@ -81,7 +81,6 @@ package main
import (
"encoding/json"
"fmt"
- "io/ioutil"
"os"
"time"
)
@@ -100,7 +99,7 @@ func truncateLike(t, p time.Time) time.Time {
func main() {
var t1 time.Time
- b1, err := ioutil.ReadFile(os.Args[1])
+ b1, err := os.ReadFile(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
@@ -111,7 +110,7 @@ func main() {
}
var t2 time.Time
- b2, err := ioutil.ReadFile(os.Args[2])
+ b2, err := os.ReadFile(os.Args[2])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
diff --git a/src/cmd/go/testdata/script/build_trimpath.txt b/src/cmd/go/testdata/script/build_trimpath.txt
index 2c3bee8fdc..e1ea0a48b2 100644
--- a/src/cmd/go/testdata/script/build_trimpath.txt
+++ b/src/cmd/go/testdata/script/build_trimpath.txt
@@ -121,7 +121,6 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -131,7 +130,7 @@ import (
func main() {
exe := os.Args[1]
- data, err := ioutil.ReadFile(exe)
+ data, err := os.ReadFile(exe)
if err != nil {
log.Fatal(err)
}
diff --git a/src/cmd/go/testdata/script/cover_error.txt b/src/cmd/go/testdata/script/cover_error.txt
index 4abdf1137a..583a664237 100644
--- a/src/cmd/go/testdata/script/cover_error.txt
+++ b/src/cmd/go/testdata/script/cover_error.txt
@@ -54,7 +54,6 @@ func Test(t *testing.T) {}
package main
import (
- "io/ioutil"
"log"
"os"
"strings"
@@ -62,13 +61,13 @@ import (
func main() {
log.SetFlags(0)
- b, err := ioutil.ReadFile(os.Args[1])
+ b, err := os.ReadFile(os.Args[1])
if err != nil {
log.Fatal(err)
}
s := strings.ReplaceAll(string(b), "p.go:4:2:", "p.go:4:")
s = strings.ReplaceAll(s, "p1.go:6:2:", "p1.go:6:")
- ioutil.WriteFile(os.Args[1], []byte(s), 0644)
+ os.WriteFile(os.Args[1], []byte(s), 0644)
if err != nil {
log.Fatal(err)
}
diff --git a/src/cmd/go/testdata/script/gopath_moved_repo.txt b/src/cmd/go/testdata/script/gopath_moved_repo.txt
index 869980da7c..99d80bff5d 100644
--- a/src/cmd/go/testdata/script/gopath_moved_repo.txt
+++ b/src/cmd/go/testdata/script/gopath_moved_repo.txt
@@ -45,7 +45,6 @@ package main
import (
"bytes"
- "io/ioutil"
"log"
"os"
)
@@ -57,11 +56,11 @@ func main() {
base := []byte(os.Args[1])
path := os.Args[2]
- data, err := ioutil.ReadFile(path)
+ data, err := os.ReadFile(path)
if err != nil {
log.Fatal(err)
}
- err = ioutil.WriteFile(path, bytes.ReplaceAll(data, base, append(base, "XXX"...)), 0644)
+ err = os.WriteFile(path, bytes.ReplaceAll(data, base, append(base, "XXX"...)), 0644)
if err != nil {
log.Fatal(err)
}
diff --git a/src/cmd/go/testdata/script/mod_download_concurrent_read.txt b/src/cmd/go/testdata/script/mod_download_concurrent_read.txt
index caf105c6e5..231babd0c0 100644
--- a/src/cmd/go/testdata/script/mod_download_concurrent_read.txt
+++ b/src/cmd/go/testdata/script/mod_download_concurrent_read.txt
@@ -25,7 +25,6 @@ package main
import (
"fmt"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -45,7 +44,7 @@ func main() {
// don't need to clean the cache or synchronize closing files after each
// iteration.
func run() (err error) {
- tmpDir, err := ioutil.TempDir("", "")
+ tmpDir, err := os.MkdirTemp("", "")
if err != nil {
return err
}
diff --git a/src/cmd/go/testdata/script/mod_modinfo.txt b/src/cmd/go/testdata/script/mod_modinfo.txt
index d9e9fdec21..8d77e224a5 100644
--- a/src/cmd/go/testdata/script/mod_modinfo.txt
+++ b/src/cmd/go/testdata/script/mod_modinfo.txt
@@ -69,7 +69,6 @@ package main
import (
"bytes"
"encoding/hex"
- "io/ioutil"
"log"
"os"
@@ -77,7 +76,7 @@ import (
)
func main() {
- b, err := ioutil.ReadFile(os.Args[0])
+ b, err := os.ReadFile(os.Args[0])
if err != nil {
log.Fatal(err)
}
diff --git a/src/cmd/go/testdata/script/mod_test_cached.txt b/src/cmd/go/testdata/script/mod_test_cached.txt
index ffd573c02a..3da4358fa1 100644
--- a/src/cmd/go/testdata/script/mod_test_cached.txt
+++ b/src/cmd/go/testdata/script/mod_test_cached.txt
@@ -51,26 +51,25 @@ bar
package foo_test
import (
- "io/ioutil"
"os"
"path/filepath"
"testing"
)
func TestWriteTmp(t *testing.T) {
- dir, err := ioutil.TempDir("", "")
+ dir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
- err = ioutil.WriteFile(filepath.Join(dir, "x"), nil, 0666)
+ err = os.WriteFile(filepath.Join(dir, "x"), nil, 0666)
if err != nil {
t.Fatal(err)
}
}
func TestReadTestdata(t *testing.T) {
- _, err := ioutil.ReadFile("testdata/foo.txt")
+ _, err := os.ReadFile("testdata/foo.txt")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/testdata/script/test_compile_tempfile.txt b/src/cmd/go/testdata/script/test_compile_tempfile.txt
index 912410814f..05f721a800 100644
--- a/src/cmd/go/testdata/script/test_compile_tempfile.txt
+++ b/src/cmd/go/testdata/script/test_compile_tempfile.txt
@@ -1,7 +1,7 @@
[short] skip
# Ensure that the target of 'go build -o' can be an existing, empty file so that
-# its name can be reserved using ioutil.TempFile or the 'mktemp` command.
+# its name can be reserved using os.CreateTemp or the 'mktemp` command.
go build -o empty-file$GOEXE main.go
diff --git a/src/cmd/go/testdata/script/test_generated_main.txt b/src/cmd/go/testdata/script/test_generated_main.txt
index 75ffa9cde2..2e991a5797 100644
--- a/src/cmd/go/testdata/script/test_generated_main.txt
+++ b/src/cmd/go/testdata/script/test_generated_main.txt
@@ -12,7 +12,6 @@ package x
import (
"os"
"path/filepath"
- "io/ioutil"
"regexp"
"testing"
)
@@ -23,7 +22,7 @@ func Test(t *testing.T) {
t.Fatal(err)
}
testmainPath := filepath.Join(filepath.Dir(exePath), "_testmain.go")
- source, err := ioutil.ReadFile(testmainPath)
+ source, err := os.ReadFile(testmainPath)
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/go/testdata/script/test_race_install_cgo.txt b/src/cmd/go/testdata/script/test_race_install_cgo.txt
index 82f00f2086..3f4eb90e3f 100644
--- a/src/cmd/go/testdata/script/test_race_install_cgo.txt
+++ b/src/cmd/go/testdata/script/test_race_install_cgo.txt
@@ -29,7 +29,6 @@ go 1.16
package main
import (
- "io/ioutil"
"encoding/json"
"fmt"
"os"
@@ -37,7 +36,7 @@ import (
)
func main() {
- b, err := ioutil.ReadFile(os.Args[1])
+ b, err := os.ReadFile(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
@@ -59,7 +58,6 @@ package main
import (
"encoding/json"
"fmt"
- "io/ioutil"
"os"
"time"
)
@@ -67,7 +65,7 @@ import (
func main() {
var t1 time.Time
- b1, err := ioutil.ReadFile(os.Args[1])
+ b1, err := os.ReadFile(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
@@ -78,7 +76,7 @@ func main() {
}
var t2 time.Time
- b2, err := ioutil.ReadFile(os.Args[2])
+ b2, err := os.ReadFile(os.Args[2])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
diff --git a/src/cmd/gofmt/gofmt.go b/src/cmd/gofmt/gofmt.go
index 719c681a3e..2793c2c2a4 100644
--- a/src/cmd/gofmt/gofmt.go
+++ b/src/cmd/gofmt/gofmt.go
@@ -15,7 +15,6 @@ import (
"go/token"
"io"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -137,7 +136,7 @@ func processFile(filename string, in io.Reader, out io.Writer, stdin bool) error
if err != nil {
return err
}
- err = ioutil.WriteFile(filename, res, perm)
+ err = os.WriteFile(filename, res, perm)
if err != nil {
os.Rename(bakname, filename)
return err
@@ -278,7 +277,7 @@ const chmodSupported = runtime.GOOS != "windows"
// the chosen file name.
func backupFile(filename string, data []byte, perm fs.FileMode) (string, error) {
// create backup file
- f, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename))
+ f, err := os.CreateTemp(filepath.Dir(filename), filepath.Base(filename))
if err != nil {
return "", err
}
diff --git a/src/cmd/gofmt/gofmt_test.go b/src/cmd/gofmt/gofmt_test.go
index 98d3eb7eb2..bf2adfe64c 100644
--- a/src/cmd/gofmt/gofmt_test.go
+++ b/src/cmd/gofmt/gofmt_test.go
@@ -7,7 +7,6 @@ package main
import (
"bytes"
"flag"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -93,7 +92,7 @@ func runTest(t *testing.T, in, out string) {
return
}
- expected, err := ioutil.ReadFile(out)
+ expected, err := os.ReadFile(out)
if err != nil {
t.Error(err)
return
@@ -102,7 +101,7 @@ func runTest(t *testing.T, in, out string) {
if got := buf.Bytes(); !bytes.Equal(got, expected) {
if *update {
if in != out {
- if err := ioutil.WriteFile(out, got, 0666); err != nil {
+ if err := os.WriteFile(out, got, 0666); err != nil {
t.Error(err)
}
return
@@ -116,7 +115,7 @@ func runTest(t *testing.T, in, out string) {
if err == nil {
t.Errorf("%s", d)
}
- if err := ioutil.WriteFile(in+".gofmt", got, 0666); err != nil {
+ if err := os.WriteFile(in+".gofmt", got, 0666); err != nil {
t.Error(err)
}
}
@@ -157,7 +156,7 @@ func TestCRLF(t *testing.T) {
const input = "testdata/crlf.input" // must contain CR/LF's
const golden = "testdata/crlf.golden" // must not contain any CR's
- data, err := ioutil.ReadFile(input)
+ data, err := os.ReadFile(input)
if err != nil {
t.Error(err)
}
@@ -165,7 +164,7 @@ func TestCRLF(t *testing.T) {
t.Errorf("%s contains no CR/LF's", input)
}
- data, err = ioutil.ReadFile(golden)
+ data, err = os.ReadFile(golden)
if err != nil {
t.Error(err)
}
@@ -175,7 +174,7 @@ func TestCRLF(t *testing.T) {
}
func TestBackupFile(t *testing.T) {
- dir, err := ioutil.TempDir("", "gofmt_test")
+ dir, err := os.MkdirTemp("", "gofmt_test")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/nm/nm_test.go b/src/cmd/nm/nm_test.go
index 382446e9fe..0d51b07a44 100644
--- a/src/cmd/nm/nm_test.go
+++ b/src/cmd/nm/nm_test.go
@@ -8,7 +8,6 @@ import (
"fmt"
"internal/obscuretestdata"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -31,7 +30,7 @@ func testMain(m *testing.M) int {
return 0
}
- tmpDir, err := ioutil.TempDir("", "TestNM")
+ tmpDir, err := os.MkdirTemp("", "TestNM")
if err != nil {
fmt.Println("TempDir failed:", err)
return 2
@@ -88,7 +87,7 @@ func TestNonGoExecs(t *testing.T) {
func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
t.Parallel()
- tmpdir, err := ioutil.TempDir("", "TestGoExec")
+ tmpdir, err := os.MkdirTemp("", "TestGoExec")
if err != nil {
t.Fatal(err)
}
@@ -222,7 +221,7 @@ func TestGoExec(t *testing.T) {
func testGoLib(t *testing.T, iscgo bool) {
t.Parallel()
- tmpdir, err := ioutil.TempDir("", "TestGoLib")
+ tmpdir, err := os.MkdirTemp("", "TestGoLib")
if err != nil {
t.Fatal(err)
}
@@ -245,7 +244,7 @@ func testGoLib(t *testing.T, iscgo bool) {
err = e
}
if err == nil {
- err = ioutil.WriteFile(filepath.Join(libpath, "go.mod"), []byte("module mylib\n"), 0666)
+ err = os.WriteFile(filepath.Join(libpath, "go.mod"), []byte("module mylib\n"), 0666)
}
if err != nil {
t.Fatal(err)
diff --git a/src/cmd/objdump/objdump_test.go b/src/cmd/objdump/objdump_test.go
index cb692e7a81..edaca774f7 100644
--- a/src/cmd/objdump/objdump_test.go
+++ b/src/cmd/objdump/objdump_test.go
@@ -10,7 +10,6 @@ import (
"fmt"
"go/build"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -39,7 +38,7 @@ func TestMain(m *testing.M) {
func buildObjdump() error {
var err error
- tmp, err = ioutil.TempDir("", "TestObjDump")
+ tmp, err = os.MkdirTemp("", "TestObjDump")
if err != nil {
return fmt.Errorf("TempDir failed: %v", err)
}
@@ -320,7 +319,7 @@ func TestGoobjFileNumber(t *testing.T) {
t.Parallel()
- tmpdir, err := ioutil.TempDir("", "TestGoobjFileNumber")
+ tmpdir, err := os.MkdirTemp("", "TestGoobjFileNumber")
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/pack/pack_test.go b/src/cmd/pack/pack_test.go
index 9f65705def..218c7acda6 100644
--- a/src/cmd/pack/pack_test.go
+++ b/src/cmd/pack/pack_test.go
@@ -12,7 +12,6 @@ import (
"internal/testenv"
"io"
"io/fs"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -22,7 +21,7 @@ import (
// tmpDir creates a temporary directory and returns its name.
func tmpDir(t *testing.T) string {
- name, err := ioutil.TempDir("", "pack")
+ name, err := os.MkdirTemp("", "pack")
if err != nil {
t.Fatal(err)
}
@@ -158,7 +157,7 @@ func TestExtract(t *testing.T) {
ar = openArchive(name, os.O_RDONLY, []string{goodbyeFile.name})
ar.scan(ar.extractContents)
ar.a.File().Close()
- data, err := ioutil.ReadFile(goodbyeFile.name)
+ data, err := os.ReadFile(goodbyeFile.name)
if err != nil {
t.Fatal(err)
}
@@ -183,7 +182,7 @@ func TestHello(t *testing.T) {
println("hello world")
}
`
- err := ioutil.WriteFile(hello, []byte(prog), 0666)
+ err := os.WriteFile(hello, []byte(prog), 0666)
if err != nil {
t.Fatal(err)
}
@@ -251,7 +250,7 @@ func TestLargeDefs(t *testing.T) {
println("ok")
}
`
- err = ioutil.WriteFile(main, []byte(prog), 0666)
+ err = os.WriteFile(main, []byte(prog), 0666)
if err != nil {
t.Fatal(err)
}
@@ -281,13 +280,13 @@ func TestIssue21703(t *testing.T) {
defer os.RemoveAll(dir)
const aSrc = `package a; const X = "\n!\n"`
- err := ioutil.WriteFile(filepath.Join(dir, "a.go"), []byte(aSrc), 0666)
+ err := os.WriteFile(filepath.Join(dir, "a.go"), []byte(aSrc), 0666)
if err != nil {
t.Fatal(err)
}
const bSrc = `package b; import _ "a"`
- err = ioutil.WriteFile(filepath.Join(dir, "b.go"), []byte(bSrc), 0666)
+ err = os.WriteFile(filepath.Join(dir, "b.go"), []byte(bSrc), 0666)
if err != nil {
t.Fatal(err)
}
diff --git a/src/cmd/trace/annotations_test.go b/src/cmd/trace/annotations_test.go
index a9068d53c1..9c2d027366 100644
--- a/src/cmd/trace/annotations_test.go
+++ b/src/cmd/trace/annotations_test.go
@@ -12,7 +12,7 @@ import (
"flag"
"fmt"
traceparser "internal/trace"
- "io/ioutil"
+ "os"
"reflect"
"runtime/debug"
"runtime/trace"
@@ -386,7 +386,7 @@ func saveTrace(buf *bytes.Buffer, name string) {
if !*saveTraces {
return
}
- if err := ioutil.WriteFile(name+".trace", buf.Bytes(), 0600); err != nil {
+ if err := os.WriteFile(name+".trace", buf.Bytes(), 0600); err != nil {
panic(fmt.Errorf("failed to write trace file: %v", err))
}
}
diff --git a/src/cmd/trace/pprof.go b/src/cmd/trace/pprof.go
index a31d71b013..a73ff5336a 100644
--- a/src/cmd/trace/pprof.go
+++ b/src/cmd/trace/pprof.go
@@ -11,7 +11,6 @@ import (
"fmt"
"internal/trace"
"io"
- "io/ioutil"
"net/http"
"os"
"os/exec"
@@ -294,7 +293,7 @@ func serveSVGProfile(prof func(w io.Writer, r *http.Request) error) http.Handler
return
}
- blockf, err := ioutil.TempFile("", "block")
+ blockf, err := os.CreateTemp("", "block")
if err != nil {
http.Error(w, fmt.Sprintf("failed to create temp file: %v", err), http.StatusInternalServerError)
return
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go b/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
index cde648f20b..8cb87da9af 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
@@ -127,7 +127,7 @@ func (b *builder) addLegend() {
}
title := labels[0]
fmt.Fprintf(b, `subgraph cluster_L { "%s" [shape=box fontsize=16`, title)
- fmt.Fprintf(b, ` label="%s\l"`, strings.Join(escapeForDot(labels), `\l`))
+ fmt.Fprintf(b, ` label="%s\l"`, strings.Join(escapeAllForDot(labels), `\l`))
if b.config.LegendURL != "" {
fmt.Fprintf(b, ` URL="%s" target="_blank"`, b.config.LegendURL)
}
@@ -187,7 +187,7 @@ func (b *builder) addNode(node *Node, nodeID int, maxFlat float64) {
// Create DOT attribute for node.
attr := fmt.Sprintf(`label="%s" id="node%d" fontsize=%d shape=%s tooltip="%s (%s)" color="%s" fillcolor="%s"`,
- label, nodeID, fontSize, shape, node.Info.PrintableName(), cumValue,
+ label, nodeID, fontSize, shape, escapeForDot(node.Info.PrintableName()), cumValue,
dotColor(float64(node.CumValue())/float64(abs64(b.config.Total)), false),
dotColor(float64(node.CumValue())/float64(abs64(b.config.Total)), true))
@@ -305,7 +305,8 @@ func (b *builder) addEdge(edge *Edge, from, to int, hasNodelets bool) {
arrow = "..."
}
tooltip := fmt.Sprintf(`"%s %s %s (%s)"`,
- edge.Src.Info.PrintableName(), arrow, edge.Dest.Info.PrintableName(), w)
+ escapeForDot(edge.Src.Info.PrintableName()), arrow,
+ escapeForDot(edge.Dest.Info.PrintableName()), w)
attr = fmt.Sprintf(`%s tooltip=%s labeltooltip=%s`, attr, tooltip, tooltip)
if edge.Residual {
@@ -382,7 +383,7 @@ func dotColor(score float64, isBackground bool) string {
func multilinePrintableName(info *NodeInfo) string {
infoCopy := *info
- infoCopy.Name = ShortenFunctionName(infoCopy.Name)
+ infoCopy.Name = escapeForDot(ShortenFunctionName(infoCopy.Name))
infoCopy.Name = strings.Replace(infoCopy.Name, "::", `\n`, -1)
infoCopy.Name = strings.Replace(infoCopy.Name, ".", `\n`, -1)
if infoCopy.File != "" {
@@ -473,13 +474,18 @@ func min64(a, b int64) int64 {
return b
}
-// escapeForDot escapes double quotes and backslashes, and replaces Graphviz's
-// "center" character (\n) with a left-justified character.
-// See https://graphviz.org/doc/info/attrs.html#k:escString for more info.
-func escapeForDot(in []string) []string {
+// escapeAllForDot applies escapeForDot to all strings in the given slice.
+func escapeAllForDot(in []string) []string {
var out = make([]string, len(in))
for i := range in {
- out[i] = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(in[i], `\`, `\\`), `"`, `\"`), "\n", `\l`)
+ out[i] = escapeForDot(in[i])
}
return out
}
+
+// escapeForDot escapes double quotes and backslashes, and replaces Graphviz's
+// "center" character (\n) with a left-justified character.
+// See https://graphviz.org/doc/info/attrs.html#k:escString for more info.
+func escapeForDot(str string) string {
+ return strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(str, `\`, `\\`), `"`, `\"`), "\n", `\l`)
+}
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go b/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
index d2397a93d8..74b904c402 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/graph/graph.go
@@ -28,12 +28,14 @@ import (
)
var (
- // Removes package name and method arugments for Java method names.
+ // Removes package name and method arguments for Java method names.
// See tests for examples.
javaRegExp = regexp.MustCompile(`^(?:[a-z]\w*\.)*([A-Z][\w\$]*\.(?:<init>|[a-z][\w\$]*(?:\$\d+)?))(?:(?:\()|$)`)
- // Removes package name and method arugments for Go function names.
+ // Removes package name and method arguments for Go function names.
// See tests for examples.
goRegExp = regexp.MustCompile(`^(?:[\w\-\.]+\/)+(.+)`)
+ // Removes potential module versions in a package path.
+ goVerRegExp = regexp.MustCompile(`^(.*?)/v(?:[2-9]|[1-9][0-9]+)([./].*)$`)
// Strips C++ namespace prefix from a C++ function / method name.
// NOTE: Make sure to keep the template parameters in the name. Normally,
// template parameters are stripped from the C++ names but when
@@ -317,6 +319,8 @@ func New(prof *profile.Profile, o *Options) *Graph {
// nodes.
func newGraph(prof *profile.Profile, o *Options) (*Graph, map[uint64]Nodes) {
nodes, locationMap := CreateNodes(prof, o)
+ seenNode := make(map[*Node]bool)
+ seenEdge := make(map[nodePair]bool)
for _, sample := range prof.Sample {
var w, dw int64
w = o.SampleValue(sample.Value)
@@ -326,8 +330,12 @@ func newGraph(prof *profile.Profile, o *Options) (*Graph, map[uint64]Nodes) {
if dw == 0 && w == 0 {
continue
}
- seenNode := make(map[*Node]bool, len(sample.Location))
- seenEdge := make(map[nodePair]bool, len(sample.Location))
+ for k := range seenNode {
+ delete(seenNode, k)
+ }
+ for k := range seenEdge {
+ delete(seenEdge, k)
+ }
var parent *Node
// A residual edge goes over one or more nodes that were not kept.
residual := false
@@ -440,6 +448,7 @@ func newTree(prof *profile.Profile, o *Options) (g *Graph) {
// ShortenFunctionName returns a shortened version of a function's name.
func ShortenFunctionName(f string) string {
f = cppAnonymousPrefixRegExp.ReplaceAllString(f, "")
+ f = goVerRegExp.ReplaceAllString(f, `${1}${2}`)
for _, re := range []*regexp.Regexp{goRegExp, javaRegExp, cppRegExp} {
if matches := re.FindStringSubmatch(f); len(matches) >= 2 {
return strings.Join(matches[1:], "")
diff --git a/src/cmd/vendor/github.com/ianlancetaylor/demangle/ast.go b/src/cmd/vendor/github.com/ianlancetaylor/demangle/ast.go
index 0ad5354f58..ccbe5b3559 100644
--- a/src/cmd/vendor/github.com/ianlancetaylor/demangle/ast.go
+++ b/src/cmd/vendor/github.com/ianlancetaylor/demangle/ast.go
@@ -5,7 +5,6 @@
package demangle
import (
- "bytes"
"fmt"
"strings"
)
@@ -23,7 +22,10 @@ type AST interface {
// Copy an AST with possible transformations.
// If the skip function returns true, no copy is required.
// If the copy function returns nil, no copy is required.
- // Otherwise the AST returned by copy is used in a copy of the full AST.
+ // The Copy method will do the right thing if copy returns nil
+ // for some components of an AST but not others, so a good
+ // copy function will only return non-nil for AST values that
+ // need to change.
// Copy itself returns either a copy or nil.
Copy(copy func(AST) AST, skip func(AST) bool) AST
@@ -51,7 +53,7 @@ func ASTToString(a AST, options ...Option) string {
type printState struct {
tparams bool // whether to print template parameters
- buf bytes.Buffer
+ buf strings.Builder
last byte // Last byte written to buffer.
// The inner field is a list of items to print for a type
@@ -398,13 +400,172 @@ func (tp *TemplateParam) goString(indent int, field string) string {
return fmt.Sprintf("%*s%sTemplateParam: Template: %p; Index %d", indent, "", field, tp.Template, tp.Index)
}
+// LambdaAuto is a lambda auto parameter.
+type LambdaAuto struct {
+ Index int
+}
+
+func (la *LambdaAuto) print(ps *printState) {
+ // We print the index plus 1 because that is what the standard
+ // demangler does.
+ fmt.Fprintf(&ps.buf, "auto:%d", la.Index+1)
+}
+
+func (la *LambdaAuto) Traverse(fn func(AST) bool) {
+ fn(la)
+}
+
+func (la *LambdaAuto) Copy(fn func(AST) AST, skip func(AST) bool) AST {
+ if skip(la) {
+ return nil
+ }
+ return fn(la)
+}
+
+func (la *LambdaAuto) GoString() string {
+ return la.goString(0, "")
+}
+
+func (la *LambdaAuto) goString(indent int, field string) string {
+ return fmt.Sprintf("%*s%sLambdaAuto: Index %d", indent, "", field, la.Index)
+}
+
// Qualifiers is an ordered list of type qualifiers.
-type Qualifiers []string
+type Qualifiers struct {
+ Qualifiers []AST
+}
+
+func (qs *Qualifiers) print(ps *printState) {
+ first := true
+ for _, q := range qs.Qualifiers {
+ if !first {
+ ps.writeByte(' ')
+ }
+ q.print(ps)
+ first = false
+ }
+}
+
+func (qs *Qualifiers) Traverse(fn func(AST) bool) {
+ if fn(qs) {
+ for _, q := range qs.Qualifiers {
+ q.Traverse(fn)
+ }
+ }
+}
+
+func (qs *Qualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST {
+ if skip(qs) {
+ return nil
+ }
+ changed := false
+ qualifiers := make([]AST, len(qs.Qualifiers))
+ for i, q := range qs.Qualifiers {
+ qc := q.Copy(fn, skip)
+ if qc == nil {
+ qualifiers[i] = q
+ } else {
+ qualifiers[i] = qc
+ changed = true
+ }
+ }
+ if !changed {
+ return fn(qs)
+ }
+ qs = &Qualifiers{Qualifiers: qualifiers}
+ if r := fn(qs); r != nil {
+ return r
+ }
+ return qs
+}
+
+func (qs *Qualifiers) GoString() string {
+ return qs.goString(0, "")
+}
+
+func (qs *Qualifiers) goString(indent int, field string) string {
+ quals := fmt.Sprintf("%*s%s", indent, "", field)
+ for _, q := range qs.Qualifiers {
+ quals += "\n"
+ quals += q.goString(indent+2, "")
+ }
+ return quals
+}
+
+// Qualifier is a single type qualifier.
+type Qualifier struct {
+ Name string // qualifier name: const, volatile, etc.
+ Exprs []AST // can be non-nil for noexcept and throw
+}
+
+func (q *Qualifier) print(ps *printState) {
+ ps.writeString(q.Name)
+ if len(q.Exprs) > 0 {
+ ps.writeByte('(')
+ first := true
+ for _, e := range q.Exprs {
+ if !first {
+ ps.writeString(", ")
+ }
+ ps.print(e)
+ first = false
+ }
+ ps.writeByte(')')
+ }
+}
+
+func (q *Qualifier) Traverse(fn func(AST) bool) {
+ if fn(q) {
+ for _, e := range q.Exprs {
+ e.Traverse(fn)
+ }
+ }
+}
+
+func (q *Qualifier) Copy(fn func(AST) AST, skip func(AST) bool) AST {
+ if skip(q) {
+ return nil
+ }
+ exprs := make([]AST, len(q.Exprs))
+ changed := false
+ for i, e := range q.Exprs {
+ ec := e.Copy(fn, skip)
+ if ec == nil {
+ exprs[i] = e
+ } else {
+ exprs[i] = ec
+ changed = true
+ }
+ }
+ if !changed {
+ return fn(q)
+ }
+ q = &Qualifier{Name: q.Name, Exprs: exprs}
+ if r := fn(q); r != nil {
+ return r
+ }
+ return q
+}
+
+func (q *Qualifier) GoString() string {
+ return q.goString(0, "Qualifier: ")
+}
+
+func (q *Qualifier) goString(indent int, field string) string {
+ qs := fmt.Sprintf("%*s%s%s", indent, "", field, q.Name)
+ if len(q.Exprs) > 0 {
+ for i, e := range q.Exprs {
+ qs += "\n"
+ qs += e.goString(indent+2, fmt.Sprintf("%d: ", i))
+ }
+ }
+ return qs
+}
// TypeWithQualifiers is a type with standard qualifiers.
type TypeWithQualifiers struct {
Base AST
- Qualifiers Qualifiers
+ Qualifiers AST
}
func (twq *TypeWithQualifiers) print(ps *printState) {
@@ -414,7 +575,7 @@ func (twq *TypeWithQualifiers) print(ps *printState) {
if len(ps.inner) > 0 {
// The qualifier wasn't printed by Base.
ps.writeByte(' ')
- ps.writeString(strings.Join(twq.Qualifiers, " "))
+ ps.print(twq.Qualifiers)
ps.inner = ps.inner[:len(ps.inner)-1]
}
}
@@ -422,7 +583,7 @@ func (twq *TypeWithQualifiers) print(ps *printState) {
// Print qualifiers as an inner type by just printing the qualifiers.
func (twq *TypeWithQualifiers) printInner(ps *printState) {
ps.writeByte(' ')
- ps.writeString(strings.Join(twq.Qualifiers, " "))
+ ps.print(twq.Qualifiers)
}
func (twq *TypeWithQualifiers) Traverse(fn func(AST) bool) {
@@ -436,10 +597,17 @@ func (twq *TypeWithQualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST {
return nil
}
base := twq.Base.Copy(fn, skip)
- if base == nil {
+ quals := twq.Qualifiers.Copy(fn, skip)
+ if base == nil && quals == nil {
return fn(twq)
}
- twq = &TypeWithQualifiers{Base: base, Qualifiers: twq.Qualifiers}
+ if base == nil {
+ base = twq.Base
+ }
+ if quals == nil {
+ quals = twq.Qualifiers
+ }
+ twq = &TypeWithQualifiers{Base: base, Qualifiers: quals}
if r := fn(twq); r != nil {
return r
}
@@ -451,14 +619,15 @@ func (twq *TypeWithQualifiers) GoString() string {
}
func (twq *TypeWithQualifiers) goString(indent int, field string) string {
- return fmt.Sprintf("%*s%sTypeWithQualifiers: Qualifiers: %s\n%s", indent, "", field,
- twq.Qualifiers, twq.Base.goString(indent+2, "Base: "))
+ return fmt.Sprintf("%*s%sTypeWithQualifiers:\n%s\n%s", indent, "", field,
+ twq.Qualifiers.goString(indent+2, "Qualifiers: "),
+ twq.Base.goString(indent+2, "Base: "))
}
// MethodWithQualifiers is a method with qualifiers.
type MethodWithQualifiers struct {
Method AST
- Qualifiers Qualifiers
+ Qualifiers AST
RefQualifier string // "" or "&" or "&&"
}
@@ -467,9 +636,9 @@ func (mwq *MethodWithQualifiers) print(ps *printState) {
ps.inner = append(ps.inner, mwq)
ps.print(mwq.Method)
if len(ps.inner) > 0 {
- if len(mwq.Qualifiers) > 0 {
+ if mwq.Qualifiers != nil {
ps.writeByte(' ')
- ps.writeString(strings.Join(mwq.Qualifiers, " "))
+ ps.print(mwq.Qualifiers)
}
if mwq.RefQualifier != "" {
ps.writeByte(' ')
@@ -480,9 +649,9 @@ func (mwq *MethodWithQualifiers) print(ps *printState) {
}
func (mwq *MethodWithQualifiers) printInner(ps *printState) {
- if len(mwq.Qualifiers) > 0 {
+ if mwq.Qualifiers != nil {
ps.writeByte(' ')
- ps.writeString(strings.Join(mwq.Qualifiers, " "))
+ ps.print(mwq.Qualifiers)
}
if mwq.RefQualifier != "" {
ps.writeByte(' ')
@@ -501,10 +670,20 @@ func (mwq *MethodWithQualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST
return nil
}
method := mwq.Method.Copy(fn, skip)
- if method == nil {
+ var quals AST
+ if mwq.Qualifiers != nil {
+ quals = mwq.Qualifiers.Copy(fn, skip)
+ }
+ if method == nil && quals == nil {
return fn(mwq)
}
- mwq = &MethodWithQualifiers{Method: method, Qualifiers: mwq.Qualifiers, RefQualifier: mwq.RefQualifier}
+ if method == nil {
+ method = mwq.Method
+ }
+ if quals == nil {
+ quals = mwq.Qualifiers
+ }
+ mwq = &MethodWithQualifiers{Method: method, Qualifiers: quals, RefQualifier: mwq.RefQualifier}
if r := fn(mwq); r != nil {
return r
}
@@ -517,14 +696,14 @@ func (mwq *MethodWithQualifiers) GoString() string {
func (mwq *MethodWithQualifiers) goString(indent int, field string) string {
var q string
- if len(mwq.Qualifiers) > 0 {
- q += fmt.Sprintf(" Qualifiers: %v", mwq.Qualifiers)
+ if mwq.Qualifiers != nil {
+ q += "\n" + mwq.Qualifiers.goString(indent+2, "Qualifiers: ")
}
if mwq.RefQualifier != "" {
if q != "" {
- q += ";"
+ q += "\n"
}
- q += " RefQualifier: " + mwq.RefQualifier
+ q += fmt.Sprintf("%*s%s%s", indent+2, "", "RefQualifier: ", mwq.RefQualifier)
}
return fmt.Sprintf("%*s%sMethodWithQualifiers:%s\n%s", indent, "", field,
q, mwq.Method.goString(indent+2, "Method: "))
@@ -1955,6 +2134,22 @@ func (u *Unary) goString(indent int, field string) string {
u.Expr.goString(indent+2, "Expr: "))
}
+// isDesignatedInitializer reports whether x is a designated
+// initializer.
+func isDesignatedInitializer(x AST) bool {
+ switch x := x.(type) {
+ case *Binary:
+ if op, ok := x.Op.(*Operator); ok {
+ return op.Name == "=" || op.Name == "]="
+ }
+ case *Trinary:
+ if op, ok := x.Op.(*Operator); ok {
+ return op.Name == "[...]="
+ }
+ }
+ return false
+}
+
// Binary is a binary operation in an expression.
type Binary struct {
Op AST
@@ -1975,6 +2170,27 @@ func (b *Binary) print(ps *printState) {
return
}
+ if isDesignatedInitializer(b) {
+ if op.Name == "=" {
+ ps.writeByte('.')
+ } else {
+ ps.writeByte('[')
+ }
+ ps.print(b.Left)
+ if op.Name == "]=" {
+ ps.writeByte(']')
+ }
+ if isDesignatedInitializer(b.Right) {
+ // Don't add anything between designated
+ // initializer chains.
+ ps.print(b.Right)
+ } else {
+ ps.writeByte('=')
+ parenthesize(ps, b.Right)
+ }
+ return
+ }
+
// Use an extra set of parentheses around an expression that
// uses the greater-than operator, so that it does not get
// confused with the '>' that ends template parameters.
@@ -1984,15 +2200,28 @@ func (b *Binary) print(ps *printState) {
left := b.Left
- // A function call in an expression should not print the types
- // of the arguments.
+ // For a function call in an expression, don't print the types
+ // of the arguments unless there is a return type.
+ skipParens := false
if op != nil && op.Name == "()" {
if ty, ok := b.Left.(*Typed); ok {
- left = ty.Name
+ if ft, ok := ty.Type.(*FunctionType); ok {
+ if ft.Return == nil {
+ left = ty.Name
+ } else {
+ skipParens = true
+ }
+ } else {
+ left = ty.Name
+ }
}
}
- parenthesize(ps, left)
+ if skipParens {
+ ps.print(left)
+ } else {
+ parenthesize(ps, left)
+ }
if op != nil && op.Name == "[]" {
ps.writeByte('[')
@@ -2070,6 +2299,23 @@ type Trinary struct {
}
func (t *Trinary) print(ps *printState) {
+ if isDesignatedInitializer(t) {
+ ps.writeByte('[')
+ ps.print(t.First)
+ ps.writeString(" ... ")
+ ps.print(t.Second)
+ ps.writeByte(']')
+ if isDesignatedInitializer(t.Third) {
+ // Don't add anything between designated
+ // initializer chains.
+ ps.print(t.Third)
+ } else {
+ ps.writeByte('=')
+ parenthesize(ps, t.Third)
+ }
+ return
+ }
+
parenthesize(ps, t.First)
ps.writeByte('?')
parenthesize(ps, t.Second)
@@ -2362,6 +2608,9 @@ func (l *Literal) print(ps *printState) {
ps.writeString("true")
return
}
+ } else if b.Name == "decltype(nullptr)" && l.Val == "" {
+ ps.print(l.Type)
+ return
} else {
isFloat = builtinTypeFloat[b.Name]
}
@@ -2821,6 +3070,83 @@ func (s *Special2) goString(indent int, field string) string {
indent+2, "", s.Middle, s.Val2.goString(indent+2, "Val2: "))
}
+// EnableIf is used by clang for an enable_if attribute.
+type EnableIf struct {
+ Type AST
+ Args []AST
+}
+
+func (ei *EnableIf) print(ps *printState) {
+ ps.print(ei.Type)
+ ps.writeString(" [enable_if:")
+ first := true
+ for _, a := range ei.Args {
+ if !first {
+ ps.writeString(", ")
+ }
+ ps.print(a)
+ first = false
+ }
+ ps.writeString("]")
+}
+
+func (ei *EnableIf) Traverse(fn func(AST) bool) {
+ if fn(ei) {
+ ei.Type.Traverse(fn)
+ for _, a := range ei.Args {
+ a.Traverse(fn)
+ }
+ }
+}
+
+func (ei *EnableIf) Copy(fn func(AST) AST, skip func(AST) bool) AST {
+ if skip(ei) {
+ return nil
+ }
+ typ := ei.Type.Copy(fn, skip)
+ argsChanged := false
+ args := make([]AST, len(ei.Args))
+ for i, a := range ei.Args {
+ ac := a.Copy(fn, skip)
+ if ac == nil {
+ args[i] = a
+ } else {
+ args[i] = ac
+ argsChanged = true
+ }
+ }
+ if typ == nil && !argsChanged {
+ return fn(ei)
+ }
+ if typ == nil {
+ typ = ei.Type
+ }
+ ei = &EnableIf{Type: typ, Args: args}
+ if r := fn(ei); r != nil {
+ return r
+ }
+ return ei
+}
+
+func (ei *EnableIf) GoString() string {
+ return ei.goString(0, "")
+}
+
+func (ei *EnableIf) goString(indent int, field string) string {
+ var args string
+ if len(ei.Args) == 0 {
+ args = fmt.Sprintf("%*sArgs: nil", indent+2, "")
+ } else {
+ args = fmt.Sprintf("%*sArgs:", indent+2, "")
+ for i, a := range ei.Args {
+ args += "\n"
+ args += a.goString(indent+4, fmt.Sprintf("%d: ", i))
+ }
+ }
+ return fmt.Sprintf("%*s%sEnableIf:\n%s\n%s", indent, "", field,
+ ei.Type.goString(indent+2, "Type: "), args)
+}
+
// Print the inner types.
func (ps *printState) printInner(prefixOnly bool) []AST {
var save []AST
diff --git a/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go b/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go
index 7541b736ba..c2667446df 100644
--- a/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go
+++ b/src/cmd/vendor/github.com/ianlancetaylor/demangle/demangle.go
@@ -5,6 +5,8 @@
// Package demangle defines functions that demangle GCC/LLVM C++ symbol names.
// This package recognizes names that were mangled according to the C++ ABI
// defined at http://codesourcery.com/cxx-abi/.
+//
+// Most programs will want to call Filter or ToString.
package demangle
import (
@@ -45,7 +47,7 @@ func Filter(name string, options ...Option) string {
return ret
}
-// ToString demangles a C++ symbol name, returning human-readable C++
+// ToString demangles a C++ symbol name, returning a human-readable C++
// name or an error.
// If the name does not appear to be a C++ symbol name at all, the
// error will be ErrNotMangledName.
@@ -183,6 +185,7 @@ type state struct {
off int // offset of str within original string
subs substitutions // substitutions
templates []*Template // templates being processed
+ inLambda int // number of lambdas being parsed
}
// copy returns a copy of the current state.
@@ -310,15 +313,42 @@ func (st *state) encoding(params bool, local forLocalNameType) AST {
if mwq != nil {
check = mwq.Method
}
- template, _ := check.(*Template)
+
+ var template *Template
+ switch check := check.(type) {
+ case *Template:
+ template = check
+ case *Qualified:
+ if check.LocalName {
+ n := check.Name
+ if nmwq, ok := n.(*MethodWithQualifiers); ok {
+ n = nmwq.Method
+ }
+ template, _ = n.(*Template)
+ }
+ }
+ var oldInLambda int
if template != nil {
st.templates = append(st.templates, template)
+ oldInLambda = st.inLambda
+ st.inLambda = 0
+ }
+
+ // Checking for the enable_if attribute here is what the LLVM
+ // demangler does. This is not very general but perhaps it is
+ // sufficent.
+ const enableIfPrefix = "Ua9enable_ifI"
+ var enableIfArgs []AST
+ if strings.HasPrefix(st.str, enableIfPrefix) {
+ st.advance(len(enableIfPrefix) - 1)
+ enableIfArgs = st.templateArgs()
}
ft := st.bareFunctionType(hasReturnType(a))
if template != nil {
st.templates = st.templates[:len(st.templates)-1]
+ st.inLambda = oldInLambda
}
ft = simplify(ft)
@@ -349,13 +379,24 @@ func (st *state) encoding(params bool, local forLocalNameType) AST {
}
}
- return &Typed{Name: a, Type: ft}
+ r := AST(&Typed{Name: a, Type: ft})
+
+ if len(enableIfArgs) > 0 {
+ r = &EnableIf{Type: r, Args: enableIfArgs}
+ }
+
+ return r
}
// hasReturnType returns whether the mangled form of a will have a
// return type.
func hasReturnType(a AST) bool {
switch a := a.(type) {
+ case *Qualified:
+ if a.LocalName {
+ return hasReturnType(a.Name)
+ }
+ return false
case *Template:
return !isCDtorConversion(a.Name)
case *TypeWithQualifiers:
@@ -481,7 +522,7 @@ func (st *state) nestedName() AST {
q := st.cvQualifiers()
r := st.refQualifier()
a := st.prefix()
- if len(q) > 0 || r != "" {
+ if q != nil || r != "" {
a = &MethodWithQualifiers{Method: a, Qualifiers: q, RefQualifier: r}
}
if len(st.str) == 0 || st.str[0] != 'E' {
@@ -608,6 +649,29 @@ func (st *state) prefix() AST {
// gives appropriate output.
st.advance(1)
continue
+ case 'J':
+ // It appears that in some cases clang
+ // can emit a J for a template arg
+ // without the expected I. I don't
+ // know when this happens, but I've
+ // seen it in some large C++ programs.
+ if a == nil {
+ st.fail("unexpected template arguments")
+ }
+ var args []AST
+ for len(st.str) == 0 || st.str[0] != 'E' {
+ arg := st.templateArg()
+ args = append(args, arg)
+ }
+ st.advance(1)
+ tmpl := &Template{Name: a, Args: args}
+ if isCast {
+ st.setTemplate(a, tmpl)
+ st.clearTemplateArgs(args)
+ isCast = false
+ }
+ a = nil
+ next = tmpl
default:
st.fail("unrecognized letter in prefix")
}
@@ -754,19 +818,26 @@ var operators = map[string]operator{
"ad": {"&", 1},
"an": {"&", 2},
"at": {"alignof ", 1},
+ "aw": {"co_await ", 1},
"az": {"alignof ", 1},
"cc": {"const_cast", 2},
"cl": {"()", 2},
+ // cp is not in the ABI but is used by clang "when the call
+ // would use ADL except for being parenthesized."
+ "cp": {"()", 2},
"cm": {",", 2},
"co": {"~", 1},
"dV": {"/=", 2},
+ "dX": {"[...]=", 3},
"da": {"delete[] ", 1},
"dc": {"dynamic_cast", 2},
"de": {"*", 1},
+ "di": {"=", 2},
"dl": {"delete ", 1},
"ds": {".*", 2},
"dt": {".", 2},
"dv": {"/", 2},
+ "dx": {"]=", 2},
"eO": {"^=", 2},
"eo": {"^", 2},
"eq": {"==", 2},
@@ -808,7 +879,10 @@ var operators = map[string]operator{
"rc": {"reinterpret_cast", 2},
"rm": {"%", 2},
"rs": {">>", 2},
+ "sP": {"sizeof...", 1},
+ "sZ": {"sizeof...", 1},
"sc": {"static_cast", 2},
+ "ss": {"<=>", 2},
"st": {"sizeof ", 1},
"sz": {"sizeof ", 1},
"tr": {"throw", 0},
@@ -928,6 +1002,7 @@ func (st *state) javaResource() AST {
// ::= TT <type>
// ::= TI <type>
// ::= TS <type>
+// ::= TA <template-arg>
// ::= GV <(object) name>
// ::= T <call-offset> <(base) encoding>
// ::= Tc <call-offset> <call-offset> <(base) encoding>
@@ -961,6 +1036,9 @@ func (st *state) specialName() AST {
case 'S':
t := st.demangleType(false)
return &Special{Prefix: "typeinfo name for ", Val: t}
+ case 'A':
+ t := st.templateArg()
+ return &Special{Prefix: "template parameter object for ", Val: t}
case 'h':
st.callOffset('h')
v := st.encoding(true, notForLocalName)
@@ -1138,7 +1216,7 @@ func (st *state) demangleType(isCast bool) AST {
addSubst := true
q := st.cvQualifiers()
- if len(q) > 0 {
+ if q != nil {
if len(st.str) == 0 {
st.fail("expected type")
}
@@ -1159,7 +1237,7 @@ func (st *state) demangleType(isCast bool) AST {
if btype, ok := builtinTypes[st.str[0]]; ok {
ret = &BuiltinType{Name: btype}
st.advance(1)
- if len(q) > 0 {
+ if q != nil {
ret = &TypeWithQualifiers{Base: ret, Qualifiers: q}
st.subs.add(ret)
}
@@ -1286,6 +1364,8 @@ func (st *state) demangleType(isCast bool) AST {
case 'a':
ret = &Name{Name: "auto"}
+ case 'c':
+ ret = &Name{Name: "decltype(auto)"}
case 'f':
ret = &BuiltinType{Name: "decimal32"}
@@ -1295,6 +1375,8 @@ func (st *state) demangleType(isCast bool) AST {
ret = &BuiltinType{Name: "decimal128"}
case 'h':
ret = &BuiltinType{Name: "half"}
+ case 'u':
+ ret = &BuiltinType{Name: "char8_t"}
case 's':
ret = &BuiltinType{Name: "char16_t"}
case 'i':
@@ -1343,7 +1425,7 @@ func (st *state) demangleType(isCast bool) AST {
}
}
- if len(q) > 0 {
+ if q != nil {
if _, ok := ret.(*FunctionType); ok {
ret = &MethodWithQualifiers{Method: ret, Qualifiers: q, RefQualifier: ""}
} else if mwq, ok := ret.(*MethodWithQualifiers); ok {
@@ -1433,17 +1515,32 @@ func (st *state) demangleCastTemplateArgs(tp AST, addSubst bool) AST {
}
// mergeQualifiers merges two qualifer lists into one.
-func mergeQualifiers(q1, q2 Qualifiers) Qualifiers {
+func mergeQualifiers(q1AST, q2AST AST) AST {
+ if q1AST == nil {
+ return q2AST
+ }
+ if q2AST == nil {
+ return q1AST
+ }
+ q1 := q1AST.(*Qualifiers)
m := make(map[string]bool)
- for _, qual := range q1 {
- m[qual] = true
+ for _, qualAST := range q1.Qualifiers {
+ qual := qualAST.(*Qualifier)
+ if len(qual.Exprs) == 0 {
+ m[qual.Name] = true
+ }
}
- for _, qual := range q2 {
- if !m[qual] {
- q1 = append(q1, qual)
- m[qual] = true
+ rq := q1.Qualifiers
+ for _, qualAST := range q2AST.(*Qualifiers).Qualifiers {
+ qual := qualAST.(*Qualifier)
+ if len(qual.Exprs) > 0 {
+ rq = append(rq, qualAST)
+ } else if !m[qual.Name] {
+ rq = append(rq, qualAST)
+ m[qual.Name] = true
}
}
+ q1.Qualifiers = rq
return q1
}
@@ -1456,20 +1553,51 @@ var qualifiers = map[byte]string{
}
// <CV-qualifiers> ::= [r] [V] [K]
-func (st *state) cvQualifiers() Qualifiers {
- var q Qualifiers
+func (st *state) cvQualifiers() AST {
+ var q []AST
+qualLoop:
for len(st.str) > 0 {
if qv, ok := qualifiers[st.str[0]]; ok {
- q = append([]string{qv}, q...)
+ qual := &Qualifier{Name: qv}
+ q = append([]AST{qual}, q...)
st.advance(1)
- } else if len(st.str) > 1 && st.str[:2] == "Dx" {
- q = append([]string{"transaction_safe"}, q...)
- st.advance(2)
+ } else if len(st.str) > 1 && st.str[0] == 'D' {
+ var qual AST
+ switch st.str[1] {
+ case 'x':
+ qual = &Qualifier{Name: "transaction_safe"}
+ st.advance(2)
+ case 'o':
+ qual = &Qualifier{Name: "noexcept"}
+ st.advance(2)
+ case 'O':
+ st.advance(2)
+ expr := st.expression()
+ if len(st.str) == 0 || st.str[0] != 'E' {
+ st.fail("expected E after computed noexcept expression")
+ }
+ st.advance(1)
+ qual = &Qualifier{Name: "noexcept", Exprs: []AST{expr}}
+ case 'w':
+ st.advance(2)
+ parmlist := st.parmlist()
+ if len(st.str) == 0 || st.str[0] != 'E' {
+ st.fail("expected E after throw parameter list")
+ }
+ st.advance(1)
+ qual = &Qualifier{Name: "throw", Exprs: parmlist}
+ default:
+ break qualLoop
+ }
+ q = append([]AST{qual}, q...)
} else {
break
}
}
- return q
+ if len(q) == 0 {
+ return nil
+ }
+ return &Qualifiers{Qualifiers: q}
}
// <ref-qualifier> ::= R
@@ -1677,7 +1805,7 @@ func (st *state) compactNumber() int {
// whatever the template parameter would be expanded to here. We sort
// this out in substitution and simplify.
func (st *state) templateParam() AST {
- if len(st.templates) == 0 {
+ if len(st.templates) == 0 && st.inLambda == 0 {
st.fail("template parameter not in scope of template")
}
off := st.off
@@ -1685,6 +1813,13 @@ func (st *state) templateParam() AST {
st.checkChar('T')
n := st.compactNumber()
+ if st.inLambda > 0 {
+ // g++ mangles lambda auto params as template params.
+ // Apparently we can't encounter a template within a lambda.
+ // See https://gcc.gnu.org/PR78252.
+ return &LambdaAuto{Index: n}
+ }
+
template := st.templates[len(st.templates)-1]
if template == nil {
@@ -1723,6 +1858,10 @@ func (st *state) setTemplate(a AST, tmpl *Template) {
}
a.Template = tmpl
return false
+ case *Closure:
+ // There are no template params in closure types.
+ // https://gcc.gnu.org/PR78252.
+ return false
default:
for _, v := range seen {
if v == a {
@@ -1812,12 +1951,60 @@ func (st *state) exprList(stop byte) AST {
// <expression> ::= <(unary) operator-name> <expression>
// ::= <(binary) operator-name> <expression> <expression>
// ::= <(trinary) operator-name> <expression> <expression> <expression>
+// ::= pp_ <expression>
+// ::= mm_ <expression>
+// ::= cl <expression>+ E
// ::= cl <expression>+ E
+// ::= cv <type> <expression>
+// ::= cv <type> _ <expression>* E
+// ::= tl <type> <braced-expression>* E
+// ::= il <braced-expression>* E
+// ::= [gs] nw <expression>* _ <type> E
+// ::= [gs] nw <expression>* _ <type> <initializer>
+// ::= [gs] na <expression>* _ <type> E
+// ::= [gs] na <expression>* _ <type> <initializer>
+// ::= [gs] dl <expression>
+// ::= [gs] da <expression>
+// ::= dc <type> <expression>
+// ::= sc <type> <expression>
+// ::= cc <type> <expression>
+// ::= rc <type> <expression>
+// ::= ti <type>
+// ::= te <expression>
// ::= st <type>
+// ::= sz <expression>
+// ::= at <type>
+// ::= az <expression>
+// ::= nx <expression>
// ::= <template-param>
-// ::= sr <type> <unqualified-name>
-// ::= sr <type> <unqualified-name> <template-args>
+// ::= <function-param>
+// ::= dt <expression> <unresolved-name>
+// ::= pt <expression> <unresolved-name>
+// ::= ds <expression> <expression>
+// ::= sZ <template-param>
+// ::= sZ <function-param>
+// ::= sP <template-arg>* E
+// ::= sp <expression>
+// ::= fl <binary operator-name> <expression>
+// ::= fr <binary operator-name> <expression>
+// ::= fL <binary operator-name> <expression> <expression>
+// ::= fR <binary operator-name> <expression> <expression>
+// ::= tw <expression>
+// ::= tr
+// ::= <unresolved-name>
// ::= <expr-primary>
+//
+// <function-param> ::= fp <CV-qualifiers> _
+// ::= fp <CV-qualifiers> <number>
+// ::= fL <number> p <CV-qualifiers> _
+// ::= fL <number> p <CV-qualifiers> <number>
+// ::= fpT
+//
+// <braced-expression> ::= <expression>
+// ::= di <field source-name> <braced-expression>
+// ::= dx <index expression> <braced-expression>
+// ::= dX <range begin expression> <range end expression> <braced-expression>
+//
func (st *state) expression() AST {
if len(st.str) == 0 {
st.fail("expected expression")
@@ -1827,61 +2014,7 @@ func (st *state) expression() AST {
} else if st.str[0] == 'T' {
return st.templateParam()
} else if st.str[0] == 's' && len(st.str) > 1 && st.str[1] == 'r' {
- st.advance(2)
- if len(st.str) == 0 {
- st.fail("expected unresolved type")
- }
- switch st.str[0] {
- case 'T', 'D', 'S':
- t := st.demangleType(false)
- n := st.baseUnresolvedName()
- n = &Qualified{Scope: t, Name: n, LocalName: false}
- if len(st.str) > 0 && st.str[0] == 'I' {
- args := st.templateArgs()
- n = &Template{Name: n, Args: args}
- }
- return n
- default:
- var s AST
- if st.str[0] == 'N' {
- st.advance(1)
- s = st.demangleType(false)
- }
- for len(st.str) == 0 || st.str[0] != 'E' {
- // GCC does not seem to follow the ABI here.
- // It can emit type/name without an 'E'.
- if s != nil && len(st.str) > 0 && !isDigit(st.str[0]) {
- if q, ok := s.(*Qualified); ok {
- a := q.Scope
- if t, ok := a.(*Template); ok {
- st.subs.add(t.Name)
- st.subs.add(t)
- } else {
- st.subs.add(a)
- }
- return s
- }
- }
- n := st.sourceName()
- if len(st.str) > 0 && st.str[0] == 'I' {
- st.subs.add(n)
- args := st.templateArgs()
- n = &Template{Name: n, Args: args}
- }
- if s == nil {
- s = n
- } else {
- s = &Qualified{Scope: s, Name: n, LocalName: false}
- }
- st.subs.add(s)
- }
- if s == nil {
- st.fail("missing scope in unresolved name")
- }
- st.advance(1)
- n := st.baseUnresolvedName()
- return &Qualified{Scope: s, Name: n, LocalName: false}
- }
+ return st.unresolvedName()
} else if st.str[0] == 's' && len(st.str) > 1 && st.str[1] == 'p' {
st.advance(2)
e := st.expression()
@@ -1911,9 +2044,25 @@ func (st *state) expression() AST {
st.advance(1)
return &FunctionParam{Index: 0}
} else {
+ // We can see qualifiers here, but we don't
+ // include them in the demangled string.
+ st.cvQualifiers()
index := st.compactNumber()
return &FunctionParam{Index: index + 1}
}
+ } else if st.str[0] == 'f' && len(st.str) > 2 && st.str[1] == 'L' && isDigit(st.str[2]) {
+ st.advance(2)
+ // We don't include the scope count in the demangled string.
+ st.number()
+ if len(st.str) == 0 || st.str[0] != 'p' {
+ st.fail("expected p after function parameter scope count")
+ }
+ st.advance(1)
+ // We can see qualifiers here, but we don't include them
+ // in the demangled string.
+ st.cvQualifiers()
+ index := st.compactNumber()
+ return &FunctionParam{Index: index + 1}
} else if isDigit(st.str[0]) || (st.str[0] == 'o' && len(st.str) > 1 && st.str[1] == 'n') {
if st.str[0] == 'o' {
// Skip operator function ID.
@@ -1975,13 +2124,15 @@ func (st *state) expression() AST {
left, _ = st.operatorName(true)
right = st.expression()
return &Fold{Left: code[1] == 'l', Op: left, Arg1: right, Arg2: nil}
+ } else if code == "di" {
+ left, _ = st.unqualifiedName()
} else {
left = st.expression()
}
- if code == "cl" {
+ if code == "cl" || code == "cp" {
right = st.exprList('E')
} else if code == "dt" || code == "pt" {
- right, _ = st.unqualifiedName()
+ right = st.unresolvedName()
if len(st.str) > 0 && st.str[0] == 'I' {
args := st.templateArgs()
right = &Template{Name: right, Args: args}
@@ -2034,6 +2185,82 @@ func (st *state) expression() AST {
}
}
+// <unresolved-name> ::= [gs] <base-unresolved-name>
+// ::= sr <unresolved-type> <base-unresolved-name>
+// ::= srN <unresolved-type> <unresolved-qualifier-level>+ E <base-unresolved-name>
+// ::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name>
+func (st *state) unresolvedName() AST {
+ if len(st.str) >= 2 && st.str[:2] == "gs" {
+ st.advance(2)
+ n := st.unresolvedName()
+ return &Unary{
+ Op: &Operator{Name: "::"},
+ Expr: n,
+ Suffix: false,
+ SizeofType: false,
+ }
+ } else if len(st.str) >= 2 && st.str[:2] == "sr" {
+ st.advance(2)
+ if len(st.str) == 0 {
+ st.fail("expected unresolved type")
+ }
+ switch st.str[0] {
+ case 'T', 'D', 'S':
+ t := st.demangleType(false)
+ n := st.baseUnresolvedName()
+ n = &Qualified{Scope: t, Name: n, LocalName: false}
+ if len(st.str) > 0 && st.str[0] == 'I' {
+ args := st.templateArgs()
+ n = &Template{Name: n, Args: args}
+ st.subs.add(n)
+ }
+ return n
+ default:
+ var s AST
+ if st.str[0] == 'N' {
+ st.advance(1)
+ s = st.demangleType(false)
+ }
+ for len(st.str) == 0 || st.str[0] != 'E' {
+ // GCC does not seem to follow the ABI here.
+ // It can emit type/name without an 'E'.
+ if s != nil && len(st.str) > 0 && !isDigit(st.str[0]) {
+ if q, ok := s.(*Qualified); ok {
+ a := q.Scope
+ if t, ok := a.(*Template); ok {
+ st.subs.add(t.Name)
+ st.subs.add(t)
+ } else {
+ st.subs.add(a)
+ }
+ return s
+ }
+ }
+ n := st.sourceName()
+ if len(st.str) > 0 && st.str[0] == 'I' {
+ st.subs.add(n)
+ args := st.templateArgs()
+ n = &Template{Name: n, Args: args}
+ }
+ if s == nil {
+ s = n
+ } else {
+ s = &Qualified{Scope: s, Name: n, LocalName: false}
+ }
+ st.subs.add(s)
+ }
+ if s == nil {
+ st.fail("missing scope in unresolved name")
+ }
+ st.advance(1)
+ n := st.baseUnresolvedName()
+ return &Qualified{Scope: s, Name: n, LocalName: false}
+ }
+ } else {
+ return st.baseUnresolvedName()
+ }
+}
+
// <base-unresolved-name> ::= <simple-id>
// ::= on <operator-name>
// ::= on <operator-name> <template-args>
@@ -2099,7 +2326,14 @@ func (st *state) exprPrimary() AST {
st.advance(1)
}
if len(st.str) > 0 && st.str[0] == 'E' {
- st.fail("missing literal value")
+ if bt, ok := t.(*BuiltinType); ok && bt.Name == "decltype(nullptr)" {
+ // A nullptr should not have a value.
+ // We accept one if present because GCC
+ // used to generate one.
+ // https://gcc.gnu.org/PR91979.
+ } else {
+ st.fail("missing literal value")
+ }
}
i := 0
for len(st.str) > i && st.str[i] != 'E' {
@@ -2116,17 +2350,29 @@ func (st *state) exprPrimary() AST {
return ret
}
-// <discriminator> ::= _ <(non-negative) number>
+// <discriminator> ::= _ <(non-negative) number> (when number < 10)
+// __ <(non-negative) number> _ (when number >= 10)
func (st *state) discriminator(a AST) AST {
if len(st.str) == 0 || st.str[0] != '_' {
return a
}
off := st.off
st.advance(1)
+ trailingUnderscore := false
+ if len(st.str) > 0 && st.str[0] == '_' {
+ st.advance(1)
+ trailingUnderscore = true
+ }
d := st.number()
if d < 0 {
st.failEarlier("invalid negative discriminator", st.off-off)
}
+ if trailingUnderscore && d >= 10 {
+ if len(st.str) == 0 || st.str[0] != '_' {
+ st.fail("expected _ after discriminator >= 10")
+ }
+ st.advance(1)
+ }
// We don't currently print out the discriminator, so we don't
// save it.
return a
@@ -2136,15 +2382,15 @@ func (st *state) discriminator(a AST) AST {
func (st *state) closureTypeName() AST {
st.checkChar('U')
st.checkChar('l')
+ st.inLambda++
types := st.parmlist()
+ st.inLambda--
if len(st.str) == 0 || st.str[0] != 'E' {
st.fail("expected E after closure type name")
}
st.advance(1)
num := st.compactNumber()
- ret := &Closure{Types: types, Num: num}
- st.subs.add(ret)
- return ret
+ return &Closure{Types: types, Num: num}
}
// <unnamed-type-name> ::= Ut [ <nonnegative number> ] _
@@ -2295,31 +2541,92 @@ func (st *state) substitution(forPrefix bool) AST {
// We need to update any references to template
// parameters to refer to the currently active
// template.
+
+ // When copying a Typed we may need to adjust
+ // the templates.
+ copyTemplates := st.templates
+ var oldInLambda []int
+
+ // pushTemplate is called from skip, popTemplate from copy.
+ pushTemplate := func(template *Template) {
+ copyTemplates = append(copyTemplates, template)
+ oldInLambda = append(oldInLambda, st.inLambda)
+ st.inLambda = 0
+ }
+ popTemplate := func() {
+ copyTemplates = copyTemplates[:len(copyTemplates)-1]
+ st.inLambda = oldInLambda[len(oldInLambda)-1]
+ oldInLambda = oldInLambda[:len(oldInLambda)-1]
+ }
+
copy := func(a AST) AST {
- tp, ok := a.(*TemplateParam)
- if !ok {
+ var index int
+ switch a := a.(type) {
+ case *Typed:
+ // Remove the template added in skip.
+ if _, ok := a.Name.(*Template); ok {
+ popTemplate()
+ }
+ return nil
+ case *Closure:
+ // Undo the decrement in skip.
+ st.inLambda--
return nil
+ case *TemplateParam:
+ index = a.Index
+ case *LambdaAuto:
+ // A lambda auto parameter is represented
+ // as a template parameter, so we may have
+ // to change back when substituting.
+ index = a.Index
+ default:
+ return nil
+ }
+ if st.inLambda > 0 {
+ if _, ok := a.(*LambdaAuto); ok {
+ return nil
+ }
+ return &LambdaAuto{Index: index}
}
- if len(st.templates) == 0 {
+ var template *Template
+ if len(copyTemplates) > 0 {
+ template = copyTemplates[len(copyTemplates)-1]
+ } else if rt, ok := ret.(*Template); ok {
+ // At least with clang we can see a template
+ // to start, and sometimes we need to refer
+ // to it. There is probably something wrong
+ // here.
+ template = rt
+ } else {
st.failEarlier("substituted template parameter not in scope of template", dec)
}
- template := st.templates[len(st.templates)-1]
if template == nil {
// This template parameter is within
// the scope of a cast operator.
- return &TemplateParam{Index: tp.Index, Template: nil}
+ return &TemplateParam{Index: index, Template: nil}
}
- if tp.Index >= len(template.Args) {
- st.failEarlier(fmt.Sprintf("substituted template index out of range (%d >= %d)", tp.Index, len(template.Args)), dec)
+ if index >= len(template.Args) {
+ st.failEarlier(fmt.Sprintf("substituted template index out of range (%d >= %d)", index, len(template.Args)), dec)
}
- return &TemplateParam{Index: tp.Index, Template: template}
+ return &TemplateParam{Index: index, Template: template}
}
var seen []AST
skip := func(a AST) bool {
- if _, ok := a.(*Typed); ok {
- return true
+ switch a := a.(type) {
+ case *Typed:
+ if template, ok := a.Name.(*Template); ok {
+ // This template is removed in copy.
+ pushTemplate(template)
+ }
+ return false
+ case *Closure:
+ // This is decremented in copy.
+ st.inLambda++
+ return false
+ case *TemplateParam, *LambdaAuto:
+ return false
}
for _, v := range seen {
if v == a {
@@ -2329,6 +2636,7 @@ func (st *state) substitution(forPrefix bool) AST {
seen = append(seen, a)
return false
}
+
if c := ret.Copy(copy, skip); c != nil {
return c
}
@@ -2351,6 +2659,7 @@ func (st *state) substitution(forPrefix bool) AST {
if len(st.str) > 0 && st.str[0] == 'B' {
a = st.taggedName(a)
+ st.subs.add(a)
}
return a
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
index 06f84b8555..6b4027b33f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_386.s
index 8a7278319e..8a06b87d71 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_386.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_386.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
index 6321421f27..f2397fde55 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
index 333242d506..c9e6b6fc8b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
// +build arm,darwin
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
index 97e0174371..89843f8f4b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
// +build arm64,darwin
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
index 603dd5728c..27674e1caf 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
index c9a0a26015..49f0ac2364 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
index 35172477c8..f2dfc57b83 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
index 9227c875bf..6d740db2c0 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
index d9318cbf03..a8f5a29b35 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_386.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_386.s
index 448bebbb59..0655ecbfbb 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_386.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_386.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
index c6468a9588..bc3fb6ac3e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm.s
index cf0f3575c1..55b13c7ba4 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
index afe6fdf6b1..22a83d8e3f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
@@ -4,7 +4,7 @@
// +build linux
// +build arm64
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
index ab9d63831a..dc222b90ce 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
@@ -4,7 +4,7 @@
// +build linux
// +build mips64 mips64le
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
index 99e5399045..d333f13cff 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
@@ -4,7 +4,7 @@
// +build linux
// +build mips mipsle
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
index 88f7125578..459a629c27 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
@@ -4,7 +4,7 @@
// +build linux
// +build ppc64 ppc64le
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
index 3cfefed2ec..04d38497c6 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build riscv64,!gccgo
+// +build riscv64,gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
index a5a863c6bd..cc303989e1 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
@@ -4,7 +4,7 @@
// +build s390x
// +build linux
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
index 48bdcd7632..ae7b498d50 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
index 2ede05c72f..e57367c17a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
index e8928571c4..d7da175e1a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
index 6f98ba5a37..e7cbe1904c 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
index 00576f3c83..2f00b0310f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
index 790ef77f86..07632c99ce 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
index 469bfa1003..73e997320f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
index 0cedea3d39..c47302aa46 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
index 567a4763c8..47c93fcb6c 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
index ded8260f3e..1f2c755a72 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
+++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/endian_big.go b/src/cmd/vendor/golang.org/x/sys/unix/endian_big.go
index 5e9269063f..86781eac22 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/endian_big.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/endian_big.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
-// +build ppc64 s390x mips mips64
+// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/endian_little.go b/src/cmd/vendor/golang.org/x/sys/unix/endian_little.go
index bcdb5d30eb..8822d8541f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/endian_little.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/endian_little.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
-// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64
+// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh b/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
index 0c9a5c44bb..c0f9f2d523 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ b/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
@@ -225,6 +225,7 @@ struct ltchars {
#include <linux/kexec.h>
#include <linux/keyctl.h>
#include <linux/loop.h>
+#include <linux/lwtunnel.h>
#include <linux/magic.h>
#include <linux/memfd.h>
#include <linux/module.h>
@@ -561,6 +562,7 @@ ccflags="$@"
$2 ~ /^CRYPTO_/ ||
$2 ~ /^TIPC_/ ||
$2 ~ /^DEVLINK_/ ||
+ $2 ~ /^LWTUNNEL_IP/ ||
$2 !~ "WMESGLEN" &&
$2 ~ /^W[A-Z0-9]+$/ ||
$2 ~/^PPPIOC/ ||
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
index dc0befee37..ee852f1abc 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
@@ -26,7 +26,6 @@ func fdopendir(fd int) (dir uintptr, err error) {
func libc_fdopendir_trampoline()
-//go:linkname libc_fdopendir libc_fdopendir
//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index 842ab5acde..a4f2944a24 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -105,6 +105,19 @@ func Pipe(p []int) (err error) {
return
}
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+
+func Pipe2(p []int, flags int) error {
+ if len(p) != 2 {
+ return EINVAL
+ }
+ var pp [2]_C_int
+ err := pipe2(&pp, flags)
+ p[0] = int(pp[0])
+ p[1] = int(pp[1])
+ return err
+}
+
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
func Pread(fd int, p []byte, offset int64) (n int, err error) {
return extpread(fd, p, 0, offset)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
index 84a9e5277a..28be1306ec 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -641,6 +641,36 @@ func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
}
+// SockaddrCANJ1939 implements the Sockaddr interface for AF_CAN using J1939
+// protocol (https://en.wikipedia.org/wiki/SAE_J1939). For more information
+// on the purposes of the fields, check the official linux kernel documentation
+// available here: https://www.kernel.org/doc/Documentation/networking/j1939.rst
+type SockaddrCANJ1939 struct {
+ Ifindex int
+ Name uint64
+ PGN uint32
+ Addr uint8
+ raw RawSockaddrCAN
+}
+
+func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) {
+ if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
+ return nil, 0, EINVAL
+ }
+ sa.raw.Family = AF_CAN
+ sa.raw.Ifindex = int32(sa.Ifindex)
+ n := (*[8]byte)(unsafe.Pointer(&sa.Name))
+ for i := 0; i < 8; i++ {
+ sa.raw.Addr[i] = n[i]
+ }
+ p := (*[4]byte)(unsafe.Pointer(&sa.PGN))
+ for i := 0; i < 4; i++ {
+ sa.raw.Addr[i+8] = p[i]
+ }
+ sa.raw.Addr[12] = sa.Addr
+ return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
+}
+
// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
// SockaddrALG enables userspace access to the Linux kernel's cryptography
// subsystem. The Type and Name fields specify which type of hash or cipher
@@ -952,6 +982,10 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
}
+var socketProtocol = func(fd int) (int, error) {
+ return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
+}
+
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family {
case AF_NETLINK:
@@ -1002,7 +1036,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return sa, nil
case AF_INET:
- proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
+ proto, err := socketProtocol(fd)
if err != nil {
return nil, err
}
@@ -1028,7 +1062,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
}
case AF_INET6:
- proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
+ proto, err := socketProtocol(fd)
if err != nil {
return nil, err
}
@@ -1063,7 +1097,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
}
return sa, nil
case AF_BLUETOOTH:
- proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
+ proto, err := socketProtocol(fd)
if err != nil {
return nil, err
}
@@ -1150,20 +1184,43 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return sa, nil
case AF_CAN:
- pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa))
- sa := &SockaddrCAN{
- Ifindex: int(pp.Ifindex),
- }
- rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
- for i := 0; i < 4; i++ {
- rx[i] = pp.Addr[i]
- }
- tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
- for i := 0; i < 4; i++ {
- tx[i] = pp.Addr[i+4]
+ proto, err := socketProtocol(fd)
+ if err != nil {
+ return nil, err
}
- return sa, nil
+ pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa))
+
+ switch proto {
+ case CAN_J1939:
+ sa := &SockaddrCANJ1939{
+ Ifindex: int(pp.Ifindex),
+ }
+ name := (*[8]byte)(unsafe.Pointer(&sa.Name))
+ for i := 0; i < 8; i++ {
+ name[i] = pp.Addr[i]
+ }
+ pgn := (*[4]byte)(unsafe.Pointer(&sa.PGN))
+ for i := 0; i < 4; i++ {
+ pgn[i] = pp.Addr[i+8]
+ }
+ addr := (*[1]byte)(unsafe.Pointer(&sa.Addr))
+ addr[0] = pp.Addr[12]
+ return sa, nil
+ default:
+ sa := &SockaddrCAN{
+ Ifindex: int(pp.Ifindex),
+ }
+ rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
+ for i := 0; i < 4; i++ {
+ rx[i] = pp.Addr[i]
+ }
+ tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
+ for i := 0; i < 4; i++ {
+ tx[i] = pp.Addr[i+4]
+ }
+ return sa, nil
+ }
}
return nil, EAFNOSUPPORT
}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
index 21a4946ba5..baa771f8ad 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build amd64,linux
-// +build !gccgo
+// +build gc
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc.go
index c26e6ec231..9edf3961b0 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build linux,!gccgo
+// +build linux,gc
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
index 070bd38994..90e33d8cf7 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build linux,!gccgo,386
+// +build linux,gc,386
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go
index 8c514c95ed..1a97baae73 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build arm,!gccgo,linux
+// +build arm,gc,linux
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
index 1c70d1b690..87bd161cef 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
-// +build !gccgo,!ppc64le,!ppc64
+// +build gc,!ppc64le,!ppc64
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
index 86dc765aba..d36216c3ca 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
@@ -4,7 +4,7 @@
// +build linux
// +build ppc64le ppc64
-// +build !gccgo
+// +build gc
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go
index 2069fb861d..b46110354d 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go
@@ -1217,6 +1217,12 @@ const (
LOOP_SET_STATUS_SETTABLE_FLAGS = 0xc
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
+ LWTUNNEL_IP6_MAX = 0x8
+ LWTUNNEL_IP_MAX = 0x8
+ LWTUNNEL_IP_OPTS_MAX = 0x3
+ LWTUNNEL_IP_OPT_ERSPAN_MAX = 0x4
+ LWTUNNEL_IP_OPT_GENEVE_MAX = 0x3
+ LWTUNNEL_IP_OPT_VXLAN_MAX = 0x1
MADV_COLD = 0x14
MADV_DODUMP = 0x11
MADV_DOFORK = 0xb
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
index 4b3a8ad7be..0550da06d1 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
@@ -2,7 +2,7 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build aix,ppc64
-// +build !gccgo
+// +build gc
package unix
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go
index e263fbdb8b..c8c142c59a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go
@@ -24,7 +24,6 @@ func closedir(dir uintptr) (err error) {
func libc_closedir_trampoline()
-//go:linkname libc_closedir libc_closedir
//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -37,5 +36,4 @@ func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) {
func libc_readdir_r_trampoline()
-//go:linkname libc_readdir_r libc_readdir_r
//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
index 6eb4579832..7f0f117d32 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
@@ -25,7 +25,6 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
func libc_getgroups_trampoline()
-//go:linkname libc_getgroups libc_getgroups
//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -40,7 +39,6 @@ func setgroups(ngid int, gid *_Gid_t) (err error) {
func libc_setgroups_trampoline()
-//go:linkname libc_setgroups libc_setgroups
//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -56,7 +54,6 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
func libc_wait4_trampoline()
-//go:linkname libc_wait4 libc_wait4
//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -72,7 +69,6 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
func libc_accept_trampoline()
-//go:linkname libc_accept libc_accept
//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -87,7 +83,6 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_bind_trampoline()
-//go:linkname libc_bind libc_bind
//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -102,7 +97,6 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_connect_trampoline()
-//go:linkname libc_connect libc_connect
//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -118,7 +112,6 @@ func socket(domain int, typ int, proto int) (fd int, err error) {
func libc_socket_trampoline()
-//go:linkname libc_socket libc_socket
//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -133,7 +126,6 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen
func libc_getsockopt_trampoline()
-//go:linkname libc_getsockopt libc_getsockopt
//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -148,7 +140,6 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr)
func libc_setsockopt_trampoline()
-//go:linkname libc_setsockopt libc_setsockopt
//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -163,7 +154,6 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getpeername_trampoline()
-//go:linkname libc_getpeername libc_getpeername
//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -178,7 +168,6 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getsockname_trampoline()
-//go:linkname libc_getsockname libc_getsockname
//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -193,7 +182,6 @@ func Shutdown(s int, how int) (err error) {
func libc_shutdown_trampoline()
-//go:linkname libc_shutdown libc_shutdown
//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -208,7 +196,6 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
func libc_socketpair_trampoline()
-//go:linkname libc_socketpair libc_socketpair
//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -230,7 +217,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl
func libc_recvfrom_trampoline()
-//go:linkname libc_recvfrom libc_recvfrom
//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -251,7 +237,6 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (
func libc_sendto_trampoline()
-//go:linkname libc_sendto libc_sendto
//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -267,7 +252,6 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_recvmsg_trampoline()
-//go:linkname libc_recvmsg libc_recvmsg
//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -283,7 +267,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_sendmsg_trampoline()
-//go:linkname libc_sendmsg libc_sendmsg
//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -299,7 +282,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne
func libc_kevent_trampoline()
-//go:linkname libc_kevent libc_kevent
//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -319,7 +301,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
func libc_utimes_trampoline()
-//go:linkname libc_utimes libc_utimes
//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -334,7 +315,6 @@ func futimes(fd int, timeval *[2]Timeval) (err error) {
func libc_futimes_trampoline()
-//go:linkname libc_futimes libc_futimes
//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -350,7 +330,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
func libc_poll_trampoline()
-//go:linkname libc_poll libc_poll
//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -371,7 +350,6 @@ func Madvise(b []byte, behav int) (err error) {
func libc_madvise_trampoline()
-//go:linkname libc_madvise libc_madvise
//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -392,7 +370,6 @@ func Mlock(b []byte) (err error) {
func libc_mlock_trampoline()
-//go:linkname libc_mlock libc_mlock
//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -407,7 +384,6 @@ func Mlockall(flags int) (err error) {
func libc_mlockall_trampoline()
-//go:linkname libc_mlockall libc_mlockall
//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -428,7 +404,6 @@ func Mprotect(b []byte, prot int) (err error) {
func libc_mprotect_trampoline()
-//go:linkname libc_mprotect libc_mprotect
//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -449,7 +424,6 @@ func Msync(b []byte, flags int) (err error) {
func libc_msync_trampoline()
-//go:linkname libc_msync libc_msync
//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -470,7 +444,6 @@ func Munlock(b []byte) (err error) {
func libc_munlock_trampoline()
-//go:linkname libc_munlock libc_munlock
//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -485,7 +458,6 @@ func Munlockall() (err error) {
func libc_munlockall_trampoline()
-//go:linkname libc_munlockall libc_munlockall
//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -502,7 +474,6 @@ func pipe() (r int, w int, err error) {
func libc_pipe_trampoline()
-//go:linkname libc_pipe libc_pipe
//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -528,7 +499,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o
func libc_getxattr_trampoline()
-//go:linkname libc_getxattr libc_getxattr
//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -549,7 +519,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio
func libc_fgetxattr_trampoline()
-//go:linkname libc_fgetxattr libc_fgetxattr
//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -574,7 +543,6 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o
func libc_setxattr_trampoline()
-//go:linkname libc_setxattr libc_setxattr
//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -594,7 +562,6 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio
func libc_fsetxattr_trampoline()
-//go:linkname libc_fsetxattr libc_fsetxattr
//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -619,7 +586,6 @@ func removexattr(path string, attr string, options int) (err error) {
func libc_removexattr_trampoline()
-//go:linkname libc_removexattr libc_removexattr
//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -639,7 +605,6 @@ func fremovexattr(fd int, attr string, options int) (err error) {
func libc_fremovexattr_trampoline()
-//go:linkname libc_fremovexattr libc_fremovexattr
//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -660,7 +625,6 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro
func libc_listxattr_trampoline()
-//go:linkname libc_listxattr libc_listxattr
//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -676,7 +640,6 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) {
func libc_flistxattr_trampoline()
-//go:linkname libc_flistxattr libc_flistxattr
//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -691,7 +654,6 @@ func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp
func libc_setattrlist_trampoline()
-//go:linkname libc_setattrlist libc_setattrlist
//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -707,7 +669,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
func libc_fcntl_trampoline()
-//go:linkname libc_fcntl libc_fcntl
//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -722,7 +683,6 @@ func kill(pid int, signum int, posix int) (err error) {
func libc_kill_trampoline()
-//go:linkname libc_kill libc_kill
//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -737,7 +697,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
func libc_ioctl_trampoline()
-//go:linkname libc_ioctl libc_ioctl
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -758,7 +717,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
func libc_sysctl_trampoline()
-//go:linkname libc_sysctl libc_sysctl
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -773,7 +731,6 @@ func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer
func libc_sendfile_trampoline()
-//go:linkname libc_sendfile libc_sendfile
//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -793,7 +750,6 @@ func Access(path string, mode uint32) (err error) {
func libc_access_trampoline()
-//go:linkname libc_access libc_access
//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -808,7 +764,6 @@ func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
func libc_adjtime_trampoline()
-//go:linkname libc_adjtime libc_adjtime
//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -828,7 +783,6 @@ func Chdir(path string) (err error) {
func libc_chdir_trampoline()
-//go:linkname libc_chdir libc_chdir
//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -848,7 +802,6 @@ func Chflags(path string, flags int) (err error) {
func libc_chflags_trampoline()
-//go:linkname libc_chflags libc_chflags
//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -868,7 +821,6 @@ func Chmod(path string, mode uint32) (err error) {
func libc_chmod_trampoline()
-//go:linkname libc_chmod libc_chmod
//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -888,7 +840,6 @@ func Chown(path string, uid int, gid int) (err error) {
func libc_chown_trampoline()
-//go:linkname libc_chown libc_chown
//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -908,7 +859,6 @@ func Chroot(path string) (err error) {
func libc_chroot_trampoline()
-//go:linkname libc_chroot libc_chroot
//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -923,7 +873,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
func libc_clock_gettime_trampoline()
-//go:linkname libc_clock_gettime libc_clock_gettime
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -938,7 +887,6 @@ func Close(fd int) (err error) {
func libc_close_trampoline()
-//go:linkname libc_close libc_close
//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -963,7 +911,6 @@ func Clonefile(src string, dst string, flags int) (err error) {
func libc_clonefile_trampoline()
-//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -988,7 +935,6 @@ func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int)
func libc_clonefileat_trampoline()
-//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1004,7 +950,6 @@ func Dup(fd int) (nfd int, err error) {
func libc_dup_trampoline()
-//go:linkname libc_dup libc_dup
//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1019,7 +964,6 @@ func Dup2(from int, to int) (err error) {
func libc_dup2_trampoline()
-//go:linkname libc_dup2 libc_dup2
//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1044,7 +988,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
func libc_exchangedata_trampoline()
-//go:linkname libc_exchangedata libc_exchangedata
//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1056,7 +999,6 @@ func Exit(code int) {
func libc_exit_trampoline()
-//go:linkname libc_exit libc_exit
//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1076,7 +1018,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_faccessat_trampoline()
-//go:linkname libc_faccessat libc_faccessat
//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1091,7 +1032,6 @@ func Fchdir(fd int) (err error) {
func libc_fchdir_trampoline()
-//go:linkname libc_fchdir libc_fchdir
//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1106,7 +1046,6 @@ func Fchflags(fd int, flags int) (err error) {
func libc_fchflags_trampoline()
-//go:linkname libc_fchflags libc_fchflags
//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1121,7 +1060,6 @@ func Fchmod(fd int, mode uint32) (err error) {
func libc_fchmod_trampoline()
-//go:linkname libc_fchmod libc_fchmod
//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1141,7 +1079,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_fchmodat_trampoline()
-//go:linkname libc_fchmodat libc_fchmodat
//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1156,7 +1093,6 @@ func Fchown(fd int, uid int, gid int) (err error) {
func libc_fchown_trampoline()
-//go:linkname libc_fchown libc_fchown
//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1176,7 +1112,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
func libc_fchownat_trampoline()
-//go:linkname libc_fchownat libc_fchownat
//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1196,7 +1131,6 @@ func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
func libc_fclonefileat_trampoline()
-//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1211,7 +1145,6 @@ func Flock(fd int, how int) (err error) {
func libc_flock_trampoline()
-//go:linkname libc_flock libc_flock
//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1227,7 +1160,6 @@ func Fpathconf(fd int, name int) (val int, err error) {
func libc_fpathconf_trampoline()
-//go:linkname libc_fpathconf libc_fpathconf
//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1242,7 +1174,6 @@ func Fsync(fd int) (err error) {
func libc_fsync_trampoline()
-//go:linkname libc_fsync libc_fsync
//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1257,7 +1188,6 @@ func Ftruncate(fd int, length int64) (err error) {
func libc_ftruncate_trampoline()
-//go:linkname libc_ftruncate libc_ftruncate
//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1279,7 +1209,6 @@ func Getcwd(buf []byte) (n int, err error) {
func libc_getcwd_trampoline()
-//go:linkname libc_getcwd libc_getcwd
//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1292,7 +1221,6 @@ func Getdtablesize() (size int) {
func libc_getdtablesize_trampoline()
-//go:linkname libc_getdtablesize libc_getdtablesize
//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1305,7 +1233,6 @@ func Getegid() (egid int) {
func libc_getegid_trampoline()
-//go:linkname libc_getegid libc_getegid
//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1318,7 +1245,6 @@ func Geteuid() (uid int) {
func libc_geteuid_trampoline()
-//go:linkname libc_geteuid libc_geteuid
//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1331,7 +1257,6 @@ func Getgid() (gid int) {
func libc_getgid_trampoline()
-//go:linkname libc_getgid libc_getgid
//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1347,7 +1272,6 @@ func Getpgid(pid int) (pgid int, err error) {
func libc_getpgid_trampoline()
-//go:linkname libc_getpgid libc_getpgid
//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1360,7 +1284,6 @@ func Getpgrp() (pgrp int) {
func libc_getpgrp_trampoline()
-//go:linkname libc_getpgrp libc_getpgrp
//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1373,7 +1296,6 @@ func Getpid() (pid int) {
func libc_getpid_trampoline()
-//go:linkname libc_getpid libc_getpid
//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1386,7 +1308,6 @@ func Getppid() (ppid int) {
func libc_getppid_trampoline()
-//go:linkname libc_getppid libc_getppid
//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1402,7 +1323,6 @@ func Getpriority(which int, who int) (prio int, err error) {
func libc_getpriority_trampoline()
-//go:linkname libc_getpriority libc_getpriority
//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1417,7 +1337,6 @@ func Getrlimit(which int, lim *Rlimit) (err error) {
func libc_getrlimit_trampoline()
-//go:linkname libc_getrlimit libc_getrlimit
//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1432,7 +1351,6 @@ func Getrusage(who int, rusage *Rusage) (err error) {
func libc_getrusage_trampoline()
-//go:linkname libc_getrusage libc_getrusage
//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1448,7 +1366,6 @@ func Getsid(pid int) (sid int, err error) {
func libc_getsid_trampoline()
-//go:linkname libc_getsid libc_getsid
//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1463,7 +1380,6 @@ func Gettimeofday(tp *Timeval) (err error) {
func libc_gettimeofday_trampoline()
-//go:linkname libc_gettimeofday libc_gettimeofday
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1476,7 +1392,6 @@ func Getuid() (uid int) {
func libc_getuid_trampoline()
-//go:linkname libc_getuid libc_getuid
//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1489,7 +1404,6 @@ func Issetugid() (tainted bool) {
func libc_issetugid_trampoline()
-//go:linkname libc_issetugid libc_issetugid
//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1505,7 +1419,6 @@ func Kqueue() (fd int, err error) {
func libc_kqueue_trampoline()
-//go:linkname libc_kqueue libc_kqueue
//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1525,7 +1438,6 @@ func Lchown(path string, uid int, gid int) (err error) {
func libc_lchown_trampoline()
-//go:linkname libc_lchown libc_lchown
//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1550,7 +1462,6 @@ func Link(path string, link string) (err error) {
func libc_link_trampoline()
-//go:linkname libc_link libc_link
//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1575,7 +1486,6 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er
func libc_linkat_trampoline()
-//go:linkname libc_linkat libc_linkat
//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1590,7 +1500,6 @@ func Listen(s int, backlog int) (err error) {
func libc_listen_trampoline()
-//go:linkname libc_listen libc_listen
//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1610,7 +1519,6 @@ func Mkdir(path string, mode uint32) (err error) {
func libc_mkdir_trampoline()
-//go:linkname libc_mkdir libc_mkdir
//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1630,7 +1538,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
func libc_mkdirat_trampoline()
-//go:linkname libc_mkdirat libc_mkdirat
//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1650,7 +1557,6 @@ func Mkfifo(path string, mode uint32) (err error) {
func libc_mkfifo_trampoline()
-//go:linkname libc_mkfifo libc_mkfifo
//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1670,7 +1576,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
func libc_mknod_trampoline()
-//go:linkname libc_mknod libc_mknod
//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1691,7 +1596,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
func libc_open_trampoline()
-//go:linkname libc_open libc_open
//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1712,7 +1616,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
func libc_openat_trampoline()
-//go:linkname libc_openat libc_openat
//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1733,7 +1636,6 @@ func Pathconf(path string, name int) (val int, err error) {
func libc_pathconf_trampoline()
-//go:linkname libc_pathconf libc_pathconf
//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1755,7 +1657,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) {
func libc_pread_trampoline()
-//go:linkname libc_pread libc_pread
//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1777,7 +1678,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
func libc_pwrite_trampoline()
-//go:linkname libc_pwrite libc_pwrite
//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1799,7 +1699,6 @@ func read(fd int, p []byte) (n int, err error) {
func libc_read_trampoline()
-//go:linkname libc_read libc_read
//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1826,7 +1725,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
func libc_readlink_trampoline()
-//go:linkname libc_readlink libc_readlink
//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1853,7 +1751,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
func libc_readlinkat_trampoline()
-//go:linkname libc_readlinkat libc_readlinkat
//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1878,7 +1775,6 @@ func Rename(from string, to string) (err error) {
func libc_rename_trampoline()
-//go:linkname libc_rename libc_rename
//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1903,7 +1799,6 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) {
func libc_renameat_trampoline()
-//go:linkname libc_renameat libc_renameat
//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1923,7 +1818,6 @@ func Revoke(path string) (err error) {
func libc_revoke_trampoline()
-//go:linkname libc_revoke libc_revoke
//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1943,7 +1837,6 @@ func Rmdir(path string) (err error) {
func libc_rmdir_trampoline()
-//go:linkname libc_rmdir libc_rmdir
//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1959,7 +1852,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
func libc_lseek_trampoline()
-//go:linkname libc_lseek libc_lseek
//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1975,7 +1867,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
func libc_select_trampoline()
-//go:linkname libc_select libc_select
//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1990,7 +1881,6 @@ func Setegid(egid int) (err error) {
func libc_setegid_trampoline()
-//go:linkname libc_setegid libc_setegid
//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2005,7 +1895,6 @@ func Seteuid(euid int) (err error) {
func libc_seteuid_trampoline()
-//go:linkname libc_seteuid libc_seteuid
//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2020,7 +1909,6 @@ func Setgid(gid int) (err error) {
func libc_setgid_trampoline()
-//go:linkname libc_setgid libc_setgid
//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2040,7 +1928,6 @@ func Setlogin(name string) (err error) {
func libc_setlogin_trampoline()
-//go:linkname libc_setlogin libc_setlogin
//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2055,7 +1942,6 @@ func Setpgid(pid int, pgid int) (err error) {
func libc_setpgid_trampoline()
-//go:linkname libc_setpgid libc_setpgid
//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2070,7 +1956,6 @@ func Setpriority(which int, who int, prio int) (err error) {
func libc_setpriority_trampoline()
-//go:linkname libc_setpriority libc_setpriority
//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2085,7 +1970,6 @@ func Setprivexec(flag int) (err error) {
func libc_setprivexec_trampoline()
-//go:linkname libc_setprivexec libc_setprivexec
//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2100,7 +1984,6 @@ func Setregid(rgid int, egid int) (err error) {
func libc_setregid_trampoline()
-//go:linkname libc_setregid libc_setregid
//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2115,7 +1998,6 @@ func Setreuid(ruid int, euid int) (err error) {
func libc_setreuid_trampoline()
-//go:linkname libc_setreuid libc_setreuid
//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2130,7 +2012,6 @@ func Setrlimit(which int, lim *Rlimit) (err error) {
func libc_setrlimit_trampoline()
-//go:linkname libc_setrlimit libc_setrlimit
//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2146,7 +2027,6 @@ func Setsid() (pid int, err error) {
func libc_setsid_trampoline()
-//go:linkname libc_setsid libc_setsid
//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2161,7 +2041,6 @@ func Settimeofday(tp *Timeval) (err error) {
func libc_settimeofday_trampoline()
-//go:linkname libc_settimeofday libc_settimeofday
//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2176,7 +2055,6 @@ func Setuid(uid int) (err error) {
func libc_setuid_trampoline()
-//go:linkname libc_setuid libc_setuid
//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2201,7 +2079,6 @@ func Symlink(path string, link string) (err error) {
func libc_symlink_trampoline()
-//go:linkname libc_symlink libc_symlink
//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2226,7 +2103,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
func libc_symlinkat_trampoline()
-//go:linkname libc_symlinkat libc_symlinkat
//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2241,7 +2117,6 @@ func Sync() (err error) {
func libc_sync_trampoline()
-//go:linkname libc_sync libc_sync
//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2261,7 +2136,6 @@ func Truncate(path string, length int64) (err error) {
func libc_truncate_trampoline()
-//go:linkname libc_truncate libc_truncate
//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2274,7 +2148,6 @@ func Umask(newmask int) (oldmask int) {
func libc_umask_trampoline()
-//go:linkname libc_umask libc_umask
//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2294,7 +2167,6 @@ func Undelete(path string) (err error) {
func libc_undelete_trampoline()
-//go:linkname libc_undelete libc_undelete
//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2314,7 +2186,6 @@ func Unlink(path string) (err error) {
func libc_unlink_trampoline()
-//go:linkname libc_unlink libc_unlink
//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2334,7 +2205,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
func libc_unlinkat_trampoline()
-//go:linkname libc_unlinkat libc_unlinkat
//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2354,7 +2224,6 @@ func Unmount(path string, flags int) (err error) {
func libc_unmount_trampoline()
-//go:linkname libc_unmount libc_unmount
//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2376,7 +2245,6 @@ func write(fd int, p []byte) (n int, err error) {
func libc_write_trampoline()
-//go:linkname libc_write libc_write
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2392,7 +2260,6 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (
func libc_mmap_trampoline()
-//go:linkname libc_mmap libc_mmap
//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2407,7 +2274,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
func libc_munmap_trampoline()
-//go:linkname libc_munmap libc_munmap
//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2444,7 +2310,6 @@ func Fstat(fd int, stat *Stat_t) (err error) {
func libc_fstat64_trampoline()
-//go:linkname libc_fstat64 libc_fstat64
//go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2464,7 +2329,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
func libc_fstatat64_trampoline()
-//go:linkname libc_fstatat64 libc_fstatat64
//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2479,7 +2343,6 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) {
func libc_fstatfs64_trampoline()
-//go:linkname libc_fstatfs64 libc_fstatfs64
//go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2495,7 +2358,6 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) {
func libc_getfsstat64_trampoline()
-//go:linkname libc_getfsstat64 libc_getfsstat64
//go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2515,7 +2377,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
func libc_lstat64_trampoline()
-//go:linkname libc_lstat64 libc_lstat64
//go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2530,7 +2391,6 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
func libc_ptrace_trampoline()
-//go:linkname libc_ptrace libc_ptrace
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2550,7 +2410,6 @@ func Stat(path string, stat *Stat_t) (err error) {
func libc_stat64_trampoline()
-//go:linkname libc_stat64 libc_stat64
//go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2570,5 +2429,4 @@ func Statfs(path string, stat *Statfs_t) (err error) {
func libc_statfs64_trampoline()
-//go:linkname libc_statfs64 libc_statfs64
//go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go
index 314042a9d4..8882623613 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go
@@ -24,7 +24,6 @@ func closedir(dir uintptr) (err error) {
func libc_closedir_trampoline()
-//go:linkname libc_closedir libc_closedir
//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -37,5 +36,4 @@ func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) {
func libc_readdir_r_trampoline()
-//go:linkname libc_readdir_r libc_readdir_r
//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
index 889c14059e..2daf0bd628 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
@@ -25,7 +25,6 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
func libc_getgroups_trampoline()
-//go:linkname libc_getgroups libc_getgroups
//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -40,7 +39,6 @@ func setgroups(ngid int, gid *_Gid_t) (err error) {
func libc_setgroups_trampoline()
-//go:linkname libc_setgroups libc_setgroups
//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -56,7 +54,6 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
func libc_wait4_trampoline()
-//go:linkname libc_wait4 libc_wait4
//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -72,7 +69,6 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
func libc_accept_trampoline()
-//go:linkname libc_accept libc_accept
//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -87,7 +83,6 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_bind_trampoline()
-//go:linkname libc_bind libc_bind
//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -102,7 +97,6 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_connect_trampoline()
-//go:linkname libc_connect libc_connect
//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -118,7 +112,6 @@ func socket(domain int, typ int, proto int) (fd int, err error) {
func libc_socket_trampoline()
-//go:linkname libc_socket libc_socket
//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -133,7 +126,6 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen
func libc_getsockopt_trampoline()
-//go:linkname libc_getsockopt libc_getsockopt
//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -148,7 +140,6 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr)
func libc_setsockopt_trampoline()
-//go:linkname libc_setsockopt libc_setsockopt
//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -163,7 +154,6 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getpeername_trampoline()
-//go:linkname libc_getpeername libc_getpeername
//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -178,7 +168,6 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getsockname_trampoline()
-//go:linkname libc_getsockname libc_getsockname
//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -193,7 +182,6 @@ func Shutdown(s int, how int) (err error) {
func libc_shutdown_trampoline()
-//go:linkname libc_shutdown libc_shutdown
//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -208,7 +196,6 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
func libc_socketpair_trampoline()
-//go:linkname libc_socketpair libc_socketpair
//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -230,7 +217,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl
func libc_recvfrom_trampoline()
-//go:linkname libc_recvfrom libc_recvfrom
//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -251,7 +237,6 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (
func libc_sendto_trampoline()
-//go:linkname libc_sendto libc_sendto
//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -267,7 +252,6 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_recvmsg_trampoline()
-//go:linkname libc_recvmsg libc_recvmsg
//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -283,7 +267,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_sendmsg_trampoline()
-//go:linkname libc_sendmsg libc_sendmsg
//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -299,7 +282,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne
func libc_kevent_trampoline()
-//go:linkname libc_kevent libc_kevent
//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -319,7 +301,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
func libc_utimes_trampoline()
-//go:linkname libc_utimes libc_utimes
//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -334,7 +315,6 @@ func futimes(fd int, timeval *[2]Timeval) (err error) {
func libc_futimes_trampoline()
-//go:linkname libc_futimes libc_futimes
//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -350,7 +330,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
func libc_poll_trampoline()
-//go:linkname libc_poll libc_poll
//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -371,7 +350,6 @@ func Madvise(b []byte, behav int) (err error) {
func libc_madvise_trampoline()
-//go:linkname libc_madvise libc_madvise
//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -392,7 +370,6 @@ func Mlock(b []byte) (err error) {
func libc_mlock_trampoline()
-//go:linkname libc_mlock libc_mlock
//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -407,7 +384,6 @@ func Mlockall(flags int) (err error) {
func libc_mlockall_trampoline()
-//go:linkname libc_mlockall libc_mlockall
//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -428,7 +404,6 @@ func Mprotect(b []byte, prot int) (err error) {
func libc_mprotect_trampoline()
-//go:linkname libc_mprotect libc_mprotect
//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -449,7 +424,6 @@ func Msync(b []byte, flags int) (err error) {
func libc_msync_trampoline()
-//go:linkname libc_msync libc_msync
//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -470,7 +444,6 @@ func Munlock(b []byte) (err error) {
func libc_munlock_trampoline()
-//go:linkname libc_munlock libc_munlock
//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -485,7 +458,6 @@ func Munlockall() (err error) {
func libc_munlockall_trampoline()
-//go:linkname libc_munlockall libc_munlockall
//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -502,7 +474,6 @@ func pipe() (r int, w int, err error) {
func libc_pipe_trampoline()
-//go:linkname libc_pipe libc_pipe
//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -528,7 +499,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o
func libc_getxattr_trampoline()
-//go:linkname libc_getxattr libc_getxattr
//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -549,7 +519,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio
func libc_fgetxattr_trampoline()
-//go:linkname libc_fgetxattr libc_fgetxattr
//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -574,7 +543,6 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o
func libc_setxattr_trampoline()
-//go:linkname libc_setxattr libc_setxattr
//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -594,7 +562,6 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio
func libc_fsetxattr_trampoline()
-//go:linkname libc_fsetxattr libc_fsetxattr
//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -619,7 +586,6 @@ func removexattr(path string, attr string, options int) (err error) {
func libc_removexattr_trampoline()
-//go:linkname libc_removexattr libc_removexattr
//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -639,7 +605,6 @@ func fremovexattr(fd int, attr string, options int) (err error) {
func libc_fremovexattr_trampoline()
-//go:linkname libc_fremovexattr libc_fremovexattr
//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -660,7 +625,6 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro
func libc_listxattr_trampoline()
-//go:linkname libc_listxattr libc_listxattr
//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -676,7 +640,6 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) {
func libc_flistxattr_trampoline()
-//go:linkname libc_flistxattr libc_flistxattr
//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -691,7 +654,6 @@ func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp
func libc_setattrlist_trampoline()
-//go:linkname libc_setattrlist libc_setattrlist
//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -707,7 +669,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
func libc_fcntl_trampoline()
-//go:linkname libc_fcntl libc_fcntl
//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -722,7 +683,6 @@ func kill(pid int, signum int, posix int) (err error) {
func libc_kill_trampoline()
-//go:linkname libc_kill libc_kill
//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -737,7 +697,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
func libc_ioctl_trampoline()
-//go:linkname libc_ioctl libc_ioctl
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -758,7 +717,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
func libc_sysctl_trampoline()
-//go:linkname libc_sysctl libc_sysctl
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -773,7 +731,6 @@ func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer
func libc_sendfile_trampoline()
-//go:linkname libc_sendfile libc_sendfile
//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -793,7 +750,6 @@ func Access(path string, mode uint32) (err error) {
func libc_access_trampoline()
-//go:linkname libc_access libc_access
//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -808,7 +764,6 @@ func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
func libc_adjtime_trampoline()
-//go:linkname libc_adjtime libc_adjtime
//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -828,7 +783,6 @@ func Chdir(path string) (err error) {
func libc_chdir_trampoline()
-//go:linkname libc_chdir libc_chdir
//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -848,7 +802,6 @@ func Chflags(path string, flags int) (err error) {
func libc_chflags_trampoline()
-//go:linkname libc_chflags libc_chflags
//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -868,7 +821,6 @@ func Chmod(path string, mode uint32) (err error) {
func libc_chmod_trampoline()
-//go:linkname libc_chmod libc_chmod
//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -888,7 +840,6 @@ func Chown(path string, uid int, gid int) (err error) {
func libc_chown_trampoline()
-//go:linkname libc_chown libc_chown
//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -908,7 +859,6 @@ func Chroot(path string) (err error) {
func libc_chroot_trampoline()
-//go:linkname libc_chroot libc_chroot
//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -923,7 +873,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
func libc_clock_gettime_trampoline()
-//go:linkname libc_clock_gettime libc_clock_gettime
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -938,7 +887,6 @@ func Close(fd int) (err error) {
func libc_close_trampoline()
-//go:linkname libc_close libc_close
//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -963,7 +911,6 @@ func Clonefile(src string, dst string, flags int) (err error) {
func libc_clonefile_trampoline()
-//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -988,7 +935,6 @@ func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int)
func libc_clonefileat_trampoline()
-//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1004,7 +950,6 @@ func Dup(fd int) (nfd int, err error) {
func libc_dup_trampoline()
-//go:linkname libc_dup libc_dup
//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1019,7 +964,6 @@ func Dup2(from int, to int) (err error) {
func libc_dup2_trampoline()
-//go:linkname libc_dup2 libc_dup2
//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1044,7 +988,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
func libc_exchangedata_trampoline()
-//go:linkname libc_exchangedata libc_exchangedata
//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1056,7 +999,6 @@ func Exit(code int) {
func libc_exit_trampoline()
-//go:linkname libc_exit libc_exit
//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1076,7 +1018,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_faccessat_trampoline()
-//go:linkname libc_faccessat libc_faccessat
//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1091,7 +1032,6 @@ func Fchdir(fd int) (err error) {
func libc_fchdir_trampoline()
-//go:linkname libc_fchdir libc_fchdir
//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1106,7 +1046,6 @@ func Fchflags(fd int, flags int) (err error) {
func libc_fchflags_trampoline()
-//go:linkname libc_fchflags libc_fchflags
//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1121,7 +1060,6 @@ func Fchmod(fd int, mode uint32) (err error) {
func libc_fchmod_trampoline()
-//go:linkname libc_fchmod libc_fchmod
//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1141,7 +1079,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_fchmodat_trampoline()
-//go:linkname libc_fchmodat libc_fchmodat
//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1156,7 +1093,6 @@ func Fchown(fd int, uid int, gid int) (err error) {
func libc_fchown_trampoline()
-//go:linkname libc_fchown libc_fchown
//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1176,7 +1112,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
func libc_fchownat_trampoline()
-//go:linkname libc_fchownat libc_fchownat
//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1196,7 +1131,6 @@ func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
func libc_fclonefileat_trampoline()
-//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1211,7 +1145,6 @@ func Flock(fd int, how int) (err error) {
func libc_flock_trampoline()
-//go:linkname libc_flock libc_flock
//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1227,7 +1160,6 @@ func Fpathconf(fd int, name int) (val int, err error) {
func libc_fpathconf_trampoline()
-//go:linkname libc_fpathconf libc_fpathconf
//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1242,7 +1174,6 @@ func Fsync(fd int) (err error) {
func libc_fsync_trampoline()
-//go:linkname libc_fsync libc_fsync
//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1257,7 +1188,6 @@ func Ftruncate(fd int, length int64) (err error) {
func libc_ftruncate_trampoline()
-//go:linkname libc_ftruncate libc_ftruncate
//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1279,7 +1209,6 @@ func Getcwd(buf []byte) (n int, err error) {
func libc_getcwd_trampoline()
-//go:linkname libc_getcwd libc_getcwd
//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1292,7 +1221,6 @@ func Getdtablesize() (size int) {
func libc_getdtablesize_trampoline()
-//go:linkname libc_getdtablesize libc_getdtablesize
//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1305,7 +1233,6 @@ func Getegid() (egid int) {
func libc_getegid_trampoline()
-//go:linkname libc_getegid libc_getegid
//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1318,7 +1245,6 @@ func Geteuid() (uid int) {
func libc_geteuid_trampoline()
-//go:linkname libc_geteuid libc_geteuid
//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1331,7 +1257,6 @@ func Getgid() (gid int) {
func libc_getgid_trampoline()
-//go:linkname libc_getgid libc_getgid
//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1347,7 +1272,6 @@ func Getpgid(pid int) (pgid int, err error) {
func libc_getpgid_trampoline()
-//go:linkname libc_getpgid libc_getpgid
//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1360,7 +1284,6 @@ func Getpgrp() (pgrp int) {
func libc_getpgrp_trampoline()
-//go:linkname libc_getpgrp libc_getpgrp
//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1373,7 +1296,6 @@ func Getpid() (pid int) {
func libc_getpid_trampoline()
-//go:linkname libc_getpid libc_getpid
//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1386,7 +1308,6 @@ func Getppid() (ppid int) {
func libc_getppid_trampoline()
-//go:linkname libc_getppid libc_getppid
//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1402,7 +1323,6 @@ func Getpriority(which int, who int) (prio int, err error) {
func libc_getpriority_trampoline()
-//go:linkname libc_getpriority libc_getpriority
//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1417,7 +1337,6 @@ func Getrlimit(which int, lim *Rlimit) (err error) {
func libc_getrlimit_trampoline()
-//go:linkname libc_getrlimit libc_getrlimit
//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1432,7 +1351,6 @@ func Getrusage(who int, rusage *Rusage) (err error) {
func libc_getrusage_trampoline()
-//go:linkname libc_getrusage libc_getrusage
//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1448,7 +1366,6 @@ func Getsid(pid int) (sid int, err error) {
func libc_getsid_trampoline()
-//go:linkname libc_getsid libc_getsid
//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1463,7 +1380,6 @@ func Gettimeofday(tp *Timeval) (err error) {
func libc_gettimeofday_trampoline()
-//go:linkname libc_gettimeofday libc_gettimeofday
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1476,7 +1392,6 @@ func Getuid() (uid int) {
func libc_getuid_trampoline()
-//go:linkname libc_getuid libc_getuid
//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1489,7 +1404,6 @@ func Issetugid() (tainted bool) {
func libc_issetugid_trampoline()
-//go:linkname libc_issetugid libc_issetugid
//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1505,7 +1419,6 @@ func Kqueue() (fd int, err error) {
func libc_kqueue_trampoline()
-//go:linkname libc_kqueue libc_kqueue
//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1525,7 +1438,6 @@ func Lchown(path string, uid int, gid int) (err error) {
func libc_lchown_trampoline()
-//go:linkname libc_lchown libc_lchown
//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1550,7 +1462,6 @@ func Link(path string, link string) (err error) {
func libc_link_trampoline()
-//go:linkname libc_link libc_link
//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1575,7 +1486,6 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er
func libc_linkat_trampoline()
-//go:linkname libc_linkat libc_linkat
//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1590,7 +1500,6 @@ func Listen(s int, backlog int) (err error) {
func libc_listen_trampoline()
-//go:linkname libc_listen libc_listen
//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1610,7 +1519,6 @@ func Mkdir(path string, mode uint32) (err error) {
func libc_mkdir_trampoline()
-//go:linkname libc_mkdir libc_mkdir
//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1630,7 +1538,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
func libc_mkdirat_trampoline()
-//go:linkname libc_mkdirat libc_mkdirat
//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1650,7 +1557,6 @@ func Mkfifo(path string, mode uint32) (err error) {
func libc_mkfifo_trampoline()
-//go:linkname libc_mkfifo libc_mkfifo
//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1670,7 +1576,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
func libc_mknod_trampoline()
-//go:linkname libc_mknod libc_mknod
//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1691,7 +1596,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
func libc_open_trampoline()
-//go:linkname libc_open libc_open
//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1712,7 +1616,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
func libc_openat_trampoline()
-//go:linkname libc_openat libc_openat
//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1733,7 +1636,6 @@ func Pathconf(path string, name int) (val int, err error) {
func libc_pathconf_trampoline()
-//go:linkname libc_pathconf libc_pathconf
//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1755,7 +1657,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) {
func libc_pread_trampoline()
-//go:linkname libc_pread libc_pread
//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1777,7 +1678,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
func libc_pwrite_trampoline()
-//go:linkname libc_pwrite libc_pwrite
//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1799,7 +1699,6 @@ func read(fd int, p []byte) (n int, err error) {
func libc_read_trampoline()
-//go:linkname libc_read libc_read
//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1826,7 +1725,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
func libc_readlink_trampoline()
-//go:linkname libc_readlink libc_readlink
//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1853,7 +1751,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
func libc_readlinkat_trampoline()
-//go:linkname libc_readlinkat libc_readlinkat
//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1878,7 +1775,6 @@ func Rename(from string, to string) (err error) {
func libc_rename_trampoline()
-//go:linkname libc_rename libc_rename
//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1903,7 +1799,6 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) {
func libc_renameat_trampoline()
-//go:linkname libc_renameat libc_renameat
//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1923,7 +1818,6 @@ func Revoke(path string) (err error) {
func libc_revoke_trampoline()
-//go:linkname libc_revoke libc_revoke
//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1943,7 +1837,6 @@ func Rmdir(path string) (err error) {
func libc_rmdir_trampoline()
-//go:linkname libc_rmdir libc_rmdir
//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1959,7 +1852,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
func libc_lseek_trampoline()
-//go:linkname libc_lseek libc_lseek
//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1975,7 +1867,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
func libc_select_trampoline()
-//go:linkname libc_select libc_select
//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1990,7 +1881,6 @@ func Setegid(egid int) (err error) {
func libc_setegid_trampoline()
-//go:linkname libc_setegid libc_setegid
//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2005,7 +1895,6 @@ func Seteuid(euid int) (err error) {
func libc_seteuid_trampoline()
-//go:linkname libc_seteuid libc_seteuid
//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2020,7 +1909,6 @@ func Setgid(gid int) (err error) {
func libc_setgid_trampoline()
-//go:linkname libc_setgid libc_setgid
//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2040,7 +1928,6 @@ func Setlogin(name string) (err error) {
func libc_setlogin_trampoline()
-//go:linkname libc_setlogin libc_setlogin
//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2055,7 +1942,6 @@ func Setpgid(pid int, pgid int) (err error) {
func libc_setpgid_trampoline()
-//go:linkname libc_setpgid libc_setpgid
//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2070,7 +1956,6 @@ func Setpriority(which int, who int, prio int) (err error) {
func libc_setpriority_trampoline()
-//go:linkname libc_setpriority libc_setpriority
//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2085,7 +1970,6 @@ func Setprivexec(flag int) (err error) {
func libc_setprivexec_trampoline()
-//go:linkname libc_setprivexec libc_setprivexec
//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2100,7 +1984,6 @@ func Setregid(rgid int, egid int) (err error) {
func libc_setregid_trampoline()
-//go:linkname libc_setregid libc_setregid
//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2115,7 +1998,6 @@ func Setreuid(ruid int, euid int) (err error) {
func libc_setreuid_trampoline()
-//go:linkname libc_setreuid libc_setreuid
//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2130,7 +2012,6 @@ func Setrlimit(which int, lim *Rlimit) (err error) {
func libc_setrlimit_trampoline()
-//go:linkname libc_setrlimit libc_setrlimit
//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2146,7 +2027,6 @@ func Setsid() (pid int, err error) {
func libc_setsid_trampoline()
-//go:linkname libc_setsid libc_setsid
//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2161,7 +2041,6 @@ func Settimeofday(tp *Timeval) (err error) {
func libc_settimeofday_trampoline()
-//go:linkname libc_settimeofday libc_settimeofday
//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2176,7 +2055,6 @@ func Setuid(uid int) (err error) {
func libc_setuid_trampoline()
-//go:linkname libc_setuid libc_setuid
//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2201,7 +2079,6 @@ func Symlink(path string, link string) (err error) {
func libc_symlink_trampoline()
-//go:linkname libc_symlink libc_symlink
//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2226,7 +2103,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
func libc_symlinkat_trampoline()
-//go:linkname libc_symlinkat libc_symlinkat
//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2241,7 +2117,6 @@ func Sync() (err error) {
func libc_sync_trampoline()
-//go:linkname libc_sync libc_sync
//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2261,7 +2136,6 @@ func Truncate(path string, length int64) (err error) {
func libc_truncate_trampoline()
-//go:linkname libc_truncate libc_truncate
//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2274,7 +2148,6 @@ func Umask(newmask int) (oldmask int) {
func libc_umask_trampoline()
-//go:linkname libc_umask libc_umask
//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2294,7 +2167,6 @@ func Undelete(path string) (err error) {
func libc_undelete_trampoline()
-//go:linkname libc_undelete libc_undelete
//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2314,7 +2186,6 @@ func Unlink(path string) (err error) {
func libc_unlink_trampoline()
-//go:linkname libc_unlink libc_unlink
//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2334,7 +2205,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
func libc_unlinkat_trampoline()
-//go:linkname libc_unlinkat libc_unlinkat
//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2354,7 +2224,6 @@ func Unmount(path string, flags int) (err error) {
func libc_unmount_trampoline()
-//go:linkname libc_unmount libc_unmount
//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2376,7 +2245,6 @@ func write(fd int, p []byte) (n int, err error) {
func libc_write_trampoline()
-//go:linkname libc_write libc_write
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2392,7 +2260,6 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (
func libc_mmap_trampoline()
-//go:linkname libc_mmap libc_mmap
//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2407,7 +2274,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
func libc_munmap_trampoline()
-//go:linkname libc_munmap libc_munmap
//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2444,7 +2310,6 @@ func Fstat(fd int, stat *Stat_t) (err error) {
func libc_fstat64_trampoline()
-//go:linkname libc_fstat64 libc_fstat64
//go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2464,7 +2329,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
func libc_fstatat64_trampoline()
-//go:linkname libc_fstatat64 libc_fstatat64
//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2479,7 +2343,6 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) {
func libc_fstatfs64_trampoline()
-//go:linkname libc_fstatfs64 libc_fstatfs64
//go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2495,7 +2358,6 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) {
func libc_getfsstat64_trampoline()
-//go:linkname libc_getfsstat64 libc_getfsstat64
//go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2515,7 +2377,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
func libc_lstat64_trampoline()
-//go:linkname libc_lstat64 libc_lstat64
//go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2530,7 +2391,6 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
func libc_ptrace_trampoline()
-//go:linkname libc_ptrace libc_ptrace
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2550,7 +2410,6 @@ func Stat(path string, stat *Stat_t) (err error) {
func libc_stat64_trampoline()
-//go:linkname libc_stat64 libc_stat64
//go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2570,5 +2429,4 @@ func Statfs(path string, stat *Statfs_t) (err error) {
func libc_statfs64_trampoline()
-//go:linkname libc_statfs64 libc_statfs64
//go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go
index f519ce9afb..de4738fff8 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go
@@ -24,7 +24,6 @@ func closedir(dir uintptr) (err error) {
func libc_closedir_trampoline()
-//go:linkname libc_closedir libc_closedir
//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -37,5 +36,4 @@ func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) {
func libc_readdir_r_trampoline()
-//go:linkname libc_readdir_r libc_readdir_r
//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
index d6b5249c2f..8e79ad377b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
@@ -25,7 +25,6 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
func libc_getgroups_trampoline()
-//go:linkname libc_getgroups libc_getgroups
//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -40,7 +39,6 @@ func setgroups(ngid int, gid *_Gid_t) (err error) {
func libc_setgroups_trampoline()
-//go:linkname libc_setgroups libc_setgroups
//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -56,7 +54,6 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
func libc_wait4_trampoline()
-//go:linkname libc_wait4 libc_wait4
//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -72,7 +69,6 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
func libc_accept_trampoline()
-//go:linkname libc_accept libc_accept
//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -87,7 +83,6 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_bind_trampoline()
-//go:linkname libc_bind libc_bind
//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -102,7 +97,6 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_connect_trampoline()
-//go:linkname libc_connect libc_connect
//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -118,7 +112,6 @@ func socket(domain int, typ int, proto int) (fd int, err error) {
func libc_socket_trampoline()
-//go:linkname libc_socket libc_socket
//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -133,7 +126,6 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen
func libc_getsockopt_trampoline()
-//go:linkname libc_getsockopt libc_getsockopt
//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -148,7 +140,6 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr)
func libc_setsockopt_trampoline()
-//go:linkname libc_setsockopt libc_setsockopt
//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -163,7 +154,6 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getpeername_trampoline()
-//go:linkname libc_getpeername libc_getpeername
//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -178,7 +168,6 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getsockname_trampoline()
-//go:linkname libc_getsockname libc_getsockname
//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -193,7 +182,6 @@ func Shutdown(s int, how int) (err error) {
func libc_shutdown_trampoline()
-//go:linkname libc_shutdown libc_shutdown
//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -208,7 +196,6 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
func libc_socketpair_trampoline()
-//go:linkname libc_socketpair libc_socketpair
//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -230,7 +217,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl
func libc_recvfrom_trampoline()
-//go:linkname libc_recvfrom libc_recvfrom
//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -251,7 +237,6 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (
func libc_sendto_trampoline()
-//go:linkname libc_sendto libc_sendto
//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -267,7 +252,6 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_recvmsg_trampoline()
-//go:linkname libc_recvmsg libc_recvmsg
//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -283,7 +267,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_sendmsg_trampoline()
-//go:linkname libc_sendmsg libc_sendmsg
//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -299,7 +282,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne
func libc_kevent_trampoline()
-//go:linkname libc_kevent libc_kevent
//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -319,7 +301,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
func libc_utimes_trampoline()
-//go:linkname libc_utimes libc_utimes
//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -334,7 +315,6 @@ func futimes(fd int, timeval *[2]Timeval) (err error) {
func libc_futimes_trampoline()
-//go:linkname libc_futimes libc_futimes
//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -350,7 +330,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
func libc_poll_trampoline()
-//go:linkname libc_poll libc_poll
//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -371,7 +350,6 @@ func Madvise(b []byte, behav int) (err error) {
func libc_madvise_trampoline()
-//go:linkname libc_madvise libc_madvise
//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -392,7 +370,6 @@ func Mlock(b []byte) (err error) {
func libc_mlock_trampoline()
-//go:linkname libc_mlock libc_mlock
//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -407,7 +384,6 @@ func Mlockall(flags int) (err error) {
func libc_mlockall_trampoline()
-//go:linkname libc_mlockall libc_mlockall
//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -428,7 +404,6 @@ func Mprotect(b []byte, prot int) (err error) {
func libc_mprotect_trampoline()
-//go:linkname libc_mprotect libc_mprotect
//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -449,7 +424,6 @@ func Msync(b []byte, flags int) (err error) {
func libc_msync_trampoline()
-//go:linkname libc_msync libc_msync
//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -470,7 +444,6 @@ func Munlock(b []byte) (err error) {
func libc_munlock_trampoline()
-//go:linkname libc_munlock libc_munlock
//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -485,7 +458,6 @@ func Munlockall() (err error) {
func libc_munlockall_trampoline()
-//go:linkname libc_munlockall libc_munlockall
//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -502,7 +474,6 @@ func pipe() (r int, w int, err error) {
func libc_pipe_trampoline()
-//go:linkname libc_pipe libc_pipe
//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -528,7 +499,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o
func libc_getxattr_trampoline()
-//go:linkname libc_getxattr libc_getxattr
//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -549,7 +519,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio
func libc_fgetxattr_trampoline()
-//go:linkname libc_fgetxattr libc_fgetxattr
//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -574,7 +543,6 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o
func libc_setxattr_trampoline()
-//go:linkname libc_setxattr libc_setxattr
//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -594,7 +562,6 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio
func libc_fsetxattr_trampoline()
-//go:linkname libc_fsetxattr libc_fsetxattr
//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -619,7 +586,6 @@ func removexattr(path string, attr string, options int) (err error) {
func libc_removexattr_trampoline()
-//go:linkname libc_removexattr libc_removexattr
//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -639,7 +605,6 @@ func fremovexattr(fd int, attr string, options int) (err error) {
func libc_fremovexattr_trampoline()
-//go:linkname libc_fremovexattr libc_fremovexattr
//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -660,7 +625,6 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro
func libc_listxattr_trampoline()
-//go:linkname libc_listxattr libc_listxattr
//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -676,7 +640,6 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) {
func libc_flistxattr_trampoline()
-//go:linkname libc_flistxattr libc_flistxattr
//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -691,7 +654,6 @@ func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp
func libc_setattrlist_trampoline()
-//go:linkname libc_setattrlist libc_setattrlist
//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -707,7 +669,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
func libc_fcntl_trampoline()
-//go:linkname libc_fcntl libc_fcntl
//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -722,7 +683,6 @@ func kill(pid int, signum int, posix int) (err error) {
func libc_kill_trampoline()
-//go:linkname libc_kill libc_kill
//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -737,7 +697,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
func libc_ioctl_trampoline()
-//go:linkname libc_ioctl libc_ioctl
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -758,7 +717,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
func libc_sysctl_trampoline()
-//go:linkname libc_sysctl libc_sysctl
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -773,7 +731,6 @@ func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer
func libc_sendfile_trampoline()
-//go:linkname libc_sendfile libc_sendfile
//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -793,7 +750,6 @@ func Access(path string, mode uint32) (err error) {
func libc_access_trampoline()
-//go:linkname libc_access libc_access
//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -808,7 +764,6 @@ func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
func libc_adjtime_trampoline()
-//go:linkname libc_adjtime libc_adjtime
//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -828,7 +783,6 @@ func Chdir(path string) (err error) {
func libc_chdir_trampoline()
-//go:linkname libc_chdir libc_chdir
//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -848,7 +802,6 @@ func Chflags(path string, flags int) (err error) {
func libc_chflags_trampoline()
-//go:linkname libc_chflags libc_chflags
//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -868,7 +821,6 @@ func Chmod(path string, mode uint32) (err error) {
func libc_chmod_trampoline()
-//go:linkname libc_chmod libc_chmod
//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -888,7 +840,6 @@ func Chown(path string, uid int, gid int) (err error) {
func libc_chown_trampoline()
-//go:linkname libc_chown libc_chown
//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -908,7 +859,6 @@ func Chroot(path string) (err error) {
func libc_chroot_trampoline()
-//go:linkname libc_chroot libc_chroot
//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -923,7 +873,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
func libc_clock_gettime_trampoline()
-//go:linkname libc_clock_gettime libc_clock_gettime
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -938,7 +887,6 @@ func Close(fd int) (err error) {
func libc_close_trampoline()
-//go:linkname libc_close libc_close
//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -963,7 +911,6 @@ func Clonefile(src string, dst string, flags int) (err error) {
func libc_clonefile_trampoline()
-//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -988,7 +935,6 @@ func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int)
func libc_clonefileat_trampoline()
-//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1004,7 +950,6 @@ func Dup(fd int) (nfd int, err error) {
func libc_dup_trampoline()
-//go:linkname libc_dup libc_dup
//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1019,7 +964,6 @@ func Dup2(from int, to int) (err error) {
func libc_dup2_trampoline()
-//go:linkname libc_dup2 libc_dup2
//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1044,7 +988,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
func libc_exchangedata_trampoline()
-//go:linkname libc_exchangedata libc_exchangedata
//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1056,7 +999,6 @@ func Exit(code int) {
func libc_exit_trampoline()
-//go:linkname libc_exit libc_exit
//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1076,7 +1018,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_faccessat_trampoline()
-//go:linkname libc_faccessat libc_faccessat
//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1091,7 +1032,6 @@ func Fchdir(fd int) (err error) {
func libc_fchdir_trampoline()
-//go:linkname libc_fchdir libc_fchdir
//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1106,7 +1046,6 @@ func Fchflags(fd int, flags int) (err error) {
func libc_fchflags_trampoline()
-//go:linkname libc_fchflags libc_fchflags
//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1121,7 +1060,6 @@ func Fchmod(fd int, mode uint32) (err error) {
func libc_fchmod_trampoline()
-//go:linkname libc_fchmod libc_fchmod
//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1141,7 +1079,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_fchmodat_trampoline()
-//go:linkname libc_fchmodat libc_fchmodat
//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1156,7 +1093,6 @@ func Fchown(fd int, uid int, gid int) (err error) {
func libc_fchown_trampoline()
-//go:linkname libc_fchown libc_fchown
//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1176,7 +1112,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
func libc_fchownat_trampoline()
-//go:linkname libc_fchownat libc_fchownat
//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1196,7 +1131,6 @@ func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
func libc_fclonefileat_trampoline()
-//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1211,7 +1145,6 @@ func Flock(fd int, how int) (err error) {
func libc_flock_trampoline()
-//go:linkname libc_flock libc_flock
//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1227,7 +1160,6 @@ func Fpathconf(fd int, name int) (val int, err error) {
func libc_fpathconf_trampoline()
-//go:linkname libc_fpathconf libc_fpathconf
//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1242,7 +1174,6 @@ func Fsync(fd int) (err error) {
func libc_fsync_trampoline()
-//go:linkname libc_fsync libc_fsync
//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1257,7 +1188,6 @@ func Ftruncate(fd int, length int64) (err error) {
func libc_ftruncate_trampoline()
-//go:linkname libc_ftruncate libc_ftruncate
//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1279,7 +1209,6 @@ func Getcwd(buf []byte) (n int, err error) {
func libc_getcwd_trampoline()
-//go:linkname libc_getcwd libc_getcwd
//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1292,7 +1221,6 @@ func Getdtablesize() (size int) {
func libc_getdtablesize_trampoline()
-//go:linkname libc_getdtablesize libc_getdtablesize
//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1305,7 +1233,6 @@ func Getegid() (egid int) {
func libc_getegid_trampoline()
-//go:linkname libc_getegid libc_getegid
//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1318,7 +1245,6 @@ func Geteuid() (uid int) {
func libc_geteuid_trampoline()
-//go:linkname libc_geteuid libc_geteuid
//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1331,7 +1257,6 @@ func Getgid() (gid int) {
func libc_getgid_trampoline()
-//go:linkname libc_getgid libc_getgid
//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1347,7 +1272,6 @@ func Getpgid(pid int) (pgid int, err error) {
func libc_getpgid_trampoline()
-//go:linkname libc_getpgid libc_getpgid
//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1360,7 +1284,6 @@ func Getpgrp() (pgrp int) {
func libc_getpgrp_trampoline()
-//go:linkname libc_getpgrp libc_getpgrp
//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1373,7 +1296,6 @@ func Getpid() (pid int) {
func libc_getpid_trampoline()
-//go:linkname libc_getpid libc_getpid
//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1386,7 +1308,6 @@ func Getppid() (ppid int) {
func libc_getppid_trampoline()
-//go:linkname libc_getppid libc_getppid
//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1402,7 +1323,6 @@ func Getpriority(which int, who int) (prio int, err error) {
func libc_getpriority_trampoline()
-//go:linkname libc_getpriority libc_getpriority
//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1417,7 +1337,6 @@ func Getrlimit(which int, lim *Rlimit) (err error) {
func libc_getrlimit_trampoline()
-//go:linkname libc_getrlimit libc_getrlimit
//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1432,7 +1351,6 @@ func Getrusage(who int, rusage *Rusage) (err error) {
func libc_getrusage_trampoline()
-//go:linkname libc_getrusage libc_getrusage
//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1448,7 +1366,6 @@ func Getsid(pid int) (sid int, err error) {
func libc_getsid_trampoline()
-//go:linkname libc_getsid libc_getsid
//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1463,7 +1380,6 @@ func Gettimeofday(tp *Timeval) (err error) {
func libc_gettimeofday_trampoline()
-//go:linkname libc_gettimeofday libc_gettimeofday
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1476,7 +1392,6 @@ func Getuid() (uid int) {
func libc_getuid_trampoline()
-//go:linkname libc_getuid libc_getuid
//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1489,7 +1404,6 @@ func Issetugid() (tainted bool) {
func libc_issetugid_trampoline()
-//go:linkname libc_issetugid libc_issetugid
//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1505,7 +1419,6 @@ func Kqueue() (fd int, err error) {
func libc_kqueue_trampoline()
-//go:linkname libc_kqueue libc_kqueue
//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1525,7 +1438,6 @@ func Lchown(path string, uid int, gid int) (err error) {
func libc_lchown_trampoline()
-//go:linkname libc_lchown libc_lchown
//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1550,7 +1462,6 @@ func Link(path string, link string) (err error) {
func libc_link_trampoline()
-//go:linkname libc_link libc_link
//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1575,7 +1486,6 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er
func libc_linkat_trampoline()
-//go:linkname libc_linkat libc_linkat
//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1590,7 +1500,6 @@ func Listen(s int, backlog int) (err error) {
func libc_listen_trampoline()
-//go:linkname libc_listen libc_listen
//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1610,7 +1519,6 @@ func Mkdir(path string, mode uint32) (err error) {
func libc_mkdir_trampoline()
-//go:linkname libc_mkdir libc_mkdir
//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1630,7 +1538,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
func libc_mkdirat_trampoline()
-//go:linkname libc_mkdirat libc_mkdirat
//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1650,7 +1557,6 @@ func Mkfifo(path string, mode uint32) (err error) {
func libc_mkfifo_trampoline()
-//go:linkname libc_mkfifo libc_mkfifo
//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1670,7 +1576,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
func libc_mknod_trampoline()
-//go:linkname libc_mknod libc_mknod
//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1691,7 +1596,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
func libc_open_trampoline()
-//go:linkname libc_open libc_open
//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1712,7 +1616,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
func libc_openat_trampoline()
-//go:linkname libc_openat libc_openat
//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1733,7 +1636,6 @@ func Pathconf(path string, name int) (val int, err error) {
func libc_pathconf_trampoline()
-//go:linkname libc_pathconf libc_pathconf
//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1755,7 +1657,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) {
func libc_pread_trampoline()
-//go:linkname libc_pread libc_pread
//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1777,7 +1678,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
func libc_pwrite_trampoline()
-//go:linkname libc_pwrite libc_pwrite
//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1799,7 +1699,6 @@ func read(fd int, p []byte) (n int, err error) {
func libc_read_trampoline()
-//go:linkname libc_read libc_read
//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1826,7 +1725,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
func libc_readlink_trampoline()
-//go:linkname libc_readlink libc_readlink
//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1853,7 +1751,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
func libc_readlinkat_trampoline()
-//go:linkname libc_readlinkat libc_readlinkat
//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1878,7 +1775,6 @@ func Rename(from string, to string) (err error) {
func libc_rename_trampoline()
-//go:linkname libc_rename libc_rename
//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1903,7 +1799,6 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) {
func libc_renameat_trampoline()
-//go:linkname libc_renameat libc_renameat
//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1923,7 +1818,6 @@ func Revoke(path string) (err error) {
func libc_revoke_trampoline()
-//go:linkname libc_revoke libc_revoke
//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1943,7 +1837,6 @@ func Rmdir(path string) (err error) {
func libc_rmdir_trampoline()
-//go:linkname libc_rmdir libc_rmdir
//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1959,7 +1852,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
func libc_lseek_trampoline()
-//go:linkname libc_lseek libc_lseek
//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1975,7 +1867,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
func libc_select_trampoline()
-//go:linkname libc_select libc_select
//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1990,7 +1881,6 @@ func Setegid(egid int) (err error) {
func libc_setegid_trampoline()
-//go:linkname libc_setegid libc_setegid
//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2005,7 +1895,6 @@ func Seteuid(euid int) (err error) {
func libc_seteuid_trampoline()
-//go:linkname libc_seteuid libc_seteuid
//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2020,7 +1909,6 @@ func Setgid(gid int) (err error) {
func libc_setgid_trampoline()
-//go:linkname libc_setgid libc_setgid
//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2040,7 +1928,6 @@ func Setlogin(name string) (err error) {
func libc_setlogin_trampoline()
-//go:linkname libc_setlogin libc_setlogin
//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2055,7 +1942,6 @@ func Setpgid(pid int, pgid int) (err error) {
func libc_setpgid_trampoline()
-//go:linkname libc_setpgid libc_setpgid
//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2070,7 +1956,6 @@ func Setpriority(which int, who int, prio int) (err error) {
func libc_setpriority_trampoline()
-//go:linkname libc_setpriority libc_setpriority
//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2085,7 +1970,6 @@ func Setprivexec(flag int) (err error) {
func libc_setprivexec_trampoline()
-//go:linkname libc_setprivexec libc_setprivexec
//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2100,7 +1984,6 @@ func Setregid(rgid int, egid int) (err error) {
func libc_setregid_trampoline()
-//go:linkname libc_setregid libc_setregid
//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2115,7 +1998,6 @@ func Setreuid(ruid int, euid int) (err error) {
func libc_setreuid_trampoline()
-//go:linkname libc_setreuid libc_setreuid
//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2130,7 +2012,6 @@ func Setrlimit(which int, lim *Rlimit) (err error) {
func libc_setrlimit_trampoline()
-//go:linkname libc_setrlimit libc_setrlimit
//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2146,7 +2027,6 @@ func Setsid() (pid int, err error) {
func libc_setsid_trampoline()
-//go:linkname libc_setsid libc_setsid
//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2161,7 +2041,6 @@ func Settimeofday(tp *Timeval) (err error) {
func libc_settimeofday_trampoline()
-//go:linkname libc_settimeofday libc_settimeofday
//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2176,7 +2055,6 @@ func Setuid(uid int) (err error) {
func libc_setuid_trampoline()
-//go:linkname libc_setuid libc_setuid
//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2201,7 +2079,6 @@ func Symlink(path string, link string) (err error) {
func libc_symlink_trampoline()
-//go:linkname libc_symlink libc_symlink
//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2226,7 +2103,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
func libc_symlinkat_trampoline()
-//go:linkname libc_symlinkat libc_symlinkat
//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2241,7 +2117,6 @@ func Sync() (err error) {
func libc_sync_trampoline()
-//go:linkname libc_sync libc_sync
//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2261,7 +2136,6 @@ func Truncate(path string, length int64) (err error) {
func libc_truncate_trampoline()
-//go:linkname libc_truncate libc_truncate
//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2274,7 +2148,6 @@ func Umask(newmask int) (oldmask int) {
func libc_umask_trampoline()
-//go:linkname libc_umask libc_umask
//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2294,7 +2167,6 @@ func Undelete(path string) (err error) {
func libc_undelete_trampoline()
-//go:linkname libc_undelete libc_undelete
//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2314,7 +2186,6 @@ func Unlink(path string) (err error) {
func libc_unlink_trampoline()
-//go:linkname libc_unlink libc_unlink
//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2334,7 +2205,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
func libc_unlinkat_trampoline()
-//go:linkname libc_unlinkat libc_unlinkat
//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2354,7 +2224,6 @@ func Unmount(path string, flags int) (err error) {
func libc_unmount_trampoline()
-//go:linkname libc_unmount libc_unmount
//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2376,7 +2245,6 @@ func write(fd int, p []byte) (n int, err error) {
func libc_write_trampoline()
-//go:linkname libc_write libc_write
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2392,7 +2260,6 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (
func libc_mmap_trampoline()
-//go:linkname libc_mmap libc_mmap
//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2407,7 +2274,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
func libc_munmap_trampoline()
-//go:linkname libc_munmap libc_munmap
//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2444,7 +2310,6 @@ func Fstat(fd int, stat *Stat_t) (err error) {
func libc_fstat_trampoline()
-//go:linkname libc_fstat libc_fstat
//go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2464,7 +2329,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
func libc_fstatat_trampoline()
-//go:linkname libc_fstatat libc_fstatat
//go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2479,7 +2343,6 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) {
func libc_fstatfs_trampoline()
-//go:linkname libc_fstatfs libc_fstatfs
//go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2495,7 +2358,6 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) {
func libc_getfsstat_trampoline()
-//go:linkname libc_getfsstat libc_getfsstat
//go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2515,7 +2377,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
func libc_lstat_trampoline()
-//go:linkname libc_lstat libc_lstat
//go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2535,7 +2396,6 @@ func Stat(path string, stat *Stat_t) (err error) {
func libc_stat_trampoline()
-//go:linkname libc_stat libc_stat
//go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2555,5 +2415,4 @@ func Statfs(path string, stat *Statfs_t) (err error) {
func libc_statfs_trampoline()
-//go:linkname libc_statfs libc_statfs
//go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go
index d64e6c806f..870eb37abf 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go
@@ -24,7 +24,6 @@ func closedir(dir uintptr) (err error) {
func libc_closedir_trampoline()
-//go:linkname libc_closedir libc_closedir
//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -37,5 +36,4 @@ func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) {
func libc_readdir_r_trampoline()
-//go:linkname libc_readdir_r libc_readdir_r
//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
index 23b65a5301..23be592a9f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
@@ -25,7 +25,6 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
func libc_getgroups_trampoline()
-//go:linkname libc_getgroups libc_getgroups
//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -40,7 +39,6 @@ func setgroups(ngid int, gid *_Gid_t) (err error) {
func libc_setgroups_trampoline()
-//go:linkname libc_setgroups libc_setgroups
//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -56,7 +54,6 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
func libc_wait4_trampoline()
-//go:linkname libc_wait4 libc_wait4
//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -72,7 +69,6 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
func libc_accept_trampoline()
-//go:linkname libc_accept libc_accept
//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -87,7 +83,6 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_bind_trampoline()
-//go:linkname libc_bind libc_bind
//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -102,7 +97,6 @@ func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func libc_connect_trampoline()
-//go:linkname libc_connect libc_connect
//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -118,7 +112,6 @@ func socket(domain int, typ int, proto int) (fd int, err error) {
func libc_socket_trampoline()
-//go:linkname libc_socket libc_socket
//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -133,7 +126,6 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen
func libc_getsockopt_trampoline()
-//go:linkname libc_getsockopt libc_getsockopt
//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -148,7 +140,6 @@ func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr)
func libc_setsockopt_trampoline()
-//go:linkname libc_setsockopt libc_setsockopt
//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -163,7 +154,6 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getpeername_trampoline()
-//go:linkname libc_getpeername libc_getpeername
//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -178,7 +168,6 @@ func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func libc_getsockname_trampoline()
-//go:linkname libc_getsockname libc_getsockname
//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -193,7 +182,6 @@ func Shutdown(s int, how int) (err error) {
func libc_shutdown_trampoline()
-//go:linkname libc_shutdown libc_shutdown
//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -208,7 +196,6 @@ func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
func libc_socketpair_trampoline()
-//go:linkname libc_socketpair libc_socketpair
//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -230,7 +217,6 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl
func libc_recvfrom_trampoline()
-//go:linkname libc_recvfrom libc_recvfrom
//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -251,7 +237,6 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (
func libc_sendto_trampoline()
-//go:linkname libc_sendto libc_sendto
//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -267,7 +252,6 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_recvmsg_trampoline()
-//go:linkname libc_recvmsg libc_recvmsg
//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -283,7 +267,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func libc_sendmsg_trampoline()
-//go:linkname libc_sendmsg libc_sendmsg
//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -299,7 +282,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne
func libc_kevent_trampoline()
-//go:linkname libc_kevent libc_kevent
//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -319,7 +301,6 @@ func utimes(path string, timeval *[2]Timeval) (err error) {
func libc_utimes_trampoline()
-//go:linkname libc_utimes libc_utimes
//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -334,7 +315,6 @@ func futimes(fd int, timeval *[2]Timeval) (err error) {
func libc_futimes_trampoline()
-//go:linkname libc_futimes libc_futimes
//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -350,7 +330,6 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
func libc_poll_trampoline()
-//go:linkname libc_poll libc_poll
//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -371,7 +350,6 @@ func Madvise(b []byte, behav int) (err error) {
func libc_madvise_trampoline()
-//go:linkname libc_madvise libc_madvise
//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -392,7 +370,6 @@ func Mlock(b []byte) (err error) {
func libc_mlock_trampoline()
-//go:linkname libc_mlock libc_mlock
//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -407,7 +384,6 @@ func Mlockall(flags int) (err error) {
func libc_mlockall_trampoline()
-//go:linkname libc_mlockall libc_mlockall
//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -428,7 +404,6 @@ func Mprotect(b []byte, prot int) (err error) {
func libc_mprotect_trampoline()
-//go:linkname libc_mprotect libc_mprotect
//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -449,7 +424,6 @@ func Msync(b []byte, flags int) (err error) {
func libc_msync_trampoline()
-//go:linkname libc_msync libc_msync
//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -470,7 +444,6 @@ func Munlock(b []byte) (err error) {
func libc_munlock_trampoline()
-//go:linkname libc_munlock libc_munlock
//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -485,7 +458,6 @@ func Munlockall() (err error) {
func libc_munlockall_trampoline()
-//go:linkname libc_munlockall libc_munlockall
//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -502,7 +474,6 @@ func pipe() (r int, w int, err error) {
func libc_pipe_trampoline()
-//go:linkname libc_pipe libc_pipe
//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -528,7 +499,6 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o
func libc_getxattr_trampoline()
-//go:linkname libc_getxattr libc_getxattr
//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -549,7 +519,6 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio
func libc_fgetxattr_trampoline()
-//go:linkname libc_fgetxattr libc_fgetxattr
//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -574,7 +543,6 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o
func libc_setxattr_trampoline()
-//go:linkname libc_setxattr libc_setxattr
//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -594,7 +562,6 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio
func libc_fsetxattr_trampoline()
-//go:linkname libc_fsetxattr libc_fsetxattr
//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -619,7 +586,6 @@ func removexattr(path string, attr string, options int) (err error) {
func libc_removexattr_trampoline()
-//go:linkname libc_removexattr libc_removexattr
//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -639,7 +605,6 @@ func fremovexattr(fd int, attr string, options int) (err error) {
func libc_fremovexattr_trampoline()
-//go:linkname libc_fremovexattr libc_fremovexattr
//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -660,7 +625,6 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro
func libc_listxattr_trampoline()
-//go:linkname libc_listxattr libc_listxattr
//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -676,7 +640,6 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) {
func libc_flistxattr_trampoline()
-//go:linkname libc_flistxattr libc_flistxattr
//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -691,7 +654,6 @@ func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp
func libc_setattrlist_trampoline()
-//go:linkname libc_setattrlist libc_setattrlist
//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -707,7 +669,6 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
func libc_fcntl_trampoline()
-//go:linkname libc_fcntl libc_fcntl
//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -722,7 +683,6 @@ func kill(pid int, signum int, posix int) (err error) {
func libc_kill_trampoline()
-//go:linkname libc_kill libc_kill
//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -737,7 +697,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
func libc_ioctl_trampoline()
-//go:linkname libc_ioctl libc_ioctl
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -758,7 +717,6 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr)
func libc_sysctl_trampoline()
-//go:linkname libc_sysctl libc_sysctl
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -773,7 +731,6 @@ func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer
func libc_sendfile_trampoline()
-//go:linkname libc_sendfile libc_sendfile
//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -793,7 +750,6 @@ func Access(path string, mode uint32) (err error) {
func libc_access_trampoline()
-//go:linkname libc_access libc_access
//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -808,7 +764,6 @@ func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
func libc_adjtime_trampoline()
-//go:linkname libc_adjtime libc_adjtime
//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -828,7 +783,6 @@ func Chdir(path string) (err error) {
func libc_chdir_trampoline()
-//go:linkname libc_chdir libc_chdir
//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -848,7 +802,6 @@ func Chflags(path string, flags int) (err error) {
func libc_chflags_trampoline()
-//go:linkname libc_chflags libc_chflags
//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -868,7 +821,6 @@ func Chmod(path string, mode uint32) (err error) {
func libc_chmod_trampoline()
-//go:linkname libc_chmod libc_chmod
//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -888,7 +840,6 @@ func Chown(path string, uid int, gid int) (err error) {
func libc_chown_trampoline()
-//go:linkname libc_chown libc_chown
//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -908,7 +859,6 @@ func Chroot(path string) (err error) {
func libc_chroot_trampoline()
-//go:linkname libc_chroot libc_chroot
//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -923,7 +873,6 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
func libc_clock_gettime_trampoline()
-//go:linkname libc_clock_gettime libc_clock_gettime
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -938,7 +887,6 @@ func Close(fd int) (err error) {
func libc_close_trampoline()
-//go:linkname libc_close libc_close
//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -963,7 +911,6 @@ func Clonefile(src string, dst string, flags int) (err error) {
func libc_clonefile_trampoline()
-//go:linkname libc_clonefile libc_clonefile
//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -988,7 +935,6 @@ func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int)
func libc_clonefileat_trampoline()
-//go:linkname libc_clonefileat libc_clonefileat
//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1004,7 +950,6 @@ func Dup(fd int) (nfd int, err error) {
func libc_dup_trampoline()
-//go:linkname libc_dup libc_dup
//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1019,7 +964,6 @@ func Dup2(from int, to int) (err error) {
func libc_dup2_trampoline()
-//go:linkname libc_dup2 libc_dup2
//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1044,7 +988,6 @@ func Exchangedata(path1 string, path2 string, options int) (err error) {
func libc_exchangedata_trampoline()
-//go:linkname libc_exchangedata libc_exchangedata
//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1056,7 +999,6 @@ func Exit(code int) {
func libc_exit_trampoline()
-//go:linkname libc_exit libc_exit
//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1076,7 +1018,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_faccessat_trampoline()
-//go:linkname libc_faccessat libc_faccessat
//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1091,7 +1032,6 @@ func Fchdir(fd int) (err error) {
func libc_fchdir_trampoline()
-//go:linkname libc_fchdir libc_fchdir
//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1106,7 +1046,6 @@ func Fchflags(fd int, flags int) (err error) {
func libc_fchflags_trampoline()
-//go:linkname libc_fchflags libc_fchflags
//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1121,7 +1060,6 @@ func Fchmod(fd int, mode uint32) (err error) {
func libc_fchmod_trampoline()
-//go:linkname libc_fchmod libc_fchmod
//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1141,7 +1079,6 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
func libc_fchmodat_trampoline()
-//go:linkname libc_fchmodat libc_fchmodat
//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1156,7 +1093,6 @@ func Fchown(fd int, uid int, gid int) (err error) {
func libc_fchown_trampoline()
-//go:linkname libc_fchown libc_fchown
//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1176,7 +1112,6 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
func libc_fchownat_trampoline()
-//go:linkname libc_fchownat libc_fchownat
//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1196,7 +1131,6 @@ func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
func libc_fclonefileat_trampoline()
-//go:linkname libc_fclonefileat libc_fclonefileat
//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1211,7 +1145,6 @@ func Flock(fd int, how int) (err error) {
func libc_flock_trampoline()
-//go:linkname libc_flock libc_flock
//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1227,7 +1160,6 @@ func Fpathconf(fd int, name int) (val int, err error) {
func libc_fpathconf_trampoline()
-//go:linkname libc_fpathconf libc_fpathconf
//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1242,7 +1174,6 @@ func Fsync(fd int) (err error) {
func libc_fsync_trampoline()
-//go:linkname libc_fsync libc_fsync
//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1257,7 +1188,6 @@ func Ftruncate(fd int, length int64) (err error) {
func libc_ftruncate_trampoline()
-//go:linkname libc_ftruncate libc_ftruncate
//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1279,7 +1209,6 @@ func Getcwd(buf []byte) (n int, err error) {
func libc_getcwd_trampoline()
-//go:linkname libc_getcwd libc_getcwd
//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1292,7 +1221,6 @@ func Getdtablesize() (size int) {
func libc_getdtablesize_trampoline()
-//go:linkname libc_getdtablesize libc_getdtablesize
//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1305,7 +1233,6 @@ func Getegid() (egid int) {
func libc_getegid_trampoline()
-//go:linkname libc_getegid libc_getegid
//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1318,7 +1245,6 @@ func Geteuid() (uid int) {
func libc_geteuid_trampoline()
-//go:linkname libc_geteuid libc_geteuid
//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1331,7 +1257,6 @@ func Getgid() (gid int) {
func libc_getgid_trampoline()
-//go:linkname libc_getgid libc_getgid
//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1347,7 +1272,6 @@ func Getpgid(pid int) (pgid int, err error) {
func libc_getpgid_trampoline()
-//go:linkname libc_getpgid libc_getpgid
//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1360,7 +1284,6 @@ func Getpgrp() (pgrp int) {
func libc_getpgrp_trampoline()
-//go:linkname libc_getpgrp libc_getpgrp
//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1373,7 +1296,6 @@ func Getpid() (pid int) {
func libc_getpid_trampoline()
-//go:linkname libc_getpid libc_getpid
//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1386,7 +1308,6 @@ func Getppid() (ppid int) {
func libc_getppid_trampoline()
-//go:linkname libc_getppid libc_getppid
//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1402,7 +1323,6 @@ func Getpriority(which int, who int) (prio int, err error) {
func libc_getpriority_trampoline()
-//go:linkname libc_getpriority libc_getpriority
//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1417,7 +1337,6 @@ func Getrlimit(which int, lim *Rlimit) (err error) {
func libc_getrlimit_trampoline()
-//go:linkname libc_getrlimit libc_getrlimit
//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1432,7 +1351,6 @@ func Getrusage(who int, rusage *Rusage) (err error) {
func libc_getrusage_trampoline()
-//go:linkname libc_getrusage libc_getrusage
//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1448,7 +1366,6 @@ func Getsid(pid int) (sid int, err error) {
func libc_getsid_trampoline()
-//go:linkname libc_getsid libc_getsid
//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1463,7 +1380,6 @@ func Gettimeofday(tp *Timeval) (err error) {
func libc_gettimeofday_trampoline()
-//go:linkname libc_gettimeofday libc_gettimeofday
//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1476,7 +1392,6 @@ func Getuid() (uid int) {
func libc_getuid_trampoline()
-//go:linkname libc_getuid libc_getuid
//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1489,7 +1404,6 @@ func Issetugid() (tainted bool) {
func libc_issetugid_trampoline()
-//go:linkname libc_issetugid libc_issetugid
//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1505,7 +1419,6 @@ func Kqueue() (fd int, err error) {
func libc_kqueue_trampoline()
-//go:linkname libc_kqueue libc_kqueue
//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1525,7 +1438,6 @@ func Lchown(path string, uid int, gid int) (err error) {
func libc_lchown_trampoline()
-//go:linkname libc_lchown libc_lchown
//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1550,7 +1462,6 @@ func Link(path string, link string) (err error) {
func libc_link_trampoline()
-//go:linkname libc_link libc_link
//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1575,7 +1486,6 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er
func libc_linkat_trampoline()
-//go:linkname libc_linkat libc_linkat
//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1590,7 +1500,6 @@ func Listen(s int, backlog int) (err error) {
func libc_listen_trampoline()
-//go:linkname libc_listen libc_listen
//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1610,7 +1519,6 @@ func Mkdir(path string, mode uint32) (err error) {
func libc_mkdir_trampoline()
-//go:linkname libc_mkdir libc_mkdir
//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1630,7 +1538,6 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
func libc_mkdirat_trampoline()
-//go:linkname libc_mkdirat libc_mkdirat
//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1650,7 +1557,6 @@ func Mkfifo(path string, mode uint32) (err error) {
func libc_mkfifo_trampoline()
-//go:linkname libc_mkfifo libc_mkfifo
//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1670,7 +1576,6 @@ func Mknod(path string, mode uint32, dev int) (err error) {
func libc_mknod_trampoline()
-//go:linkname libc_mknod libc_mknod
//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1691,7 +1596,6 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
func libc_open_trampoline()
-//go:linkname libc_open libc_open
//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1712,7 +1616,6 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
func libc_openat_trampoline()
-//go:linkname libc_openat libc_openat
//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1733,7 +1636,6 @@ func Pathconf(path string, name int) (val int, err error) {
func libc_pathconf_trampoline()
-//go:linkname libc_pathconf libc_pathconf
//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1755,7 +1657,6 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) {
func libc_pread_trampoline()
-//go:linkname libc_pread libc_pread
//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1777,7 +1678,6 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
func libc_pwrite_trampoline()
-//go:linkname libc_pwrite libc_pwrite
//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1799,7 +1699,6 @@ func read(fd int, p []byte) (n int, err error) {
func libc_read_trampoline()
-//go:linkname libc_read libc_read
//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1826,7 +1725,6 @@ func Readlink(path string, buf []byte) (n int, err error) {
func libc_readlink_trampoline()
-//go:linkname libc_readlink libc_readlink
//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1853,7 +1751,6 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
func libc_readlinkat_trampoline()
-//go:linkname libc_readlinkat libc_readlinkat
//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1878,7 +1775,6 @@ func Rename(from string, to string) (err error) {
func libc_rename_trampoline()
-//go:linkname libc_rename libc_rename
//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1903,7 +1799,6 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) {
func libc_renameat_trampoline()
-//go:linkname libc_renameat libc_renameat
//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1923,7 +1818,6 @@ func Revoke(path string) (err error) {
func libc_revoke_trampoline()
-//go:linkname libc_revoke libc_revoke
//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1943,7 +1837,6 @@ func Rmdir(path string) (err error) {
func libc_rmdir_trampoline()
-//go:linkname libc_rmdir libc_rmdir
//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1959,7 +1852,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
func libc_lseek_trampoline()
-//go:linkname libc_lseek libc_lseek
//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1975,7 +1867,6 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
func libc_select_trampoline()
-//go:linkname libc_select libc_select
//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -1990,7 +1881,6 @@ func Setegid(egid int) (err error) {
func libc_setegid_trampoline()
-//go:linkname libc_setegid libc_setegid
//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2005,7 +1895,6 @@ func Seteuid(euid int) (err error) {
func libc_seteuid_trampoline()
-//go:linkname libc_seteuid libc_seteuid
//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2020,7 +1909,6 @@ func Setgid(gid int) (err error) {
func libc_setgid_trampoline()
-//go:linkname libc_setgid libc_setgid
//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2040,7 +1928,6 @@ func Setlogin(name string) (err error) {
func libc_setlogin_trampoline()
-//go:linkname libc_setlogin libc_setlogin
//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2055,7 +1942,6 @@ func Setpgid(pid int, pgid int) (err error) {
func libc_setpgid_trampoline()
-//go:linkname libc_setpgid libc_setpgid
//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2070,7 +1956,6 @@ func Setpriority(which int, who int, prio int) (err error) {
func libc_setpriority_trampoline()
-//go:linkname libc_setpriority libc_setpriority
//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2085,7 +1970,6 @@ func Setprivexec(flag int) (err error) {
func libc_setprivexec_trampoline()
-//go:linkname libc_setprivexec libc_setprivexec
//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2100,7 +1984,6 @@ func Setregid(rgid int, egid int) (err error) {
func libc_setregid_trampoline()
-//go:linkname libc_setregid libc_setregid
//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2115,7 +1998,6 @@ func Setreuid(ruid int, euid int) (err error) {
func libc_setreuid_trampoline()
-//go:linkname libc_setreuid libc_setreuid
//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2130,7 +2012,6 @@ func Setrlimit(which int, lim *Rlimit) (err error) {
func libc_setrlimit_trampoline()
-//go:linkname libc_setrlimit libc_setrlimit
//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2146,7 +2027,6 @@ func Setsid() (pid int, err error) {
func libc_setsid_trampoline()
-//go:linkname libc_setsid libc_setsid
//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2161,7 +2041,6 @@ func Settimeofday(tp *Timeval) (err error) {
func libc_settimeofday_trampoline()
-//go:linkname libc_settimeofday libc_settimeofday
//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2176,7 +2055,6 @@ func Setuid(uid int) (err error) {
func libc_setuid_trampoline()
-//go:linkname libc_setuid libc_setuid
//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2201,7 +2079,6 @@ func Symlink(path string, link string) (err error) {
func libc_symlink_trampoline()
-//go:linkname libc_symlink libc_symlink
//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2226,7 +2103,6 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
func libc_symlinkat_trampoline()
-//go:linkname libc_symlinkat libc_symlinkat
//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2241,7 +2117,6 @@ func Sync() (err error) {
func libc_sync_trampoline()
-//go:linkname libc_sync libc_sync
//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2261,7 +2136,6 @@ func Truncate(path string, length int64) (err error) {
func libc_truncate_trampoline()
-//go:linkname libc_truncate libc_truncate
//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2274,7 +2148,6 @@ func Umask(newmask int) (oldmask int) {
func libc_umask_trampoline()
-//go:linkname libc_umask libc_umask
//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2294,7 +2167,6 @@ func Undelete(path string) (err error) {
func libc_undelete_trampoline()
-//go:linkname libc_undelete libc_undelete
//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2314,7 +2186,6 @@ func Unlink(path string) (err error) {
func libc_unlink_trampoline()
-//go:linkname libc_unlink libc_unlink
//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2334,7 +2205,6 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
func libc_unlinkat_trampoline()
-//go:linkname libc_unlinkat libc_unlinkat
//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2354,7 +2224,6 @@ func Unmount(path string, flags int) (err error) {
func libc_unmount_trampoline()
-//go:linkname libc_unmount libc_unmount
//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2376,7 +2245,6 @@ func write(fd int, p []byte) (n int, err error) {
func libc_write_trampoline()
-//go:linkname libc_write libc_write
//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2392,7 +2260,6 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (
func libc_mmap_trampoline()
-//go:linkname libc_mmap libc_mmap
//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2407,7 +2274,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
func libc_munmap_trampoline()
-//go:linkname libc_munmap libc_munmap
//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2444,7 +2310,6 @@ func Fstat(fd int, stat *Stat_t) (err error) {
func libc_fstat_trampoline()
-//go:linkname libc_fstat libc_fstat
//go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2464,7 +2329,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
func libc_fstatat_trampoline()
-//go:linkname libc_fstatat libc_fstatat
//go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2479,7 +2343,6 @@ func Fstatfs(fd int, stat *Statfs_t) (err error) {
func libc_fstatfs_trampoline()
-//go:linkname libc_fstatfs libc_fstatfs
//go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2495,7 +2358,6 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) {
func libc_getfsstat_trampoline()
-//go:linkname libc_getfsstat libc_getfsstat
//go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2515,7 +2377,6 @@ func Lstat(path string, stat *Stat_t) (err error) {
func libc_lstat_trampoline()
-//go:linkname libc_lstat libc_lstat
//go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2530,7 +2391,6 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
func libc_ptrace_trampoline()
-//go:linkname libc_ptrace libc_ptrace
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2550,7 +2410,6 @@ func Stat(path string, stat *Stat_t) (err error) {
func libc_stat_trampoline()
-//go:linkname libc_stat libc_stat
//go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2570,5 +2429,4 @@ func Statfs(path string, stat *Statfs_t) (err error) {
func libc_statfs_trampoline()
-//go:linkname libc_statfs libc_statfs
//go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib"
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
index aebfe511ad..1aaccd3615 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
@@ -362,6 +362,16 @@ func pipe() (r int, w int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func pipe2(p *[2]_C_int, flags int) (err error) {
+ _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go
index 830fbb35c0..725b4bee27 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go
@@ -269,6 +269,7 @@ const (
SizeofSockaddrDatalink = 0x14
SizeofSockaddrCtl = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x1c
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
index e53a7c49ff..080ffce325 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
@@ -274,6 +274,7 @@ const (
SizeofSockaddrDatalink = 0x14
SizeofSockaddrCtl = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go
index 98be973ef9..f2a77bc4e2 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go
@@ -269,6 +269,7 @@ const (
SizeofSockaddrDatalink = 0x14
SizeofSockaddrCtl = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x1c
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
index ddae5afe1b..c9492428bf 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
@@ -274,6 +274,7 @@ const (
SizeofSockaddrDatalink = 0x14
SizeofSockaddrCtl = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
index a96ad4c299..504ef131fb 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
@@ -2981,3 +2981,21 @@ type PPSKTime struct {
Nsec int32
Flags uint32
}
+
+const (
+ LWTUNNEL_ENCAP_NONE = 0x0
+ LWTUNNEL_ENCAP_MPLS = 0x1
+ LWTUNNEL_ENCAP_IP = 0x2
+ LWTUNNEL_ENCAP_ILA = 0x3
+ LWTUNNEL_ENCAP_IP6 = 0x4
+ LWTUNNEL_ENCAP_SEG6 = 0x5
+ LWTUNNEL_ENCAP_BPF = 0x6
+ LWTUNNEL_ENCAP_SEG6_LOCAL = 0x7
+ LWTUNNEL_ENCAP_RPL = 0x8
+ LWTUNNEL_ENCAP_MAX = 0x8
+
+ MPLS_IPTUNNEL_UNSPEC = 0x0
+ MPLS_IPTUNNEL_DST = 0x1
+ MPLS_IPTUNNEL_TTL = 0x2
+ MPLS_IPTUNNEL_MAX = 0x2
+)
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/dll_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/dll_windows.go
index 82076fb74f..115341fba6 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/dll_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/dll_windows.go
@@ -32,6 +32,8 @@ type DLLError struct {
func (e *DLLError) Error() string { return e.Msg }
+func (e *DLLError) Unwrap() error { return e.Err }
+
// A DLL implements access to a single DLL.
type DLL struct {
Name string
@@ -389,7 +391,6 @@ func loadLibraryEx(name string, system bool) (*DLL, error) {
var flags uintptr
if system {
if canDoSearchSystem32() {
- const LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
flags = LOAD_LIBRARY_SEARCH_SYSTEM32
} else if isBaseName(name) {
// WindowsXP or unpatched Windows machine
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go
index 9e3c44a855..69eb462c59 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go
@@ -624,6 +624,7 @@ func (tml *Tokenmandatorylabel) Size() uint32 {
// Authorization Functions
//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership
+//sys isTokenRestricted(tokenHandle Token) (ret bool, err error) [!failretval] = advapi32.IsTokenRestricted
//sys OpenProcessToken(process Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken
//sys OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) = advapi32.OpenThreadToken
//sys ImpersonateSelf(impersonationlevel uint32) (err error) = advapi32.ImpersonateSelf
@@ -837,6 +838,16 @@ func (t Token) IsMember(sid *SID) (bool, error) {
return b != 0, nil
}
+// IsRestricted reports whether the access token t is a restricted token.
+func (t Token) IsRestricted() (isRestricted bool, err error) {
+ isRestricted, err = isTokenRestricted(t)
+ if !isRestricted && err == syscall.EINVAL {
+ // If err is EINVAL, this returned ERROR_SUCCESS indicating a non-restricted token.
+ err = nil
+ }
+ return
+}
+
const (
WTS_CONSOLE_CONNECT = 0x1
WTS_CONSOLE_DISCONNECT = 0x2
@@ -1103,9 +1114,10 @@ type OBJECTS_AND_NAME struct {
}
//sys getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) = advapi32.GetSecurityInfo
-//sys SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) = advapi32.SetSecurityInfo
+//sys SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) = advapi32.SetSecurityInfo
//sys getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) = advapi32.GetNamedSecurityInfoW
//sys SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) = advapi32.SetNamedSecurityInfoW
+//sys SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) = advapi32.SetKernelObjectSecurity
//sys buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) = advapi32.BuildSecurityDescriptorW
//sys initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) = advapi32.InitializeSecurityDescriptor
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/service.go b/src/cmd/vendor/golang.org/x/sys/windows/service.go
index f54ff90aac..b269850d06 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/service.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/service.go
@@ -128,6 +128,10 @@ const (
SERVICE_NOTIFY_CREATED = 0x00000080
SERVICE_NOTIFY_DELETED = 0x00000100
SERVICE_NOTIFY_DELETE_PENDING = 0x00000200
+
+ SC_EVENT_DATABASE_CHANGE = 0
+ SC_EVENT_PROPERTY_CHANGE = 1
+ SC_EVENT_STATUS_CHANGE = 2
)
type SERVICE_STATUS struct {
@@ -229,3 +233,5 @@ type QUERY_SERVICE_LOCK_STATUS struct {
//sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW
//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx
//sys NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) = advapi32.NotifyServiceStatusChangeW
+//sys SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) = sechost.SubscribeServiceChangeNotifications?
+//sys UnsubscribeServiceChangeNotifications(subscription uintptr) = sechost.UnsubscribeServiceChangeNotifications?
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/setupapierrors_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/setupapierrors_windows.go
new file mode 100644
index 0000000000..1681810e04
--- /dev/null
+++ b/src/cmd/vendor/golang.org/x/sys/windows/setupapierrors_windows.go
@@ -0,0 +1,100 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package windows
+
+import "syscall"
+
+const (
+ ERROR_EXPECTED_SECTION_NAME syscall.Errno = 0x20000000 | 0xC0000000 | 0
+ ERROR_BAD_SECTION_NAME_LINE syscall.Errno = 0x20000000 | 0xC0000000 | 1
+ ERROR_SECTION_NAME_TOO_LONG syscall.Errno = 0x20000000 | 0xC0000000 | 2
+ ERROR_GENERAL_SYNTAX syscall.Errno = 0x20000000 | 0xC0000000 | 3
+ ERROR_WRONG_INF_STYLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x100
+ ERROR_SECTION_NOT_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x101
+ ERROR_LINE_NOT_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x102
+ ERROR_NO_BACKUP syscall.Errno = 0x20000000 | 0xC0000000 | 0x103
+ ERROR_NO_ASSOCIATED_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x200
+ ERROR_CLASS_MISMATCH syscall.Errno = 0x20000000 | 0xC0000000 | 0x201
+ ERROR_DUPLICATE_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x202
+ ERROR_NO_DRIVER_SELECTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x203
+ ERROR_KEY_DOES_NOT_EXIST syscall.Errno = 0x20000000 | 0xC0000000 | 0x204
+ ERROR_INVALID_DEVINST_NAME syscall.Errno = 0x20000000 | 0xC0000000 | 0x205
+ ERROR_INVALID_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x206
+ ERROR_DEVINST_ALREADY_EXISTS syscall.Errno = 0x20000000 | 0xC0000000 | 0x207
+ ERROR_DEVINFO_NOT_REGISTERED syscall.Errno = 0x20000000 | 0xC0000000 | 0x208
+ ERROR_INVALID_REG_PROPERTY syscall.Errno = 0x20000000 | 0xC0000000 | 0x209
+ ERROR_NO_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x20A
+ ERROR_NO_SUCH_DEVINST syscall.Errno = 0x20000000 | 0xC0000000 | 0x20B
+ ERROR_CANT_LOAD_CLASS_ICON syscall.Errno = 0x20000000 | 0xC0000000 | 0x20C
+ ERROR_INVALID_CLASS_INSTALLER syscall.Errno = 0x20000000 | 0xC0000000 | 0x20D
+ ERROR_DI_DO_DEFAULT syscall.Errno = 0x20000000 | 0xC0000000 | 0x20E
+ ERROR_DI_NOFILECOPY syscall.Errno = 0x20000000 | 0xC0000000 | 0x20F
+ ERROR_INVALID_HWPROFILE syscall.Errno = 0x20000000 | 0xC0000000 | 0x210
+ ERROR_NO_DEVICE_SELECTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x211
+ ERROR_DEVINFO_LIST_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x212
+ ERROR_DEVINFO_DATA_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x213
+ ERROR_DI_BAD_PATH syscall.Errno = 0x20000000 | 0xC0000000 | 0x214
+ ERROR_NO_CLASSINSTALL_PARAMS syscall.Errno = 0x20000000 | 0xC0000000 | 0x215
+ ERROR_FILEQUEUE_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x216
+ ERROR_BAD_SERVICE_INSTALLSECT syscall.Errno = 0x20000000 | 0xC0000000 | 0x217
+ ERROR_NO_CLASS_DRIVER_LIST syscall.Errno = 0x20000000 | 0xC0000000 | 0x218
+ ERROR_NO_ASSOCIATED_SERVICE syscall.Errno = 0x20000000 | 0xC0000000 | 0x219
+ ERROR_NO_DEFAULT_DEVICE_INTERFACE syscall.Errno = 0x20000000 | 0xC0000000 | 0x21A
+ ERROR_DEVICE_INTERFACE_ACTIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x21B
+ ERROR_DEVICE_INTERFACE_REMOVED syscall.Errno = 0x20000000 | 0xC0000000 | 0x21C
+ ERROR_BAD_INTERFACE_INSTALLSECT syscall.Errno = 0x20000000 | 0xC0000000 | 0x21D
+ ERROR_NO_SUCH_INTERFACE_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x21E
+ ERROR_INVALID_REFERENCE_STRING syscall.Errno = 0x20000000 | 0xC0000000 | 0x21F
+ ERROR_INVALID_MACHINENAME syscall.Errno = 0x20000000 | 0xC0000000 | 0x220
+ ERROR_REMOTE_COMM_FAILURE syscall.Errno = 0x20000000 | 0xC0000000 | 0x221
+ ERROR_MACHINE_UNAVAILABLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x222
+ ERROR_NO_CONFIGMGR_SERVICES syscall.Errno = 0x20000000 | 0xC0000000 | 0x223
+ ERROR_INVALID_PROPPAGE_PROVIDER syscall.Errno = 0x20000000 | 0xC0000000 | 0x224
+ ERROR_NO_SUCH_DEVICE_INTERFACE syscall.Errno = 0x20000000 | 0xC0000000 | 0x225
+ ERROR_DI_POSTPROCESSING_REQUIRED syscall.Errno = 0x20000000 | 0xC0000000 | 0x226
+ ERROR_INVALID_COINSTALLER syscall.Errno = 0x20000000 | 0xC0000000 | 0x227
+ ERROR_NO_COMPAT_DRIVERS syscall.Errno = 0x20000000 | 0xC0000000 | 0x228
+ ERROR_NO_DEVICE_ICON syscall.Errno = 0x20000000 | 0xC0000000 | 0x229
+ ERROR_INVALID_INF_LOGCONFIG syscall.Errno = 0x20000000 | 0xC0000000 | 0x22A
+ ERROR_DI_DONT_INSTALL syscall.Errno = 0x20000000 | 0xC0000000 | 0x22B
+ ERROR_INVALID_FILTER_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22C
+ ERROR_NON_WINDOWS_NT_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22D
+ ERROR_NON_WINDOWS_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22E
+ ERROR_NO_CATALOG_FOR_OEM_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x22F
+ ERROR_DEVINSTALL_QUEUE_NONNATIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x230
+ ERROR_NOT_DISABLEABLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x231
+ ERROR_CANT_REMOVE_DEVINST syscall.Errno = 0x20000000 | 0xC0000000 | 0x232
+ ERROR_INVALID_TARGET syscall.Errno = 0x20000000 | 0xC0000000 | 0x233
+ ERROR_DRIVER_NONNATIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x234
+ ERROR_IN_WOW64 syscall.Errno = 0x20000000 | 0xC0000000 | 0x235
+ ERROR_SET_SYSTEM_RESTORE_POINT syscall.Errno = 0x20000000 | 0xC0000000 | 0x236
+ ERROR_SCE_DISABLED syscall.Errno = 0x20000000 | 0xC0000000 | 0x238
+ ERROR_UNKNOWN_EXCEPTION syscall.Errno = 0x20000000 | 0xC0000000 | 0x239
+ ERROR_PNP_REGISTRY_ERROR syscall.Errno = 0x20000000 | 0xC0000000 | 0x23A
+ ERROR_REMOTE_REQUEST_UNSUPPORTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x23B
+ ERROR_NOT_AN_INSTALLED_OEM_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x23C
+ ERROR_INF_IN_USE_BY_DEVICES syscall.Errno = 0x20000000 | 0xC0000000 | 0x23D
+ ERROR_DI_FUNCTION_OBSOLETE syscall.Errno = 0x20000000 | 0xC0000000 | 0x23E
+ ERROR_NO_AUTHENTICODE_CATALOG syscall.Errno = 0x20000000 | 0xC0000000 | 0x23F
+ ERROR_AUTHENTICODE_DISALLOWED syscall.Errno = 0x20000000 | 0xC0000000 | 0x240
+ ERROR_AUTHENTICODE_TRUSTED_PUBLISHER syscall.Errno = 0x20000000 | 0xC0000000 | 0x241
+ ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED syscall.Errno = 0x20000000 | 0xC0000000 | 0x242
+ ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x243
+ ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH syscall.Errno = 0x20000000 | 0xC0000000 | 0x244
+ ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE syscall.Errno = 0x20000000 | 0xC0000000 | 0x245
+ ERROR_DEVICE_INSTALLER_NOT_READY syscall.Errno = 0x20000000 | 0xC0000000 | 0x246
+ ERROR_DRIVER_STORE_ADD_FAILED syscall.Errno = 0x20000000 | 0xC0000000 | 0x247
+ ERROR_DEVICE_INSTALL_BLOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x248
+ ERROR_DRIVER_INSTALL_BLOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x249
+ ERROR_WRONG_INF_TYPE syscall.Errno = 0x20000000 | 0xC0000000 | 0x24A
+ ERROR_FILE_HASH_NOT_IN_CATALOG syscall.Errno = 0x20000000 | 0xC0000000 | 0x24B
+ ERROR_DRIVER_STORE_DELETE_FAILED syscall.Errno = 0x20000000 | 0xC0000000 | 0x24C
+ ERROR_UNRECOVERABLE_STACK_OVERFLOW syscall.Errno = 0x20000000 | 0xC0000000 | 0x300
+ EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW syscall.Errno = ERROR_UNRECOVERABLE_STACK_OVERFLOW
+ ERROR_NO_DEFAULT_INTERFACE_DEVICE syscall.Errno = ERROR_NO_DEFAULT_DEVICE_INTERFACE
+ ERROR_INTERFACE_DEVICE_ACTIVE syscall.Errno = ERROR_DEVICE_INTERFACE_ACTIVE
+ ERROR_INTERFACE_DEVICE_REMOVED syscall.Errno = ERROR_DEVICE_INTERFACE_REMOVED
+ ERROR_NO_SUCH_INTERFACE_DEVICE syscall.Errno = ERROR_NO_SUCH_DEVICE_INTERFACE
+)
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go
index 008ffc11a0..c71bad127d 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go
@@ -170,10 +170,13 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys GetProcAddress(module Handle, procname string) (proc uintptr, err error)
//sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW
//sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW
+//sys SetDefaultDllDirectories(directoryFlags uint32) (err error)
+//sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW
//sys GetVersion() (ver uint32, err error)
//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW
//sys ExitProcess(exitcode uint32)
//sys IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process
+//sys IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) = IsWow64Process2?
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
//sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
//sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
@@ -187,6 +190,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys FindClose(handle Handle) (err error)
//sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error)
//sys GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error)
+//sys SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error)
//sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW
//sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW
//sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW
@@ -243,6 +247,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) = kernel32.GetFullPathNameW
//sys GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) = kernel32.GetLongPathNameW
//sys GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) = kernel32.GetShortPathNameW
+//sys GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) = kernel32.GetFinalPathNameByHandleW
//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) = kernel32.CreateFileMappingW
//sys MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error)
//sys UnmapViewOfFile(addr uintptr) (err error)
@@ -255,7 +260,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile
//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW
//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW
-//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) [failretval==InvalidHandle] = crypt32.CertOpenStore
+//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) = crypt32.CertOpenStore
//sys CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) [failretval==nil] = crypt32.CertEnumCertificatesInStore
//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore
//sys CertCloseStore(store Handle, flags uint32) (err error) = crypt32.CertCloseStore
@@ -351,7 +356,6 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetThreadPreferredUILanguages
//sys getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetUserPreferredUILanguages
//sys getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetSystemPreferredUILanguages
-//sys GetFinalPathNameByHandleW(file syscall.Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) = kernel32.GetFinalPathNameByHandleW
// Process Status API (PSAPI)
//sys EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
index da1652e74b..265d797cac 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
@@ -1772,3 +1772,51 @@ const (
MUI_LANGUAGE_INSTALLED = 0x20
MUI_LANGUAGE_LICENSED = 0x40
)
+
+// FILE_INFO_BY_HANDLE_CLASS constants for SetFileInformationByHandle/GetFileInformationByHandleEx
+const (
+ FileBasicInfo = 0
+ FileStandardInfo = 1
+ FileNameInfo = 2
+ FileRenameInfo = 3
+ FileDispositionInfo = 4
+ FileAllocationInfo = 5
+ FileEndOfFileInfo = 6
+ FileStreamInfo = 7
+ FileCompressionInfo = 8
+ FileAttributeTagInfo = 9
+ FileIdBothDirectoryInfo = 10
+ FileIdBothDirectoryRestartInfo = 11
+ FileIoPriorityHintInfo = 12
+ FileRemoteProtocolInfo = 13
+ FileFullDirectoryInfo = 14
+ FileFullDirectoryRestartInfo = 15
+ FileStorageInfo = 16
+ FileAlignmentInfo = 17
+ FileIdInfo = 18
+ FileIdExtdDirectoryInfo = 19
+ FileIdExtdDirectoryRestartInfo = 20
+ FileDispositionInfoEx = 21
+ FileRenameInfoEx = 22
+ FileCaseSensitiveInfo = 23
+ FileNormalizedNameInfo = 24
+)
+
+// LoadLibrary flags for determining from where to search for a DLL
+const (
+ DONT_RESOLVE_DLL_REFERENCES = 0x1
+ LOAD_LIBRARY_AS_DATAFILE = 0x2
+ LOAD_WITH_ALTERED_SEARCH_PATH = 0x8
+ LOAD_IGNORE_CODE_AUTHZ_LEVEL = 0x10
+ LOAD_LIBRARY_AS_IMAGE_RESOURCE = 0x20
+ LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 0x40
+ LOAD_LIBRARY_REQUIRE_SIGNED_TARGET = 0x80
+ LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 0x100
+ LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 0x200
+ LOAD_LIBRARY_SEARCH_USER_DIRS = 0x400
+ LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x800
+ LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x1000
+ LOAD_LIBRARY_SAFE_CURRENT_DIRS = 0x00002000
+ LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER = 0x00004000
+ LOAD_LIBRARY_OS_INTEGRITY_CONTINUITY = 0x00008000
+)
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
index d400c3512d..a933c0ee37 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
@@ -46,6 +46,7 @@ var (
modntdll = NewLazySystemDLL("ntdll.dll")
modole32 = NewLazySystemDLL("ole32.dll")
modpsapi = NewLazySystemDLL("psapi.dll")
+ modsechost = NewLazySystemDLL("sechost.dll")
modsecur32 = NewLazySystemDLL("secur32.dll")
modshell32 = NewLazySystemDLL("shell32.dll")
moduser32 = NewLazySystemDLL("user32.dll")
@@ -95,6 +96,7 @@ var (
procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf")
procInitializeSecurityDescriptor = modadvapi32.NewProc("InitializeSecurityDescriptor")
procInitiateSystemShutdownExW = modadvapi32.NewProc("InitiateSystemShutdownExW")
+ procIsTokenRestricted = modadvapi32.NewProc("IsTokenRestricted")
procIsValidSecurityDescriptor = modadvapi32.NewProc("IsValidSecurityDescriptor")
procIsValidSid = modadvapi32.NewProc("IsValidSid")
procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid")
@@ -122,6 +124,7 @@ var (
procReportEventW = modadvapi32.NewProc("ReportEventW")
procRevertToSelf = modadvapi32.NewProc("RevertToSelf")
procSetEntriesInAclW = modadvapi32.NewProc("SetEntriesInAclW")
+ procSetKernelObjectSecurity = modadvapi32.NewProc("SetKernelObjectSecurity")
procSetNamedSecurityInfoW = modadvapi32.NewProc("SetNamedSecurityInfoW")
procSetSecurityDescriptorControl = modadvapi32.NewProc("SetSecurityDescriptorControl")
procSetSecurityDescriptorDacl = modadvapi32.NewProc("SetSecurityDescriptorDacl")
@@ -248,6 +251,7 @@ var (
procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW")
procGetWindowsDirectoryW = modkernel32.NewProc("GetWindowsDirectoryW")
procIsWow64Process = modkernel32.NewProc("IsWow64Process")
+ procIsWow64Process2 = modkernel32.NewProc("IsWow64Process2")
procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
procLocalFree = modkernel32.NewProc("LocalFree")
@@ -277,12 +281,15 @@ var (
procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
procSetConsoleMode = modkernel32.NewProc("SetConsoleMode")
procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
+ procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories")
+ procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW")
procSetEndOfFile = modkernel32.NewProc("SetEndOfFile")
procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
procSetErrorMode = modkernel32.NewProc("SetErrorMode")
procSetEvent = modkernel32.NewProc("SetEvent")
procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW")
procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes")
+ procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle")
procSetFilePointer = modkernel32.NewProc("SetFilePointer")
procSetFileTime = modkernel32.NewProc("SetFileTime")
procSetHandleInformation = modkernel32.NewProc("SetHandleInformation")
@@ -323,6 +330,8 @@ var (
procCoTaskMemFree = modole32.NewProc("CoTaskMemFree")
procStringFromGUID2 = modole32.NewProc("StringFromGUID2")
procEnumProcesses = modpsapi.NewProc("EnumProcesses")
+ procSubscribeServiceChangeNotifications = modsechost.NewProc("SubscribeServiceChangeNotifications")
+ procUnsubscribeServiceChangeNotifications = modsechost.NewProc("UnsubscribeServiceChangeNotifications")
procGetUserNameExW = modsecur32.NewProc("GetUserNameExW")
procTranslateNameW = modsecur32.NewProc("TranslateNameW")
procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW")
@@ -753,6 +762,15 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint
return
}
+func isTokenRestricted(tokenHandle Token) (ret bool, err error) {
+ r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0)
+ ret = r0 != 0
+ if !ret {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) {
r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
isValid = r0 != 0
@@ -970,6 +988,14 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE
return
}
+func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) {
+ r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor)))
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
var _p0 *uint16
_p0, ret = syscall.UTF16PtrFromString(objectName)
@@ -1056,8 +1082,11 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *
return
}
-func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) {
- syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
+func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
+ r0, _, _ := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
+ if r0 != 0 {
+ ret = syscall.Errno(r0)
+ }
return
}
@@ -1167,7 +1196,7 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a
func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
handle = Handle(r0)
- if handle == InvalidHandle {
+ if handle == 0 {
err = errnoErr(e1)
}
return
@@ -1727,7 +1756,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) {
return
}
-func GetFinalPathNameByHandleW(file syscall.Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
+func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0)
n = uint32(r0)
if n == 0 {
@@ -2055,6 +2084,18 @@ func IsWow64Process(handle Handle, isWow64 *bool) (err error) {
return
}
+func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) {
+ err = procIsWow64Process2.Find()
+ if err != nil {
+ return
+ }
+ r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine)))
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) {
var _p0 *uint16
_p0, err = syscall.UTF16PtrFromString(libname)
@@ -2340,6 +2381,31 @@ func SetCurrentDirectory(path *uint16) (err error) {
return
}
+func SetDefaultDllDirectories(directoryFlags uint32) (err error) {
+ r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func SetDllDirectory(path string) (err error) {
+ var _p0 *uint16
+ _p0, err = syscall.UTF16PtrFromString(path)
+ if err != nil {
+ return
+ }
+ return _SetDllDirectory(_p0)
+}
+
+func _SetDllDirectory(path *uint16) (err error) {
+ r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func SetEndOfFile(handle Handle) (err error) {
r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
if r1 == 0 {
@@ -2386,6 +2452,14 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error)
return
}
+func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) {
+ r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
newlowoffset = uint32(r0)
@@ -2718,6 +2792,27 @@ func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) {
return
}
+func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) {
+ ret = procSubscribeServiceChangeNotifications.Find()
+ if ret != nil {
+ return
+ }
+ r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0)
+ if r0 != 0 {
+ ret = syscall.Errno(r0)
+ }
+ return
+}
+
+func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) {
+ err = procUnsubscribeServiceChangeNotifications.Find()
+ if err != nil {
+ return
+ }
+ syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0)
+ return
+}
+
func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
if r1&0xff == 0 {
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/framepointer/framepointer.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/framepointer/framepointer.go
new file mode 100644
index 0000000000..741492e477
--- /dev/null
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/framepointer/framepointer.go
@@ -0,0 +1,91 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package framepointer defines an Analyzer that reports assembly code
+// that clobbers the frame pointer before saving it.
+package framepointer
+
+import (
+ "go/build"
+ "regexp"
+ "strings"
+
+ "golang.org/x/tools/go/analysis"
+ "golang.org/x/tools/go/analysis/passes/internal/analysisutil"
+)
+
+const Doc = "report assembly that clobbers the frame pointer before saving it"
+
+var Analyzer = &analysis.Analyzer{
+ Name: "framepointer",
+ Doc: Doc,
+ Run: run,
+}
+
+var (
+ re = regexp.MustCompile
+ asmWriteBP = re(`,\s*BP$`) // TODO: can have false positive, e.g. for TESTQ BP,BP. Seems unlikely.
+ asmMentionBP = re(`\bBP\b`)
+ asmControlFlow = re(`^(J|RET)`)
+)
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ if build.Default.GOARCH != "amd64" { // TODO: arm64 also?
+ return nil, nil
+ }
+ if build.Default.GOOS != "linux" && build.Default.GOOS != "darwin" {
+ return nil, nil
+ }
+
+ // Find assembly files to work on.
+ var sfiles []string
+ for _, fname := range pass.OtherFiles {
+ if strings.HasSuffix(fname, ".s") && pass.Pkg.Path() != "runtime" {
+ sfiles = append(sfiles, fname)
+ }
+ }
+
+ for _, fname := range sfiles {
+ content, tf, err := analysisutil.ReadFile(pass.Fset, fname)
+ if err != nil {
+ return nil, err
+ }
+
+ lines := strings.SplitAfter(string(content), "\n")
+ active := false
+ for lineno, line := range lines {
+ lineno++
+
+ // Ignore comments and commented-out code.
+ if i := strings.Index(line, "//"); i >= 0 {
+ line = line[:i]
+ }
+ line = strings.TrimSpace(line)
+
+ // We start checking code at a TEXT line for a frameless function.
+ if strings.HasPrefix(line, "TEXT") && strings.Contains(line, "(SB)") && strings.Contains(line, "$0") {
+ active = true
+ continue
+ }
+ if !active {
+ continue
+ }
+
+ if asmWriteBP.MatchString(line) { // clobber of BP, function is not OK
+ pass.Reportf(analysisutil.LineStart(tf, lineno), "frame pointer is clobbered before saving")
+ active = false
+ continue
+ }
+ if asmMentionBP.MatchString(line) { // any other use of BP might be a read, so function is OK
+ active = false
+ continue
+ }
+ if asmControlFlow.MatchString(line) { // give up after any branch instruction
+ active = false
+ continue
+ }
+ }
+ }
+ return nil, nil
+}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert/ifaceassert.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert/ifaceassert.go
index c5a71a7c57..fd2285332c 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert/ifaceassert.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert/ifaceassert.go
@@ -41,6 +41,10 @@ var Analyzer = &analysis.Analyzer{
// assertableTo checks whether interface v can be asserted into t. It returns
// nil on success, or the first conflicting method on failure.
func assertableTo(v, t types.Type) *types.Func {
+ if t == nil || v == nil {
+ // not assertable to, but there is no missing method
+ return nil
+ }
// ensure that v and t are interfaces
V, _ := v.Underlying().(*types.Interface)
T, _ := t.Underlying().(*types.Interface)
diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt
index 21bd6bfe48..b549258cfa 100644
--- a/src/cmd/vendor/modules.txt
+++ b/src/cmd/vendor/modules.txt
@@ -1,4 +1,4 @@
-# github.com/google/pprof v0.0.0-20201007051231-1066cbb265c7
+# github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2
## explicit
github.com/google/pprof/driver
github.com/google/pprof/internal/binutils
@@ -15,8 +15,7 @@ github.com/google/pprof/profile
github.com/google/pprof/third_party/d3
github.com/google/pprof/third_party/d3flamegraph
github.com/google/pprof/third_party/svgpan
-# github.com/ianlancetaylor/demangle v0.0.0-20200414190113-039b1ae3a340
-## explicit
+# github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639
github.com/ianlancetaylor/demangle
# golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff
## explicit
@@ -40,12 +39,12 @@ golang.org/x/mod/sumdb/dirhash
golang.org/x/mod/sumdb/note
golang.org/x/mod/sumdb/tlog
golang.org/x/mod/zip
-# golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65
+# golang.org/x/sys v0.0.0-20201204225414-ed752295db88
## explicit
golang.org/x/sys/internal/unsafeheader
golang.org/x/sys/unix
golang.org/x/sys/windows
-# golang.org/x/tools v0.0.0-20201110201400-7099162a900a
+# golang.org/x/tools v0.0.0-20201208211828-de58e7c01d49
## explicit
golang.org/x/tools/go/analysis
golang.org/x/tools/go/analysis/internal/analysisflags
@@ -60,6 +59,7 @@ golang.org/x/tools/go/analysis/passes/composite
golang.org/x/tools/go/analysis/passes/copylock
golang.org/x/tools/go/analysis/passes/ctrlflow
golang.org/x/tools/go/analysis/passes/errorsas
+golang.org/x/tools/go/analysis/passes/framepointer
golang.org/x/tools/go/analysis/passes/httpresponse
golang.org/x/tools/go/analysis/passes/ifaceassert
golang.org/x/tools/go/analysis/passes/inspect
diff --git a/src/cmd/vet/main.go b/src/cmd/vet/main.go
index bad3807039..d50c45d691 100644
--- a/src/cmd/vet/main.go
+++ b/src/cmd/vet/main.go
@@ -14,6 +14,7 @@ import (
"golang.org/x/tools/go/analysis/passes/composite"
"golang.org/x/tools/go/analysis/passes/copylock"
"golang.org/x/tools/go/analysis/passes/errorsas"
+ "golang.org/x/tools/go/analysis/passes/framepointer"
"golang.org/x/tools/go/analysis/passes/httpresponse"
"golang.org/x/tools/go/analysis/passes/ifaceassert"
"golang.org/x/tools/go/analysis/passes/loopclosure"
@@ -45,6 +46,7 @@ func main() {
composite.Analyzer,
copylock.Analyzer,
errorsas.Analyzer,
+ framepointer.Analyzer,
httpresponse.Analyzer,
ifaceassert.Analyzer,
loopclosure.Analyzer,
diff --git a/src/cmd/vet/vet_test.go b/src/cmd/vet/vet_test.go
index 5d8139d977..d15d1ce377 100644
--- a/src/cmd/vet/vet_test.go
+++ b/src/cmd/vet/vet_test.go
@@ -9,7 +9,6 @@ import (
"errors"
"fmt"
"internal/testenv"
- "io/ioutil"
"log"
"os"
"os/exec"
@@ -32,7 +31,7 @@ func TestMain(m *testing.M) {
}
func testMain(m *testing.M) int {
- dir, err := ioutil.TempDir("", "vet_test")
+ dir, err := os.MkdirTemp("", "vet_test")
if err != nil {
fmt.Fprintln(os.Stderr, err)
return 1
@@ -345,7 +344,7 @@ var (
func wantedErrors(file, short string) (errs []wantedError) {
cache := make(map[string]*regexp.Regexp)
- src, err := ioutil.ReadFile(file)
+ src, err := os.ReadFile(file)
if err != nil {
log.Fatal(err)
}
diff --git a/src/compress/bzip2/bzip2_test.go b/src/compress/bzip2/bzip2_test.go
index 98477791b3..e6065cb43f 100644
--- a/src/compress/bzip2/bzip2_test.go
+++ b/src/compress/bzip2/bzip2_test.go
@@ -9,7 +9,7 @@ import (
"encoding/hex"
"fmt"
"io"
- "io/ioutil"
+ "os"
"testing"
)
@@ -22,7 +22,7 @@ func mustDecodeHex(s string) []byte {
}
func mustLoadFile(f string) []byte {
- b, err := ioutil.ReadFile(f)
+ b, err := os.ReadFile(f)
if err != nil {
panic(err)
}
diff --git a/src/compress/flate/deflate_test.go b/src/compress/flate/deflate_test.go
index 6fc5abf4d5..ff56712123 100644
--- a/src/compress/flate/deflate_test.go
+++ b/src/compress/flate/deflate_test.go
@@ -10,8 +10,8 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
"math/rand"
+ "os"
"reflect"
"runtime/debug"
"sync"
@@ -387,7 +387,7 @@ func TestDeflateInflateString(t *testing.T) {
t.Skip("skipping in short mode")
}
for _, test := range deflateInflateStringTests {
- gold, err := ioutil.ReadFile(test.filename)
+ gold, err := os.ReadFile(test.filename)
if err != nil {
t.Error(err)
}
@@ -685,7 +685,7 @@ func (w *failWriter) Write(b []byte) (int, error) {
func TestWriterPersistentError(t *testing.T) {
t.Parallel()
- d, err := ioutil.ReadFile("../../testdata/Isaac.Newton-Opticks.txt")
+ d, err := os.ReadFile("../../testdata/Isaac.Newton-Opticks.txt")
if err != nil {
t.Fatalf("ReadFile: %v", err)
}
diff --git a/src/compress/flate/huffman_bit_writer_test.go b/src/compress/flate/huffman_bit_writer_test.go
index 882d3abec1..a57799cae0 100644
--- a/src/compress/flate/huffman_bit_writer_test.go
+++ b/src/compress/flate/huffman_bit_writer_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"flag"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -38,7 +37,7 @@ func TestBlockHuff(t *testing.T) {
}
func testBlockHuff(t *testing.T, in, out string) {
- all, err := ioutil.ReadFile(in)
+ all, err := os.ReadFile(in)
if err != nil {
t.Error(err)
return
@@ -49,7 +48,7 @@ func testBlockHuff(t *testing.T, in, out string) {
bw.flush()
got := buf.Bytes()
- want, err := ioutil.ReadFile(out)
+ want, err := os.ReadFile(out)
if err != nil && !*update {
t.Error(err)
return
@@ -60,7 +59,7 @@ func testBlockHuff(t *testing.T, in, out string) {
if *update {
if in != out {
t.Logf("Updating %q", out)
- if err := ioutil.WriteFile(out, got, 0666); err != nil {
+ if err := os.WriteFile(out, got, 0666); err != nil {
t.Error(err)
}
return
@@ -70,7 +69,7 @@ func testBlockHuff(t *testing.T, in, out string) {
}
t.Errorf("%q != %q (see %q)", in, out, in+".got")
- if err := ioutil.WriteFile(in+".got", got, 0666); err != nil {
+ if err := os.WriteFile(in+".got", got, 0666); err != nil {
t.Error(err)
}
return
@@ -85,7 +84,7 @@ func testBlockHuff(t *testing.T, in, out string) {
got = buf.Bytes()
if !bytes.Equal(got, want) {
t.Errorf("after reset %q != %q (see %q)", in, out, in+".reset.got")
- if err := ioutil.WriteFile(in+".reset.got", got, 0666); err != nil {
+ if err := os.WriteFile(in+".reset.got", got, 0666); err != nil {
t.Error(err)
}
return
@@ -186,7 +185,7 @@ func testBlock(t *testing.T, test huffTest, ttype string) {
if *update {
if test.input != "" {
t.Logf("Updating %q", test.want)
- input, err := ioutil.ReadFile(test.input)
+ input, err := os.ReadFile(test.input)
if err != nil {
t.Error(err)
return
@@ -216,12 +215,12 @@ func testBlock(t *testing.T, test huffTest, ttype string) {
if test.input != "" {
t.Logf("Testing %q", test.want)
- input, err := ioutil.ReadFile(test.input)
+ input, err := os.ReadFile(test.input)
if err != nil {
t.Error(err)
return
}
- want, err := ioutil.ReadFile(test.want)
+ want, err := os.ReadFile(test.want)
if err != nil {
t.Error(err)
return
@@ -233,7 +232,7 @@ func testBlock(t *testing.T, test huffTest, ttype string) {
got := buf.Bytes()
if !bytes.Equal(got, want) {
t.Errorf("writeBlock did not yield expected result for file %q with input. See %q", test.want, test.want+".got")
- if err := ioutil.WriteFile(test.want+".got", got, 0666); err != nil {
+ if err := os.WriteFile(test.want+".got", got, 0666); err != nil {
t.Error(err)
}
}
@@ -247,7 +246,7 @@ func testBlock(t *testing.T, test huffTest, ttype string) {
got = buf.Bytes()
if !bytes.Equal(got, want) {
t.Errorf("reset: writeBlock did not yield expected result for file %q with input. See %q", test.want, test.want+".reset.got")
- if err := ioutil.WriteFile(test.want+".reset.got", got, 0666); err != nil {
+ if err := os.WriteFile(test.want+".reset.got", got, 0666); err != nil {
t.Error(err)
}
return
@@ -256,7 +255,7 @@ func testBlock(t *testing.T, test huffTest, ttype string) {
testWriterEOF(t, "wb", test, true)
}
t.Logf("Testing %q", test.wantNoInput)
- wantNI, err := ioutil.ReadFile(test.wantNoInput)
+ wantNI, err := os.ReadFile(test.wantNoInput)
if err != nil {
t.Error(err)
return
@@ -268,7 +267,7 @@ func testBlock(t *testing.T, test huffTest, ttype string) {
got := buf.Bytes()
if !bytes.Equal(got, wantNI) {
t.Errorf("writeBlock did not yield expected result for file %q with input. See %q", test.wantNoInput, test.wantNoInput+".got")
- if err := ioutil.WriteFile(test.want+".got", got, 0666); err != nil {
+ if err := os.WriteFile(test.want+".got", got, 0666); err != nil {
t.Error(err)
}
} else if got[0]&1 == 1 {
@@ -286,7 +285,7 @@ func testBlock(t *testing.T, test huffTest, ttype string) {
got = buf.Bytes()
if !bytes.Equal(got, wantNI) {
t.Errorf("reset: writeBlock did not yield expected result for file %q without input. See %q", test.want, test.want+".reset.got")
- if err := ioutil.WriteFile(test.want+".reset.got", got, 0666); err != nil {
+ if err := os.WriteFile(test.want+".reset.got", got, 0666); err != nil {
t.Error(err)
}
return
@@ -325,7 +324,7 @@ func testWriterEOF(t *testing.T, ttype string, test huffTest, useInput bool) {
var input []byte
if useInput {
var err error
- input, err = ioutil.ReadFile(test.input)
+ input, err = os.ReadFile(test.input)
if err != nil {
t.Error(err)
return
diff --git a/src/compress/flate/reader_test.go b/src/compress/flate/reader_test.go
index eb32c89184..94610fbb78 100644
--- a/src/compress/flate/reader_test.go
+++ b/src/compress/flate/reader_test.go
@@ -7,7 +7,7 @@ package flate
import (
"bytes"
"io"
- "io/ioutil"
+ "os"
"runtime"
"strings"
"testing"
@@ -80,7 +80,7 @@ var sizes = []struct {
func doBench(b *testing.B, f func(b *testing.B, buf []byte, level, n int)) {
for _, suite := range suites {
- buf, err := ioutil.ReadFile(suite.file)
+ buf, err := os.ReadFile(suite.file)
if err != nil {
b.Fatal(err)
}
diff --git a/src/compress/lzw/reader_test.go b/src/compress/lzw/reader_test.go
index 6d91dd806f..d1eb76d042 100644
--- a/src/compress/lzw/reader_test.go
+++ b/src/compress/lzw/reader_test.go
@@ -8,8 +8,8 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"math"
+ "os"
"runtime"
"strconv"
"strings"
@@ -218,7 +218,7 @@ func TestNoLongerSavingPriorExpansions(t *testing.T) {
}
func BenchmarkDecoder(b *testing.B) {
- buf, err := ioutil.ReadFile("../testdata/e.txt")
+ buf, err := os.ReadFile("../testdata/e.txt")
if err != nil {
b.Fatal(err)
}
diff --git a/src/compress/lzw/writer_test.go b/src/compress/lzw/writer_test.go
index 33a28bdd3a..1a5dbcae93 100644
--- a/src/compress/lzw/writer_test.go
+++ b/src/compress/lzw/writer_test.go
@@ -8,7 +8,6 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
"math"
"os"
"runtime"
@@ -125,7 +124,7 @@ func TestSmallLitWidth(t *testing.T) {
}
func BenchmarkEncoder(b *testing.B) {
- buf, err := ioutil.ReadFile("../testdata/e.txt")
+ buf, err := os.ReadFile("../testdata/e.txt")
if err != nil {
b.Fatal(err)
}
diff --git a/src/compress/zlib/writer_test.go b/src/compress/zlib/writer_test.go
index c518729146..f0b38880a6 100644
--- a/src/compress/zlib/writer_test.go
+++ b/src/compress/zlib/writer_test.go
@@ -9,7 +9,6 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"testing"
)
@@ -95,7 +94,7 @@ func testFileLevelDictReset(t *testing.T, fn string, level int, dict []byte) {
var b0 []byte
var err error
if fn != "" {
- b0, err = ioutil.ReadFile(fn)
+ b0, err = os.ReadFile(fn)
if err != nil {
t.Errorf("%s (level=%d): %v", fn, level, err)
return
diff --git a/src/crypto/md5/gen.go b/src/crypto/md5/gen.go
index a11f22059f..1468924cbc 100644
--- a/src/crypto/md5/gen.go
+++ b/src/crypto/md5/gen.go
@@ -15,8 +15,8 @@ import (
"bytes"
"flag"
"go/format"
- "io/ioutil"
"log"
+ "os"
"strings"
"text/template"
)
@@ -37,7 +37,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
- err = ioutil.WriteFile(*filename, data, 0644)
+ err = os.WriteFile(*filename, data, 0644)
if err != nil {
log.Fatal(err)
}
diff --git a/src/crypto/tls/handshake_test.go b/src/crypto/tls/handshake_test.go
index 605be587b5..d9ff9fe948 100644
--- a/src/crypto/tls/handshake_test.go
+++ b/src/crypto/tls/handshake_test.go
@@ -13,7 +13,6 @@ import (
"flag"
"fmt"
"io"
- "io/ioutil"
"net"
"os"
"os/exec"
@@ -224,7 +223,7 @@ func parseTestData(r io.Reader) (flows [][]byte, err error) {
// tempFile creates a temp file containing contents and returns its path.
func tempFile(contents string) string {
- file, err := ioutil.TempFile("", "go-tls-test")
+ file, err := os.CreateTemp("", "go-tls-test")
if err != nil {
panic("failed to create temp file: " + err.Error())
}
diff --git a/src/crypto/tls/link_test.go b/src/crypto/tls/link_test.go
index 8224216b5c..8c392ff7c4 100644
--- a/src/crypto/tls/link_test.go
+++ b/src/crypto/tls/link_test.go
@@ -7,7 +7,6 @@ package tls
import (
"bytes"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -77,7 +76,7 @@ func main() { tls.Dial("", "", nil) }
exeFile := filepath.Join(tmpDir, "x.exe")
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- if err := ioutil.WriteFile(goFile, []byte(tt.program), 0644); err != nil {
+ if err := os.WriteFile(goFile, []byte(tt.program), 0644); err != nil {
t.Fatal(err)
}
os.Remove(exeFile)
diff --git a/src/crypto/tls/tls.go b/src/crypto/tls/tls.go
index bf577cadea..19884f96e7 100644
--- a/src/crypto/tls/tls.go
+++ b/src/crypto/tls/tls.go
@@ -22,8 +22,8 @@ import (
"encoding/pem"
"errors"
"fmt"
- "io/ioutil"
"net"
+ "os"
"strings"
)
@@ -222,11 +222,11 @@ func (d *Dialer) DialContext(ctx context.Context, network, addr string) (net.Con
// form a certificate chain. On successful return, Certificate.Leaf will
// be nil because the parsed form of the certificate is not retained.
func LoadX509KeyPair(certFile, keyFile string) (Certificate, error) {
- certPEMBlock, err := ioutil.ReadFile(certFile)
+ certPEMBlock, err := os.ReadFile(certFile)
if err != nil {
return Certificate{}, err
}
- keyPEMBlock, err := ioutil.ReadFile(keyFile)
+ keyPEMBlock, err := os.ReadFile(keyFile)
if err != nil {
return Certificate{}, err
}
diff --git a/src/crypto/x509/name_constraints_test.go b/src/crypto/x509/name_constraints_test.go
index 34055d07b5..3826c82c38 100644
--- a/src/crypto/x509/name_constraints_test.go
+++ b/src/crypto/x509/name_constraints_test.go
@@ -14,7 +14,6 @@ import (
"encoding/hex"
"encoding/pem"
"fmt"
- "io/ioutil"
"math/big"
"net"
"net/url"
@@ -2005,7 +2004,7 @@ func TestConstraintCases(t *testing.T) {
}
func writePEMsToTempFile(certs []*Certificate) *os.File {
- file, err := ioutil.TempFile("", "name_constraints_test")
+ file, err := os.CreateTemp("", "name_constraints_test")
if err != nil {
panic("cannot create tempfile")
}
diff --git a/src/crypto/x509/root_ios_gen.go b/src/crypto/x509/root_ios_gen.go
index 2bcdab1a77..8bc6e7d9c4 100644
--- a/src/crypto/x509/root_ios_gen.go
+++ b/src/crypto/x509/root_ios_gen.go
@@ -27,9 +27,9 @@ import (
"fmt"
"go/format"
"io"
- "io/ioutil"
"log"
"net/http"
+ "os"
"path"
"sort"
"strings"
@@ -155,7 +155,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
- if err := ioutil.WriteFile(*output, source, 0644); err != nil {
+ if err := os.WriteFile(*output, source, 0644); err != nil {
log.Fatal(err)
}
}
diff --git a/src/crypto/x509/root_plan9.go b/src/crypto/x509/root_plan9.go
index 09f0e23033..2dc4aaf5d7 100644
--- a/src/crypto/x509/root_plan9.go
+++ b/src/crypto/x509/root_plan9.go
@@ -7,7 +7,6 @@
package x509
import (
- "io/ioutil"
"os"
)
@@ -24,7 +23,7 @@ func loadSystemRoots() (*CertPool, error) {
roots := NewCertPool()
var bestErr error
for _, file := range certFiles {
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err == nil {
roots.AppendCertsFromPEM(data)
return roots, nil
diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go
index 1090b69f83..262fc079d5 100644
--- a/src/crypto/x509/root_unix.go
+++ b/src/crypto/x509/root_unix.go
@@ -8,7 +8,6 @@ package x509
import (
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -40,7 +39,7 @@ func loadSystemRoots() (*CertPool, error) {
var firstErr error
for _, file := range files {
- data, err := ioutil.ReadFile(file)
+ data, err := os.ReadFile(file)
if err == nil {
roots.AppendCertsFromPEM(data)
break
@@ -68,7 +67,7 @@ func loadSystemRoots() (*CertPool, error) {
continue
}
for _, fi := range fis {
- data, err := ioutil.ReadFile(directory + "/" + fi.Name())
+ data, err := os.ReadFile(directory + "/" + fi.Name())
if err == nil {
roots.AppendCertsFromPEM(data)
}
@@ -82,17 +81,17 @@ func loadSystemRoots() (*CertPool, error) {
return nil, firstErr
}
-// readUniqueDirectoryEntries is like ioutil.ReadDir but omits
+// readUniqueDirectoryEntries is like os.ReadDir but omits
// symlinks that point within the directory.
-func readUniqueDirectoryEntries(dir string) ([]fs.FileInfo, error) {
- fis, err := ioutil.ReadDir(dir)
+func readUniqueDirectoryEntries(dir string) ([]fs.DirEntry, error) {
+ files, err := os.ReadDir(dir)
if err != nil {
return nil, err
}
- uniq := fis[:0]
- for _, fi := range fis {
- if !isSameDirSymlink(fi, dir) {
- uniq = append(uniq, fi)
+ uniq := files[:0]
+ for _, f := range files {
+ if !isSameDirSymlink(f, dir) {
+ uniq = append(uniq, f)
}
}
return uniq, nil
@@ -100,10 +99,10 @@ func readUniqueDirectoryEntries(dir string) ([]fs.FileInfo, error) {
// isSameDirSymlink reports whether fi in dir is a symlink with a
// target not containing a slash.
-func isSameDirSymlink(fi fs.FileInfo, dir string) bool {
- if fi.Mode()&fs.ModeSymlink == 0 {
+func isSameDirSymlink(f fs.DirEntry, dir string) bool {
+ if f.Type()&fs.ModeSymlink == 0 {
return false
}
- target, err := os.Readlink(filepath.Join(dir, fi.Name()))
+ target, err := os.Readlink(filepath.Join(dir, f.Name()))
return err == nil && !strings.Contains(target, "/")
}
diff --git a/src/crypto/x509/root_unix_test.go b/src/crypto/x509/root_unix_test.go
index b2e832ff36..878ed7c2fa 100644
--- a/src/crypto/x509/root_unix_test.go
+++ b/src/crypto/x509/root_unix_test.go
@@ -9,7 +9,6 @@ package x509
import (
"bytes"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -147,7 +146,7 @@ func TestLoadSystemCertsLoadColonSeparatedDirs(t *testing.T) {
os.Setenv(certFileEnv, origFile)
}()
- tmpDir, err := ioutil.TempDir(os.TempDir(), "x509-issue35325")
+ tmpDir, err := os.MkdirTemp(os.TempDir(), "x509-issue35325")
if err != nil {
t.Fatalf("Failed to create temporary directory: %v", err)
}
@@ -166,7 +165,7 @@ func TestLoadSystemCertsLoadColonSeparatedDirs(t *testing.T) {
t.Fatalf("Failed to create certificate dir: %v", err)
}
certOutFile := filepath.Join(certDir, "cert.crt")
- if err := ioutil.WriteFile(certOutFile, []byte(certPEM), 0655); err != nil {
+ if err := os.WriteFile(certOutFile, []byte(certPEM), 0655); err != nil {
t.Fatalf("Failed to write certificate to file: %v", err)
}
certDirs = append(certDirs, certDir)
diff --git a/src/debug/dwarf/dwarf5ranges_test.go b/src/debug/dwarf/dwarf5ranges_test.go
index 2229d439a5..0ff1a55bc9 100644
--- a/src/debug/dwarf/dwarf5ranges_test.go
+++ b/src/debug/dwarf/dwarf5ranges_test.go
@@ -6,13 +6,13 @@ package dwarf
import (
"encoding/binary"
- "io/ioutil"
+ "os"
"reflect"
"testing"
)
func TestDwarf5Ranges(t *testing.T) {
- rngLists, err := ioutil.ReadFile("testdata/debug_rnglists")
+ rngLists, err := os.ReadFile("testdata/debug_rnglists")
if err != nil {
t.Fatalf("could not read test data: %v", err)
}
diff --git a/src/debug/gosym/pclntab_test.go b/src/debug/gosym/pclntab_test.go
index f93a5bf5e5..7347139b5d 100644
--- a/src/debug/gosym/pclntab_test.go
+++ b/src/debug/gosym/pclntab_test.go
@@ -10,7 +10,6 @@ import (
"debug/elf"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -31,7 +30,7 @@ func dotest(t *testing.T) {
t.Skipf("skipping on non-AMD64 system %s", runtime.GOARCH)
}
var err error
- pclineTempDir, err = ioutil.TempDir("", "pclinetest")
+ pclineTempDir, err = os.MkdirTemp("", "pclinetest")
if err != nil {
t.Fatal(err)
}
@@ -278,7 +277,7 @@ func TestPCLine(t *testing.T) {
// }
// [END]
func Test115PclnParsing(t *testing.T) {
- zippedDat, err := ioutil.ReadFile("testdata/pcln115.gz")
+ zippedDat, err := os.ReadFile("testdata/pcln115.gz")
if err != nil {
t.Fatal(err)
}
diff --git a/src/debug/pe/file_test.go b/src/debug/pe/file_test.go
index d96cd30904..58deff1450 100644
--- a/src/debug/pe/file_test.go
+++ b/src/debug/pe/file_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"debug/dwarf"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -354,7 +353,7 @@ func testDWARF(t *testing.T, linktype int) {
}
testenv.MustHaveGoRun(t)
- tmpdir, err := ioutil.TempDir("", "TestDWARF")
+ tmpdir, err := os.MkdirTemp("", "TestDWARF")
if err != nil {
t.Fatal(err)
}
@@ -473,7 +472,7 @@ func TestBSSHasZeros(t *testing.T) {
t.Skip("skipping test: gcc is missing")
}
- tmpdir, err := ioutil.TempDir("", "TestBSSHasZeros")
+ tmpdir, err := os.MkdirTemp("", "TestBSSHasZeros")
if err != nil {
t.Fatal(err)
}
@@ -492,7 +491,7 @@ main(void)
return 0;
}
`
- err = ioutil.WriteFile(srcpath, []byte(src), 0644)
+ err = os.WriteFile(srcpath, []byte(src), 0644)
if err != nil {
t.Fatal(err)
}
@@ -597,14 +596,14 @@ func TestBuildingWindowsGUI(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("skipping windows only test")
}
- tmpdir, err := ioutil.TempDir("", "TestBuildingWindowsGUI")
+ tmpdir, err := os.MkdirTemp("", "TestBuildingWindowsGUI")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
src := filepath.Join(tmpdir, "a.go")
- err = ioutil.WriteFile(src, []byte(`package main; func main() {}`), 0644)
+ err = os.WriteFile(src, []byte(`package main; func main() {}`), 0644)
if err != nil {
t.Fatal(err)
}
@@ -684,7 +683,7 @@ func TestInvalidOptionalHeaderMagic(t *testing.T) {
func TestImportedSymbolsNoPanicMissingOptionalHeader(t *testing.T) {
// https://golang.org/issue/30250
// ImportedSymbols shouldn't panic if optional headers is missing
- data, err := ioutil.ReadFile("testdata/gcc-amd64-mingw-obj")
+ data, err := os.ReadFile("testdata/gcc-amd64-mingw-obj")
if err != nil {
t.Fatal(err)
}
diff --git a/src/embed/embed.go b/src/embed/embed.go
index b22975cc3a..29e0adf1a6 100644
--- a/src/embed/embed.go
+++ b/src/embed/embed.go
@@ -59,12 +59,15 @@
// as Go double-quoted or back-quoted string literals.
//
// If a pattern names a directory, all files in the subtree rooted at that directory are
-// embedded (recursively), so the variable in the above example is equivalent to:
+// embedded (recursively), except that files with names beginning with ‘.’ or ‘_’
+// are excluded. So the variable in the above example is almost equivalent to:
//
// // content is our static web server content.
// //go:embed image template html/index.html
// var content embed.FS
//
+// The difference is that ‘image/*’ embeds ‘image/.tempfile’ while ‘image’ does not.
+//
// The //go:embed directive can be used with both exported and unexported variables,
// depending on whether the package wants to make the data available to other packages.
// Similarly, it can be used with both global and function-local variables,
diff --git a/src/embed/internal/embedtest/embed_test.go b/src/embed/internal/embedtest/embed_test.go
index c82ca9fed2..c6a7bea7a3 100644
--- a/src/embed/internal/embedtest/embed_test.go
+++ b/src/embed/internal/embedtest/embed_test.go
@@ -65,7 +65,7 @@ func TestGlobal(t *testing.T) {
testFiles(t, global, "testdata/hello.txt", "hello, world\n")
testFiles(t, global, "testdata/glass.txt", "I can eat glass and it doesn't hurt me.\n")
- if err := fstest.TestFS(global); err != nil {
+ if err := fstest.TestFS(global, "concurrency.txt", "testdata/hello.txt"); err != nil {
t.Fatal(err)
}
@@ -101,3 +101,24 @@ func TestDir(t *testing.T) {
testDir(t, all, "testdata/i/j", "k/")
testDir(t, all, "testdata/i/j/k", "k8s.txt")
}
+
+func TestHidden(t *testing.T) {
+ //go:embed testdata
+ var dir embed.FS
+
+ //go:embed testdata/*
+ var star embed.FS
+
+ t.Logf("//go:embed testdata")
+
+ testDir(t, dir, "testdata",
+ "ascii.txt", "glass.txt", "hello.txt", "i/", "ken.txt")
+
+ t.Logf("//go:embed testdata/*")
+
+ testDir(t, star, "testdata",
+ ".hidden/", "_hidden/", "ascii.txt", "glass.txt", "hello.txt", "i/", "ken.txt")
+
+ testDir(t, star, "testdata/.hidden",
+ "fortune.txt", "more/") // but not .more or _more
+}
diff --git a/src/embed/internal/embedtest/embedx_test.go b/src/embed/internal/embedtest/embedx_test.go
index 53d45488f1..20d5a28c11 100644
--- a/src/embed/internal/embedtest/embedx_test.go
+++ b/src/embed/internal/embedtest/embedx_test.go
@@ -6,7 +6,7 @@ package embedtest_test
import (
"embed"
- "io/ioutil"
+ "os"
"testing"
)
@@ -59,7 +59,7 @@ func TestXGlobal(t *testing.T) {
testString(t, concurrency2, "concurrency2", "Concurrency is not parallelism.\n")
testString(t, string(glass2), "glass2", "I can eat glass and it doesn't hurt me.\n")
- big, err := ioutil.ReadFile("testdata/ascii.txt")
+ big, err := os.ReadFile("testdata/ascii.txt")
if err != nil {
t.Fatal(err)
}
diff --git a/src/embed/internal/embedtest/testdata/.hidden/.more/tip.txt b/src/embed/internal/embedtest/testdata/.hidden/.more/tip.txt
new file mode 100644
index 0000000000..71b9c6955d
--- /dev/null
+++ b/src/embed/internal/embedtest/testdata/.hidden/.more/tip.txt
@@ -0,0 +1 @@
+#define struct union /* Great space saver */
diff --git a/src/embed/internal/embedtest/testdata/.hidden/_more/tip.txt b/src/embed/internal/embedtest/testdata/.hidden/_more/tip.txt
new file mode 100644
index 0000000000..71b9c6955d
--- /dev/null
+++ b/src/embed/internal/embedtest/testdata/.hidden/_more/tip.txt
@@ -0,0 +1 @@
+#define struct union /* Great space saver */
diff --git a/src/embed/internal/embedtest/testdata/.hidden/fortune.txt b/src/embed/internal/embedtest/testdata/.hidden/fortune.txt
new file mode 100644
index 0000000000..31f2013f94
--- /dev/null
+++ b/src/embed/internal/embedtest/testdata/.hidden/fortune.txt
@@ -0,0 +1,2 @@
+WARNING: terminal is not fully functional
+ - (press RETURN)
diff --git a/src/embed/internal/embedtest/testdata/.hidden/more/tip.txt b/src/embed/internal/embedtest/testdata/.hidden/more/tip.txt
new file mode 100644
index 0000000000..71b9c6955d
--- /dev/null
+++ b/src/embed/internal/embedtest/testdata/.hidden/more/tip.txt
@@ -0,0 +1 @@
+#define struct union /* Great space saver */
diff --git a/src/embed/internal/embedtest/testdata/_hidden/fortune.txt b/src/embed/internal/embedtest/testdata/_hidden/fortune.txt
new file mode 100644
index 0000000000..31f2013f94
--- /dev/null
+++ b/src/embed/internal/embedtest/testdata/_hidden/fortune.txt
@@ -0,0 +1,2 @@
+WARNING: terminal is not fully functional
+ - (press RETURN)
diff --git a/src/go.mod b/src/go.mod
index 37091e116a..1fcd02f9ba 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -5,6 +5,6 @@ go 1.16
require (
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
golang.org/x/net v0.0.0-20201029221708-28c70e62bb1d
- golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65 // indirect
+ golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
golang.org/x/text v0.3.4 // indirect
)
diff --git a/src/go.sum b/src/go.sum
index 3f0270fb9a..913e6ea68d 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -8,8 +8,8 @@ golang.org/x/net v0.0.0-20201029221708-28c70e62bb1d/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65 h1:Qo9oJ566/Sq7N4hrGftVXs8GI2CXBCuOd4S2wHE/e0M=
-golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso=
+golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
diff --git a/src/go/build/build_test.go b/src/go/build/build_test.go
index 5a4a2d62f5..5a3e9ee714 100644
--- a/src/go/build/build_test.go
+++ b/src/go/build/build_test.go
@@ -8,7 +8,6 @@ import (
"flag"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -454,7 +453,7 @@ func TestImportDirNotExist(t *testing.T) {
testenv.MustHaveGoBuild(t) // really must just have source
ctxt := Default
- emptyDir, err := ioutil.TempDir("", t.Name())
+ emptyDir, err := os.MkdirTemp("", t.Name())
if err != nil {
t.Fatal(err)
}
@@ -592,7 +591,7 @@ func TestImportPackageOutsideModule(t *testing.T) {
// Create a GOPATH in a temporary directory. We don't use testdata
// because it's in GOROOT, which interferes with the module heuristic.
- gopath, err := ioutil.TempDir("", "gobuild-notmodule")
+ gopath, err := os.MkdirTemp("", "gobuild-notmodule")
if err != nil {
t.Fatal(err)
}
@@ -600,7 +599,7 @@ func TestImportPackageOutsideModule(t *testing.T) {
if err := os.MkdirAll(filepath.Join(gopath, "src/example.com/p"), 0777); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(filepath.Join(gopath, "src/example.com/p/p.go"), []byte("package p"), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(gopath, "src/example.com/p/p.go"), []byte("package p"), 0666); err != nil {
t.Fatal(err)
}
@@ -656,12 +655,12 @@ func TestIssue23594(t *testing.T) {
// Verifies golang.org/issue/34752.
func TestMissingImportErrorRepetition(t *testing.T) {
testenv.MustHaveGoBuild(t) // need 'go list' internally
- tmp, err := ioutil.TempDir("", "")
+ tmp, err := os.MkdirTemp("", "")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmp)
- if err := ioutil.WriteFile(filepath.Join(tmp, "go.mod"), []byte("module m"), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(tmp, "go.mod"), []byte("module m"), 0666); err != nil {
t.Fatal(err)
}
defer os.Setenv("GO111MODULE", os.Getenv("GO111MODULE"))
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
index e9ed26aa5f..56942c0fd2 100644
--- a/src/go/build/deps_test.go
+++ b/src/go/build/deps_test.go
@@ -12,7 +12,6 @@ import (
"fmt"
"internal/testenv"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -597,7 +596,7 @@ func findImports(pkg string) ([]string, error) {
vpkg = "vendor/" + pkg
}
dir := filepath.Join(Default.GOROOT, "src", vpkg)
- files, err := ioutil.ReadDir(dir)
+ files, err := os.ReadDir(dir)
if err != nil {
return nil, err
}
diff --git a/src/go/doc/doc_test.go b/src/go/doc/doc_test.go
index ab98bed62b..cbdca62aa1 100644
--- a/src/go/doc/doc_test.go
+++ b/src/go/doc/doc_test.go
@@ -13,7 +13,7 @@ import (
"go/printer"
"go/token"
"io/fs"
- "io/ioutil"
+ "os"
"path/filepath"
"regexp"
"strings"
@@ -127,7 +127,7 @@ func test(t *testing.T, mode Mode) {
// update golden file if necessary
golden := filepath.Join(dataDir, fmt.Sprintf("%s.%d.golden", pkg.Name, mode))
if *update {
- err := ioutil.WriteFile(golden, got, 0644)
+ err := os.WriteFile(golden, got, 0644)
if err != nil {
t.Error(err)
}
@@ -135,7 +135,7 @@ func test(t *testing.T, mode Mode) {
}
// get golden file
- want, err := ioutil.ReadFile(golden)
+ want, err := os.ReadFile(golden)
if err != nil {
t.Error(err)
continue
diff --git a/src/go/format/benchmark_test.go b/src/go/format/benchmark_test.go
index 7bd45c0e95..ac19aa3bf5 100644
--- a/src/go/format/benchmark_test.go
+++ b/src/go/format/benchmark_test.go
@@ -12,7 +12,7 @@ import (
"flag"
"fmt"
"go/format"
- "io/ioutil"
+ "os"
"testing"
)
@@ -67,7 +67,7 @@ func BenchmarkFormat(b *testing.B) {
if *debug {
filename := t.name + ".src"
- err := ioutil.WriteFile(filename, data, 0660)
+ err := os.WriteFile(filename, data, 0660)
if err != nil {
b.Fatalf("couldn't write %s: %v", filename, err)
}
diff --git a/src/go/format/format_test.go b/src/go/format/format_test.go
index 58e088ede3..27f4c74cdf 100644
--- a/src/go/format/format_test.go
+++ b/src/go/format/format_test.go
@@ -9,7 +9,7 @@ import (
"go/ast"
"go/parser"
"go/token"
- "io/ioutil"
+ "os"
"strings"
"testing"
)
@@ -38,7 +38,7 @@ func diff(t *testing.T, dst, src []byte) {
}
func TestNode(t *testing.T) {
- src, err := ioutil.ReadFile(testfile)
+ src, err := os.ReadFile(testfile)
if err != nil {
t.Fatal(err)
}
@@ -96,7 +96,7 @@ func TestNodeNoModify(t *testing.T) {
}
func TestSource(t *testing.T) {
- src, err := ioutil.ReadFile(testfile)
+ src, err := os.ReadFile(testfile)
if err != nil {
t.Fatal(err)
}
diff --git a/src/go/importer/importer_test.go b/src/go/importer/importer_test.go
index ff6e12c0da..0f5121d802 100644
--- a/src/go/importer/importer_test.go
+++ b/src/go/importer/importer_test.go
@@ -8,7 +8,6 @@ import (
"go/token"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"os/exec"
"runtime"
@@ -52,7 +51,7 @@ func TestForCompiler(t *testing.T) {
mathBigInt := pkg.Scope().Lookup("Int")
posn := fset.Position(mathBigInt.Pos()) // "$GOROOT/src/math/big/int.go:25:1"
filename := strings.Replace(posn.Filename, "$GOROOT", runtime.GOROOT(), 1)
- data, err := ioutil.ReadFile(filename)
+ data, err := os.ReadFile(filename)
if err != nil {
t.Fatalf("can't read file containing declaration of math/big.Int: %v", err)
}
diff --git a/src/go/internal/gccgoimporter/importer_test.go b/src/go/internal/gccgoimporter/importer_test.go
index e4236a5867..35240c8fe6 100644
--- a/src/go/internal/gccgoimporter/importer_test.go
+++ b/src/go/internal/gccgoimporter/importer_test.go
@@ -7,7 +7,6 @@ package gccgoimporter
import (
"go/types"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -150,7 +149,7 @@ func TestObjImporter(t *testing.T) {
}
t.Logf("gccgo version %d.%d", major, minor)
- tmpdir, err := ioutil.TempDir("", "TestObjImporter")
+ tmpdir, err := os.MkdirTemp("", "TestObjImporter")
if err != nil {
t.Fatal(err)
}
@@ -159,7 +158,7 @@ func TestObjImporter(t *testing.T) {
initmap := make(map[*types.Package]InitData)
imp := GetImporter([]string{tmpdir}, initmap)
- artmpdir, err := ioutil.TempDir("", "TestObjImporter")
+ artmpdir, err := os.MkdirTemp("", "TestObjImporter")
if err != nil {
t.Fatal(err)
}
diff --git a/src/go/internal/gcimporter/gcimporter_test.go b/src/go/internal/gcimporter/gcimporter_test.go
index 663753a18a..3c76aafde3 100644
--- a/src/go/internal/gcimporter/gcimporter_test.go
+++ b/src/go/internal/gcimporter/gcimporter_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -66,7 +65,7 @@ const maxTime = 30 * time.Second
func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) {
dirname := filepath.Join(runtime.GOROOT(), "pkg", runtime.GOOS+"_"+runtime.GOARCH, dir)
- list, err := ioutil.ReadDir(dirname)
+ list, err := os.ReadDir(dirname)
if err != nil {
t.Fatalf("testDir(%s): %s", dirname, err)
}
@@ -94,7 +93,7 @@ func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) {
}
func mktmpdir(t *testing.T) string {
- tmpdir, err := ioutil.TempDir("", "gcimporter_test")
+ tmpdir, err := os.MkdirTemp("", "gcimporter_test")
if err != nil {
t.Fatal("mktmpdir:", err)
}
@@ -144,7 +143,7 @@ func TestVersionHandling(t *testing.T) {
}
const dir = "./testdata/versions"
- list, err := ioutil.ReadDir(dir)
+ list, err := os.ReadDir(dir)
if err != nil {
t.Fatal(err)
}
@@ -199,7 +198,7 @@ func TestVersionHandling(t *testing.T) {
// create file with corrupted export data
// 1) read file
- data, err := ioutil.ReadFile(filepath.Join(dir, name))
+ data, err := os.ReadFile(filepath.Join(dir, name))
if err != nil {
t.Fatal(err)
}
@@ -216,7 +215,7 @@ func TestVersionHandling(t *testing.T) {
// 4) write the file
pkgpath += "_corrupted"
filename := filepath.Join(corruptdir, pkgpath) + ".a"
- ioutil.WriteFile(filename, data, 0666)
+ os.WriteFile(filename, data, 0666)
// test that importing the corrupted file results in an error
_, err = Import(fset, make(map[string]*types.Package), pkgpath, corruptdir, nil)
diff --git a/src/go/internal/srcimporter/srcimporter.go b/src/go/internal/srcimporter/srcimporter.go
index 90bb3a9bc1..c4d501dcd9 100644
--- a/src/go/internal/srcimporter/srcimporter.go
+++ b/src/go/internal/srcimporter/srcimporter.go
@@ -14,7 +14,6 @@ import (
"go/token"
"go/types"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -200,7 +199,7 @@ func (p *Importer) parseFiles(dir string, filenames []string) ([]*ast.File, erro
}
func (p *Importer) cgo(bp *build.Package) (*ast.File, error) {
- tmpdir, err := ioutil.TempDir("", "srcimporter")
+ tmpdir, err := os.MkdirTemp("", "srcimporter")
if err != nil {
return nil, err
}
diff --git a/src/go/internal/srcimporter/srcimporter_test.go b/src/go/internal/srcimporter/srcimporter_test.go
index 102ac43f94..05b12f1636 100644
--- a/src/go/internal/srcimporter/srcimporter_test.go
+++ b/src/go/internal/srcimporter/srcimporter_test.go
@@ -10,7 +10,6 @@ import (
"go/token"
"go/types"
"internal/testenv"
- "io/ioutil"
"os"
"path"
"path/filepath"
@@ -59,7 +58,7 @@ func walkDir(t *testing.T, path string, endTime time.Time) (int, bool) {
return 0, false
}
- list, err := ioutil.ReadDir(filepath.Join(runtime.GOROOT(), "src", path))
+ list, err := os.ReadDir(filepath.Join(runtime.GOROOT(), "src", path))
if err != nil {
t.Fatalf("walkDir %s failed (%v)", path, err)
}
diff --git a/src/go/parser/error_test.go b/src/go/parser/error_test.go
index 9b79097acf..358a844f65 100644
--- a/src/go/parser/error_test.go
+++ b/src/go/parser/error_test.go
@@ -25,7 +25,7 @@ package parser
import (
"go/scanner"
"go/token"
- "io/ioutil"
+ "os"
"path/filepath"
"regexp"
"strings"
@@ -174,13 +174,13 @@ func checkErrors(t *testing.T, filename string, input interface{}) {
}
func TestErrors(t *testing.T) {
- list, err := ioutil.ReadDir(testdata)
+ list, err := os.ReadDir(testdata)
if err != nil {
t.Fatal(err)
}
- for _, fi := range list {
- name := fi.Name()
- if !fi.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".src") {
+ for _, d := range list {
+ name := d.Name()
+ if !d.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".src") {
checkErrors(t, filepath.Join(testdata, name), nil)
}
}
diff --git a/src/go/parser/interface.go b/src/go/parser/interface.go
index d5c18a9e2d..56ff5fefb4 100644
--- a/src/go/parser/interface.go
+++ b/src/go/parser/interface.go
@@ -13,7 +13,7 @@ import (
"go/token"
"io"
"io/fs"
- "io/ioutil"
+ "os"
"path/filepath"
"strings"
)
@@ -39,7 +39,7 @@ func readSource(filename string, src interface{}) ([]byte, error) {
}
return nil, errors.New("invalid source")
}
- return ioutil.ReadFile(filename)
+ return os.ReadFile(filename)
}
// A Mode value is a set of flags (or 0).
@@ -133,29 +133,39 @@ func ParseFile(fset *token.FileSet, filename string, src interface{}, mode Mode)
// first error encountered are returned.
//
func ParseDir(fset *token.FileSet, path string, filter func(fs.FileInfo) bool, mode Mode) (pkgs map[string]*ast.Package, first error) {
- list, err := ioutil.ReadDir(path)
+ list, err := os.ReadDir(path)
if err != nil {
return nil, err
}
pkgs = make(map[string]*ast.Package)
for _, d := range list {
- if !d.IsDir() && strings.HasSuffix(d.Name(), ".go") && (filter == nil || filter(d)) {
- filename := filepath.Join(path, d.Name())
- if src, err := ParseFile(fset, filename, nil, mode); err == nil {
- name := src.Name.Name
- pkg, found := pkgs[name]
- if !found {
- pkg = &ast.Package{
- Name: name,
- Files: make(map[string]*ast.File),
- }
- pkgs[name] = pkg
+ if d.IsDir() || !strings.HasSuffix(d.Name(), ".go") {
+ continue
+ }
+ if filter != nil {
+ info, err := d.Info()
+ if err != nil {
+ return nil, err
+ }
+ if !filter(info) {
+ continue
+ }
+ }
+ filename := filepath.Join(path, d.Name())
+ if src, err := ParseFile(fset, filename, nil, mode); err == nil {
+ name := src.Name.Name
+ pkg, found := pkgs[name]
+ if !found {
+ pkg = &ast.Package{
+ Name: name,
+ Files: make(map[string]*ast.File),
}
- pkg.Files[filename] = src
- } else if first == nil {
- first = err
+ pkgs[name] = pkg
}
+ pkg.Files[filename] = src
+ } else if first == nil {
+ first = err
}
}
diff --git a/src/go/parser/performance_test.go b/src/go/parser/performance_test.go
index f2732c0e2b..f81bcee969 100644
--- a/src/go/parser/performance_test.go
+++ b/src/go/parser/performance_test.go
@@ -6,14 +6,14 @@ package parser
import (
"go/token"
- "io/ioutil"
+ "os"
"testing"
)
var src = readFile("parser.go")
func readFile(filename string) []byte {
- data, err := ioutil.ReadFile(filename)
+ data, err := os.ReadFile(filename)
if err != nil {
panic(err)
}
diff --git a/src/go/printer/performance_test.go b/src/go/printer/performance_test.go
index e23de3fbae..e655fa13ee 100644
--- a/src/go/printer/performance_test.go
+++ b/src/go/printer/performance_test.go
@@ -12,8 +12,8 @@ import (
"go/ast"
"go/parser"
"io"
- "io/ioutil"
"log"
+ "os"
"testing"
)
@@ -29,7 +29,7 @@ func testprint(out io.Writer, file *ast.File) {
func initialize() {
const filename = "testdata/parser.go"
- src, err := ioutil.ReadFile(filename)
+ src, err := os.ReadFile(filename)
if err != nil {
log.Fatalf("%s", err)
}
diff --git a/src/go/printer/printer_test.go b/src/go/printer/printer_test.go
index b64bc6bfb7..45e501115a 100644
--- a/src/go/printer/printer_test.go
+++ b/src/go/printer/printer_test.go
@@ -13,7 +13,7 @@ import (
"go/parser"
"go/token"
"io"
- "io/ioutil"
+ "os"
"path/filepath"
"testing"
"time"
@@ -119,7 +119,7 @@ func diff(aname, bname string, a, b []byte) error {
}
func runcheck(t *testing.T, source, golden string, mode checkMode) {
- src, err := ioutil.ReadFile(source)
+ src, err := os.ReadFile(source)
if err != nil {
t.Error(err)
return
@@ -133,14 +133,14 @@ func runcheck(t *testing.T, source, golden string, mode checkMode) {
// update golden files if necessary
if *update {
- if err := ioutil.WriteFile(golden, res, 0644); err != nil {
+ if err := os.WriteFile(golden, res, 0644); err != nil {
t.Error(err)
}
return
}
// get golden
- gld, err := ioutil.ReadFile(golden)
+ gld, err := os.ReadFile(golden)
if err != nil {
t.Error(err)
return
@@ -552,7 +552,7 @@ func TestBaseIndent(t *testing.T) {
// are not indented (because their values must not change) and make
// this test fail.
const filename = "printer.go"
- src, err := ioutil.ReadFile(filename)
+ src, err := os.ReadFile(filename)
if err != nil {
panic(err) // error in test
}
@@ -639,7 +639,7 @@ func (l *limitWriter) Write(buf []byte) (n int, err error) {
func TestWriteErrors(t *testing.T) {
t.Parallel()
const filename = "printer.go"
- src, err := ioutil.ReadFile(filename)
+ src, err := os.ReadFile(filename)
if err != nil {
panic(err) // error in test
}
diff --git a/src/go/scanner/scanner_test.go b/src/go/scanner/scanner_test.go
index 9d3bbbbb24..ab4c2dd962 100644
--- a/src/go/scanner/scanner_test.go
+++ b/src/go/scanner/scanner_test.go
@@ -6,7 +6,6 @@ package scanner
import (
"go/token"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -893,7 +892,7 @@ func BenchmarkScan(b *testing.B) {
func BenchmarkScanFile(b *testing.B) {
b.StopTimer()
const filename = "scanner.go"
- src, err := ioutil.ReadFile(filename)
+ src, err := os.ReadFile(filename)
if err != nil {
panic(err)
}
diff --git a/src/go/types/check.go b/src/go/types/check.go
index 5e7bd92076..280792e838 100644
--- a/src/go/types/check.go
+++ b/src/go/types/check.go
@@ -46,6 +46,7 @@ type context struct {
scope *Scope // top-most scope for lookups
pos token.Pos // if valid, identifiers are looked up as if at position pos (used by Eval)
iota constant.Value // value of iota in a constant declaration; nil otherwise
+ errpos positioner // if set, identifier position of a constant with inherited initializer
sig *Signature // function signature if inside a function; nil otherwise
isPanic map[*ast.CallExpr]bool // set of panic call expressions (used for termination check)
hasLabel bool // set if a function makes use of labels (only ~1% of functions); unused outside functions
diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go
index 37b287a20d..ce31dab68b 100644
--- a/src/go/types/check_test.go
+++ b/src/go/types/check_test.go
@@ -33,7 +33,7 @@ import (
"go/scanner"
"go/token"
"internal/testenv"
- "io/ioutil"
+ "os"
"path/filepath"
"regexp"
"strings"
@@ -153,7 +153,7 @@ func errMap(t *testing.T, testname string, files []*ast.File) map[string][]strin
for _, file := range files {
filename := fset.Position(file.Package).Filename
- src, err := ioutil.ReadFile(filename)
+ src, err := os.ReadFile(filename)
if err != nil {
t.Fatalf("%s: could not read %s", testname, filename)
}
@@ -329,17 +329,17 @@ func TestFixedBugs(t *testing.T) { testDir(t, "fixedbugs") }
func testDir(t *testing.T, dir string) {
testenv.MustHaveGoBuild(t)
- fis, err := ioutil.ReadDir(dir)
+ dirs, err := os.ReadDir(dir)
if err != nil {
t.Fatal(err)
}
- for _, fi := range fis {
- testname := filepath.Base(fi.Name())
+ for _, d := range dirs {
+ testname := filepath.Base(d.Name())
testname = strings.TrimSuffix(testname, filepath.Ext(testname))
t.Run(testname, func(t *testing.T) {
- filename := filepath.Join(dir, fi.Name())
- if fi.IsDir() {
+ filename := filepath.Join(dir, d.Name())
+ if d.IsDir() {
t.Errorf("skipped directory %q", filename)
return
}
diff --git a/src/go/types/decl.go b/src/go/types/decl.go
index 17b66ca387..1f0bc358a2 100644
--- a/src/go/types/decl.go
+++ b/src/go/types/decl.go
@@ -183,7 +183,7 @@ func (check *Checker) objDecl(obj Object, def *Named) {
switch obj := obj.(type) {
case *Const:
check.decl = d // new package-level const decl
- check.constDecl(obj, d.typ, d.init)
+ check.constDecl(obj, d.typ, d.init, d.inherited)
case *Var:
check.decl = d // new package-level var decl
check.varDecl(obj, d.lhs, d.typ, d.init)
@@ -388,10 +388,11 @@ type (
importDecl struct{ spec *ast.ImportSpec }
constDecl struct {
- spec *ast.ValueSpec
- iota int
- typ ast.Expr
- init []ast.Expr
+ spec *ast.ValueSpec
+ iota int
+ typ ast.Expr
+ init []ast.Expr
+ inherited bool
}
varDecl struct{ spec *ast.ValueSpec }
typeDecl struct{ spec *ast.TypeSpec }
@@ -424,14 +425,17 @@ func (check *Checker) walkDecl(d ast.Decl, f func(decl)) {
switch d.Tok {
case token.CONST:
// determine which initialization expressions to use
+ inherited := true
switch {
case s.Type != nil || len(s.Values) > 0:
last = s
+ inherited = false
case last == nil:
last = new(ast.ValueSpec) // make sure last exists
+ inherited = false
}
check.arityMatch(s, last)
- f(constDecl{spec: s, iota: iota, init: last.Values, typ: last.Type})
+ f(constDecl{spec: s, iota: iota, typ: last.Type, init: last.Values, inherited: inherited})
case token.VAR:
check.arityMatch(s, nil)
f(varDecl{s})
@@ -451,12 +455,16 @@ func (check *Checker) walkDecl(d ast.Decl, f func(decl)) {
}
}
-func (check *Checker) constDecl(obj *Const, typ, init ast.Expr) {
+func (check *Checker) constDecl(obj *Const, typ, init ast.Expr, inherited bool) {
assert(obj.typ == nil)
// use the correct value of iota
- defer func(iota constant.Value) { check.iota = iota }(check.iota)
+ defer func(iota constant.Value, errpos positioner) {
+ check.iota = iota
+ check.errpos = errpos
+ }(check.iota, check.errpos)
check.iota = obj.val
+ check.errpos = nil
// provide valid constant value under all circumstances
obj.val = constant.MakeUnknown()
@@ -479,6 +487,15 @@ func (check *Checker) constDecl(obj *Const, typ, init ast.Expr) {
// check initialization
var x operand
if init != nil {
+ if inherited {
+ // The initialization expression is inherited from a previous
+ // constant declaration, and (error) positions refer to that
+ // expression and not the current constant declaration. Use
+ // the constant identifier position for any errors during
+ // init expression evaluation since that is all we have
+ // (see issues #42991, #42992).
+ check.errpos = atPos(obj.pos)
+ }
check.expr(&x, init)
}
check.initConst(obj, &x)
@@ -753,7 +770,7 @@ func (check *Checker) declStmt(d ast.Decl) {
init = d.init[i]
}
- check.constDecl(obj, d.typ, init)
+ check.constDecl(obj, d.typ, init, d.inherited)
}
// process function literals in init expressions before scope changes
diff --git a/src/go/types/errors.go b/src/go/types/errors.go
index c9c475e469..a2195011f0 100644
--- a/src/go/types/errors.go
+++ b/src/go/types/errors.go
@@ -89,6 +89,18 @@ func (check *Checker) err(err error) {
return
}
+ if check.errpos != nil && isInternal {
+ // If we have an internal error and the errpos override is set, use it to
+ // augment our error positioning.
+ // TODO(rFindley) we may also want to augment the error message and refer
+ // to the position (pos) in the original expression.
+ span := spanOf(check.errpos)
+ e.Pos = span.pos
+ e.go116start = span.start
+ e.go116end = span.end
+ err = e
+ }
+
if check.firstErr == nil {
check.firstErr = err
}
@@ -111,15 +123,15 @@ func (check *Checker) err(err error) {
}
func (check *Checker) newError(at positioner, code errorCode, soft bool, msg string) error {
- ext := spanOf(at)
+ span := spanOf(at)
return Error{
Fset: check.fset,
- Pos: ext.pos,
+ Pos: span.pos,
Msg: msg,
Soft: soft,
go116code: code,
- go116start: ext.start,
- go116end: ext.end,
+ go116start: span.start,
+ go116end: span.end,
}
}
diff --git a/src/go/types/hilbert_test.go b/src/go/types/hilbert_test.go
index 9783ce6dc9..77954d2f8b 100644
--- a/src/go/types/hilbert_test.go
+++ b/src/go/types/hilbert_test.go
@@ -12,7 +12,7 @@ import (
"go/importer"
"go/parser"
"go/token"
- "io/ioutil"
+ "os"
"testing"
. "go/types"
@@ -27,7 +27,7 @@ func TestHilbert(t *testing.T) {
// generate source
src := program(*H, *out)
if *out != "" {
- ioutil.WriteFile(*out, src, 0666)
+ os.WriteFile(*out, src, 0666)
return
}
diff --git a/src/go/types/issues_test.go b/src/go/types/issues_test.go
index f59f905397..34850eb034 100644
--- a/src/go/types/issues_test.go
+++ b/src/go/types/issues_test.go
@@ -12,6 +12,7 @@ import (
"go/ast"
"go/importer"
"go/parser"
+ "go/token"
"internal/testenv"
"sort"
"strings"
@@ -523,3 +524,28 @@ func TestIssue34921(t *testing.T) {
pkg = res // res is imported by the next package in this test
}
}
+
+func TestIssue43088(t *testing.T) {
+ // type T1 struct {
+ // _ T2
+ // }
+ //
+ // type T2 struct {
+ // _ struct {
+ // _ T2
+ // }
+ // }
+ n1 := NewTypeName(token.NoPos, nil, "T1", nil)
+ T1 := NewNamed(n1, nil, nil)
+ n2 := NewTypeName(token.NoPos, nil, "T2", nil)
+ T2 := NewNamed(n2, nil, nil)
+ s1 := NewStruct([]*Var{NewField(token.NoPos, nil, "_", T2, false)}, nil)
+ T1.SetUnderlying(s1)
+ s2 := NewStruct([]*Var{NewField(token.NoPos, nil, "_", T2, false)}, nil)
+ s3 := NewStruct([]*Var{NewField(token.NoPos, nil, "_", s2, false)}, nil)
+ T2.SetUnderlying(s3)
+
+ // These calls must terminate (no endless recursion).
+ Comparable(T1)
+ Comparable(T2)
+}
diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go
index 057908eacd..148edbfb76 100644
--- a/src/go/types/predicates.go
+++ b/src/go/types/predicates.go
@@ -79,6 +79,18 @@ func IsInterface(typ Type) bool {
// Comparable reports whether values of type T are comparable.
func Comparable(T Type) bool {
+ return comparable(T, nil)
+}
+
+func comparable(T Type, seen map[Type]bool) bool {
+ if seen[T] {
+ return true
+ }
+ if seen == nil {
+ seen = make(map[Type]bool)
+ }
+ seen[T] = true
+
switch t := T.Underlying().(type) {
case *Basic:
// assume invalid types to be comparable
@@ -88,13 +100,13 @@ func Comparable(T Type) bool {
return true
case *Struct:
for _, f := range t.fields {
- if !Comparable(f.typ) {
+ if !comparable(f.typ, seen) {
return false
}
}
return true
case *Array:
- return Comparable(t.elem)
+ return comparable(t.elem, seen)
}
return false
}
diff --git a/src/go/types/resolver.go b/src/go/types/resolver.go
index 4092d55b4e..b637f8b8ca 100644
--- a/src/go/types/resolver.go
+++ b/src/go/types/resolver.go
@@ -17,12 +17,13 @@ import (
// A declInfo describes a package-level const, type, var, or func declaration.
type declInfo struct {
- file *Scope // scope of file containing this declaration
- lhs []*Var // lhs of n:1 variable declarations, or nil
- typ ast.Expr // type, or nil
- init ast.Expr // init/orig expression, or nil
- fdecl *ast.FuncDecl // func declaration, or nil
- alias bool // type alias declaration
+ file *Scope // scope of file containing this declaration
+ lhs []*Var // lhs of n:1 variable declarations, or nil
+ typ ast.Expr // type, or nil
+ init ast.Expr // init/orig expression, or nil
+ inherited bool // if set, the init expression is inherited from a previous constant declaration
+ fdecl *ast.FuncDecl // func declaration, or nil
+ alias bool // type alias declaration
// The deps field tracks initialization expression dependencies.
deps map[Object]bool // lazily initialized
@@ -323,7 +324,7 @@ func (check *Checker) collectObjects() {
init = d.init[i]
}
- d := &declInfo{file: fileScope, typ: d.typ, init: init}
+ d := &declInfo{file: fileScope, typ: d.typ, init: init, inherited: d.inherited}
check.declarePkgObj(name, obj, d)
}
diff --git a/src/go/types/stdlib_test.go b/src/go/types/stdlib_test.go
index 5bd43e688a..96011c54ad 100644
--- a/src/go/types/stdlib_test.go
+++ b/src/go/types/stdlib_test.go
@@ -16,7 +16,6 @@ import (
"go/scanner"
"go/token"
"internal/testenv"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -87,7 +86,7 @@ func firstComment(filename string) string {
}
func testTestDir(t *testing.T, path string, ignore ...string) {
- files, err := ioutil.ReadDir(path)
+ files, err := os.ReadDir(path)
if err != nil {
t.Fatal(err)
}
@@ -298,7 +297,7 @@ func (w *walker) walk(dir string) {
return
}
- fis, err := ioutil.ReadDir(dir)
+ files, err := os.ReadDir(dir)
if err != nil {
w.errh(err)
return
@@ -318,9 +317,9 @@ func (w *walker) walk(dir string) {
}
// traverse subdirectories, but don't walk into testdata
- for _, fi := range fis {
- if fi.IsDir() && fi.Name() != "testdata" {
- w.walk(filepath.Join(dir, fi.Name()))
+ for _, f := range files {
+ if f.IsDir() && f.Name() != "testdata" {
+ w.walk(filepath.Join(dir, f.Name()))
}
}
}
diff --git a/src/go/types/testdata/constdecl.src b/src/go/types/testdata/constdecl.src
index c2f40ed6e6..680c85aff3 100644
--- a/src/go/types/testdata/constdecl.src
+++ b/src/go/types/testdata/constdecl.src
@@ -107,4 +107,35 @@ func _() {
const x, y, z = 0, 1, unsafe.Sizeof(func() { _ = x /* ERROR "undeclared name" */ + y /* ERROR "undeclared name" */ + z /* ERROR "undeclared name" */ })
}
+// Test cases for errors in inherited constant initialization expressions.
+// Errors related to inherited initialization expressions must appear at
+// the constant identifier being declared, not at the original expression
+// (issues #42991, #42992).
+const (
+ _ byte = 255 + iota
+ /* some gap */
+ _ // ERROR overflows
+ /* some gap */
+ /* some gap */ _ /* ERROR overflows */; _ /* ERROR overflows */
+ /* some gap */
+ _ = 255 + iota
+ _ = byte /* ERROR overflows */ (255) + iota
+ _ /* ERROR overflows */
+)
+
+// Test cases from issue.
+const (
+ ok = byte(iota + 253)
+ bad
+ barn
+ bard // ERROR cannot convert
+)
+
+const (
+ c = len([1 - iota]int{})
+ d
+ e // ERROR invalid array length
+ f // ERROR invalid array length
+)
+
// TODO(gri) move extra tests from testdata/const0.src into here
diff --git a/src/hash/crc32/gen_const_ppc64le.go b/src/hash/crc32/gen_const_ppc64le.go
index bfb3b3a227..d7af018af4 100644
--- a/src/hash/crc32/gen_const_ppc64le.go
+++ b/src/hash/crc32/gen_const_ppc64le.go
@@ -27,7 +27,7 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
+ "os"
)
var blocking = 32 * 1024
@@ -103,7 +103,7 @@ func main() {
genCrc32ConstTable(w, 0xeb31d82e, "Koop")
b := w.Bytes()
- err := ioutil.WriteFile("crc32_table_ppc64le.s", b, 0666)
+ err := os.WriteFile("crc32_table_ppc64le.s", b, 0666)
if err != nil {
fmt.Printf("can't write output: %s\n", err)
}
diff --git a/src/html/template/examplefiles_test.go b/src/html/template/examplefiles_test.go
index 60518aee9e..5eb2597464 100644
--- a/src/html/template/examplefiles_test.go
+++ b/src/html/template/examplefiles_test.go
@@ -6,7 +6,6 @@ package template_test
import (
"io"
- "io/ioutil"
"log"
"os"
"path/filepath"
@@ -20,7 +19,7 @@ type templateFile struct {
}
func createTestDir(files []templateFile) string {
- dir, err := ioutil.TempDir("", "template")
+ dir, err := os.MkdirTemp("", "template")
if err != nil {
log.Fatal(err)
}
diff --git a/src/html/template/template.go b/src/html/template/template.go
index bc960afe5f..69312d36fd 100644
--- a/src/html/template/template.go
+++ b/src/html/template/template.go
@@ -8,7 +8,7 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
+ "os"
"path"
"path/filepath"
"sync"
@@ -523,7 +523,7 @@ func parseFS(t *Template, fsys fs.FS, patterns []string) (*Template, error) {
func readFileOS(file string) (name string, b []byte, err error) {
name = filepath.Base(file)
- b, err = ioutil.ReadFile(file)
+ b, err = os.ReadFile(file)
return
}
diff --git a/src/image/color/palette/gen.go b/src/image/color/palette/gen.go
index f8587db8f3..3243e53981 100644
--- a/src/image/color/palette/gen.go
+++ b/src/image/color/palette/gen.go
@@ -15,8 +15,8 @@ import (
"fmt"
"go/format"
"io"
- "io/ioutil"
"log"
+ "os"
)
var filename = flag.String("output", "palette.go", "output file name")
@@ -43,7 +43,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
- err = ioutil.WriteFile(*filename, data, 0644)
+ err = os.WriteFile(*filename, data, 0644)
if err != nil {
log.Fatal(err)
}
diff --git a/src/image/gif/reader_test.go b/src/image/gif/reader_test.go
index 29f47b6c08..5eec5ecb4a 100644
--- a/src/image/gif/reader_test.go
+++ b/src/image/gif/reader_test.go
@@ -11,7 +11,7 @@ import (
"image/color"
"image/color/palette"
"io"
- "io/ioutil"
+ "os"
"reflect"
"runtime"
"runtime/debug"
@@ -424,7 +424,7 @@ func TestDecodeMemoryConsumption(t *testing.T) {
}
func BenchmarkDecode(b *testing.B) {
- data, err := ioutil.ReadFile("../testdata/video-001.gif")
+ data, err := os.ReadFile("../testdata/video-001.gif")
if err != nil {
b.Fatal(err)
}
diff --git a/src/image/internal/imageutil/gen.go b/src/image/internal/imageutil/gen.go
index bc85c512f9..36de5dc9cc 100644
--- a/src/image/internal/imageutil/gen.go
+++ b/src/image/internal/imageutil/gen.go
@@ -11,7 +11,6 @@ import (
"flag"
"fmt"
"go/format"
- "io/ioutil"
"log"
"os"
)
@@ -36,7 +35,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
- if err := ioutil.WriteFile("impl.go", out, 0660); err != nil {
+ if err := os.WriteFile("impl.go", out, 0660); err != nil {
log.Fatal(err)
}
}
diff --git a/src/image/jpeg/reader_test.go b/src/image/jpeg/reader_test.go
index 1e2798c945..bf07fadede 100644
--- a/src/image/jpeg/reader_test.go
+++ b/src/image/jpeg/reader_test.go
@@ -11,7 +11,6 @@ import (
"image"
"image/color"
"io"
- "io/ioutil"
"math/rand"
"os"
"strings"
@@ -118,7 +117,7 @@ func (r *eofReader) Read(b []byte) (n int, err error) {
func TestDecodeEOF(t *testing.T) {
// Check that if reader returns final data and EOF at same time, jpeg handles it.
- data, err := ioutil.ReadFile("../testdata/video-001.jpeg")
+ data, err := os.ReadFile("../testdata/video-001.jpeg")
if err != nil {
t.Fatal(err)
}
@@ -189,7 +188,7 @@ func pixString(pix []byte, stride, x, y int) string {
}
func TestTruncatedSOSDataDoesntPanic(t *testing.T) {
- b, err := ioutil.ReadFile("../testdata/video-005.gray.q50.jpeg")
+ b, err := os.ReadFile("../testdata/video-005.gray.q50.jpeg")
if err != nil {
t.Fatal(err)
}
@@ -493,7 +492,7 @@ func TestExtraneousData(t *testing.T) {
}
func benchmarkDecode(b *testing.B, filename string) {
- data, err := ioutil.ReadFile(filename)
+ data, err := os.ReadFile(filename)
if err != nil {
b.Fatal(err)
}
diff --git a/src/image/png/reader_test.go b/src/image/png/reader_test.go
index 22c704e5cb..3937685294 100644
--- a/src/image/png/reader_test.go
+++ b/src/image/png/reader_test.go
@@ -11,7 +11,6 @@ import (
"image"
"image/color"
"io"
- "io/ioutil"
"os"
"reflect"
"strings"
@@ -785,7 +784,7 @@ func TestDimensionOverflow(t *testing.T) {
}
func benchmarkDecode(b *testing.B, filename string, bytesPerPixel int) {
- data, err := ioutil.ReadFile(filename)
+ data, err := os.ReadFile(filename)
if err != nil {
b.Fatal(err)
}
diff --git a/src/index/suffixarray/gen.go b/src/index/suffixarray/gen.go
index 8c3de553c9..94184d71b6 100644
--- a/src/index/suffixarray/gen.go
+++ b/src/index/suffixarray/gen.go
@@ -11,8 +11,8 @@ package main
import (
"bytes"
- "io/ioutil"
"log"
+ "os"
"strings"
)
@@ -20,7 +20,7 @@ func main() {
log.SetPrefix("gen: ")
log.SetFlags(0)
- data, err := ioutil.ReadFile("sais.go")
+ data, err := os.ReadFile("sais.go")
if err != nil {
log.Fatal(err)
}
@@ -64,7 +64,7 @@ func main() {
}
}
- if err := ioutil.WriteFile("sais2.go", buf.Bytes(), 0666); err != nil {
+ if err := os.WriteFile("sais2.go", buf.Bytes(), 0666); err != nil {
log.Fatal(err)
}
}
diff --git a/src/index/suffixarray/suffixarray_test.go b/src/index/suffixarray/suffixarray_test.go
index a11a98dae0..44c5041535 100644
--- a/src/index/suffixarray/suffixarray_test.go
+++ b/src/index/suffixarray/suffixarray_test.go
@@ -8,8 +8,8 @@ import (
"bytes"
"fmt"
"io/fs"
- "io/ioutil"
"math/rand"
+ "os"
"path/filepath"
"regexp"
"sort"
@@ -498,14 +498,14 @@ func makeText(name string) ([]byte, error) {
switch name {
case "opticks":
var err error
- data, err = ioutil.ReadFile("../../testdata/Isaac.Newton-Opticks.txt")
+ data, err = os.ReadFile("../../testdata/Isaac.Newton-Opticks.txt")
if err != nil {
return nil, err
}
case "go":
err := filepath.WalkDir("../..", func(path string, info fs.DirEntry, err error) error {
if err == nil && strings.HasSuffix(path, ".go") && !info.IsDir() {
- file, err := ioutil.ReadFile(path)
+ file, err := os.ReadFile(path)
if err != nil {
return err
}
diff --git a/src/internal/cpu/cpu_arm64.go b/src/internal/cpu/cpu_arm64.go
index 4e9ea8ca96..f64d9e4dd3 100644
--- a/src/internal/cpu/cpu_arm64.go
+++ b/src/internal/cpu/cpu_arm64.go
@@ -6,21 +6,6 @@ package cpu
const CacheLinePadSize = 64
-// HWCap may be initialized by archauxv and
-// should not be changed after it was initialized.
-var HWCap uint
-
-// HWCAP bits. These are exposed by Linux.
-const (
- hwcap_AES = 1 << 3
- hwcap_PMULL = 1 << 4
- hwcap_SHA1 = 1 << 5
- hwcap_SHA2 = 1 << 6
- hwcap_CRC32 = 1 << 7
- hwcap_ATOMICS = 1 << 8
- hwcap_CPUID = 1 << 11
-)
-
func doinit() {
options = []option{
{Name: "aes", Feature: &ARM64.HasAES},
@@ -34,86 +19,8 @@ func doinit() {
{Name: "isZeus", Feature: &ARM64.IsZeus},
}
- switch GOOS {
- case "linux", "android":
- // HWCap was populated by the runtime from the auxillary vector.
- // Use HWCap information since reading aarch64 system registers
- // is not supported in user space on older linux kernels.
- ARM64.HasAES = isSet(HWCap, hwcap_AES)
- ARM64.HasPMULL = isSet(HWCap, hwcap_PMULL)
- ARM64.HasSHA1 = isSet(HWCap, hwcap_SHA1)
- ARM64.HasSHA2 = isSet(HWCap, hwcap_SHA2)
- ARM64.HasCRC32 = isSet(HWCap, hwcap_CRC32)
- ARM64.HasCPUID = isSet(HWCap, hwcap_CPUID)
-
- // The Samsung S9+ kernel reports support for atomics, but not all cores
- // actually support them, resulting in SIGILL. See issue #28431.
- // TODO(elias.naur): Only disable the optimization on bad chipsets on android.
- ARM64.HasATOMICS = isSet(HWCap, hwcap_ATOMICS) && GOOS != "android"
-
- // Check to see if executing on a NeoverseN1 and in order to do that,
- // check the AUXV for the CPUID bit. The getMIDR function executes an
- // instruction which would normally be an illegal instruction, but it's
- // trapped by the kernel, the value sanitized and then returned. Without
- // the CPUID bit the kernel will not trap the instruction and the process
- // will be terminated with SIGILL.
- if ARM64.HasCPUID {
- midr := getMIDR()
- part_num := uint16((midr >> 4) & 0xfff)
- implementor := byte((midr >> 24) & 0xff)
-
- if implementor == 'A' && part_num == 0xd0c {
- ARM64.IsNeoverseN1 = true
- }
- if implementor == 'A' && part_num == 0xd40 {
- ARM64.IsZeus = true
- }
- }
-
- case "freebsd":
- // Retrieve info from system register ID_AA64ISAR0_EL1.
- isar0 := getisar0()
-
- // ID_AA64ISAR0_EL1
- switch extractBits(isar0, 4, 7) {
- case 1:
- ARM64.HasAES = true
- case 2:
- ARM64.HasAES = true
- ARM64.HasPMULL = true
- }
-
- switch extractBits(isar0, 8, 11) {
- case 1:
- ARM64.HasSHA1 = true
- }
-
- switch extractBits(isar0, 12, 15) {
- case 1, 2:
- ARM64.HasSHA2 = true
- }
-
- switch extractBits(isar0, 16, 19) {
- case 1:
- ARM64.HasCRC32 = true
- }
-
- switch extractBits(isar0, 20, 23) {
- case 2:
- ARM64.HasATOMICS = true
- }
- default:
- // Other operating systems do not support reading HWCap from auxillary vector
- // or reading privileged aarch64 system registers in user space.
- }
-}
-
-func extractBits(data uint64, start, end uint) uint {
- return (uint)(data>>start) & ((1 << (end - start + 1)) - 1)
-}
-
-func isSet(hwc uint, value uint) bool {
- return hwc&value != 0
+ // arm64 uses different ways to detect CPU features at runtime depending on the operating system.
+ osInit()
}
func getisar0() uint64
diff --git a/src/internal/cpu/cpu_linux.go b/src/internal/cpu/cpu_arm64_android.go
index ec0b84c510..3c9e57c52a 100644
--- a/src/internal/cpu/cpu_linux.go
+++ b/src/internal/cpu/cpu_arm64_android.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !android
+// +build arm64
package cpu
-const GOOS = "linux"
+func osInit() {
+ hwcapInit("android")
+}
diff --git a/src/internal/cpu/cpu_arm64_darwin.go b/src/internal/cpu/cpu_arm64_darwin.go
new file mode 100644
index 0000000000..e094b97f97
--- /dev/null
+++ b/src/internal/cpu/cpu_arm64_darwin.go
@@ -0,0 +1,34 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build arm64
+// +build darwin
+// +build !ios
+
+package cpu
+
+func osInit() {
+ ARM64.HasATOMICS = sysctlEnabled([]byte("hw.optional.armv8_1_atomics\x00"))
+ ARM64.HasCRC32 = sysctlEnabled([]byte("hw.optional.armv8_crc32\x00"))
+
+ // There are no hw.optional sysctl values for the below features on Mac OS 11.0
+ // to detect their supported state dynamically. Assume the CPU features that
+ // Apple Silicon M1 supports to be available as a minimal set of features
+ // to all Go programs running on darwin/arm64.
+ ARM64.HasAES = true
+ ARM64.HasPMULL = true
+ ARM64.HasSHA1 = true
+ ARM64.HasSHA2 = true
+}
+
+//go:noescape
+func getsysctlbyname(name []byte) (int32, int32)
+
+func sysctlEnabled(name []byte) bool {
+ ret, value := getsysctlbyname(name)
+ if ret < 0 {
+ return false
+ }
+ return value > 0
+}
diff --git a/src/internal/cpu/cpu_arm64_freebsd.go b/src/internal/cpu/cpu_arm64_freebsd.go
new file mode 100644
index 0000000000..9de2005c2e
--- /dev/null
+++ b/src/internal/cpu/cpu_arm64_freebsd.go
@@ -0,0 +1,45 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build arm64
+
+package cpu
+
+func osInit() {
+ // Retrieve info from system register ID_AA64ISAR0_EL1.
+ isar0 := getisar0()
+
+ // ID_AA64ISAR0_EL1
+ switch extractBits(isar0, 4, 7) {
+ case 1:
+ ARM64.HasAES = true
+ case 2:
+ ARM64.HasAES = true
+ ARM64.HasPMULL = true
+ }
+
+ switch extractBits(isar0, 8, 11) {
+ case 1:
+ ARM64.HasSHA1 = true
+ }
+
+ switch extractBits(isar0, 12, 15) {
+ case 1, 2:
+ ARM64.HasSHA2 = true
+ }
+
+ switch extractBits(isar0, 16, 19) {
+ case 1:
+ ARM64.HasCRC32 = true
+ }
+
+ switch extractBits(isar0, 20, 23) {
+ case 2:
+ ARM64.HasATOMICS = true
+ }
+}
+
+func extractBits(data uint64, start, end uint) uint {
+ return (uint)(data>>start) & ((1 << (end - start + 1)) - 1)
+}
diff --git a/src/internal/cpu/cpu_arm64_hwcap.go b/src/internal/cpu/cpu_arm64_hwcap.go
new file mode 100644
index 0000000000..fdaf43e1a2
--- /dev/null
+++ b/src/internal/cpu/cpu_arm64_hwcap.go
@@ -0,0 +1,63 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build arm64
+// +build linux
+
+package cpu
+
+// HWCap may be initialized by archauxv and
+// should not be changed after it was initialized.
+var HWCap uint
+
+// HWCAP bits. These are exposed by Linux.
+const (
+ hwcap_AES = 1 << 3
+ hwcap_PMULL = 1 << 4
+ hwcap_SHA1 = 1 << 5
+ hwcap_SHA2 = 1 << 6
+ hwcap_CRC32 = 1 << 7
+ hwcap_ATOMICS = 1 << 8
+ hwcap_CPUID = 1 << 11
+)
+
+func hwcapInit(os string) {
+ // HWCap was populated by the runtime from the auxiliary vector.
+ // Use HWCap information since reading aarch64 system registers
+ // is not supported in user space on older linux kernels.
+ ARM64.HasAES = isSet(HWCap, hwcap_AES)
+ ARM64.HasPMULL = isSet(HWCap, hwcap_PMULL)
+ ARM64.HasSHA1 = isSet(HWCap, hwcap_SHA1)
+ ARM64.HasSHA2 = isSet(HWCap, hwcap_SHA2)
+ ARM64.HasCRC32 = isSet(HWCap, hwcap_CRC32)
+ ARM64.HasCPUID = isSet(HWCap, hwcap_CPUID)
+
+ // The Samsung S9+ kernel reports support for atomics, but not all cores
+ // actually support them, resulting in SIGILL. See issue #28431.
+ // TODO(elias.naur): Only disable the optimization on bad chipsets on android.
+ ARM64.HasATOMICS = isSet(HWCap, hwcap_ATOMICS) && os != "android"
+
+ // Check to see if executing on a NeoverseN1 and in order to do that,
+ // check the AUXV for the CPUID bit. The getMIDR function executes an
+ // instruction which would normally be an illegal instruction, but it's
+ // trapped by the kernel, the value sanitized and then returned. Without
+ // the CPUID bit the kernel will not trap the instruction and the process
+ // will be terminated with SIGILL.
+ if ARM64.HasCPUID {
+ midr := getMIDR()
+ part_num := uint16((midr >> 4) & 0xfff)
+ implementor := byte((midr >> 24) & 0xff)
+
+ if implementor == 'A' && part_num == 0xd0c {
+ ARM64.IsNeoverseN1 = true
+ }
+ if implementor == 'A' && part_num == 0xd40 {
+ ARM64.IsZeus = true
+ }
+ }
+}
+
+func isSet(hwc uint, value uint) bool {
+ return hwc&value != 0
+}
diff --git a/src/internal/cpu/cpu_other.go b/src/internal/cpu/cpu_arm64_linux.go
index 8a15fbe79d..2f7411ff1e 100644
--- a/src/internal/cpu/cpu_other.go
+++ b/src/internal/cpu/cpu_arm64_linux.go
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !linux
-// +build !freebsd
+// +build arm64
+// +build linux
// +build !android
package cpu
-const GOOS = "other"
+func osInit() {
+ hwcapInit("linux")
+}
diff --git a/src/internal/cpu/cpu_arm64_other.go b/src/internal/cpu/cpu_arm64_other.go
new file mode 100644
index 0000000000..f191db28d2
--- /dev/null
+++ b/src/internal/cpu/cpu_arm64_other.go
@@ -0,0 +1,17 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build arm64
+// +build !linux
+// +build !freebsd
+// +build !android
+// +build !darwin ios
+
+package cpu
+
+func osInit() {
+ // Other operating systems do not support reading HWCap from auxiliary vector,
+ // reading privileged aarch64 system registers or sysctl in user space to detect
+ // CPU features at runtime.
+}
diff --git a/src/internal/cpu/cpu_s390x_test.go b/src/internal/cpu/cpu_s390x_test.go
index d910bbe695..ad86858db0 100644
--- a/src/internal/cpu/cpu_s390x_test.go
+++ b/src/internal/cpu/cpu_s390x_test.go
@@ -7,13 +7,13 @@ package cpu_test
import (
"errors"
. "internal/cpu"
- "io/ioutil"
+ "os"
"regexp"
"testing"
)
func getFeatureList() ([]string, error) {
- cpuinfo, err := ioutil.ReadFile("/proc/cpuinfo")
+ cpuinfo, err := os.ReadFile("/proc/cpuinfo")
if err != nil {
return nil, err
}
diff --git a/src/internal/cpu/cpu_test.go b/src/internal/cpu/cpu_test.go
index 919bbd5ed7..2de7365732 100644
--- a/src/internal/cpu/cpu_test.go
+++ b/src/internal/cpu/cpu_test.go
@@ -18,7 +18,7 @@ func TestMinimalFeatures(t *testing.T) {
// TODO: maybe do MustSupportFeatureDectection(t) ?
if runtime.GOARCH == "arm64" {
switch runtime.GOOS {
- case "linux", "android":
+ case "linux", "android", "darwin":
default:
t.Skipf("%s/%s is not supported", runtime.GOOS, runtime.GOARCH)
}
@@ -38,10 +38,7 @@ func MustHaveDebugOptionsSupport(t *testing.T) {
}
func MustSupportFeatureDectection(t *testing.T) {
- if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
- t.Skipf("CPU feature detection is not supported on %s/%s", runtime.GOOS, runtime.GOARCH)
- }
- // TODO: maybe there are other platforms?
+ // TODO: add platforms that do not have CPU feature detection support.
}
func runDebugOptionsTest(t *testing.T, test string, options string) {
diff --git a/src/internal/cpu/cpu_x86.go b/src/internal/cpu/cpu_x86.go
index fb414adaf8..ba6bf69034 100644
--- a/src/internal/cpu/cpu_x86.go
+++ b/src/internal/cpu/cpu_x86.go
@@ -75,13 +75,22 @@ func doinit() {
X86.HasSSE3 = isSet(ecx1, cpuid_SSE3)
X86.HasPCLMULQDQ = isSet(ecx1, cpuid_PCLMULQDQ)
X86.HasSSSE3 = isSet(ecx1, cpuid_SSSE3)
- X86.HasFMA = isSet(ecx1, cpuid_FMA)
X86.HasSSE41 = isSet(ecx1, cpuid_SSE41)
X86.HasSSE42 = isSet(ecx1, cpuid_SSE42)
X86.HasPOPCNT = isSet(ecx1, cpuid_POPCNT)
X86.HasAES = isSet(ecx1, cpuid_AES)
+
+ // OSXSAVE can be false when using older Operating Systems
+ // or when explicitly disabled on newer Operating Systems by
+ // e.g. setting the xsavedisable boot option on Windows 10.
X86.HasOSXSAVE = isSet(ecx1, cpuid_OSXSAVE)
+ // The FMA instruction set extension only has VEX prefixed instructions.
+ // VEX prefixed instructions require OSXSAVE to be enabled.
+ // See Intel 64 and IA-32 Architecture Software Developer’s Manual Volume 2
+ // Section 2.4 "AVX and SSE Instruction Exception Specification"
+ X86.HasFMA = isSet(ecx1, cpuid_FMA) && X86.HasOSXSAVE
+
osSupportsAVX := false
// For XGETBV, OSXSAVE bit is required and sufficient.
if X86.HasOSXSAVE {
diff --git a/src/internal/obscuretestdata/obscuretestdata.go b/src/internal/obscuretestdata/obscuretestdata.go
index 06cd1df22c..5ea2cdf5d1 100644
--- a/src/internal/obscuretestdata/obscuretestdata.go
+++ b/src/internal/obscuretestdata/obscuretestdata.go
@@ -10,7 +10,6 @@ package obscuretestdata
import (
"encoding/base64"
"io"
- "io/ioutil"
"os"
)
@@ -24,7 +23,7 @@ func DecodeToTempFile(name string) (path string, err error) {
}
defer f.Close()
- tmp, err := ioutil.TempFile("", "obscuretestdata-decoded-")
+ tmp, err := os.CreateTemp("", "obscuretestdata-decoded-")
if err != nil {
return "", err
}
diff --git a/src/internal/poll/read_test.go b/src/internal/poll/read_test.go
index 2d4ef97da0..598a52ee44 100644
--- a/src/internal/poll/read_test.go
+++ b/src/internal/poll/read_test.go
@@ -5,7 +5,6 @@
package poll_test
import (
- "io/ioutil"
"os"
"runtime"
"sync"
@@ -22,7 +21,7 @@ func TestRead(t *testing.T) {
go func(p string) {
defer wg.Done()
for i := 0; i < 100; i++ {
- if _, err := ioutil.ReadFile(p); err != nil {
+ if _, err := os.ReadFile(p); err != nil {
t.Error(err)
return
}
diff --git a/src/internal/testenv/testenv_windows.go b/src/internal/testenv/testenv_windows.go
index eb8d6ac165..4802b13951 100644
--- a/src/internal/testenv/testenv_windows.go
+++ b/src/internal/testenv/testenv_windows.go
@@ -5,7 +5,6 @@
package testenv
import (
- "io/ioutil"
"os"
"path/filepath"
"sync"
@@ -16,7 +15,7 @@ var symlinkOnce sync.Once
var winSymlinkErr error
func initWinHasSymlink() {
- tmpdir, err := ioutil.TempDir("", "symtest")
+ tmpdir, err := os.MkdirTemp("", "symtest")
if err != nil {
panic("failed to create temp directory: " + err.Error())
}
diff --git a/src/internal/trace/gc_test.go b/src/internal/trace/gc_test.go
index 4f9c77041a..9b9771e7b0 100644
--- a/src/internal/trace/gc_test.go
+++ b/src/internal/trace/gc_test.go
@@ -6,8 +6,8 @@ package trace
import (
"bytes"
- "io/ioutil"
"math"
+ "os"
"testing"
"time"
)
@@ -84,7 +84,7 @@ func TestMMUTrace(t *testing.T) {
t.Skip("skipping in -short mode")
}
- data, err := ioutil.ReadFile("testdata/stress_1_10_good")
+ data, err := os.ReadFile("testdata/stress_1_10_good")
if err != nil {
t.Fatalf("failed to read input file: %v", err)
}
@@ -126,7 +126,7 @@ func TestMMUTrace(t *testing.T) {
}
func BenchmarkMMU(b *testing.B) {
- data, err := ioutil.ReadFile("testdata/stress_1_10_good")
+ data, err := os.ReadFile("testdata/stress_1_10_good")
if err != nil {
b.Fatalf("failed to read input file: %v", err)
}
diff --git a/src/internal/trace/parser_test.go b/src/internal/trace/parser_test.go
index 6d87970157..cdab95a59e 100644
--- a/src/internal/trace/parser_test.go
+++ b/src/internal/trace/parser_test.go
@@ -6,7 +6,6 @@ package trace
import (
"bytes"
- "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -34,20 +33,20 @@ func TestCorruptedInputs(t *testing.T) {
}
func TestParseCanned(t *testing.T) {
- files, err := ioutil.ReadDir("./testdata")
+ files, err := os.ReadDir("./testdata")
if err != nil {
t.Fatalf("failed to read ./testdata: %v", err)
}
for _, f := range files {
- name := filepath.Join("./testdata", f.Name())
- info, err := os.Stat(name)
+ info, err := f.Info()
if err != nil {
t.Fatal(err)
}
if testing.Short() && info.Size() > 10000 {
continue
}
- data, err := ioutil.ReadFile(name)
+ name := filepath.Join("./testdata", f.Name())
+ data, err := os.ReadFile(name)
if err != nil {
t.Fatal(err)
}
diff --git a/src/io/fs/readdir_test.go b/src/io/fs/readdir_test.go
index 46a4bc2788..405bfa67ca 100644
--- a/src/io/fs/readdir_test.go
+++ b/src/io/fs/readdir_test.go
@@ -16,12 +16,12 @@ func (readDirOnly) Open(name string) (File, error) { return nil, ErrNotExist }
func TestReadDir(t *testing.T) {
check := func(desc string, dirs []DirEntry, err error) {
t.Helper()
- if err != nil || len(dirs) != 1 || dirs[0].Name() != "hello.txt" {
+ if err != nil || len(dirs) != 2 || dirs[0].Name() != "hello.txt" || dirs[1].Name() != "sub" {
var names []string
for _, d := range dirs {
names = append(names, d.Name())
}
- t.Errorf("ReadDir(%s) = %v, %v, want %v, nil", desc, names, err, []string{"hello.txt"})
+ t.Errorf("ReadDir(%s) = %v, %v, want %v, nil", desc, names, err, []string{"hello.txt", "sub"})
}
}
@@ -32,4 +32,12 @@ func TestReadDir(t *testing.T) {
// Test that ReadDir uses Open when the method is not present.
dirs, err = ReadDir(openOnly{testFsys}, ".")
check("openOnly", dirs, err)
+
+ // Test that ReadDir on Sub of . works (sub_test checks non-trivial subs).
+ sub, err := Sub(testFsys, ".")
+ if err != nil {
+ t.Fatal(err)
+ }
+ dirs, err = ReadDir(sub, ".")
+ check("sub(.)", dirs, err)
}
diff --git a/src/io/fs/readfile_test.go b/src/io/fs/readfile_test.go
index 0afa334ace..07219c1445 100644
--- a/src/io/fs/readfile_test.go
+++ b/src/io/fs/readfile_test.go
@@ -18,6 +18,12 @@ var testFsys = fstest.MapFS{
ModTime: time.Now(),
Sys: &sysValue,
},
+ "sub/goodbye.txt": {
+ Data: []byte("goodbye, world"),
+ Mode: 0456,
+ ModTime: time.Now(),
+ Sys: &sysValue,
+ },
}
var sysValue int
@@ -40,4 +46,14 @@ func TestReadFile(t *testing.T) {
if string(data) != "hello, world" || err != nil {
t.Fatalf(`ReadFile(openOnly, "hello.txt") = %q, %v, want %q, nil`, data, err, "hello, world")
}
+
+ // Test that ReadFile on Sub of . works (sub_test checks non-trivial subs).
+ sub, err := Sub(testFsys, ".")
+ if err != nil {
+ t.Fatal(err)
+ }
+ data, err = ReadFile(sub, "hello.txt")
+ if string(data) != "hello, world" || err != nil {
+ t.Fatalf(`ReadFile(sub(.), "hello.txt") = %q, %v, want %q, nil`, data, err, "hello, world")
+ }
}
diff --git a/src/io/fs/sub.go b/src/io/fs/sub.go
new file mode 100644
index 0000000000..64cdffe6de
--- /dev/null
+++ b/src/io/fs/sub.go
@@ -0,0 +1,127 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fs
+
+import (
+ "errors"
+ "path"
+)
+
+// A SubFS is a file system with a Sub method.
+type SubFS interface {
+ FS
+
+ // Sub returns an FS corresponding to the subtree rooted at dir.
+ Sub(dir string) (FS, error)
+}
+
+// Sub returns an FS corresponding to the subtree rooted at fsys's dir.
+//
+// If fs implements SubFS, Sub calls returns fsys.Sub(dir).
+// Otherwise, if dir is ".", Sub returns fsys unchanged.
+// Otherwise, Sub returns a new FS implementation sub that,
+// in effect, implements sub.Open(dir) as fsys.Open(path.Join(dir, name)).
+// The implementation also translates calls to ReadDir, ReadFile, and Glob appropriately.
+//
+// Note that Sub(os.DirFS("/"), "prefix") is equivalent to os.DirFS("/prefix")
+// and that neither of them guarantees to avoid operating system
+// accesses outside "/prefix", because the implementation of os.DirFS
+// does not check for symbolic links inside "/prefix" that point to
+// other directories. That is, os.DirFS is not a general substitute for a
+// chroot-style security mechanism, and Sub does not change that fact.
+func Sub(fsys FS, dir string) (FS, error) {
+ if !ValidPath(dir) {
+ return nil, &PathError{Op: "sub", Path: dir, Err: errors.New("invalid name")}
+ }
+ if dir == "." {
+ return fsys, nil
+ }
+ if fsys, ok := fsys.(SubFS); ok {
+ return fsys.Sub(dir)
+ }
+ return &subFS{fsys, dir}, nil
+}
+
+type subFS struct {
+ fsys FS
+ dir string
+}
+
+// fullName maps name to the fully-qualified name dir/name.
+func (f *subFS) fullName(op string, name string) (string, error) {
+ if !ValidPath(name) {
+ return "", &PathError{Op: op, Path: name, Err: errors.New("invalid name")}
+ }
+ return path.Join(f.dir, name), nil
+}
+
+// shorten maps name, which should start with f.dir, back to the suffix after f.dir.
+func (f *subFS) shorten(name string) (rel string, ok bool) {
+ if name == f.dir {
+ return ".", true
+ }
+ if len(name) >= len(f.dir)+2 && name[len(f.dir)] == '/' && name[:len(f.dir)] == f.dir {
+ return name[len(f.dir)+1:], true
+ }
+ return "", false
+}
+
+// fixErr shortens any reported names in PathErrors by stripping dir.
+func (f *subFS) fixErr(err error) error {
+ if e, ok := err.(*PathError); ok {
+ if short, ok := f.shorten(e.Path); ok {
+ e.Path = short
+ }
+ }
+ return err
+}
+
+func (f *subFS) Open(name string) (File, error) {
+ full, err := f.fullName("open", name)
+ if err != nil {
+ return nil, err
+ }
+ file, err := f.fsys.Open(full)
+ return file, f.fixErr(err)
+}
+
+func (f *subFS) ReadDir(name string) ([]DirEntry, error) {
+ full, err := f.fullName("read", name)
+ if err != nil {
+ return nil, err
+ }
+ dir, err := ReadDir(f.fsys, full)
+ return dir, f.fixErr(err)
+}
+
+func (f *subFS) ReadFile(name string) ([]byte, error) {
+ full, err := f.fullName("read", name)
+ if err != nil {
+ return nil, err
+ }
+ data, err := ReadFile(f.fsys, full)
+ return data, f.fixErr(err)
+}
+
+func (f *subFS) Glob(pattern string) ([]string, error) {
+ // Check pattern is well-formed.
+ if _, err := path.Match(pattern, ""); err != nil {
+ return nil, err
+ }
+ if pattern == "." {
+ return []string{"."}, nil
+ }
+
+ full := f.dir + "/" + pattern
+ list, err := Glob(f.fsys, full)
+ for i, name := range list {
+ name, ok := f.shorten(name)
+ if !ok {
+ return nil, errors.New("invalid result from inner fsys Glob: " + name + " not in " + f.dir) // can't use fmt in this package
+ }
+ list[i] = name
+ }
+ return list, f.fixErr(err)
+}
diff --git a/src/io/fs/sub_test.go b/src/io/fs/sub_test.go
new file mode 100644
index 0000000000..451b0efb02
--- /dev/null
+++ b/src/io/fs/sub_test.go
@@ -0,0 +1,57 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package fs_test
+
+import (
+ . "io/fs"
+ "testing"
+)
+
+type subOnly struct{ SubFS }
+
+func (subOnly) Open(name string) (File, error) { return nil, ErrNotExist }
+
+func TestSub(t *testing.T) {
+ check := func(desc string, sub FS, err error) {
+ t.Helper()
+ if err != nil {
+ t.Errorf("Sub(sub): %v", err)
+ return
+ }
+ data, err := ReadFile(sub, "goodbye.txt")
+ if string(data) != "goodbye, world" || err != nil {
+ t.Errorf(`ReadFile(%s, "goodbye.txt" = %q, %v, want %q, nil`, desc, string(data), err, "goodbye, world")
+ }
+
+ dirs, err := ReadDir(sub, ".")
+ if err != nil || len(dirs) != 1 || dirs[0].Name() != "goodbye.txt" {
+ var names []string
+ for _, d := range dirs {
+ names = append(names, d.Name())
+ }
+ t.Errorf(`ReadDir(%s, ".") = %v, %v, want %v, nil`, desc, names, err, []string{"goodbye.txt"})
+ }
+ }
+
+ // Test that Sub uses the method when present.
+ sub, err := Sub(subOnly{testFsys}, "sub")
+ check("subOnly", sub, err)
+
+ // Test that Sub uses Open when the method is not present.
+ sub, err = Sub(openOnly{testFsys}, "sub")
+ check("openOnly", sub, err)
+
+ _, err = sub.Open("nonexist")
+ if err == nil {
+ t.Fatal("Open(nonexist): succeeded")
+ }
+ pe, ok := err.(*PathError)
+ if !ok {
+ t.Fatalf("Open(nonexist): error is %T, want *PathError", err)
+ }
+ if pe.Path != "nonexist" {
+ t.Fatalf("Open(nonexist): err.Path = %q, want %q", pe.Path, "nonexist")
+ }
+}
diff --git a/src/log/syslog/syslog_test.go b/src/log/syslog/syslog_test.go
index 8f472a56b7..207bcf57c1 100644
--- a/src/log/syslog/syslog_test.go
+++ b/src/log/syslog/syslog_test.go
@@ -10,7 +10,6 @@ import (
"bufio"
"fmt"
"io"
- "io/ioutil"
"log"
"net"
"os"
@@ -88,8 +87,8 @@ func startServer(n, la string, done chan<- string) (addr string, sock io.Closer,
} else {
// unix and unixgram: choose an address if none given
if la == "" {
- // use ioutil.TempFile to get a name that is unique
- f, err := ioutil.TempFile("", "syslogtest")
+ // use os.CreateTemp to get a name that is unique
+ f, err := os.CreateTemp("", "syslogtest")
if err != nil {
log.Fatal("TempFile: ", err)
}
diff --git a/src/math/big/arith_s390x.s b/src/math/big/arith_s390x.s
index 242aca7434..caa4db0829 100644
--- a/src/math/big/arith_s390x.s
+++ b/src/math/big/arith_s390x.s
@@ -693,199 +693,11 @@ returnC:
// func shlVU(z, x []Word, s uint) (c Word)
TEXT ·shlVU(SB), NOSPLIT, $0
- MOVD z_len+8(FP), R5
- MOVD $0, R0
- SUB $1, R5 // n--
- BLT X8b // n < 0 (n <= 0)
-
- // n > 0
- MOVD s+48(FP), R4
- CMPBEQ R0, R4, Z80 // handle 0 case beq
- MOVD $64, R6
- CMPBEQ R6, R4, Z864 // handle 64 case beq
- MOVD z+0(FP), R2
- MOVD x+24(FP), R8
- SLD $3, R5 // n = n*8
- SUB R4, R6, R7
- MOVD (R8)(R5*1), R10 // w1 = x[i-1]
- SRD R7, R10, R3
- MOVD R3, c+56(FP)
-
- MOVD $0, R1 // i = 0
- BR E8
-
- // i < n-1
-L8:
- MOVD R10, R3 // w = w1
- MOVD -8(R8)(R5*1), R10 // w1 = x[i+1]
-
- SLD R4, R3 // w<<s | w1>>ŝ
- SRD R7, R10, R6
- OR R6, R3
- MOVD R3, (R2)(R5*1) // z[i] = w<<s | w1>>ŝ
- SUB $8, R5 // i--
-
-E8:
- CMPBGT R5, R0, L8 // i < n-1
-
- // i >= n-1
-X8a:
- SLD R4, R10 // w1<<s
- MOVD R10, (R2) // z[0] = w1<<s
- RET
-
-X8b:
- MOVD R0, c+56(FP)
- RET
-
-Z80:
- MOVD z+0(FP), R2
- MOVD x+24(FP), R8
- SLD $3, R5 // n = n*8
-
- MOVD (R8), R10
- MOVD $0, R3
- MOVD R3, c+56(FP)
-
- MOVD $0, R1 // i = 0
- BR E8Z
-
- // i < n-1
-L8Z:
- MOVD R10, R3
- MOVD 8(R8)(R1*1), R10
-
- MOVD R3, (R2)(R1*1)
- ADD $8, R1
-
-E8Z:
- CMPBLT R1, R5, L8Z
-
- // i >= n-1
- MOVD R10, (R2)(R5*1)
- RET
-
-Z864:
- MOVD z+0(FP), R2
- MOVD x+24(FP), R8
- SLD $3, R5 // n = n*8
- MOVD (R8)(R5*1), R3 // w1 = x[n-1]
- MOVD R3, c+56(FP) // z[i] = x[n-1]
-
- BR E864
-
- // i < n-1
-L864:
- MOVD -8(R8)(R5*1), R3
-
- MOVD R3, (R2)(R5*1) // z[i] = x[n-1]
- SUB $8, R5 // i--
-
-E864:
- CMPBGT R5, R0, L864 // i < n-1
-
- MOVD R0, (R2) // z[n-1] = 0
- RET
+ BR ·shlVU_g(SB)
-// CX = R4, r8 = r8, r10 = r2 , r11 = r5, DX = r3, AX = r10 , BX = R1 , 64-count = r7 (R0 set to 0) temp = R6
// func shrVU(z, x []Word, s uint) (c Word)
TEXT ·shrVU(SB), NOSPLIT, $0
- MOVD z_len+8(FP), R5
- MOVD $0, R0
- SUB $1, R5 // n--
- BLT X9b // n < 0 (n <= 0)
-
- // n > 0
- MOVD s+48(FP), R4
- CMPBEQ R0, R4, ZB0 // handle 0 case beq
- MOVD $64, R6
- CMPBEQ R6, R4, ZB64 // handle 64 case beq
- MOVD z+0(FP), R2
- MOVD x+24(FP), R8
- SLD $3, R5 // n = n*8
- SUB R4, R6, R7
- MOVD (R8), R10 // w1 = x[0]
- SLD R7, R10, R3
- MOVD R3, c+56(FP)
-
- MOVD $0, R1 // i = 0
- BR E9
-
- // i < n-1
-L9:
- MOVD R10, R3 // w = w1
- MOVD 8(R8)(R1*1), R10 // w1 = x[i+1]
-
- SRD R4, R3 // w>>s | w1<<s
- SLD R7, R10, R6
- OR R6, R3
- MOVD R3, (R2)(R1*1) // z[i] = w>>s | w1<<s
- ADD $8, R1 // i++
-
-E9:
- CMPBLT R1, R5, L9 // i < n-1
-
- // i >= n-1
-X9a:
- SRD R4, R10 // w1>>s
- MOVD R10, (R2)(R5*1) // z[n-1] = w1>>s
- RET
-
-X9b:
- MOVD R0, c+56(FP)
- RET
-
-ZB0:
- MOVD z+0(FP), R2
- MOVD x+24(FP), R8
- SLD $3, R5 // n = n*8
-
- MOVD (R8), R10 // w1 = x[0]
- MOVD $0, R3 // R10 << 64
- MOVD R3, c+56(FP)
-
- MOVD $0, R1 // i = 0
- BR E9Z
-
- // i < n-1
-L9Z:
- MOVD R10, R3 // w = w1
- MOVD 8(R8)(R1*1), R10 // w1 = x[i+1]
-
- MOVD R3, (R2)(R1*1) // z[i] = w>>s | w1<<s
- ADD $8, R1 // i++
-
-E9Z:
- CMPBLT R1, R5, L9Z // i < n-1
-
- // i >= n-1
- MOVD R10, (R2)(R5*1) // z[n-1] = w1>>s
- RET
-
-ZB64:
- MOVD z+0(FP), R2
- MOVD x+24(FP), R8
- SLD $3, R5 // n = n*8
- MOVD (R8), R3 // w1 = x[0]
- MOVD R3, c+56(FP)
-
- MOVD $0, R1 // i = 0
- BR E964
-
- // i < n-1
-L964:
- MOVD 8(R8)(R1*1), R3 // w1 = x[i+1]
-
- MOVD R3, (R2)(R1*1) // z[i] = w>>s | w1<<s
- ADD $8, R1 // i++
-
-E964:
- CMPBLT R1, R5, L964 // i < n-1
-
- // i >= n-1
- MOVD $0, R10 // w1>>s
- MOVD R10, (R2)(R5*1) // z[n-1] = w1>>s
- RET
+ BR ·shrVU_g(SB)
// CX = R4, r8 = r8, r9=r9, r10 = r2 , r11 = r5, DX = r3, AX = r6 , BX = R1 , (R0 set to 0) + use R11 + use R7 for i
// func mulAddVWW(z, x []Word, y, r Word) (c Word)
diff --git a/src/math/big/arith_test.go b/src/math/big/arith_test.go
index 808d178459..2aca0effde 100644
--- a/src/math/big/arith_test.go
+++ b/src/math/big/arith_test.go
@@ -285,13 +285,36 @@ type argVU struct {
m string // message.
}
+var argshlVUIn = []Word{1, 2, 4, 8, 16, 32, 64, 0, 0, 0}
+var argshlVUr0 = []Word{1, 2, 4, 8, 16, 32, 64}
+var argshlVUr1 = []Word{2, 4, 8, 16, 32, 64, 128}
+var argshlVUrWm1 = []Word{1 << (_W - 1), 0, 1, 2, 4, 8, 16}
+
var argshlVU = []argVU{
// test cases for shlVU
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0}, 7, 0, 0, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "complete overlap of shlVU"},
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0, 0, 0, 0}, 7, 0, 3, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "partial overlap by half of shlVU"},
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0, 0, 0, 0, 0, 0, 0}, 7, 0, 6, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "partial overlap by 1 Word of shlVU"},
{[]Word{1, _M, _M, _M, _M, _M, 3 << (_W - 2), 0, 0, 0, 0, 0, 0, 0, 0}, 7, 0, 7, 1, []Word{2, _M - 1, _M, _M, _M, _M, 1<<(_W-1) + 1}, 1, "no overlap of shlVU"},
-}
+ // additional test cases with shift values of 0, 1 and (_W-1)
+ {argshlVUIn, 7, 0, 0, 0, argshlVUr0, 0, "complete overlap of shlVU and shift of 0"},
+ {argshlVUIn, 7, 0, 0, 1, argshlVUr1, 0, "complete overlap of shlVU and shift of 1"},
+ {argshlVUIn, 7, 0, 0, _W - 1, argshlVUrWm1, 32, "complete overlap of shlVU and shift of _W - 1"},
+ {argshlVUIn, 7, 0, 1, 0, argshlVUr0, 0, "partial overlap by 6 Words of shlVU and shift of 0"},
+ {argshlVUIn, 7, 0, 1, 1, argshlVUr1, 0, "partial overlap by 6 Words of shlVU and shift of 1"},
+ {argshlVUIn, 7, 0, 1, _W - 1, argshlVUrWm1, 32, "partial overlap by 6 Words of shlVU and shift of _W - 1"},
+ {argshlVUIn, 7, 0, 2, 0, argshlVUr0, 0, "partial overlap by 5 Words of shlVU and shift of 0"},
+ {argshlVUIn, 7, 0, 2, 1, argshlVUr1, 0, "partial overlap by 5 Words of shlVU and shift of 1"},
+ {argshlVUIn, 7, 0, 2, _W - 1, argshlVUrWm1, 32, "partial overlap by 5 Words of shlVU abd shift of _W - 1"},
+ {argshlVUIn, 7, 0, 3, 0, argshlVUr0, 0, "partial overlap by 4 Words of shlVU and shift of 0"},
+ {argshlVUIn, 7, 0, 3, 1, argshlVUr1, 0, "partial overlap by 4 Words of shlVU and shift of 1"},
+ {argshlVUIn, 7, 0, 3, _W - 1, argshlVUrWm1, 32, "partial overlap by 4 Words of shlVU and shift of _W - 1"},
+}
+
+var argshrVUIn = []Word{0, 0, 0, 1, 2, 4, 8, 16, 32, 64}
+var argshrVUr0 = []Word{1, 2, 4, 8, 16, 32, 64}
+var argshrVUr1 = []Word{0, 1, 2, 4, 8, 16, 32}
+var argshrVUrWm1 = []Word{4, 8, 16, 32, 64, 128, 0}
var argshrVU = []argVU{
// test cases for shrVU
@@ -299,6 +322,19 @@ var argshrVU = []argVU{
{[]Word{0, 0, 0, 0, 3, _M, _M, _M, _M, _M, 1 << (_W - 1)}, 7, 4, 1, 1, []Word{1<<(_W-1) + 1, _M, _M, _M, _M, _M >> 1, 1 << (_W - 2)}, 1 << (_W - 1), "partial overlap by half of shrVU"},
{[]Word{0, 0, 0, 0, 0, 0, 0, 3, _M, _M, _M, _M, _M, 1 << (_W - 1)}, 7, 7, 1, 1, []Word{1<<(_W-1) + 1, _M, _M, _M, _M, _M >> 1, 1 << (_W - 2)}, 1 << (_W - 1), "partial overlap by 1 Word of shrVU"},
{[]Word{0, 0, 0, 0, 0, 0, 0, 0, 3, _M, _M, _M, _M, _M, 1 << (_W - 1)}, 7, 8, 1, 1, []Word{1<<(_W-1) + 1, _M, _M, _M, _M, _M >> 1, 1 << (_W - 2)}, 1 << (_W - 1), "no overlap of shrVU"},
+ // additional test cases with shift values of 0, 1 and (_W-1)
+ {argshrVUIn, 7, 3, 3, 0, argshrVUr0, 0, "complete overlap of shrVU and shift of 0"},
+ {argshrVUIn, 7, 3, 3, 1, argshrVUr1, 1 << (_W - 1), "complete overlap of shrVU and shift of 1"},
+ {argshrVUIn, 7, 3, 3, _W - 1, argshrVUrWm1, 2, "complete overlap of shrVU and shift of _W - 1"},
+ {argshrVUIn, 7, 3, 2, 0, argshrVUr0, 0, "partial overlap by 6 Words of shrVU and shift of 0"},
+ {argshrVUIn, 7, 3, 2, 1, argshrVUr1, 1 << (_W - 1), "partial overlap by 6 Words of shrVU and shift of 1"},
+ {argshrVUIn, 7, 3, 2, _W - 1, argshrVUrWm1, 2, "partial overlap by 6 Words of shrVU and shift of _W - 1"},
+ {argshrVUIn, 7, 3, 1, 0, argshrVUr0, 0, "partial overlap by 5 Words of shrVU and shift of 0"},
+ {argshrVUIn, 7, 3, 1, 1, argshrVUr1, 1 << (_W - 1), "partial overlap by 5 Words of shrVU and shift of 1"},
+ {argshrVUIn, 7, 3, 1, _W - 1, argshrVUrWm1, 2, "partial overlap by 5 Words of shrVU and shift of _W - 1"},
+ {argshrVUIn, 7, 3, 0, 0, argshrVUr0, 0, "partial overlap by 4 Words of shrVU and shift of 0"},
+ {argshrVUIn, 7, 3, 0, 1, argshrVUr1, 1 << (_W - 1), "partial overlap by 4 Words of shrVU and shift of 1"},
+ {argshrVUIn, 7, 3, 0, _W - 1, argshrVUrWm1, 2, "partial overlap by 4 Words of shrVU and shift of _W - 1"},
}
func testShiftFunc(t *testing.T, f func(z, x []Word, s uint) Word, a argVU) {
@@ -335,11 +371,24 @@ func TestIssue31084(t *testing.T) {
// compute 10^n via 5^n << n.
const n = 165
p := nat(nil).expNN(nat{5}, nat{n}, nil)
- p = p.shl(p, uint(n))
+ p = p.shl(p, n)
got := string(p.utoa(10))
want := "1" + strings.Repeat("0", n)
if got != want {
- t.Errorf("shl(%v, %v)\n\tgot %s; want %s\n", p, uint(n), got, want)
+ t.Errorf("shl(%v, %v)\n\tgot %s\n\twant %s", p, n, got, want)
+ }
+}
+
+const issue42838Value = "159309191113245227702888039776771180559110455519261878607388585338616290151305816094308987472018268594098344692611135542392730712890625"
+
+func TestIssue42838(t *testing.T) {
+ const s = 192
+ z, _, _, _ := nat(nil).scan(strings.NewReader(issue42838Value), 0, false)
+ z = z.shl(z, s)
+ got := string(z.utoa(10))
+ want := "1" + strings.Repeat("0", s)
+ if got != want {
+ t.Errorf("shl(%v, %v)\n\tgot %s\n\twant %s", z, s, got, want)
}
}
diff --git a/src/math/big/link_test.go b/src/math/big/link_test.go
index 2212bd444f..42f9cefca0 100644
--- a/src/math/big/link_test.go
+++ b/src/math/big/link_test.go
@@ -7,7 +7,7 @@ package big
import (
"bytes"
"internal/testenv"
- "io/ioutil"
+ "os"
"os/exec"
"path/filepath"
"testing"
@@ -27,7 +27,7 @@ func TestLinkerGC(t *testing.T) {
import _ "math/big"
func main() {}
`)
- if err := ioutil.WriteFile(goFile, file, 0644); err != nil {
+ if err := os.WriteFile(goFile, file, 0644); err != nil {
t.Fatal(err)
}
cmd := exec.Command(goBin, "build", "-o", "x.exe", "x.go")
diff --git a/src/math/bits/make_examples.go b/src/math/bits/make_examples.go
index cd81cd6c4d..1d3ad53fe6 100644
--- a/src/math/bits/make_examples.go
+++ b/src/math/bits/make_examples.go
@@ -11,9 +11,9 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"log"
"math/bits"
+ "os"
)
const header = `// Copyright 2017 The Go Authors. All rights reserved.
@@ -106,7 +106,7 @@ func main() {
}
}
- if err := ioutil.WriteFile("example_test.go", w.Bytes(), 0666); err != nil {
+ if err := os.WriteFile("example_test.go", w.Bytes(), 0666); err != nil {
log.Fatal(err)
}
}
diff --git a/src/math/bits/make_tables.go b/src/math/bits/make_tables.go
index ff2fe2e385..b068d5e0e3 100644
--- a/src/math/bits/make_tables.go
+++ b/src/math/bits/make_tables.go
@@ -13,8 +13,8 @@ import (
"fmt"
"go/format"
"io"
- "io/ioutil"
"log"
+ "os"
)
var header = []byte(`// Copyright 2017 The Go Authors. All rights reserved.
@@ -40,7 +40,7 @@ func main() {
log.Fatal(err)
}
- err = ioutil.WriteFile("bits_tables.go", out, 0666)
+ err = os.WriteFile("bits_tables.go", out, 0666)
if err != nil {
log.Fatal(err)
}
diff --git a/src/mime/multipart/formdata.go b/src/mime/multipart/formdata.go
index 4eb3101294..fca5f9e15f 100644
--- a/src/mime/multipart/formdata.go
+++ b/src/mime/multipart/formdata.go
@@ -7,9 +7,8 @@ package multipart
import (
"bytes"
"errors"
- "fmt"
"io"
- "io/ioutil"
+ "math"
"net/textproto"
"os"
)
@@ -43,7 +42,11 @@ func (r *Reader) readForm(maxMemory int64) (_ *Form, err error) {
// Reserve an additional 10 MB for non-file parts.
maxValueBytes := maxMemory + int64(10<<20)
if maxValueBytes <= 0 {
- return nil, fmt.Errorf("multipart: integer overflow from maxMemory(%d) + 10MiB for non-file parts", maxMemory)
+ if maxMemory < 0 {
+ maxValueBytes = 0
+ } else {
+ maxValueBytes = math.MaxInt64
+ }
}
for {
p, err := r.NextPart()
@@ -87,7 +90,7 @@ func (r *Reader) readForm(maxMemory int64) (_ *Form, err error) {
}
if n > maxMemory {
// too big, write to disk and flush buffer
- file, err := ioutil.TempFile("", "multipart-")
+ file, err := os.CreateTemp("", "multipart-")
if err != nil {
return nil, err
}
diff --git a/src/mime/multipart/formdata_test.go b/src/mime/multipart/formdata_test.go
index 7112e0d372..e3a3a3eae8 100644
--- a/src/mime/multipart/formdata_test.go
+++ b/src/mime/multipart/formdata_test.go
@@ -53,20 +53,16 @@ func TestReadFormWithNamelessFile(t *testing.T) {
}
}
-// Issue 40430: Ensure that we report integer overflows in additions of maxMemory,
-// instead of silently and subtly failing without indication.
+// Issue 40430: Handle ReadForm(math.MaxInt64)
func TestReadFormMaxMemoryOverflow(t *testing.T) {
b := strings.NewReader(strings.ReplaceAll(messageWithTextContentType, "\n", "\r\n"))
r := NewReader(b, boundary)
f, err := r.ReadForm(math.MaxInt64)
- if err == nil {
- t.Fatal("Unexpected a non-nil error")
- }
- if f != nil {
- t.Fatalf("Unexpected returned a non-nil form: %v\n", f)
+ if err != nil {
+ t.Fatalf("ReadForm(MaxInt64): %v", err)
}
- if g, w := err.Error(), "integer overflow from maxMemory"; !strings.Contains(g, w) {
- t.Errorf(`Error mismatch\n%q\ndid not contain\n%q`, g, w)
+ if f == nil {
+ t.Fatal("ReadForm(MaxInt64): missing form")
}
}
diff --git a/src/net/dnsclient_unix_test.go b/src/net/dnsclient_unix_test.go
index 06553636ee..0530c92c2e 100644
--- a/src/net/dnsclient_unix_test.go
+++ b/src/net/dnsclient_unix_test.go
@@ -10,7 +10,6 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
"os"
"path"
"reflect"
@@ -235,7 +234,7 @@ type resolvConfTest struct {
}
func newResolvConfTest() (*resolvConfTest, error) {
- dir, err := ioutil.TempDir("", "go-resolvconftest")
+ dir, err := os.MkdirTemp("", "go-resolvconftest")
if err != nil {
return nil, err
}
diff --git a/src/net/error_test.go b/src/net/error_test.go
index 7823fdf9d8..556eb8c8d4 100644
--- a/src/net/error_test.go
+++ b/src/net/error_test.go
@@ -13,7 +13,6 @@ import (
"internal/poll"
"io"
"io/fs"
- "io/ioutil"
"net/internal/socktest"
"os"
"runtime"
@@ -730,7 +729,7 @@ func TestFileError(t *testing.T) {
t.Skipf("not supported on %s", runtime.GOOS)
}
- f, err := ioutil.TempFile("", "go-nettest")
+ f, err := os.CreateTemp("", "go-nettest")
if err != nil {
t.Fatal(err)
}
diff --git a/src/net/http/filetransport_test.go b/src/net/http/filetransport_test.go
index fdfd44d967..b58888dcb1 100644
--- a/src/net/http/filetransport_test.go
+++ b/src/net/http/filetransport_test.go
@@ -6,7 +6,6 @@ package http
import (
"io"
- "io/ioutil"
"os"
"path/filepath"
"testing"
@@ -24,10 +23,10 @@ func checker(t *testing.T) func(string, error) {
func TestFileTransport(t *testing.T) {
check := checker(t)
- dname, err := ioutil.TempDir("", "")
+ dname, err := os.MkdirTemp("", "")
check("TempDir", err)
fname := filepath.Join(dname, "foo.txt")
- err = ioutil.WriteFile(fname, []byte("Bar"), 0644)
+ err = os.WriteFile(fname, []byte("Bar"), 0644)
check("WriteFile", err)
defer os.Remove(dname)
defer os.Remove(fname)
diff --git a/src/net/http/fs_test.go b/src/net/http/fs_test.go
index 2e4751114d..2499051625 100644
--- a/src/net/http/fs_test.go
+++ b/src/net/http/fs_test.go
@@ -79,7 +79,7 @@ func TestServeFile(t *testing.T) {
var err error
- file, err := ioutil.ReadFile(testFile)
+ file, err := os.ReadFile(testFile)
if err != nil {
t.Fatal("reading file:", err)
}
@@ -379,12 +379,12 @@ func mustRemoveAll(dir string) {
func TestFileServerImplicitLeadingSlash(t *testing.T) {
defer afterTest(t)
- tempDir, err := ioutil.TempDir("", "")
+ tempDir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("TempDir: %v", err)
}
defer mustRemoveAll(tempDir)
- if err := ioutil.WriteFile(filepath.Join(tempDir, "foo.txt"), []byte("Hello world"), 0644); err != nil {
+ if err := os.WriteFile(filepath.Join(tempDir, "foo.txt"), []byte("Hello world"), 0644); err != nil {
t.Fatalf("WriteFile: %v", err)
}
ts := httptest.NewServer(StripPrefix("/bar/", FileServer(Dir(tempDir))))
@@ -1177,7 +1177,7 @@ func TestLinuxSendfile(t *testing.T) {
filename := fmt.Sprintf("1kb-%d", os.Getpid())
filepath := path.Join(os.TempDir(), filename)
- if err := ioutil.WriteFile(filepath, bytes.Repeat([]byte{'a'}, 1<<10), 0755); err != nil {
+ if err := os.WriteFile(filepath, bytes.Repeat([]byte{'a'}, 1<<10), 0755); err != nil {
t.Fatal(err)
}
defer os.Remove(filepath)
diff --git a/src/net/http/request_test.go b/src/net/http/request_test.go
index 19526b9ad7..29297b0e7b 100644
--- a/src/net/http/request_test.go
+++ b/src/net/http/request_test.go
@@ -12,7 +12,6 @@ import (
"encoding/base64"
"fmt"
"io"
- "io/ioutil"
"math"
"mime/multipart"
. "net/http"
@@ -285,7 +284,7 @@ func TestMaxInt64ForMultipartFormMaxMemoryOverflow(t *testing.T) {
t.Fatal(err)
}
res.Body.Close()
- if g, w := res.StatusCode, StatusBadRequest; g != w {
+ if g, w := res.StatusCode, StatusOK; g != w {
t.Fatalf("Status code mismatch: got %d, want %d", g, w)
}
}
@@ -1164,7 +1163,7 @@ func BenchmarkFileAndServer_64MB(b *testing.B) {
}
func benchmarkFileAndServer(b *testing.B, n int64) {
- f, err := ioutil.TempFile(os.TempDir(), "go-bench-http-file-and-server")
+ f, err := os.CreateTemp(os.TempDir(), "go-bench-http-file-and-server")
if err != nil {
b.Fatalf("Failed to create temp file: %v", err)
}
diff --git a/src/net/http/transfer_test.go b/src/net/http/transfer_test.go
index 1f3d32526d..f0c28b2629 100644
--- a/src/net/http/transfer_test.go
+++ b/src/net/http/transfer_test.go
@@ -10,7 +10,6 @@ import (
"crypto/rand"
"fmt"
"io"
- "io/ioutil"
"os"
"reflect"
"strings"
@@ -118,7 +117,7 @@ func TestTransferWriterWriteBodyReaderTypes(t *testing.T) {
nBytes := int64(1 << 10)
newFileFunc := func() (r io.Reader, done func(), err error) {
- f, err := ioutil.TempFile("", "net-http-newfilefunc")
+ f, err := os.CreateTemp("", "net-http-newfilefunc")
if err != nil {
return nil, nil, err
}
diff --git a/src/net/http/transport.go b/src/net/http/transport.go
index 8de0f3a6a0..a5830703af 100644
--- a/src/net/http/transport.go
+++ b/src/net/http/transport.go
@@ -784,7 +784,8 @@ func (t *Transport) CancelRequest(req *Request) {
}
// Cancel an in-flight request, recording the error value.
-func (t *Transport) cancelRequest(key cancelKey, err error) {
+// Returns whether the request was canceled.
+func (t *Transport) cancelRequest(key cancelKey, err error) bool {
t.reqMu.Lock()
cancel := t.reqCanceler[key]
delete(t.reqCanceler, key)
@@ -792,6 +793,8 @@ func (t *Transport) cancelRequest(key cancelKey, err error) {
if cancel != nil {
cancel(err)
}
+
+ return cancel != nil
}
//
@@ -2127,18 +2130,17 @@ func (pc *persistConn) readLoop() {
}
if !hasBody || bodyWritable {
- pc.t.setReqCanceler(rc.cancelKey, nil)
+ replaced := pc.t.replaceReqCanceler(rc.cancelKey, nil)
// Put the idle conn back into the pool before we send the response
// so if they process it quickly and make another request, they'll
// get this same conn. But we use the unbuffered channel 'rc'
// to guarantee that persistConn.roundTrip got out of its select
// potentially waiting for this persistConn to close.
- // but after
alive = alive &&
!pc.sawEOF &&
pc.wroteRequest() &&
- tryPutIdleConn(trace)
+ replaced && tryPutIdleConn(trace)
if bodyWritable {
closeErr = errCallerOwnsConn
@@ -2200,12 +2202,12 @@ func (pc *persistConn) readLoop() {
// reading the response body. (or for cancellation or death)
select {
case bodyEOF := <-waitForBodyRead:
- pc.t.setReqCanceler(rc.cancelKey, nil) // before pc might return to idle pool
+ replaced := pc.t.replaceReqCanceler(rc.cancelKey, nil) // before pc might return to idle pool
alive = alive &&
bodyEOF &&
!pc.sawEOF &&
pc.wroteRequest() &&
- tryPutIdleConn(trace)
+ replaced && tryPutIdleConn(trace)
if bodyEOF {
eofc <- struct{}{}
}
@@ -2600,6 +2602,7 @@ func (pc *persistConn) roundTrip(req *transportRequest) (resp *Response, err err
cancelChan := req.Request.Cancel
ctxDoneChan := req.Context().Done()
pcClosed := pc.closech
+ canceled := false
for {
testHookWaitResLoop()
select {
@@ -2621,8 +2624,7 @@ func (pc *persistConn) roundTrip(req *transportRequest) (resp *Response, err err
}
case <-pcClosed:
pcClosed = nil
- // check if we are still using the connection
- if pc.t.replaceReqCanceler(req.cancelKey, nil) {
+ if canceled || pc.t.replaceReqCanceler(req.cancelKey, nil) {
if debugRoundTrip {
req.logf("closech recv: %T %#v", pc.closed, pc.closed)
}
@@ -2646,10 +2648,10 @@ func (pc *persistConn) roundTrip(req *transportRequest) (resp *Response, err err
}
return re.res, nil
case <-cancelChan:
- pc.t.cancelRequest(req.cancelKey, errRequestCanceled)
+ canceled = pc.t.cancelRequest(req.cancelKey, errRequestCanceled)
cancelChan = nil
case <-ctxDoneChan:
- pc.t.cancelRequest(req.cancelKey, req.Context().Err())
+ canceled = pc.t.cancelRequest(req.cancelKey, req.Context().Err())
cancelChan = nil
ctxDoneChan = nil
}
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go
index f22b798035..7f6e0938c2 100644
--- a/src/net/http/transport_test.go
+++ b/src/net/http/transport_test.go
@@ -23,7 +23,6 @@ import (
"go/token"
"internal/nettrace"
"io"
- "io/ioutil"
"log"
mrand "math/rand"
"net"
@@ -5746,7 +5745,7 @@ func (c *testMockTCPConn) ReadFrom(r io.Reader) (int64, error) {
func TestTransportRequestWriteRoundTrip(t *testing.T) {
nBytes := int64(1 << 10)
newFileFunc := func() (r io.Reader, done func(), err error) {
- f, err := ioutil.TempFile("", "net-http-newfilefunc")
+ f, err := os.CreateTemp("", "net-http-newfilefunc")
if err != nil {
return nil, nil, err
}
diff --git a/src/net/mockserver_test.go b/src/net/mockserver_test.go
index e085f4440b..9faf173679 100644
--- a/src/net/mockserver_test.go
+++ b/src/net/mockserver_test.go
@@ -9,16 +9,15 @@ package net
import (
"errors"
"fmt"
- "io/ioutil"
"os"
"sync"
"testing"
"time"
)
-// testUnixAddr uses ioutil.TempFile to get a name that is unique.
+// testUnixAddr uses os.CreateTemp to get a name that is unique.
func testUnixAddr() string {
- f, err := ioutil.TempFile("", "go-nettest")
+ f, err := os.CreateTemp("", "go-nettest")
if err != nil {
panic(err)
}
diff --git a/src/net/net_windows_test.go b/src/net/net_windows_test.go
index 8aa719f433..a0000950c6 100644
--- a/src/net/net_windows_test.go
+++ b/src/net/net_windows_test.go
@@ -9,7 +9,6 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"os"
"os/exec"
"regexp"
@@ -176,7 +175,7 @@ func runCmd(args ...string) ([]byte, error) {
}
return b
}
- f, err := ioutil.TempFile("", "netcmd")
+ f, err := os.CreateTemp("", "netcmd")
if err != nil {
return nil, err
}
@@ -189,7 +188,7 @@ func runCmd(args ...string) ([]byte, error) {
return nil, fmt.Errorf("%s failed: %v: %q", args[0], err, string(removeUTF8BOM(out)))
}
var err2 error
- out, err2 = ioutil.ReadFile(f.Name())
+ out, err2 = os.ReadFile(f.Name())
if err2 != nil {
return nil, err2
}
@@ -198,7 +197,7 @@ func runCmd(args ...string) ([]byte, error) {
}
return nil, fmt.Errorf("%s failed: %v", args[0], err)
}
- out, err = ioutil.ReadFile(f.Name())
+ out, err = os.ReadFile(f.Name())
if err != nil {
return nil, err
}
diff --git a/src/net/unixsock_test.go b/src/net/unixsock_test.go
index 4b2cfc4d62..0b13bf655f 100644
--- a/src/net/unixsock_test.go
+++ b/src/net/unixsock_test.go
@@ -9,7 +9,6 @@ package net
import (
"bytes"
"internal/testenv"
- "io/ioutil"
"os"
"reflect"
"runtime"
@@ -417,7 +416,7 @@ func TestUnixUnlink(t *testing.T) {
checkExists(t, "after Listen")
l.Close()
checkNotExists(t, "after Listener close")
- if err := ioutil.WriteFile(name, []byte("hello world"), 0666); err != nil {
+ if err := os.WriteFile(name, []byte("hello world"), 0666); err != nil {
t.Fatalf("cannot recreate socket file: %v", err)
}
checkExists(t, "after writing temp file")
diff --git a/src/os/error_test.go b/src/os/error_test.go
index 060cf59875..6264ccc966 100644
--- a/src/os/error_test.go
+++ b/src/os/error_test.go
@@ -8,14 +8,13 @@ import (
"errors"
"fmt"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"testing"
)
func TestErrIsExist(t *testing.T) {
- f, err := ioutil.TempFile("", "_Go_ErrIsExist")
+ f, err := os.CreateTemp("", "_Go_ErrIsExist")
if err != nil {
t.Fatalf("open ErrIsExist tempfile: %s", err)
return
@@ -55,7 +54,7 @@ func testErrNotExist(name string) string {
}
func TestErrIsNotExist(t *testing.T) {
- tmpDir, err := ioutil.TempDir("", "_Go_ErrIsNotExist")
+ tmpDir, err := os.MkdirTemp("", "_Go_ErrIsNotExist")
if err != nil {
t.Fatalf("create ErrIsNotExist tempdir: %s", err)
return
@@ -147,12 +146,12 @@ func TestIsPermission(t *testing.T) {
}
func TestErrPathNUL(t *testing.T) {
- f, err := ioutil.TempFile("", "_Go_ErrPathNUL\x00")
+ f, err := os.CreateTemp("", "_Go_ErrPathNUL\x00")
if err == nil {
f.Close()
t.Fatal("TempFile should have failed")
}
- f, err = ioutil.TempFile("", "_Go_ErrPathNUL")
+ f, err = os.CreateTemp("", "_Go_ErrPathNUL")
if err != nil {
t.Fatalf("open ErrPathNUL tempfile: %s", err)
}
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index fc49b8a332..8b0c93f382 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -15,7 +15,6 @@ import (
"internal/poll"
"internal/testenv"
"io"
- "io/ioutil"
"log"
"net"
"net/http"
@@ -386,7 +385,7 @@ func TestPipeLookPathLeak(t *testing.T) {
// Reading /proc/self/fd is more reliable than calling lsof, so try that
// first.
numOpenFDs := func() (int, []byte, error) {
- fds, err := ioutil.ReadDir("/proc/self/fd")
+ fds, err := os.ReadDir("/proc/self/fd")
if err != nil {
return 0, nil, err
}
@@ -645,7 +644,7 @@ func TestExtraFiles(t *testing.T) {
t.Errorf("success trying to fetch %s; want an error", ts.URL)
}
- tf, err := ioutil.TempFile("", "")
+ tf, err := os.CreateTemp("", "")
if err != nil {
t.Fatalf("TempFile: %v", err)
}
diff --git a/src/os/exec/lp_unix_test.go b/src/os/exec/lp_unix_test.go
index e4656cafb8..296480fd04 100644
--- a/src/os/exec/lp_unix_test.go
+++ b/src/os/exec/lp_unix_test.go
@@ -7,13 +7,12 @@
package exec
import (
- "io/ioutil"
"os"
"testing"
)
func TestLookPathUnixEmptyPath(t *testing.T) {
- tmp, err := ioutil.TempDir("", "TestLookPathUnixEmptyPath")
+ tmp, err := os.MkdirTemp("", "TestLookPathUnixEmptyPath")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
diff --git a/src/os/exec/lp_windows_test.go b/src/os/exec/lp_windows_test.go
index 59b5f1c2c7..c6f3d5d406 100644
--- a/src/os/exec/lp_windows_test.go
+++ b/src/os/exec/lp_windows_test.go
@@ -11,7 +11,6 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -307,7 +306,7 @@ var lookPathTests = []lookPathTest{
}
func TestLookPath(t *testing.T) {
- tmp, err := ioutil.TempDir("", "TestLookPath")
+ tmp, err := os.MkdirTemp("", "TestLookPath")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
@@ -504,7 +503,7 @@ var commandTests = []commandTest{
}
func TestCommand(t *testing.T) {
- tmp, err := ioutil.TempDir("", "TestCommand")
+ tmp, err := os.MkdirTemp("", "TestCommand")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
@@ -529,7 +528,7 @@ func TestCommand(t *testing.T) {
func buildPrintPathExe(t *testing.T, dir string) string {
const name = "printpath"
srcname := name + ".go"
- err := ioutil.WriteFile(filepath.Join(dir, srcname), []byte(printpathSrc), 0644)
+ err := os.WriteFile(filepath.Join(dir, srcname), []byte(printpathSrc), 0644)
if err != nil {
t.Fatalf("failed to create source: %v", err)
}
diff --git a/src/os/fifo_test.go b/src/os/fifo_test.go
index 3041dcfa02..2439192a9d 100644
--- a/src/os/fifo_test.go
+++ b/src/os/fifo_test.go
@@ -11,7 +11,6 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -31,7 +30,7 @@ func TestFifoEOF(t *testing.T) {
t.Skip("skipping on OpenBSD; issue 25877")
}
- dir, err := ioutil.TempDir("", "TestFifoEOF")
+ dir, err := os.MkdirTemp("", "TestFifoEOF")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/file.go b/src/os/file.go
index 304b055dbe..416bc0efa6 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -609,6 +609,13 @@ func isWindowsNulName(name string) bool {
}
// DirFS returns a file system (an fs.FS) for the tree of files rooted at the directory dir.
+//
+// Note that DirFS("/prefix") only guarantees that the Open calls it makes to the
+// operating system will begin with "/prefix": DirFS("/prefix").Open("file") is the
+// same as os.Open("/prefix/file"). So if /prefix/file is a symbolic link pointing outside
+// the /prefix tree, then using DirFS does not stop the access any more than using
+// os.Open does. DirFS is therefore not a general substitute for a chroot-style security
+// mechanism when the directory tree contains arbitrary content.
func DirFS(dir string) fs.FS {
return dirFS(dir)
}
diff --git a/src/os/os_test.go b/src/os/os_test.go
index c5e5cbbb1b..765797f5fb 100644
--- a/src/os/os_test.go
+++ b/src/os/os_test.go
@@ -11,7 +11,7 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
+ "os"
. "os"
osexec "os/exec"
"path/filepath"
@@ -155,7 +155,7 @@ func localTmp() string {
}
func newFile(testName string, t *testing.T) (f *File) {
- f, err := ioutil.TempFile(localTmp(), "_Go_"+testName)
+ f, err := os.CreateTemp(localTmp(), "_Go_"+testName)
if err != nil {
t.Fatalf("TempFile %s: %s", testName, err)
}
@@ -163,7 +163,7 @@ func newFile(testName string, t *testing.T) (f *File) {
}
func newDir(testName string, t *testing.T) (name string) {
- name, err := ioutil.TempDir(localTmp(), "_Go_"+testName)
+ name, err := os.MkdirTemp(localTmp(), "_Go_"+testName)
if err != nil {
t.Fatalf("TempDir %s: %s", testName, err)
}
@@ -616,7 +616,7 @@ func TestReaddirNValues(t *testing.T) {
if testing.Short() {
t.Skip("test.short; skipping")
}
- dir, err := ioutil.TempDir("", "")
+ dir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("TempDir: %v", err)
}
@@ -715,7 +715,7 @@ func TestReaddirStatFailures(t *testing.T) {
// testing it wouldn't work.
t.Skipf("skipping test on %v", runtime.GOOS)
}
- dir, err := ioutil.TempDir("", "")
+ dir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("TempDir: %v", err)
}
@@ -776,7 +776,7 @@ func TestReaddirStatFailures(t *testing.T) {
// Readdir on a regular file should fail.
func TestReaddirOfFile(t *testing.T) {
- f, err := ioutil.TempFile("", "_Go_ReaddirOfFile")
+ f, err := os.CreateTemp("", "_Go_ReaddirOfFile")
if err != nil {
t.Fatal(err)
}
@@ -867,7 +867,7 @@ func chtmpdir(t *testing.T) func() {
if err != nil {
t.Fatalf("chtmpdir: %v", err)
}
- d, err := ioutil.TempDir("", "test")
+ d, err := os.MkdirTemp("", "test")
if err != nil {
t.Fatalf("chtmpdir: %v", err)
}
@@ -992,12 +992,12 @@ func TestRenameOverwriteDest(t *testing.T) {
toData := []byte("to")
fromData := []byte("from")
- err := ioutil.WriteFile(to, toData, 0777)
+ err := os.WriteFile(to, toData, 0777)
if err != nil {
t.Fatalf("write file %q failed: %v", to, err)
}
- err = ioutil.WriteFile(from, fromData, 0777)
+ err = os.WriteFile(from, fromData, 0777)
if err != nil {
t.Fatalf("write file %q failed: %v", from, err)
}
@@ -1341,7 +1341,7 @@ func testChtimes(t *testing.T, name string) {
// the contents are accessed; also, it is set
// whenever mtime is set.
case "netbsd":
- mounts, _ := ioutil.ReadFile("/proc/mounts")
+ mounts, _ := os.ReadFile("/proc/mounts")
if strings.Contains(string(mounts), "noatime") {
t.Logf("AccessTime didn't go backwards, but see a filesystem mounted noatime; ignoring. Issue 19293.")
} else {
@@ -1415,7 +1415,7 @@ func TestChdirAndGetwd(t *testing.T) {
case "arm64":
dirs = nil
for _, d := range []string{"d1", "d2"} {
- dir, err := ioutil.TempDir("", d)
+ dir, err := os.MkdirTemp("", d)
if err != nil {
t.Fatalf("TempDir: %v", err)
}
@@ -1509,7 +1509,7 @@ func TestProgWideChdir(t *testing.T) {
c <- true
t.Fatalf("Getwd: %v", err)
}
- d, err := ioutil.TempDir("", "test")
+ d, err := os.MkdirTemp("", "test")
if err != nil {
c <- true
t.Fatalf("TempDir: %v", err)
@@ -1576,7 +1576,7 @@ func TestSeek(t *testing.T) {
off, err := f.Seek(tt.in, tt.whence)
if off != tt.out || err != nil {
if e, ok := err.(*PathError); ok && e.Err == syscall.EINVAL && tt.out > 1<<32 && runtime.GOOS == "linux" {
- mounts, _ := ioutil.ReadFile("/proc/mounts")
+ mounts, _ := os.ReadFile("/proc/mounts")
if strings.Contains(string(mounts), "reiserfs") {
// Reiserfs rejects the big seeks.
t.Skipf("skipping test known to fail on reiserfs; https://golang.org/issue/91")
@@ -1858,7 +1858,7 @@ func TestWriteAt(t *testing.T) {
t.Fatalf("WriteAt 7: %d, %v", n, err)
}
- b, err := ioutil.ReadFile(f.Name())
+ b, err := os.ReadFile(f.Name())
if err != nil {
t.Fatalf("ReadFile %s: %v", f.Name(), err)
}
@@ -1906,7 +1906,7 @@ func writeFile(t *testing.T, fname string, flag int, text string) string {
t.Fatalf("WriteString: %d, %v", n, err)
}
f.Close()
- data, err := ioutil.ReadFile(fname)
+ data, err := os.ReadFile(fname)
if err != nil {
t.Fatalf("ReadFile: %v", err)
}
@@ -1948,7 +1948,7 @@ func TestAppend(t *testing.T) {
func TestStatDirWithTrailingSlash(t *testing.T) {
// Create new temporary directory and arrange to clean it up.
- path, err := ioutil.TempDir("", "_TestStatDirWithSlash_")
+ path, err := os.MkdirTemp("", "_TestStatDirWithSlash_")
if err != nil {
t.Fatalf("TempDir: %s", err)
}
@@ -2090,7 +2090,7 @@ func TestLargeWriteToConsole(t *testing.T) {
func TestStatDirModeExec(t *testing.T) {
const mode = 0111
- path, err := ioutil.TempDir("", "go-build")
+ path, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("Failed to create temp directory: %v", err)
}
@@ -2159,7 +2159,7 @@ func TestStatStdin(t *testing.T) {
func TestStatRelativeSymlink(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpdir, err := ioutil.TempDir("", "TestStatRelativeSymlink")
+ tmpdir, err := os.MkdirTemp("", "TestStatRelativeSymlink")
if err != nil {
t.Fatal(err)
}
@@ -2249,8 +2249,8 @@ func TestLongPath(t *testing.T) {
t.Fatalf("MkdirAll failed: %v", err)
}
data := []byte("hello world\n")
- if err := ioutil.WriteFile(sizedTempDir+"/foo.txt", data, 0644); err != nil {
- t.Fatalf("ioutil.WriteFile() failed: %v", err)
+ if err := os.WriteFile(sizedTempDir+"/foo.txt", data, 0644); err != nil {
+ t.Fatalf("os.WriteFile() failed: %v", err)
}
if err := Rename(sizedTempDir+"/foo.txt", sizedTempDir+"/bar.txt"); err != nil {
t.Fatalf("Rename failed: %v", err)
@@ -2434,7 +2434,7 @@ func TestRemoveAllRace(t *testing.T) {
n := runtime.GOMAXPROCS(16)
defer runtime.GOMAXPROCS(n)
- root, err := ioutil.TempDir("", "issue")
+ root, err := os.MkdirTemp("", "issue")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/os_unix_test.go b/src/os/os_unix_test.go
index 0bce2989c4..51693fd82a 100644
--- a/src/os/os_unix_test.go
+++ b/src/os/os_unix_test.go
@@ -8,7 +8,7 @@ package os_test
import (
"io"
- "io/ioutil"
+ "os"
. "os"
"path/filepath"
"runtime"
@@ -190,7 +190,7 @@ func TestReaddirRemoveRace(t *testing.T) {
}
dir := newDir("TestReaddirRemoveRace", t)
defer RemoveAll(dir)
- if err := ioutil.WriteFile(filepath.Join(dir, "some-file"), []byte("hello"), 0644); err != nil {
+ if err := os.WriteFile(filepath.Join(dir, "some-file"), []byte("hello"), 0644); err != nil {
t.Fatal(err)
}
d, err := Open(dir)
diff --git a/src/os/os_windows_test.go b/src/os/os_windows_test.go
index e002774844..8d1d1f61b2 100644
--- a/src/os/os_windows_test.go
+++ b/src/os/os_windows_test.go
@@ -13,7 +13,6 @@ import (
"internal/testenv"
"io"
"io/fs"
- "io/ioutil"
"os"
osexec "os/exec"
"path/filepath"
@@ -31,7 +30,7 @@ import (
type syscallDescriptor = syscall.Handle
func TestSameWindowsFile(t *testing.T) {
- temp, err := ioutil.TempDir("", "TestSameWindowsFile")
+ temp, err := os.MkdirTemp("", "TestSameWindowsFile")
if err != nil {
t.Fatal(err)
}
@@ -90,7 +89,7 @@ type dirLinkTest struct {
}
func testDirLinks(t *testing.T, tests []dirLinkTest) {
- tmpdir, err := ioutil.TempDir("", "testDirLinks")
+ tmpdir, err := os.MkdirTemp("", "testDirLinks")
if err != nil {
t.Fatal(err)
}
@@ -115,7 +114,7 @@ func testDirLinks(t *testing.T, tests []dirLinkTest) {
if err != nil {
t.Fatal(err)
}
- err = ioutil.WriteFile(filepath.Join(dir, "abc"), []byte("abc"), 0644)
+ err = os.WriteFile(filepath.Join(dir, "abc"), []byte("abc"), 0644)
if err != nil {
t.Fatal(err)
}
@@ -127,7 +126,7 @@ func testDirLinks(t *testing.T, tests []dirLinkTest) {
continue
}
- data, err := ioutil.ReadFile(filepath.Join(link, "abc"))
+ data, err := os.ReadFile(filepath.Join(link, "abc"))
if err != nil {
t.Errorf("failed to read abc file: %v", err)
continue
@@ -439,7 +438,7 @@ func TestNetworkSymbolicLink(t *testing.T) {
const _NERR_ServerNotStarted = syscall.Errno(2114)
- dir, err := ioutil.TempDir("", "TestNetworkSymbolicLink")
+ dir, err := os.MkdirTemp("", "TestNetworkSymbolicLink")
if err != nil {
t.Fatal(err)
}
@@ -600,7 +599,7 @@ func TestStatDir(t *testing.T) {
}
func TestOpenVolumeName(t *testing.T) {
- tmpdir, err := ioutil.TempDir("", "TestOpenVolumeName")
+ tmpdir, err := os.MkdirTemp("", "TestOpenVolumeName")
if err != nil {
t.Fatal(err)
}
@@ -619,7 +618,7 @@ func TestOpenVolumeName(t *testing.T) {
want := []string{"file1", "file2", "file3", "gopher.txt"}
sort.Strings(want)
for _, name := range want {
- err := ioutil.WriteFile(filepath.Join(tmpdir, name), nil, 0777)
+ err := os.WriteFile(filepath.Join(tmpdir, name), nil, 0777)
if err != nil {
t.Fatal(err)
}
@@ -643,7 +642,7 @@ func TestOpenVolumeName(t *testing.T) {
}
func TestDeleteReadOnly(t *testing.T) {
- tmpdir, err := ioutil.TempDir("", "TestDeleteReadOnly")
+ tmpdir, err := os.MkdirTemp("", "TestDeleteReadOnly")
if err != nil {
t.Fatal(err)
}
@@ -804,7 +803,7 @@ func compareCommandLineToArgvWithSyscall(t *testing.T, cmd string) {
}
func TestCmdArgs(t *testing.T) {
- tmpdir, err := ioutil.TempDir("", "TestCmdArgs")
+ tmpdir, err := os.MkdirTemp("", "TestCmdArgs")
if err != nil {
t.Fatal(err)
}
@@ -823,7 +822,7 @@ func main() {
}
`
src := filepath.Join(tmpdir, "main.go")
- err = ioutil.WriteFile(src, []byte(prog), 0666)
+ err = os.WriteFile(src, []byte(prog), 0666)
if err != nil {
t.Fatal(err)
}
@@ -971,14 +970,14 @@ func TestSymlinkCreation(t *testing.T) {
}
t.Parallel()
- temp, err := ioutil.TempDir("", "TestSymlinkCreation")
+ temp, err := os.MkdirTemp("", "TestSymlinkCreation")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(temp)
dummyFile := filepath.Join(temp, "file")
- err = ioutil.WriteFile(dummyFile, []byte(""), 0644)
+ err = os.WriteFile(dummyFile, []byte(""), 0644)
if err != nil {
t.Fatal(err)
}
@@ -1207,7 +1206,7 @@ func mklinkd(t *testing.T, link, target string) {
}
func TestWindowsReadlink(t *testing.T) {
- tmpdir, err := ioutil.TempDir("", "TestWindowsReadlink")
+ tmpdir, err := os.MkdirTemp("", "TestWindowsReadlink")
if err != nil {
t.Fatal(err)
}
@@ -1272,7 +1271,7 @@ func TestWindowsReadlink(t *testing.T) {
testReadlink(t, "reldirlink", "dir")
file := filepath.Join(tmpdir, "file")
- err = ioutil.WriteFile(file, []byte(""), 0666)
+ err = os.WriteFile(file, []byte(""), 0666)
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/path_test.go b/src/os/path_test.go
index 3fe9c5ffa3..b79d958711 100644
--- a/src/os/path_test.go
+++ b/src/os/path_test.go
@@ -6,7 +6,7 @@ package os_test
import (
"internal/testenv"
- "io/ioutil"
+ "os"
. "os"
"path/filepath"
"runtime"
@@ -78,7 +78,7 @@ func TestMkdirAll(t *testing.T) {
func TestMkdirAllWithSymlink(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpDir, err := ioutil.TempDir("", "TestMkdirAllWithSymlink-")
+ tmpDir, err := os.MkdirTemp("", "TestMkdirAllWithSymlink-")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/path_windows_test.go b/src/os/path_windows_test.go
index 862b404362..869db8fd6c 100644
--- a/src/os/path_windows_test.go
+++ b/src/os/path_windows_test.go
@@ -5,7 +5,6 @@
package os_test
import (
- "io/ioutil"
"os"
"strings"
"syscall"
@@ -48,7 +47,7 @@ func TestFixLongPath(t *testing.T) {
}
func TestMkdirAllExtendedLength(t *testing.T) {
- tmpDir, err := ioutil.TempDir("", "TestMkdirAllExtendedLength")
+ tmpDir, err := os.MkdirTemp("", "TestMkdirAllExtendedLength")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/pipe_test.go b/src/os/pipe_test.go
index 0593efec75..b98e53845c 100644
--- a/src/os/pipe_test.go
+++ b/src/os/pipe_test.go
@@ -14,7 +14,6 @@ import (
"internal/testenv"
"io"
"io/fs"
- "io/ioutil"
"os"
osexec "os/exec"
"os/signal"
@@ -161,7 +160,7 @@ func testClosedPipeRace(t *testing.T, read bool) {
// Get the amount we have to write to overload a pipe
// with no reader.
limit = 131073
- if b, err := ioutil.ReadFile("/proc/sys/fs/pipe-max-size"); err == nil {
+ if b, err := os.ReadFile("/proc/sys/fs/pipe-max-size"); err == nil {
if i, err := strconv.Atoi(strings.TrimSpace(string(b))); err == nil {
limit = i + 1
}
diff --git a/src/os/readfrom_linux_test.go b/src/os/readfrom_linux_test.go
index 00faf39fe5..37047175e6 100644
--- a/src/os/readfrom_linux_test.go
+++ b/src/os/readfrom_linux_test.go
@@ -8,8 +8,8 @@ import (
"bytes"
"internal/poll"
"io"
- "io/ioutil"
"math/rand"
+ "os"
. "os"
"path/filepath"
"strconv"
@@ -173,7 +173,7 @@ func TestCopyFileRange(t *testing.T) {
})
t.Run("Nil", func(t *testing.T) {
var nilFile *File
- anyFile, err := ioutil.TempFile("", "")
+ anyFile, err := os.CreateTemp("", "")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/removeall_test.go b/src/os/removeall_test.go
index 90efa313ea..3a2f6e3759 100644
--- a/src/os/removeall_test.go
+++ b/src/os/removeall_test.go
@@ -6,7 +6,7 @@ package os_test
import (
"fmt"
- "io/ioutil"
+ "os"
. "os"
"path/filepath"
"runtime"
@@ -15,7 +15,7 @@ import (
)
func TestRemoveAll(t *testing.T) {
- tmpDir, err := ioutil.TempDir("", "TestRemoveAll-")
+ tmpDir, err := os.MkdirTemp("", "TestRemoveAll-")
if err != nil {
t.Fatal(err)
}
@@ -128,7 +128,7 @@ func TestRemoveAllLarge(t *testing.T) {
t.Skip("skipping in short mode")
}
- tmpDir, err := ioutil.TempDir("", "TestRemoveAll-")
+ tmpDir, err := os.MkdirTemp("", "TestRemoveAll-")
if err != nil {
t.Fatal(err)
}
@@ -169,7 +169,7 @@ func TestRemoveAllLongPath(t *testing.T) {
t.Fatalf("Could not get wd: %s", err)
}
- startPath, err := ioutil.TempDir("", "TestRemoveAllLongPath-")
+ startPath, err := os.MkdirTemp("", "TestRemoveAllLongPath-")
if err != nil {
t.Fatalf("Could not create TempDir: %s", err)
}
@@ -211,7 +211,7 @@ func TestRemoveAllDot(t *testing.T) {
if err != nil {
t.Fatalf("Could not get wd: %s", err)
}
- tempDir, err := ioutil.TempDir("", "TestRemoveAllDot-")
+ tempDir, err := os.MkdirTemp("", "TestRemoveAllDot-")
if err != nil {
t.Fatalf("Could not create TempDir: %s", err)
}
@@ -236,7 +236,7 @@ func TestRemoveAllDot(t *testing.T) {
func TestRemoveAllDotDot(t *testing.T) {
t.Parallel()
- tempDir, err := ioutil.TempDir("", "TestRemoveAllDotDot-")
+ tempDir, err := os.MkdirTemp("", "TestRemoveAllDotDot-")
if err != nil {
t.Fatal(err)
}
@@ -261,7 +261,7 @@ func TestRemoveAllDotDot(t *testing.T) {
func TestRemoveReadOnlyDir(t *testing.T) {
t.Parallel()
- tempDir, err := ioutil.TempDir("", "TestRemoveReadOnlyDir-")
+ tempDir, err := os.MkdirTemp("", "TestRemoveReadOnlyDir-")
if err != nil {
t.Fatal(err)
}
@@ -298,7 +298,7 @@ func TestRemoveAllButReadOnlyAndPathError(t *testing.T) {
t.Parallel()
- tempDir, err := ioutil.TempDir("", "TestRemoveAllButReadOnly-")
+ tempDir, err := os.MkdirTemp("", "TestRemoveAllButReadOnly-")
if err != nil {
t.Fatal(err)
}
@@ -389,7 +389,7 @@ func TestRemoveUnreadableDir(t *testing.T) {
t.Parallel()
- tempDir, err := ioutil.TempDir("", "TestRemoveAllButReadOnly-")
+ tempDir, err := os.MkdirTemp("", "TestRemoveAllButReadOnly-")
if err != nil {
t.Fatal(err)
}
@@ -413,7 +413,7 @@ func TestRemoveAllWithMoreErrorThanReqSize(t *testing.T) {
t.Skip("skipping in short mode")
}
- tmpDir, err := ioutil.TempDir("", "TestRemoveAll-")
+ tmpDir, err := os.MkdirTemp("", "TestRemoveAll-")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go
index 23e33fe82b..8945cbfccb 100644
--- a/src/os/signal/signal_test.go
+++ b/src/os/signal/signal_test.go
@@ -12,7 +12,6 @@ import (
"flag"
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"runtime"
@@ -304,7 +303,7 @@ func TestDetectNohup(t *testing.T) {
os.Remove("nohup.out")
out, err := exec.Command("/usr/bin/nohup", os.Args[0], "-test.run=TestDetectNohup", "-check_sighup_ignored").CombinedOutput()
- data, _ := ioutil.ReadFile("nohup.out")
+ data, _ := os.ReadFile("nohup.out")
os.Remove("nohup.out")
if err != nil {
t.Errorf("ran test with -check_sighup_ignored under nohup and it failed: expected success.\nError: %v\nOutput:\n%s%s", err, out, data)
diff --git a/src/os/signal/signal_windows_test.go b/src/os/signal/signal_windows_test.go
index c2b59010fc..4640428587 100644
--- a/src/os/signal/signal_windows_test.go
+++ b/src/os/signal/signal_windows_test.go
@@ -7,7 +7,6 @@ package signal
import (
"bytes"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -57,7 +56,7 @@ func main() {
}
}
`
- tmp, err := ioutil.TempDir("", "TestCtrlBreak")
+ tmp, err := os.MkdirTemp("", "TestCtrlBreak")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
diff --git a/src/os/stat_test.go b/src/os/stat_test.go
index 88b789080e..c409f0ff18 100644
--- a/src/os/stat_test.go
+++ b/src/os/stat_test.go
@@ -7,7 +7,6 @@ package os_test
import (
"internal/testenv"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -186,7 +185,7 @@ func testSymlinkSameFile(t *testing.T, path, link string) {
func TestDirAndSymlinkStats(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpdir, err := ioutil.TempDir("", "TestDirAndSymlinkStats")
+ tmpdir, err := os.MkdirTemp("", "TestDirAndSymlinkStats")
if err != nil {
t.Fatal(err)
}
@@ -219,14 +218,14 @@ func TestDirAndSymlinkStats(t *testing.T) {
func TestFileAndSymlinkStats(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpdir, err := ioutil.TempDir("", "TestFileAndSymlinkStats")
+ tmpdir, err := os.MkdirTemp("", "TestFileAndSymlinkStats")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
file := filepath.Join(tmpdir, "file")
- err = ioutil.WriteFile(file, []byte(""), 0644)
+ err = os.WriteFile(file, []byte(""), 0644)
if err != nil {
t.Fatal(err)
}
@@ -253,7 +252,7 @@ func TestFileAndSymlinkStats(t *testing.T) {
func TestSymlinkWithTrailingSlash(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpdir, err := ioutil.TempDir("", "TestSymlinkWithTrailingSlash")
+ tmpdir, err := os.MkdirTemp("", "TestSymlinkWithTrailingSlash")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/timeout_test.go b/src/os/timeout_test.go
index d848e41642..0a39f46333 100644
--- a/src/os/timeout_test.go
+++ b/src/os/timeout_test.go
@@ -11,7 +11,6 @@ package os_test
import (
"fmt"
"io"
- "io/ioutil"
"math/rand"
"os"
"os/signal"
@@ -29,7 +28,7 @@ func TestNonpollableDeadline(t *testing.T) {
t.Skipf("skipping on %s", runtime.GOOS)
}
- f, err := ioutil.TempFile("", "ostest")
+ f, err := os.CreateTemp("", "ostest")
if err != nil {
t.Fatal(err)
}
diff --git a/src/os/user/lookup_plan9.go b/src/os/user/lookup_plan9.go
index ea3ce0bc7c..33ae3a6adf 100644
--- a/src/os/user/lookup_plan9.go
+++ b/src/os/user/lookup_plan9.go
@@ -6,7 +6,6 @@ package user
import (
"fmt"
- "io/ioutil"
"os"
"syscall"
)
@@ -23,7 +22,7 @@ func init() {
}
func current() (*User, error) {
- ubytes, err := ioutil.ReadFile(userFile)
+ ubytes, err := os.ReadFile(userFile)
if err != nil {
return nil, fmt.Errorf("user: %s", err)
}
diff --git a/src/path/filepath/example_unix_walk_test.go b/src/path/filepath/example_unix_walk_test.go
index 66dc7f6b53..c8a818fd6e 100644
--- a/src/path/filepath/example_unix_walk_test.go
+++ b/src/path/filepath/example_unix_walk_test.go
@@ -9,13 +9,12 @@ package filepath_test
import (
"fmt"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
)
func prepareTestDirTree(tree string) (string, error) {
- tmpDir, err := ioutil.TempDir("", "")
+ tmpDir, err := os.MkdirTemp("", "")
if err != nil {
return "", fmt.Errorf("error creating temp directory: %v\n", err)
}
diff --git a/src/path/filepath/match_test.go b/src/path/filepath/match_test.go
index 1c3b567fa3..48880ea439 100644
--- a/src/path/filepath/match_test.go
+++ b/src/path/filepath/match_test.go
@@ -7,7 +7,6 @@ package filepath_test
import (
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
. "path/filepath"
"reflect"
@@ -182,7 +181,7 @@ var globSymlinkTests = []struct {
func TestGlobSymlink(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpDir, err := ioutil.TempDir("", "globsymlink")
+ tmpDir, err := os.MkdirTemp("", "globsymlink")
if err != nil {
t.Fatal("creating temp dir:", err)
}
@@ -268,7 +267,7 @@ func TestWindowsGlob(t *testing.T) {
t.Skipf("skipping windows specific test")
}
- tmpDir, err := ioutil.TempDir("", "TestWindowsGlob")
+ tmpDir, err := os.MkdirTemp("", "TestWindowsGlob")
if err != nil {
t.Fatal(err)
}
@@ -302,7 +301,7 @@ func TestWindowsGlob(t *testing.T) {
}
}
for _, file := range files {
- err := ioutil.WriteFile(Join(tmpDir, file), nil, 0666)
+ err := os.WriteFile(Join(tmpDir, file), nil, 0666)
if err != nil {
t.Fatal(err)
}
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go
index d760530e26..8616256ac0 100644
--- a/src/path/filepath/path_test.go
+++ b/src/path/filepath/path_test.go
@@ -9,7 +9,6 @@ import (
"fmt"
"internal/testenv"
"io/fs"
- "io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -416,7 +415,7 @@ func chtmpdir(t *testing.T) (restore func()) {
if err != nil {
t.Fatalf("chtmpdir: %v", err)
}
- d, err := ioutil.TempDir("", "test")
+ d, err := os.MkdirTemp("", "test")
if err != nil {
t.Fatalf("chtmpdir: %v", err)
}
@@ -459,7 +458,7 @@ func testWalk(t *testing.T, walk func(string, fs.WalkDirFunc) error, errVisit in
defer restore()
}
- tmpDir, err := ioutil.TempDir("", "TestWalk")
+ tmpDir, err := os.MkdirTemp("", "TestWalk")
if err != nil {
t.Fatal("creating temp dir:", err)
}
@@ -563,7 +562,7 @@ func touch(t *testing.T, name string) {
}
func TestWalkSkipDirOnFile(t *testing.T) {
- td, err := ioutil.TempDir("", "walktest")
+ td, err := os.MkdirTemp("", "walktest")
if err != nil {
t.Fatal(err)
}
@@ -613,7 +612,7 @@ func TestWalkSkipDirOnFile(t *testing.T) {
}
func TestWalkFileError(t *testing.T) {
- td, err := ioutil.TempDir("", "walktest")
+ td, err := os.MkdirTemp("", "walktest")
if err != nil {
t.Fatal(err)
}
@@ -892,7 +891,7 @@ func testEvalSymlinksAfterChdir(t *testing.T, wd, path, want string) {
func TestEvalSymlinks(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpDir, err := ioutil.TempDir("", "evalsymlink")
+ tmpDir, err := os.MkdirTemp("", "evalsymlink")
if err != nil {
t.Fatal("creating temp dir:", err)
}
@@ -978,7 +977,7 @@ func TestEvalSymlinksIsNotExist(t *testing.T) {
func TestIssue13582(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpDir, err := ioutil.TempDir("", "issue13582")
+ tmpDir, err := os.MkdirTemp("", "issue13582")
if err != nil {
t.Fatal(err)
}
@@ -995,7 +994,7 @@ func TestIssue13582(t *testing.T) {
t.Fatal(err)
}
file := filepath.Join(linkToDir, "file")
- err = ioutil.WriteFile(file, nil, 0644)
+ err = os.WriteFile(file, nil, 0644)
if err != nil {
t.Fatal(err)
}
@@ -1065,7 +1064,7 @@ var absTests = []string{
}
func TestAbs(t *testing.T) {
- root, err := ioutil.TempDir("", "TestAbs")
+ root, err := os.MkdirTemp("", "TestAbs")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
@@ -1136,7 +1135,7 @@ func TestAbs(t *testing.T) {
// We test it separately from all other absTests because the empty string is not
// a valid path, so it can't be used with os.Stat.
func TestAbsEmptyString(t *testing.T) {
- root, err := ioutil.TempDir("", "TestAbsEmptyString")
+ root, err := os.MkdirTemp("", "TestAbsEmptyString")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
@@ -1357,7 +1356,7 @@ func TestBug3486(t *testing.T) { // https://golang.org/issue/3486
}
func testWalkSymlink(t *testing.T, mklink func(target, link string) error) {
- tmpdir, err := ioutil.TempDir("", "testWalkSymlink")
+ tmpdir, err := os.MkdirTemp("", "testWalkSymlink")
if err != nil {
t.Fatal(err)
}
@@ -1407,14 +1406,14 @@ func TestWalkSymlink(t *testing.T) {
}
func TestIssue29372(t *testing.T) {
- tmpDir, err := ioutil.TempDir("", "TestIssue29372")
+ tmpDir, err := os.MkdirTemp("", "TestIssue29372")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpDir)
path := filepath.Join(tmpDir, "file.txt")
- err = ioutil.WriteFile(path, nil, 0644)
+ err = os.WriteFile(path, nil, 0644)
if err != nil {
t.Fatal(err)
}
@@ -1443,7 +1442,7 @@ func TestEvalSymlinksAboveRoot(t *testing.T) {
t.Parallel()
- tmpDir, err := ioutil.TempDir("", "TestEvalSymlinksAboveRoot")
+ tmpDir, err := os.MkdirTemp("", "TestEvalSymlinksAboveRoot")
if err != nil {
t.Fatal(err)
}
@@ -1460,7 +1459,7 @@ func TestEvalSymlinksAboveRoot(t *testing.T) {
if err := os.Symlink(filepath.Join(evalTmpDir, "a"), filepath.Join(evalTmpDir, "b")); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(filepath.Join(evalTmpDir, "a", "file"), nil, 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(evalTmpDir, "a", "file"), nil, 0666); err != nil {
t.Fatal(err)
}
@@ -1491,7 +1490,7 @@ func TestEvalSymlinksAboveRoot(t *testing.T) {
func TestEvalSymlinksAboveRootChdir(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpDir, err := ioutil.TempDir("", "TestEvalSymlinksAboveRootChdir")
+ tmpDir, err := os.MkdirTemp("", "TestEvalSymlinksAboveRootChdir")
if err != nil {
t.Fatal(err)
}
@@ -1514,7 +1513,7 @@ func TestEvalSymlinksAboveRootChdir(t *testing.T) {
if err := os.Symlink(subdir, "c"); err != nil {
t.Fatal(err)
}
- if err := ioutil.WriteFile(filepath.Join(subdir, "file"), nil, 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(subdir, "file"), nil, 0666); err != nil {
t.Fatal(err)
}
diff --git a/src/path/filepath/path_windows_test.go b/src/path/filepath/path_windows_test.go
index 9309a7dc4d..1c3d84c62d 100644
--- a/src/path/filepath/path_windows_test.go
+++ b/src/path/filepath/path_windows_test.go
@@ -9,7 +9,6 @@ import (
"fmt"
"internal/testenv"
"io/fs"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -38,7 +37,7 @@ func testWinSplitListTestIsValid(t *testing.T, ti int, tt SplitListTest,
perm fs.FileMode = 0700
)
- tmp, err := ioutil.TempDir("", "testWinSplitListTestIsValid")
+ tmp, err := os.MkdirTemp("", "testWinSplitListTestIsValid")
if err != nil {
t.Fatalf("TempDir failed: %v", err)
}
@@ -63,7 +62,7 @@ func testWinSplitListTestIsValid(t *testing.T, ti int, tt SplitListTest,
return
}
fn, data := filepath.Join(dd, cmdfile), []byte("@echo "+d+"\r\n")
- if err = ioutil.WriteFile(fn, data, perm); err != nil {
+ if err = os.WriteFile(fn, data, perm); err != nil {
t.Errorf("%d,%d: WriteFile(%#q) failed: %v", ti, i, fn, err)
return
}
@@ -104,7 +103,7 @@ func testWinSplitListTestIsValid(t *testing.T, ti int, tt SplitListTest,
func TestWindowsEvalSymlinks(t *testing.T) {
testenv.MustHaveSymlink(t)
- tmpDir, err := ioutil.TempDir("", "TestWindowsEvalSymlinks")
+ tmpDir, err := os.MkdirTemp("", "TestWindowsEvalSymlinks")
if err != nil {
t.Fatal(err)
}
@@ -162,13 +161,13 @@ func TestWindowsEvalSymlinks(t *testing.T) {
// TestEvalSymlinksCanonicalNames verify that EvalSymlinks
// returns "canonical" path names on windows.
func TestEvalSymlinksCanonicalNames(t *testing.T) {
- tmp, err := ioutil.TempDir("", "evalsymlinkcanonical")
+ tmp, err := os.MkdirTemp("", "evalsymlinkcanonical")
if err != nil {
t.Fatal("creating temp dir:", err)
}
defer os.RemoveAll(tmp)
- // ioutil.TempDir might return "non-canonical" name.
+ // os.MkdirTemp might return "non-canonical" name.
cTmpName, err := filepath.EvalSymlinks(tmp)
if err != nil {
t.Errorf("EvalSymlinks(%q) error: %v", tmp, err)
@@ -418,7 +417,7 @@ func TestToNorm(t *testing.T) {
{".", `\\localhost\c$`, `\\localhost\c$`},
}
- tmp, err := ioutil.TempDir("", "testToNorm")
+ tmp, err := os.MkdirTemp("", "testToNorm")
if err != nil {
t.Fatal(err)
}
@@ -429,7 +428,7 @@ func TestToNorm(t *testing.T) {
}
}()
- // ioutil.TempDir might return "non-canonical" name.
+ // os.MkdirTemp might return "non-canonical" name.
ctmp, err := filepath.EvalSymlinks(tmp)
if err != nil {
t.Fatal(err)
@@ -527,7 +526,7 @@ func TestNTNamespaceSymlink(t *testing.T) {
t.Skip("skipping test because mklink command does not support junctions")
}
- tmpdir, err := ioutil.TempDir("", "TestNTNamespaceSymlink")
+ tmpdir, err := os.MkdirTemp("", "TestNTNamespaceSymlink")
if err != nil {
t.Fatal(err)
}
@@ -564,7 +563,7 @@ func TestNTNamespaceSymlink(t *testing.T) {
testenv.MustHaveSymlink(t)
file := filepath.Join(tmpdir, "file")
- err = ioutil.WriteFile(file, []byte(""), 0666)
+ err = os.WriteFile(file, []byte(""), 0666)
if err != nil {
t.Fatal(err)
}
diff --git a/src/reflect/type.go b/src/reflect/type.go
index a2076bb3f1..1f1e70d485 100644
--- a/src/reflect/type.go
+++ b/src/reflect/type.go
@@ -1104,12 +1104,16 @@ type StructField struct {
// A StructTag is the tag string in a struct field.
//
-// By convention, tag strings are a concatenation of
-// optionally space-separated key:"value" pairs.
-// Each key is a non-empty string consisting of non-control
-// characters other than space (U+0020 ' '), quote (U+0022 '"'),
-// and colon (U+003A ':'). Each value is quoted using U+0022 '"'
-// characters and Go string literal syntax.
+// By convention, tag strings are a mapping of keys to values.
+// The format is key:"value". Each key is a non-empty string consisting
+// of non-control characters other than space (U+0020 ' '),
+// quote (U+0022 '"'), and colon (U+003A ':'). Each value is quoted
+// using U+0022 '"' characters and Go string literal syntax.
+// Multiple key-value mappings are separated by zero or more spaces, as in
+// key1:"value1" key2:"value2"
+// Multiple keys may map to a single shared value by separating the keys
+// with spaces, as in
+// key1 key2:"value"
type StructTag string
// Get returns the value associated with key in the tag string.
diff --git a/src/runtime/cgo/linux_syscall.c b/src/runtime/cgo/linux_syscall.c
index c8e91918a1..56f3d67d8b 100644
--- a/src/runtime/cgo/linux_syscall.c
+++ b/src/runtime/cgo/linux_syscall.c
@@ -10,7 +10,7 @@
#include <grp.h>
#include <sys/types.h>
-#include <sys/unistd.h>
+#include <unistd.h>
#include <errno.h>
#include "libcgo.h"
diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go
index 5e22b7593e..58ad4f3eba 100644
--- a/src/runtime/crash_test.go
+++ b/src/runtime/crash_test.go
@@ -9,7 +9,6 @@ import (
"flag"
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -117,7 +116,7 @@ func buildTestProg(t *testing.T, binary string, flags ...string) (string, error)
testprog.Lock()
defer testprog.Unlock()
if testprog.dir == "" {
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
diff --git a/src/runtime/crash_unix_test.go b/src/runtime/crash_unix_test.go
index ebbdbfe5b9..803b031873 100644
--- a/src/runtime/crash_unix_test.go
+++ b/src/runtime/crash_unix_test.go
@@ -10,7 +10,6 @@ import (
"bytes"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -85,13 +84,13 @@ func TestCrashDumpsAllThreads(t *testing.T) {
t.Parallel()
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
defer os.RemoveAll(dir)
- if err := ioutil.WriteFile(filepath.Join(dir, "main.go"), []byte(crashDumpsAllThreadsSource), 0666); err != nil {
+ if err := os.WriteFile(filepath.Join(dir, "main.go"), []byte(crashDumpsAllThreadsSource), 0666); err != nil {
t.Fatalf("failed to create Go file: %v", err)
}
diff --git a/src/runtime/debug/heapdump_test.go b/src/runtime/debug/heapdump_test.go
index de1ec27d21..768934d05d 100644
--- a/src/runtime/debug/heapdump_test.go
+++ b/src/runtime/debug/heapdump_test.go
@@ -5,7 +5,6 @@
package debug_test
import (
- "io/ioutil"
"os"
"runtime"
. "runtime/debug"
@@ -16,7 +15,7 @@ func TestWriteHeapDumpNonempty(t *testing.T) {
if runtime.GOOS == "js" {
t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS)
}
- f, err := ioutil.TempFile("", "heapdumptest")
+ f, err := os.CreateTemp("", "heapdumptest")
if err != nil {
t.Fatalf("TempFile failed: %v", err)
}
@@ -45,7 +44,7 @@ func TestWriteHeapDumpFinalizers(t *testing.T) {
if runtime.GOOS == "js" {
t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS)
}
- f, err := ioutil.TempFile("", "heapdumptest")
+ f, err := os.CreateTemp("", "heapdumptest")
if err != nil {
t.Fatalf("TempFile failed: %v", err)
}
diff --git a/src/runtime/debug_test.go b/src/runtime/debug_test.go
index 722e81121f..a0b3f84382 100644
--- a/src/runtime/debug_test.go
+++ b/src/runtime/debug_test.go
@@ -17,7 +17,7 @@ package runtime_test
import (
"fmt"
- "io/ioutil"
+ "os"
"regexp"
"runtime"
"runtime/debug"
@@ -95,7 +95,7 @@ func debugCallTKill(tid int) error {
// Linux-specific.
func skipUnderDebugger(t *testing.T) {
pid := syscall.Getpid()
- status, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/status", pid))
+ status, err := os.ReadFile(fmt.Sprintf("/proc/%d/status", pid))
if err != nil {
t.Logf("couldn't get proc tracer: %s", err)
return
diff --git a/src/runtime/env_plan9.go b/src/runtime/env_plan9.go
index b7ea863735..f1ac4760a7 100644
--- a/src/runtime/env_plan9.go
+++ b/src/runtime/env_plan9.go
@@ -23,8 +23,8 @@ const (
// to the (possibly shared) Plan 9 environment, so that Setenv and Getenv
// conform to the same Posix semantics as on other operating systems.
// For Plan 9 shared environment semantics, instead of Getenv(key) and
-// Setenv(key, value), one can use ioutil.ReadFile("/env/" + key) and
-// ioutil.WriteFile("/env/" + key, value, 0666) respectively.
+// Setenv(key, value), one can use os.ReadFile("/env/" + key) and
+// os.WriteFile("/env/" + key, value, 0666) respectively.
//go:nosplit
func goenvs() {
buf := make([]byte, envBufSize)
diff --git a/src/runtime/internal/sys/gengoos.go b/src/runtime/internal/sys/gengoos.go
index 2a4bf0c3b4..9bbc48d94f 100644
--- a/src/runtime/internal/sys/gengoos.go
+++ b/src/runtime/internal/sys/gengoos.go
@@ -9,8 +9,8 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"log"
+ "os"
"strconv"
"strings"
)
@@ -18,7 +18,7 @@ import (
var gooses, goarches []string
func main() {
- data, err := ioutil.ReadFile("../../../go/build/syslist.go")
+ data, err := os.ReadFile("../../../go/build/syslist.go")
if err != nil {
log.Fatal(err)
}
@@ -68,7 +68,7 @@ func main() {
}
fmt.Fprintf(&buf, "const Goos%s = %d\n", strings.Title(goos), value)
}
- err := ioutil.WriteFile("zgoos_"+target+".go", buf.Bytes(), 0666)
+ err := os.WriteFile("zgoos_"+target+".go", buf.Bytes(), 0666)
if err != nil {
log.Fatal(err)
}
@@ -90,7 +90,7 @@ func main() {
}
fmt.Fprintf(&buf, "const Goarch%s = %d\n", strings.Title(goarch), value)
}
- err := ioutil.WriteFile("zgoarch_"+target+".go", buf.Bytes(), 0666)
+ err := os.WriteFile("zgoarch_"+target+".go", buf.Bytes(), 0666)
if err != nil {
log.Fatal(err)
}
diff --git a/src/runtime/memmove_linux_amd64_test.go b/src/runtime/memmove_linux_amd64_test.go
index d0e8b42a5a..b3ccd907b9 100644
--- a/src/runtime/memmove_linux_amd64_test.go
+++ b/src/runtime/memmove_linux_amd64_test.go
@@ -5,7 +5,6 @@
package runtime_test
import (
- "io/ioutil"
"os"
"reflect"
"syscall"
@@ -18,7 +17,7 @@ import (
func TestMemmoveOverflow(t *testing.T) {
t.Parallel()
// Create a temporary file.
- tmp, err := ioutil.TempFile("", "go-memmovetest")
+ tmp, err := os.CreateTemp("", "go-memmovetest")
if err != nil {
t.Fatal(err)
}
diff --git a/src/runtime/metrics/description_test.go b/src/runtime/metrics/description_test.go
index e966a281a1..448639ee77 100644
--- a/src/runtime/metrics/description_test.go
+++ b/src/runtime/metrics/description_test.go
@@ -7,9 +7,7 @@ package metrics_test
import (
"bufio"
"os"
- "path/filepath"
"regexp"
- "runtime"
"runtime/metrics"
"strings"
"testing"
@@ -26,17 +24,9 @@ func TestDescriptionNameFormat(t *testing.T) {
}
func extractMetricDocs(t *testing.T) map[string]string {
- if runtime.GOOS == "android" {
- t.Skip("no access to Go source on android")
- }
-
- // Get doc.go.
- _, filename, _, _ := runtime.Caller(0)
- filename = filepath.Join(filepath.Dir(filename), "doc.go")
-
- f, err := os.Open(filename)
+ f, err := os.Open("doc.go")
if err != nil {
- t.Fatal(err)
+ t.Fatalf("failed to open doc.go in runtime/metrics package: %v", err)
}
const (
stateSearch = iota // look for list of metrics
@@ -90,7 +80,7 @@ func extractMetricDocs(t *testing.T) map[string]string {
}
}
if state == stateSearch {
- t.Fatalf("failed to find supported metrics docs in %s", filename)
+ t.Fatalf("failed to find supported metrics docs in %s", f.Name())
}
return result
}
diff --git a/src/runtime/mkduff.go b/src/runtime/mkduff.go
index 6ddf0256e9..94ae75fbfe 100644
--- a/src/runtime/mkduff.go
+++ b/src/runtime/mkduff.go
@@ -27,8 +27,8 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"log"
+ "os"
)
func main() {
@@ -54,7 +54,7 @@ func gen(arch string, tags, zero, copy func(io.Writer)) {
fmt.Fprintln(&buf)
copy(&buf)
- if err := ioutil.WriteFile("duff_"+arch+".s", buf.Bytes(), 0644); err != nil {
+ if err := os.WriteFile("duff_"+arch+".s", buf.Bytes(), 0644); err != nil {
log.Fatalln(err)
}
}
diff --git a/src/runtime/mkfastlog2table.go b/src/runtime/mkfastlog2table.go
index 305c84a7c1..d650292394 100644
--- a/src/runtime/mkfastlog2table.go
+++ b/src/runtime/mkfastlog2table.go
@@ -12,9 +12,9 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"log"
"math"
+ "os"
)
func main() {
@@ -36,7 +36,7 @@ func main() {
}
fmt.Fprintln(&buf, "}")
- if err := ioutil.WriteFile("fastlog2table.go", buf.Bytes(), 0644); err != nil {
+ if err := os.WriteFile("fastlog2table.go", buf.Bytes(), 0644); err != nil {
log.Fatalln(err)
}
}
diff --git a/src/runtime/mksizeclasses.go b/src/runtime/mksizeclasses.go
index 1a210953a4..b92d1fed5f 100644
--- a/src/runtime/mksizeclasses.go
+++ b/src/runtime/mksizeclasses.go
@@ -35,7 +35,6 @@ import (
"fmt"
"go/format"
"io"
- "io/ioutil"
"log"
"os"
)
@@ -65,7 +64,7 @@ func main() {
if *stdout {
_, err = os.Stdout.Write(out)
} else {
- err = ioutil.WriteFile("sizeclasses.go", out, 0666)
+ err = os.WriteFile("sizeclasses.go", out, 0666)
}
if err != nil {
log.Fatal(err)
diff --git a/src/runtime/msan.go b/src/runtime/msan.go
index c0f3957e28..6a5960b0a8 100644
--- a/src/runtime/msan.go
+++ b/src/runtime/msan.go
@@ -50,8 +50,12 @@ func msanmalloc(addr unsafe.Pointer, sz uintptr)
//go:noescape
func msanfree(addr unsafe.Pointer, sz uintptr)
-// These are called from msan_amd64.s
+//go:noescape
+func msanmove(dst, src unsafe.Pointer, sz uintptr)
+
+// These are called from msan_GOARCH.s
//go:cgo_import_static __msan_read_go
//go:cgo_import_static __msan_write_go
//go:cgo_import_static __msan_malloc_go
//go:cgo_import_static __msan_free_go
+//go:cgo_import_static __msan_memmove
diff --git a/src/runtime/msan_amd64.s b/src/runtime/msan_amd64.s
index cbe739df53..669e9ca73f 100644
--- a/src/runtime/msan_amd64.s
+++ b/src/runtime/msan_amd64.s
@@ -58,6 +58,15 @@ TEXT runtime·msanfree(SB), NOSPLIT, $0-16
MOVQ $__msan_free_go(SB), AX
JMP msancall<>(SB)
+// func runtime·msanmove(dst, src unsafe.Pointer, sz uintptr)
+TEXT runtime·msanmove(SB), NOSPLIT, $0-24
+ MOVQ dst+0(FP), RARG0
+ MOVQ src+8(FP), RARG1
+ MOVQ size+16(FP), RARG2
+ // void __msan_memmove(void *dst, void *src, uintptr_t sz);
+ MOVQ $__msan_memmove(SB), AX
+ JMP msancall<>(SB)
+
// Switches SP to g0 stack and calls (AX). Arguments already set.
TEXT msancall<>(SB), NOSPLIT, $0-0
get_tls(R12)
diff --git a/src/runtime/msan_arm64.s b/src/runtime/msan_arm64.s
index 5e29f1aefb..f19906cfc8 100644
--- a/src/runtime/msan_arm64.s
+++ b/src/runtime/msan_arm64.s
@@ -9,6 +9,7 @@
#define RARG0 R0
#define RARG1 R1
+#define RARG2 R2
#define FARG R3
// func runtime·domsanread(addr unsafe.Pointer, sz uintptr)
@@ -45,6 +46,15 @@ TEXT runtime·msanfree(SB), NOSPLIT, $0-16
MOVD $__msan_free_go(SB), FARG
JMP msancall<>(SB)
+// func runtime·msanmove(dst, src unsafe.Pointer, sz uintptr)
+TEXT runtime·msanmove(SB), NOSPLIT, $0-24
+ MOVD dst+0(FP), RARG0
+ MOVD src+8(FP), RARG1
+ MOVD size+16(FP), RARG2
+ // void __msan_memmove(void *dst, void *src, uintptr_t sz);
+ MOVD $__msan_memmove(SB), FARG
+ JMP msancall<>(SB)
+
// Switches SP to g0 stack and calls (FARG). Arguments already set.
TEXT msancall<>(SB), NOSPLIT, $0-0
MOVD RSP, R19 // callee-saved
diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go
index 52f3cd1fef..e0a43c28aa 100644
--- a/src/runtime/os_darwin.go
+++ b/src/runtime/os_darwin.go
@@ -130,6 +130,18 @@ func osinit() {
physPageSize = getPageSize()
}
+func sysctlbynameInt32(name []byte) (int32, int32) {
+ out := int32(0)
+ nout := unsafe.Sizeof(out)
+ ret := sysctlbyname(&name[0], (*byte)(unsafe.Pointer(&out)), &nout, nil, 0)
+ return ret, out
+}
+
+//go:linkname internal_cpu_getsysctlbyname internal/cpu.getsysctlbyname
+func internal_cpu_getsysctlbyname(name []byte) (int32, int32) {
+ return sysctlbynameInt32(name)
+}
+
const (
_CTL_HW = 6
_HW_NCPU = 3
diff --git a/src/runtime/os_linux_be64.go b/src/runtime/os_linux_be64.go
index 14fbad5d5f..9860002ee4 100644
--- a/src/runtime/os_linux_be64.go
+++ b/src/runtime/os_linux_be64.go
@@ -38,6 +38,7 @@ func sigdelset(mask *sigset, i int) {
*mask &^= 1 << (uint(i) - 1)
}
+//go:nosplit
func sigfillset(mask *uint64) {
*mask = ^uint64(0)
}
diff --git a/src/runtime/os_linux_generic.go b/src/runtime/os_linux_generic.go
index 14810e3cc3..e1d0952ddf 100644
--- a/src/runtime/os_linux_generic.go
+++ b/src/runtime/os_linux_generic.go
@@ -38,6 +38,7 @@ func sigdelset(mask *sigset, i int) {
(*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
+//go:nosplit
func sigfillset(mask *uint64) {
*mask = ^uint64(0)
}
diff --git a/src/runtime/os_linux_mips64x.go b/src/runtime/os_linux_mips64x.go
index 4ff66f9538..815a83a04b 100644
--- a/src/runtime/os_linux_mips64x.go
+++ b/src/runtime/os_linux_mips64x.go
@@ -48,6 +48,7 @@ func sigdelset(mask *sigset, i int) {
(*mask)[(i-1)/64] &^= 1 << ((uint32(i) - 1) & 63)
}
+//go:nosplit
func sigfillset(mask *[2]uint64) {
(*mask)[0], (*mask)[1] = ^uint64(0), ^uint64(0)
}
diff --git a/src/runtime/os_linux_mipsx.go b/src/runtime/os_linux_mipsx.go
index 87962ed982..00fb02e4bf 100644
--- a/src/runtime/os_linux_mipsx.go
+++ b/src/runtime/os_linux_mipsx.go
@@ -42,6 +42,7 @@ func sigdelset(mask *sigset, i int) {
(*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
}
+//go:nosplit
func sigfillset(mask *[4]uint32) {
(*mask)[0], (*mask)[1], (*mask)[2], (*mask)[3] = ^uint32(0), ^uint32(0), ^uint32(0), ^uint32(0)
}
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index b807072485..b6ee160e84 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -13,7 +13,6 @@ import (
"internal/profile"
"internal/testenv"
"io"
- "io/ioutil"
"math/big"
"os"
"os/exec"
@@ -1179,7 +1178,7 @@ func TestLabelRace(t *testing.T) {
// Check that there is no deadlock when the program receives SIGPROF while in
// 64bit atomics' critical section. Used to happen on mips{,le}. See #20146.
func TestAtomicLoadStore64(t *testing.T) {
- f, err := ioutil.TempFile("", "profatomic")
+ f, err := os.CreateTemp("", "profatomic")
if err != nil {
t.Fatalf("TempFile: %v", err)
}
@@ -1208,7 +1207,7 @@ func TestAtomicLoadStore64(t *testing.T) {
func TestTracebackAll(t *testing.T) {
// With gccgo, if a profiling signal arrives at the wrong time
// during traceback, it may crash or hang. See issue #29448.
- f, err := ioutil.TempFile("", "proftraceback")
+ f, err := os.CreateTemp("", "proftraceback")
if err != nil {
t.Fatalf("TempFile: %v", err)
}
diff --git a/src/runtime/pprof/proto.go b/src/runtime/pprof/proto.go
index 8519af6985..bdb4454b6e 100644
--- a/src/runtime/pprof/proto.go
+++ b/src/runtime/pprof/proto.go
@@ -9,7 +9,7 @@ import (
"compress/gzip"
"fmt"
"io"
- "io/ioutil"
+ "os"
"runtime"
"strconv"
"time"
@@ -575,7 +575,7 @@ func (b *profileBuilder) emitLocation() uint64 {
// It saves the address ranges of the mappings in b.mem for use
// when emitting locations.
func (b *profileBuilder) readMapping() {
- data, _ := ioutil.ReadFile("/proc/self/maps")
+ data, _ := os.ReadFile("/proc/self/maps")
parseProcSelfMaps(data, b.addMapping)
if len(b.mem) == 0 { // pprof expects a map entry, so fake one.
b.addMappingEntry(0, 0, 0, "", "", true)
diff --git a/src/runtime/pprof/proto_test.go b/src/runtime/pprof/proto_test.go
index 3043d5353f..5eb1aab140 100644
--- a/src/runtime/pprof/proto_test.go
+++ b/src/runtime/pprof/proto_test.go
@@ -10,7 +10,6 @@ import (
"fmt"
"internal/profile"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"reflect"
@@ -78,7 +77,7 @@ func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) {
switch runtime.GOOS {
case "linux", "android", "netbsd":
// Figure out two addresses from /proc/self/maps.
- mmap, err := ioutil.ReadFile("/proc/self/maps")
+ mmap, err := os.ReadFile("/proc/self/maps")
if err != nil {
t.Fatal(err)
}
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 0319de5fde..64e102fb0a 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -1363,7 +1363,7 @@ found:
checkdead()
unlock(&sched.lock)
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
// Make sure pendingPreemptSignals is correct when an M exits.
// For #41702.
if atomic.Load(&m.signalPending) != 0 {
@@ -3852,7 +3852,7 @@ func syscall_runtime_BeforeExec() {
// On Darwin, wait for all pending preemption signals to
// be received. See issue #41702.
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
for int32(atomic.Load(&pendingPreemptSignals)) > 0 {
osyield()
}
diff --git a/src/runtime/race/output_test.go b/src/runtime/race/output_test.go
index 5d0192f67f..986667332f 100644
--- a/src/runtime/race/output_test.go
+++ b/src/runtime/race/output_test.go
@@ -8,7 +8,6 @@ package race_test
import (
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -19,7 +18,7 @@ import (
)
func TestOutput(t *testing.T) {
- pkgdir, err := ioutil.TempDir("", "go-build-race-output")
+ pkgdir, err := os.MkdirTemp("", "go-build-race-output")
if err != nil {
t.Fatal(err)
}
@@ -34,7 +33,7 @@ func TestOutput(t *testing.T) {
t.Logf("test %v runs only on %v, skipping: ", test.name, test.goos)
continue
}
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
diff --git a/src/runtime/race/testdata/io_test.go b/src/runtime/race/testdata/io_test.go
index 30a121bee4..c5055f7837 100644
--- a/src/runtime/race/testdata/io_test.go
+++ b/src/runtime/race/testdata/io_test.go
@@ -6,7 +6,6 @@ package race_test
import (
"fmt"
- "io/ioutil"
"net"
"net/http"
"os"
@@ -18,7 +17,7 @@ import (
func TestNoRaceIOFile(t *testing.T) {
x := 0
- path, _ := ioutil.TempDir("", "race_test")
+ path, _ := os.MkdirTemp("", "race_test")
fname := filepath.Join(path, "data")
go func() {
x = 42
diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go
index e52bd1c4c4..5df8c3c745 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -8,7 +8,6 @@ import (
"bytes"
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -170,7 +169,7 @@ func testGdbPython(t *testing.T, cgo bool) {
checkGdbVersion(t)
checkGdbPython(t)
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
@@ -195,7 +194,7 @@ func testGdbPython(t *testing.T, cgo bool) {
}
}
- err = ioutil.WriteFile(filepath.Join(dir, "main.go"), src, 0644)
+ err = os.WriteFile(filepath.Join(dir, "main.go"), src, 0644)
if err != nil {
t.Fatalf("failed to create file: %v", err)
}
@@ -404,7 +403,7 @@ func TestGdbBacktrace(t *testing.T) {
t.Parallel()
checkGdbVersion(t)
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
@@ -412,7 +411,7 @@ func TestGdbBacktrace(t *testing.T) {
// Build the source code.
src := filepath.Join(dir, "main.go")
- err = ioutil.WriteFile(src, []byte(backtraceSource), 0644)
+ err = os.WriteFile(src, []byte(backtraceSource), 0644)
if err != nil {
t.Fatalf("failed to create file: %v", err)
}
@@ -482,7 +481,7 @@ func TestGdbAutotmpTypes(t *testing.T) {
t.Skip("TestGdbAutotmpTypes is too slow on aix/ppc64")
}
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
@@ -490,7 +489,7 @@ func TestGdbAutotmpTypes(t *testing.T) {
// Build the source code.
src := filepath.Join(dir, "main.go")
- err = ioutil.WriteFile(src, []byte(autotmpTypeSource), 0644)
+ err = os.WriteFile(src, []byte(autotmpTypeSource), 0644)
if err != nil {
t.Fatalf("failed to create file: %v", err)
}
@@ -551,7 +550,7 @@ func TestGdbConst(t *testing.T) {
t.Parallel()
checkGdbVersion(t)
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
@@ -559,7 +558,7 @@ func TestGdbConst(t *testing.T) {
// Build the source code.
src := filepath.Join(dir, "main.go")
- err = ioutil.WriteFile(src, []byte(constsSource), 0644)
+ err = os.WriteFile(src, []byte(constsSource), 0644)
if err != nil {
t.Fatalf("failed to create file: %v", err)
}
@@ -618,7 +617,7 @@ func TestGdbPanic(t *testing.T) {
t.Parallel()
checkGdbVersion(t)
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
@@ -626,7 +625,7 @@ func TestGdbPanic(t *testing.T) {
// Build the source code.
src := filepath.Join(dir, "main.go")
- err = ioutil.WriteFile(src, []byte(panicSource), 0644)
+ err = os.WriteFile(src, []byte(panicSource), 0644)
if err != nil {
t.Fatalf("failed to create file: %v", err)
}
@@ -696,7 +695,7 @@ func TestGdbInfCallstack(t *testing.T) {
t.Parallel()
checkGdbVersion(t)
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
@@ -704,7 +703,7 @@ func TestGdbInfCallstack(t *testing.T) {
// Build the source code.
src := filepath.Join(dir, "main.go")
- err = ioutil.WriteFile(src, []byte(InfCallstackSource), 0644)
+ err = os.WriteFile(src, []byte(InfCallstackSource), 0644)
if err != nil {
t.Fatalf("failed to create file: %v", err)
}
diff --git a/src/runtime/runtime-lldb_test.go b/src/runtime/runtime-lldb_test.go
index 1e2e5d5be9..c923b872aa 100644
--- a/src/runtime/runtime-lldb_test.go
+++ b/src/runtime/runtime-lldb_test.go
@@ -6,7 +6,6 @@ package runtime_test
import (
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -143,20 +142,20 @@ func TestLldbPython(t *testing.T) {
checkLldbPython(t)
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
defer os.RemoveAll(dir)
src := filepath.Join(dir, "main.go")
- err = ioutil.WriteFile(src, []byte(lldbHelloSource), 0644)
+ err = os.WriteFile(src, []byte(lldbHelloSource), 0644)
if err != nil {
t.Fatalf("failed to create src file: %v", err)
}
mod := filepath.Join(dir, "go.mod")
- err = ioutil.WriteFile(mod, []byte("module lldbtest"), 0644)
+ err = os.WriteFile(mod, []byte("module lldbtest"), 0644)
if err != nil {
t.Fatalf("failed to create mod file: %v", err)
}
@@ -172,7 +171,7 @@ func TestLldbPython(t *testing.T) {
}
src = filepath.Join(dir, "script.py")
- err = ioutil.WriteFile(src, []byte(lldbScriptSource), 0755)
+ err = os.WriteFile(src, []byte(lldbScriptSource), 0755)
if err != nil {
t.Fatalf("failed to create script: %v", err)
}
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index 6aad079f03..e8f39c3321 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -336,7 +336,7 @@ func doSigPreempt(gp *g, ctxt *sigctxt) {
atomic.Xadd(&gp.m.preemptGen, 1)
atomic.Store(&gp.m.signalPending, 0)
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
atomic.Xadd(&pendingPreemptSignals, -1)
}
}
@@ -352,12 +352,12 @@ const preemptMSupported = true
func preemptM(mp *m) {
// On Darwin, don't try to preempt threads during exec.
// Issue #41702.
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
execLock.rlock()
}
if atomic.Cas(&mp.signalPending, 0, 1) {
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
atomic.Xadd(&pendingPreemptSignals, 1)
}
@@ -369,7 +369,7 @@ func preemptM(mp *m) {
signalM(mp, sigPreempt)
}
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
execLock.runlock()
}
}
@@ -432,7 +432,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
// no non-Go signal handler for sigPreempt.
// The default behavior for sigPreempt is to ignore
// the signal, so badsignal will be a no-op anyway.
- if GOOS == "darwin" {
+ if GOOS == "darwin" || GOOS == "ios" {
atomic.Xadd(&pendingPreemptSignals, -1)
}
return
diff --git a/src/runtime/signal_windows_test.go b/src/runtime/signal_windows_test.go
index f99857193c..a5a885c2f7 100644
--- a/src/runtime/signal_windows_test.go
+++ b/src/runtime/signal_windows_test.go
@@ -7,7 +7,6 @@ import (
"bytes"
"fmt"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -28,7 +27,7 @@ func TestVectoredHandlerDontCrashOnLibrary(t *testing.T) {
testenv.MustHaveExecPath(t, "gcc")
testprog.Lock()
defer testprog.Unlock()
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
@@ -93,7 +92,7 @@ func TestLibraryCtrlHandler(t *testing.T) {
testenv.MustHaveExecPath(t, "gcc")
testprog.Lock()
defer testprog.Unlock()
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go
index c63ba8c6cd..c89ce78012 100644
--- a/src/runtime/sys_darwin.go
+++ b/src/runtime/sys_darwin.go
@@ -360,13 +360,20 @@ func setitimer_trampoline()
//go:nosplit
//go:cgo_unsafe_args
-func sysctl(mib *uint32, miblen uint32, out *byte, size *uintptr, dst *byte, ndst uintptr) int32 {
+func sysctl(mib *uint32, miblen uint32, oldp *byte, oldlenp *uintptr, newp *byte, newlen uintptr) int32 {
return libcCall(unsafe.Pointer(funcPC(sysctl_trampoline)), unsafe.Pointer(&mib))
}
func sysctl_trampoline()
//go:nosplit
//go:cgo_unsafe_args
+func sysctlbyname(name *byte, oldp *byte, oldlenp *uintptr, newp *byte, newlen uintptr) int32 {
+ return libcCall(unsafe.Pointer(funcPC(sysctlbyname_trampoline)), unsafe.Pointer(&name))
+}
+func sysctlbyname_trampoline()
+
+//go:nosplit
+//go:cgo_unsafe_args
func fcntl(fd, cmd, arg int32) int32 {
return libcCall(unsafe.Pointer(funcPC(fcntl_trampoline)), unsafe.Pointer(&fd))
}
@@ -486,6 +493,7 @@ func setNonblock(fd int32) {
//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_setitimer setitimer "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib"
+//go:cgo_import_dynamic libc_sysctlbyname sysctlbyname "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib"
//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib"
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s
index 9b5b23901d..630fb5df64 100644
--- a/src/runtime/sys_darwin_amd64.s
+++ b/src/runtime/sys_darwin_amd64.s
@@ -371,15 +371,27 @@ TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 8(DI), SI // arg 2 miblen
- MOVQ 16(DI), DX // arg 3 out
- MOVQ 24(DI), CX // arg 4 size
- MOVQ 32(DI), R8 // arg 5 dst
- MOVQ 40(DI), R9 // arg 6 ndst
+ MOVQ 16(DI), DX // arg 3 oldp
+ MOVQ 24(DI), CX // arg 4 oldlenp
+ MOVQ 32(DI), R8 // arg 5 newp
+ MOVQ 40(DI), R9 // arg 6 newlen
MOVQ 0(DI), DI // arg 1 mib
CALL libc_sysctl(SB)
POPQ BP
RET
+TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0
+ PUSHQ BP
+ MOVQ SP, BP
+ MOVQ 8(DI), SI // arg 2 oldp
+ MOVQ 16(DI), DX // arg 3 oldlenp
+ MOVQ 24(DI), CX // arg 4 newp
+ MOVQ 32(DI), R8 // arg 5 newlen
+ MOVQ 0(DI), DI // arg 1 name
+ CALL libc_sysctlbyname(SB)
+ POPQ BP
+ RET
+
TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
diff --git a/src/runtime/sys_darwin_arm64.s b/src/runtime/sys_darwin_arm64.s
index 9d4d116c50..96d2ed1076 100644
--- a/src/runtime/sys_darwin_arm64.s
+++ b/src/runtime/sys_darwin_arm64.s
@@ -301,14 +301,24 @@ TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0
TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0
MOVW 8(R0), R1 // arg 2 miblen
- MOVD 16(R0), R2 // arg 3 out
- MOVD 24(R0), R3 // arg 4 size
- MOVD 32(R0), R4 // arg 5 dst
- MOVD 40(R0), R5 // arg 6 ndst
+ MOVD 16(R0), R2 // arg 3 oldp
+ MOVD 24(R0), R3 // arg 4 oldlenp
+ MOVD 32(R0), R4 // arg 5 newp
+ MOVD 40(R0), R5 // arg 6 newlen
MOVD 0(R0), R0 // arg 1 mib
BL libc_sysctl(SB)
RET
+TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0
+ MOVD 8(R0), R1 // arg 2 oldp
+ MOVD 16(R0), R2 // arg 3 oldlenp
+ MOVD 24(R0), R3 // arg 4 newp
+ MOVD 32(R0), R4 // arg 5 newlen
+ MOVD 0(R0), R0 // arg 1 name
+ BL libc_sysctlbyname(SB)
+ RET
+
+
TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0
BL libc_kqueue(SB)
RET
diff --git a/src/runtime/sys_openbsd_mips64.s b/src/runtime/sys_openbsd_mips64.s
index 57a5dbd40e..3e4d209081 100644
--- a/src/runtime/sys_openbsd_mips64.s
+++ b/src/runtime/sys_openbsd_mips64.s
@@ -244,8 +244,8 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
MOVW sig+8(FP), R4
MOVV info+16(FP), R5
MOVV ctx+24(FP), R6
- MOVV fn+0(FP), R7
- CALL (R7) // Alignment for ELF ABI?
+ MOVV fn+0(FP), R25 // Must use R25, needed for PIC code.
+ CALL (R25)
RET
TEXT runtime·sigtramp(SB),NOSPLIT,$192
diff --git a/src/runtime/syscall_windows_test.go b/src/runtime/syscall_windows_test.go
index a20573eb6a..fb215b3c31 100644
--- a/src/runtime/syscall_windows_test.go
+++ b/src/runtime/syscall_windows_test.go
@@ -10,7 +10,6 @@ import (
"internal/syscall/windows/sysdll"
"internal/testenv"
"io"
- "io/ioutil"
"math"
"os"
"os/exec"
@@ -446,7 +445,7 @@ func TestStdcallAndCDeclCallbacks(t *testing.T) {
if _, err := exec.LookPath("gcc"); err != nil {
t.Skip("skipping test: gcc is missing")
}
- tmp, err := ioutil.TempDir("", "TestCDeclCallback")
+ tmp, err := os.MkdirTemp("", "TestCDeclCallback")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
@@ -602,14 +601,14 @@ uintptr_t cfunc(callback f, uintptr_t n) {
return r;
}
`
- tmpdir, err := ioutil.TempDir("", "TestReturnAfterStackGrowInCallback")
+ tmpdir, err := os.MkdirTemp("", "TestReturnAfterStackGrowInCallback")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
defer os.RemoveAll(tmpdir)
srcname := "mydll.c"
- err = ioutil.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
+ err = os.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
if err != nil {
t.Fatal(err)
}
@@ -671,14 +670,14 @@ uintptr_t cfunc(uintptr_t a, double b, float c, double d) {
return 0;
}
`
- tmpdir, err := ioutil.TempDir("", "TestFloatArgs")
+ tmpdir, err := os.MkdirTemp("", "TestFloatArgs")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
defer os.RemoveAll(tmpdir)
srcname := "mydll.c"
- err = ioutil.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
+ err = os.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
if err != nil {
t.Fatal(err)
}
@@ -733,14 +732,14 @@ double cfuncDouble(uintptr_t a, double b, float c, double d) {
return 0;
}
`
- tmpdir, err := ioutil.TempDir("", "TestFloatReturn")
+ tmpdir, err := os.MkdirTemp("", "TestFloatReturn")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
defer os.RemoveAll(tmpdir)
srcname := "mydll.c"
- err = ioutil.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
+ err = os.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
if err != nil {
t.Fatal(err)
}
@@ -948,7 +947,7 @@ func TestDLLPreloadMitigation(t *testing.T) {
t.Skip("skipping test: gcc is missing")
}
- tmpdir, err := ioutil.TempDir("", "TestDLLPreloadMitigation")
+ tmpdir, err := os.MkdirTemp("", "TestDLLPreloadMitigation")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
@@ -975,7 +974,7 @@ uintptr_t cfunc(void) {
}
`
srcname := "nojack.c"
- err = ioutil.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
+ err = os.WriteFile(filepath.Join(tmpdir, srcname), []byte(src), 0)
if err != nil {
t.Fatal(err)
}
@@ -1035,7 +1034,7 @@ func TestBigStackCallbackSyscall(t *testing.T) {
t.Fatal("Abs failed: ", err)
}
- tmpdir, err := ioutil.TempDir("", "TestBigStackCallback")
+ tmpdir, err := os.MkdirTemp("", "TestBigStackCallback")
if err != nil {
t.Fatal("TempDir failed: ", err)
}
@@ -1184,14 +1183,14 @@ func BenchmarkOsYield(b *testing.B) {
}
func BenchmarkRunningGoProgram(b *testing.B) {
- tmpdir, err := ioutil.TempDir("", "BenchmarkRunningGoProgram")
+ tmpdir, err := os.MkdirTemp("", "BenchmarkRunningGoProgram")
if err != nil {
b.Fatal(err)
}
defer os.RemoveAll(tmpdir)
src := filepath.Join(tmpdir, "main.go")
- err = ioutil.WriteFile(src, []byte(benchmarkRunningGoProgram), 0666)
+ err = os.WriteFile(src, []byte(benchmarkRunningGoProgram), 0666)
if err != nil {
b.Fatal(err)
}
diff --git a/src/runtime/testdata/testprog/memprof.go b/src/runtime/testdata/testprog/memprof.go
index 7b134bc078..0392e60f84 100644
--- a/src/runtime/testdata/testprog/memprof.go
+++ b/src/runtime/testdata/testprog/memprof.go
@@ -7,7 +7,6 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"os"
"runtime"
"runtime/pprof"
@@ -31,7 +30,7 @@ func MemProf() {
runtime.GC()
- f, err := ioutil.TempFile("", "memprof")
+ f, err := os.CreateTemp("", "memprof")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
diff --git a/src/runtime/testdata/testprog/syscalls_linux.go b/src/runtime/testdata/testprog/syscalls_linux.go
index b8ac087626..48f8014237 100644
--- a/src/runtime/testdata/testprog/syscalls_linux.go
+++ b/src/runtime/testdata/testprog/syscalls_linux.go
@@ -7,7 +7,6 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"os"
"syscall"
)
@@ -17,7 +16,7 @@ func gettid() int {
}
func tidExists(tid int) (exists, supported bool) {
- stat, err := ioutil.ReadFile(fmt.Sprintf("/proc/self/task/%d/stat", tid))
+ stat, err := os.ReadFile(fmt.Sprintf("/proc/self/task/%d/stat", tid))
if os.IsNotExist(err) {
return false, true
}
diff --git a/src/runtime/testdata/testprog/timeprof.go b/src/runtime/testdata/testprog/timeprof.go
index 0702885369..1e90af4033 100644
--- a/src/runtime/testdata/testprog/timeprof.go
+++ b/src/runtime/testdata/testprog/timeprof.go
@@ -6,7 +6,6 @@ package main
import (
"fmt"
- "io/ioutil"
"os"
"runtime/pprof"
"time"
@@ -17,7 +16,7 @@ func init() {
}
func TimeProf() {
- f, err := ioutil.TempFile("", "timeprof")
+ f, err := os.CreateTemp("", "timeprof")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
diff --git a/src/runtime/testdata/testprog/vdso.go b/src/runtime/testdata/testprog/vdso.go
index ef92f48758..d2a300d8f2 100644
--- a/src/runtime/testdata/testprog/vdso.go
+++ b/src/runtime/testdata/testprog/vdso.go
@@ -8,7 +8,6 @@ package main
import (
"fmt"
- "io/ioutil"
"os"
"runtime/pprof"
"time"
@@ -19,7 +18,7 @@ func init() {
}
func signalInVDSO() {
- f, err := ioutil.TempFile("", "timeprofnow")
+ f, err := os.CreateTemp("", "timeprofnow")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
diff --git a/src/runtime/testdata/testprogcgo/pprof.go b/src/runtime/testdata/testprogcgo/pprof.go
index 00f2c42e93..3b73fa0bdd 100644
--- a/src/runtime/testdata/testprogcgo/pprof.go
+++ b/src/runtime/testdata/testprogcgo/pprof.go
@@ -60,7 +60,6 @@ import "C"
import (
"fmt"
- "io/ioutil"
"os"
"runtime"
"runtime/pprof"
@@ -75,7 +74,7 @@ func init() {
func CgoPprof() {
runtime.SetCgoTraceback(0, unsafe.Pointer(C.pprofCgoTraceback), nil, nil)
- f, err := ioutil.TempFile("", "prof")
+ f, err := os.CreateTemp("", "prof")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
diff --git a/src/runtime/testdata/testprogcgo/threadpprof.go b/src/runtime/testdata/testprogcgo/threadpprof.go
index 37a2a1ab65..feb774ba59 100644
--- a/src/runtime/testdata/testprogcgo/threadpprof.go
+++ b/src/runtime/testdata/testprogcgo/threadpprof.go
@@ -74,7 +74,6 @@ import "C"
import (
"fmt"
- "io/ioutil"
"os"
"runtime"
"runtime/pprof"
@@ -97,7 +96,7 @@ func CgoPprofThreadNoTraceback() {
}
func pprofThread() {
- f, err := ioutil.TempFile("", "prof")
+ f, err := os.CreateTemp("", "prof")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
diff --git a/src/runtime/time.go b/src/runtime/time.go
index 75b66f8492..d338705b7c 100644
--- a/src/runtime/time.go
+++ b/src/runtime/time.go
@@ -23,6 +23,8 @@ type timer struct {
// Timer wakes up at when, and then at when+period, ... (period > 0 only)
// each time calling f(arg, now) in the timer goroutine, so f must be
// a well-behaved function and not block.
+ //
+ // when must be positive on an active timer.
when int64
period int64
f func(interface{}, uintptr)
@@ -185,6 +187,9 @@ func timeSleep(ns int64) {
t.f = goroutineReady
t.arg = gp
t.nextwhen = nanotime() + ns
+ if t.nextwhen < 0 { // check for overflow.
+ t.nextwhen = maxWhen
+ }
gopark(resetForSleep, unsafe.Pointer(t), waitReasonSleep, traceEvGoSleep, 1)
}
@@ -242,10 +247,14 @@ func goroutineReady(arg interface{}, seq uintptr) {
// That avoids the risk of changing the when field of a timer in some P's heap,
// which could cause the heap to become unsorted.
func addtimer(t *timer) {
- // when must never be negative; otherwise runtimer will overflow
- // during its delta calculation and never expire other runtime timers.
- if t.when < 0 {
- t.when = maxWhen
+ // when must be positive. A negative value will cause runtimer to
+ // overflow during its delta calculation and never expire other runtime
+ // timers. Zero will cause checkTimers to fail to notice the timer.
+ if t.when <= 0 {
+ throw("timer when must be positive")
+ }
+ if t.period < 0 {
+ throw("timer period must be non-negative")
}
if t.status != timerNoStatus {
throw("addtimer called with initialized timer")
@@ -406,8 +415,11 @@ func dodeltimer0(pp *p) {
// This is called by the netpoll code or time.Ticker.Reset or time.Timer.Reset.
// Reports whether the timer was modified before it was run.
func modtimer(t *timer, when, period int64, f func(interface{}, uintptr), arg interface{}, seq uintptr) bool {
- if when < 0 {
- when = maxWhen
+ if when <= 0 {
+ throw("timer when must be positive")
+ }
+ if period < 0 {
+ throw("timer period must be non-negative")
}
status := uint32(timerNoStatus)
@@ -846,6 +858,9 @@ func runOneTimer(pp *p, t *timer, now int64) {
// Leave in heap but adjust next time to fire.
delta := t.when - now
t.when += t.period * (1 + -delta/t.period)
+ if t.when < 0 { // check for overflow.
+ t.when = maxWhen
+ }
siftdownTimer(pp.timers, 0)
if !atomic.Cas(&t.status, timerRunning, timerWaiting) {
badTimer()
@@ -1064,6 +1079,9 @@ func siftupTimer(t []*timer, i int) {
badTimer()
}
when := t[i].when
+ if when <= 0 {
+ badTimer()
+ }
tmp := t[i]
for i > 0 {
p := (i - 1) / 4 // parent
@@ -1084,6 +1102,9 @@ func siftdownTimer(t []*timer, i int) {
badTimer()
}
when := t[i].when
+ if when <= 0 {
+ badTimer()
+ }
tmp := t[i]
for {
c := i*4 + 1 // left child
diff --git a/src/runtime/trace/trace_test.go b/src/runtime/trace/trace_test.go
index 235845df4e..b316eafe4c 100644
--- a/src/runtime/trace/trace_test.go
+++ b/src/runtime/trace/trace_test.go
@@ -10,7 +10,6 @@ import (
"internal/race"
"internal/trace"
"io"
- "io/ioutil"
"net"
"os"
"runtime"
@@ -586,7 +585,7 @@ func saveTrace(t *testing.T, buf *bytes.Buffer, name string) {
if !*saveTraces {
return
}
- if err := ioutil.WriteFile(name+".trace", buf.Bytes(), 0600); err != nil {
+ if err := os.WriteFile(name+".trace", buf.Bytes(), 0600); err != nil {
t.Errorf("failed to write trace file: %s", err)
}
}
diff --git a/src/runtime/wincallback.go b/src/runtime/wincallback.go
index c022916422..fb452222da 100644
--- a/src/runtime/wincallback.go
+++ b/src/runtime/wincallback.go
@@ -11,7 +11,6 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"os"
)
@@ -38,7 +37,7 @@ TEXT runtime·callbackasm(SB),7,$0
}
filename := fmt.Sprintf("zcallback_windows.s")
- err := ioutil.WriteFile(filename, buf.Bytes(), 0666)
+ err := os.WriteFile(filename, buf.Bytes(), 0666)
if err != nil {
fmt.Fprintf(os.Stderr, "wincallback: %s\n", err)
os.Exit(2)
@@ -66,7 +65,7 @@ TEXT runtime·callbackasm(SB),NOSPLIT|NOFRAME,$0
buf.WriteString("\tB\truntime·callbackasm1(SB)\n")
}
- err := ioutil.WriteFile("zcallback_windows_arm.s", buf.Bytes(), 0666)
+ err := os.WriteFile("zcallback_windows_arm.s", buf.Bytes(), 0666)
if err != nil {
fmt.Fprintf(os.Stderr, "wincallback: %s\n", err)
os.Exit(2)
@@ -82,7 +81,7 @@ package runtime
const cb_max = %d // maximum number of windows callbacks allowed
`, maxCallback))
- err := ioutil.WriteFile("zcallback_windows.go", buf.Bytes(), 0666)
+ err := os.WriteFile("zcallback_windows.go", buf.Bytes(), 0666)
if err != nil {
fmt.Fprintf(os.Stderr, "wincallback: %s\n", err)
os.Exit(2)
diff --git a/src/sort/genzfunc.go b/src/sort/genzfunc.go
index 66408d26c6..e7eb573737 100644
--- a/src/sort/genzfunc.go
+++ b/src/sort/genzfunc.go
@@ -20,8 +20,8 @@ import (
"go/format"
"go/parser"
"go/token"
- "io/ioutil"
"log"
+ "os"
"regexp"
)
@@ -92,7 +92,7 @@ func main() {
out.Write(src)
const target = "zfuncversion.go"
- if err := ioutil.WriteFile(target, out.Bytes(), 0644); err != nil {
+ if err := os.WriteFile(target, out.Bytes(), 0644); err != nil {
log.Fatal(err)
}
}
diff --git a/src/strconv/makeisprint.go b/src/strconv/makeisprint.go
index 1a3248f308..0e6e90a6c6 100644
--- a/src/strconv/makeisprint.go
+++ b/src/strconv/makeisprint.go
@@ -17,8 +17,8 @@ import (
"flag"
"fmt"
"go/format"
- "io/ioutil"
"log"
+ "os"
"unicode"
)
@@ -196,7 +196,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
- err = ioutil.WriteFile(*filename, data, 0644)
+ err = os.WriteFile(*filename, data, 0644)
if err != nil {
log.Fatal(err)
}
diff --git a/src/syscall/dirent_test.go b/src/syscall/dirent_test.go
index f63153340a..7dac98ff4b 100644
--- a/src/syscall/dirent_test.go
+++ b/src/syscall/dirent_test.go
@@ -9,7 +9,6 @@ package syscall_test
import (
"bytes"
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -27,7 +26,7 @@ func TestDirent(t *testing.T) {
filenameMinSize = 11
)
- d, err := ioutil.TempDir("", "dirent-test")
+ d, err := os.MkdirTemp("", "dirent-test")
if err != nil {
t.Fatalf("tempdir: %v", err)
}
@@ -36,7 +35,7 @@ func TestDirent(t *testing.T) {
for i, c := range []byte("0123456789") {
name := string(bytes.Repeat([]byte{c}, filenameMinSize+i))
- err = ioutil.WriteFile(filepath.Join(d, name), nil, 0644)
+ err = os.WriteFile(filepath.Join(d, name), nil, 0644)
if err != nil {
t.Fatalf("writefile: %v", err)
}
@@ -93,7 +92,7 @@ func TestDirentRepeat(t *testing.T) {
}
// Make a directory containing N files
- d, err := ioutil.TempDir("", "direntRepeat-test")
+ d, err := os.MkdirTemp("", "direntRepeat-test")
if err != nil {
t.Fatalf("tempdir: %v", err)
}
@@ -104,7 +103,7 @@ func TestDirentRepeat(t *testing.T) {
files = append(files, fmt.Sprintf("file%d", i))
}
for _, file := range files {
- err = ioutil.WriteFile(filepath.Join(d, file), []byte("contents"), 0644)
+ err = os.WriteFile(filepath.Join(d, file), []byte("contents"), 0644)
if err != nil {
t.Fatalf("writefile: %v", err)
}
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go
index b79dee7525..ac3a5754ae 100644
--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -11,7 +11,6 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
"os"
"os/exec"
"os/user"
@@ -65,7 +64,7 @@ func skipNoUserNamespaces(t *testing.T) {
func skipUnprivilegedUserClone(t *testing.T) {
// Skip the test if the sysctl that prevents unprivileged user
// from creating user namespaces is enabled.
- data, errRead := ioutil.ReadFile("/proc/sys/kernel/unprivileged_userns_clone")
+ data, errRead := os.ReadFile("/proc/sys/kernel/unprivileged_userns_clone")
if errRead != nil || len(data) < 1 || data[0] == '0' {
t.Skip("kernel prohibits user namespace in unprivileged process")
}
@@ -98,7 +97,7 @@ func checkUserNS(t *testing.T) {
// On Centos 7 make sure they set the kernel parameter user_namespace=1
// See issue 16283 and 20796.
if _, err := os.Stat("/sys/module/user_namespace/parameters/enable"); err == nil {
- buf, _ := ioutil.ReadFile("/sys/module/user_namespace/parameters/enabled")
+ buf, _ := os.ReadFile("/sys/module/user_namespace/parameters/enabled")
if !strings.HasPrefix(string(buf), "Y") {
t.Skip("kernel doesn't support user namespaces")
}
@@ -106,7 +105,7 @@ func checkUserNS(t *testing.T) {
// On Centos 7.5+, user namespaces are disabled if user.max_user_namespaces = 0
if _, err := os.Stat("/proc/sys/user/max_user_namespaces"); err == nil {
- buf, errRead := ioutil.ReadFile("/proc/sys/user/max_user_namespaces")
+ buf, errRead := os.ReadFile("/proc/sys/user/max_user_namespaces")
if errRead == nil && buf[0] == '0' {
t.Skip("kernel doesn't support user namespaces")
}
@@ -226,7 +225,7 @@ func TestUnshare(t *testing.T) {
t.Fatal(err)
}
- orig, err := ioutil.ReadFile(path)
+ orig, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
@@ -349,7 +348,7 @@ func TestUnshareMountNameSpace(t *testing.T) {
t.Skip("kernel prohibits unshare in unprivileged process, unless using user namespace")
}
- d, err := ioutil.TempDir("", "unshare")
+ d, err := os.MkdirTemp("", "unshare")
if err != nil {
t.Fatalf("tempdir: %v", err)
}
@@ -391,7 +390,7 @@ func TestUnshareMountNameSpaceChroot(t *testing.T) {
t.Skip("kernel prohibits unshare in unprivileged process, unless using user namespace")
}
- d, err := ioutil.TempDir("", "unshare")
+ d, err := os.MkdirTemp("", "unshare")
if err != nil {
t.Fatalf("tempdir: %v", err)
}
@@ -599,7 +598,7 @@ func testAmbientCaps(t *testing.T, userns bool) {
}
// Copy the test binary to a temporary location which is readable by nobody.
- f, err := ioutil.TempFile("", "gotest")
+ f, err := os.CreateTemp("", "gotest")
if err != nil {
t.Fatal(err)
}
diff --git a/src/syscall/getdirentries_test.go b/src/syscall/getdirentries_test.go
index 2a3419c230..66bb8acba2 100644
--- a/src/syscall/getdirentries_test.go
+++ b/src/syscall/getdirentries_test.go
@@ -8,7 +8,6 @@ package syscall_test
import (
"fmt"
- "io/ioutil"
"os"
"path/filepath"
"sort"
@@ -29,7 +28,7 @@ func testGetdirentries(t *testing.T, count int) {
if count > 100 && testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" {
t.Skip("skipping in -short mode")
}
- d, err := ioutil.TempDir("", "getdirentries-test")
+ d, err := os.MkdirTemp("", "getdirentries-test")
if err != nil {
t.Fatalf("Tempdir: %v", err)
}
@@ -41,7 +40,7 @@ func testGetdirentries(t *testing.T, count int) {
// Make files in the temp directory
for _, name := range names {
- err := ioutil.WriteFile(filepath.Join(d, name), []byte("data"), 0)
+ err := os.WriteFile(filepath.Join(d, name), []byte("data"), 0)
if err != nil {
t.Fatalf("WriteFile: %v", err)
}
diff --git a/src/syscall/mkasm_darwin.go b/src/syscall/mkasm_darwin.go
index f6f75f99f6..1783387a53 100644
--- a/src/syscall/mkasm_darwin.go
+++ b/src/syscall/mkasm_darwin.go
@@ -11,23 +11,22 @@ package main
import (
"bytes"
"fmt"
- "io/ioutil"
"log"
"os"
"strings"
)
func main() {
- in1, err := ioutil.ReadFile("syscall_darwin.go")
+ in1, err := os.ReadFile("syscall_darwin.go")
if err != nil {
log.Fatalf("can't open syscall_darwin.go: %s", err)
}
arch := os.Args[1]
- in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch))
+ in2, err := os.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch))
if err != nil {
log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err)
}
- in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch))
+ in3, err := os.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch))
if err != nil {
log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err)
}
@@ -51,7 +50,7 @@ func main() {
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
}
}
- err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
+ err = os.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
if err != nil {
log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err)
}
diff --git a/src/syscall/syscall_linux_test.go b/src/syscall/syscall_linux_test.go
index 92764323ee..153d0efef1 100644
--- a/src/syscall/syscall_linux_test.go
+++ b/src/syscall/syscall_linux_test.go
@@ -9,7 +9,6 @@ import (
"fmt"
"io"
"io/fs"
- "io/ioutil"
"os"
"os/exec"
"os/signal"
@@ -30,7 +29,7 @@ func chtmpdir(t *testing.T) func() {
if err != nil {
t.Fatalf("chtmpdir: %v", err)
}
- d, err := ioutil.TempDir("", "test")
+ d, err := os.MkdirTemp("", "test")
if err != nil {
t.Fatalf("chtmpdir: %v", err)
}
@@ -160,7 +159,7 @@ func TestLinuxDeathSignal(t *testing.T) {
// Copy the test binary to a location that a non-root user can read/execute
// after we drop privileges
- tempDir, err := ioutil.TempDir("", "TestDeathSignal")
+ tempDir, err := os.MkdirTemp("", "TestDeathSignal")
if err != nil {
t.Fatalf("cannot create temporary directory: %v", err)
}
@@ -321,7 +320,7 @@ func TestSyscallNoError(t *testing.T) {
// Copy the test binary to a location that a non-root user can read/execute
// after we drop privileges
- tempDir, err := ioutil.TempDir("", "TestSyscallNoError")
+ tempDir, err := os.MkdirTemp("", "TestSyscallNoError")
if err != nil {
t.Fatalf("cannot create temporary directory: %v", err)
}
@@ -543,7 +542,7 @@ func TestAllThreadsSyscall(t *testing.T) {
func compareStatus(filter, expect string) error {
expected := filter + expect
pid := syscall.Getpid()
- fs, err := ioutil.ReadDir(fmt.Sprintf("/proc/%d/task", pid))
+ fs, err := os.ReadDir(fmt.Sprintf("/proc/%d/task", pid))
if err != nil {
return fmt.Errorf("unable to find %d tasks: %v", pid, err)
}
@@ -551,7 +550,7 @@ func compareStatus(filter, expect string) error {
foundAThread := false
for _, f := range fs {
tf := fmt.Sprintf("/proc/%s/status", f.Name())
- d, err := ioutil.ReadFile(tf)
+ d, err := os.ReadFile(tf)
if err != nil {
// There are a surprising number of ways this
// can error out on linux. We've seen all of
diff --git a/src/syscall/syscall_unix_test.go b/src/syscall/syscall_unix_test.go
index 1c34ed2c27..7e6a8c9043 100644
--- a/src/syscall/syscall_unix_test.go
+++ b/src/syscall/syscall_unix_test.go
@@ -11,7 +11,6 @@ import (
"fmt"
"internal/testenv"
"io"
- "io/ioutil"
"net"
"os"
"os/exec"
@@ -79,7 +78,7 @@ func TestFcntlFlock(t *testing.T) {
}
if os.Getenv("GO_WANT_HELPER_PROCESS") == "" {
// parent
- tempDir, err := ioutil.TempDir("", "TestFcntlFlock")
+ tempDir, err := os.MkdirTemp("", "TestFcntlFlock")
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
@@ -157,7 +156,7 @@ func TestPassFD(t *testing.T) {
}
- tempDir, err := ioutil.TempDir("", "TestPassFD")
+ tempDir, err := os.MkdirTemp("", "TestPassFD")
if err != nil {
t.Fatal(err)
}
@@ -257,7 +256,7 @@ func passFDChild() {
// We make it in tempDir, which our parent will clean up.
flag.Parse()
tempDir := flag.Arg(0)
- f, err := ioutil.TempFile(tempDir, "")
+ f, err := os.CreateTemp(tempDir, "")
if err != nil {
fmt.Printf("TempFile: %v", err)
return
diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index 0eea2b87a9..c1a12ccba3 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -260,7 +260,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile
//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW
//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW
-//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) [failretval==InvalidHandle] = crypt32.CertOpenStore
+//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) = crypt32.CertOpenStore
//sys CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) [failretval==nil] = crypt32.CertEnumCertificatesInStore
//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore
//sys CertCloseStore(store Handle, flags uint32) (err error) = crypt32.CertCloseStore
diff --git a/src/syscall/syscall_windows_test.go b/src/syscall/syscall_windows_test.go
index d146911073..a9ae54752b 100644
--- a/src/syscall/syscall_windows_test.go
+++ b/src/syscall/syscall_windows_test.go
@@ -5,7 +5,6 @@
package syscall_test
import (
- "io/ioutil"
"os"
"path/filepath"
"syscall"
@@ -13,7 +12,7 @@ import (
)
func TestWin32finddata(t *testing.T) {
- dir, err := ioutil.TempDir("", "go-build")
+ dir, err := os.MkdirTemp("", "go-build")
if err != nil {
t.Fatalf("failed to create temp directory: %v", err)
}
diff --git a/src/syscall/zsyscall_windows.go b/src/syscall/zsyscall_windows.go
index 5d03ca9de9..86c4cac2ad 100644
--- a/src/syscall/zsyscall_windows.go
+++ b/src/syscall/zsyscall_windows.go
@@ -399,7 +399,7 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a
func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
r0, _, e1 := Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
handle = Handle(r0)
- if handle == InvalidHandle {
+ if handle == 0 {
err = errnoErr(e1)
}
return
diff --git a/src/testing/fstest/mapfs.go b/src/testing/fstest/mapfs.go
index 10e56f5b3c..a5d4a23fac 100644
--- a/src/testing/fstest/mapfs.go
+++ b/src/testing/fstest/mapfs.go
@@ -132,6 +132,16 @@ func (fsys MapFS) Glob(pattern string) ([]string, error) {
return fs.Glob(fsOnly{fsys}, pattern)
}
+type noSub struct {
+ MapFS
+}
+
+func (noSub) Sub() {} // not the fs.SubFS signature
+
+func (fsys MapFS) Sub(dir string) (fs.FS, error) {
+ return fs.Sub(noSub{fsys}, dir)
+}
+
// A mapFileInfo implements fs.FileInfo and fs.DirEntry for a given map file.
type mapFileInfo struct {
name string
diff --git a/src/testing/fstest/testfs.go b/src/testing/fstest/testfs.go
index 4912a271b2..2602bdf0cc 100644
--- a/src/testing/fstest/testfs.go
+++ b/src/testing/fstest/testfs.go
@@ -22,6 +22,8 @@ import (
// It walks the entire tree of files in fsys,
// opening and checking that each file behaves correctly.
// It also checks that the file system contains at least the expected files.
+// As a special case, if no expected files are listed, fsys must be empty.
+// Otherwise, fsys must only contain at least the listed files: it can also contain others.
//
// If TestFS finds any misbehaviors, it returns an error reporting all of them.
// The error text spans multiple lines, one per detected misbehavior.
@@ -33,6 +35,32 @@ import (
// }
//
func TestFS(fsys fs.FS, expected ...string) error {
+ if err := testFS(fsys, expected...); err != nil {
+ return err
+ }
+ for _, name := range expected {
+ if i := strings.Index(name, "/"); i >= 0 {
+ dir, dirSlash := name[:i], name[:i+1]
+ var subExpected []string
+ for _, name := range expected {
+ if strings.HasPrefix(name, dirSlash) {
+ subExpected = append(subExpected, name[len(dirSlash):])
+ }
+ }
+ sub, err := fs.Sub(fsys, dir)
+ if err != nil {
+ return err
+ }
+ if err := testFS(sub, subExpected...); err != nil {
+ return fmt.Errorf("testing fs.Sub(fsys, %s): %v", dir, err)
+ }
+ break // one sub-test is enough
+ }
+ }
+ return nil
+}
+
+func testFS(fsys fs.FS, expected ...string) error {
t := fsTester{fsys: fsys}
t.checkDir(".")
t.checkOpen(".")
@@ -43,6 +71,20 @@ func TestFS(fsys fs.FS, expected ...string) error {
for _, file := range t.files {
found[file] = true
}
+ delete(found, ".")
+ if len(expected) == 0 && len(found) > 0 {
+ var list []string
+ for k := range found {
+ if k != "." {
+ list = append(list, k)
+ }
+ }
+ sort.Strings(list)
+ if len(list) > 15 {
+ list = append(list[:10], "...")
+ }
+ t.errorf("expected empty file system but found files:\n%s", strings.Join(list, "\n"))
+ }
for _, name := range expected {
if !found[name] {
t.errorf("expected but not found: %s", name)
diff --git a/src/testing/testing.go b/src/testing/testing.go
index d4b108a183..80354d5ce8 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -242,7 +242,6 @@ import (
"fmt"
"internal/race"
"io"
- "io/ioutil"
"os"
"runtime"
"runtime/debug"
@@ -936,14 +935,14 @@ func (c *common) TempDir() string {
if nonExistent {
c.Helper()
- // ioutil.TempDir doesn't like path separators in its pattern,
+ // os.MkdirTemp doesn't like path separators in its pattern,
// so mangle the name to accommodate subtests.
tempDirReplacer.Do(func() {
tempDirReplacer.r = strings.NewReplacer("/", "_", "\\", "_", ":", "_")
})
pattern := tempDirReplacer.r.Replace(c.Name())
- c.tempDir, c.tempDirErr = ioutil.TempDir("", pattern)
+ c.tempDir, c.tempDirErr = os.MkdirTemp("", pattern)
if c.tempDirErr == nil {
c.Cleanup(func() {
if err := os.RemoveAll(c.tempDir); err != nil {
diff --git a/src/testing/testing_test.go b/src/testing/testing_test.go
index d665a334e4..0f096980ca 100644
--- a/src/testing/testing_test.go
+++ b/src/testing/testing_test.go
@@ -5,7 +5,6 @@
package testing_test
import (
- "io/ioutil"
"os"
"path/filepath"
"testing"
@@ -102,11 +101,11 @@ func testTempDir(t *testing.T) {
if !fi.IsDir() {
t.Errorf("dir %q is not a dir", dir)
}
- fis, err := ioutil.ReadDir(dir)
+ files, err := os.ReadDir(dir)
if err != nil {
t.Fatal(err)
}
- if len(fis) > 0 {
- t.Errorf("unexpected %d files in TempDir: %v", len(fis), fis)
+ if len(files) > 0 {
+ t.Errorf("unexpected %d files in TempDir: %v", len(files), files)
}
}
diff --git a/src/text/template/examplefiles_test.go b/src/text/template/examplefiles_test.go
index a15c7a62a3..6534ee3315 100644
--- a/src/text/template/examplefiles_test.go
+++ b/src/text/template/examplefiles_test.go
@@ -6,7 +6,6 @@ package template_test
import (
"io"
- "io/ioutil"
"log"
"os"
"path/filepath"
@@ -20,7 +19,7 @@ type templateFile struct {
}
func createTestDir(files []templateFile) string {
- dir, err := ioutil.TempDir("", "template")
+ dir, err := os.MkdirTemp("", "template")
if err != nil {
log.Fatal(err)
}
diff --git a/src/text/template/helper.go b/src/text/template/helper.go
index 8269fa28c5..57905e613a 100644
--- a/src/text/template/helper.go
+++ b/src/text/template/helper.go
@@ -9,7 +9,7 @@ package template
import (
"fmt"
"io/fs"
- "io/ioutil"
+ "os"
"path"
"path/filepath"
)
@@ -164,7 +164,7 @@ func parseFS(t *Template, fsys fs.FS, patterns []string) (*Template, error) {
func readFileOS(file string) (name string, b []byte, err error) {
name = filepath.Base(file)
- b, err = ioutil.ReadFile(file)
+ b, err = os.ReadFile(file)
return
}
diff --git a/src/text/template/link_test.go b/src/text/template/link_test.go
index 4eac7e6755..9dc70dfc0d 100644
--- a/src/text/template/link_test.go
+++ b/src/text/template/link_test.go
@@ -7,7 +7,6 @@ package template_test
import (
"bytes"
"internal/testenv"
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -40,13 +39,13 @@ func main() {
t.Used()
}
`
- td, err := ioutil.TempDir("", "text_template_TestDeadCodeElimination")
+ td, err := os.MkdirTemp("", "text_template_TestDeadCodeElimination")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(td)
- if err := ioutil.WriteFile(filepath.Join(td, "x.go"), []byte(prog), 0644); err != nil {
+ if err := os.WriteFile(filepath.Join(td, "x.go"), []byte(prog), 0644); err != nil {
t.Fatal(err)
}
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "x.exe", "x.go")
@@ -54,7 +53,7 @@ func main() {
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("go build: %v, %s", err, out)
}
- slurp, err := ioutil.ReadFile(filepath.Join(td, "x.exe"))
+ slurp, err := os.ReadFile(filepath.Join(td, "x.exe"))
if err != nil {
t.Fatal(err)
}
diff --git a/src/time/genzabbrs.go b/src/time/genzabbrs.go
index 1d59ba73ce..9825e705d2 100644
--- a/src/time/genzabbrs.go
+++ b/src/time/genzabbrs.go
@@ -18,9 +18,9 @@ import (
"flag"
"go/format"
"io"
- "io/ioutil"
"log"
"net/http"
+ "os"
"sort"
"text/template"
"time"
@@ -128,7 +128,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
- err = ioutil.WriteFile(*filename, data, 0644)
+ err = os.WriteFile(*filename, data, 0644)
if err != nil {
log.Fatal(err)
}
diff --git a/src/time/internal_test.go b/src/time/internal_test.go
index 35ce69b228..ffe54e47c2 100644
--- a/src/time/internal_test.go
+++ b/src/time/internal_test.go
@@ -33,48 +33,30 @@ var DaysIn = daysIn
func empty(arg interface{}, seq uintptr) {}
-// Test that a runtimeTimer with a duration so large it overflows
-// does not cause other timers to hang.
+// Test that a runtimeTimer with a period that would overflow when on
+// expiration does not throw or cause other timers to hang.
//
// This test has to be in internal_test.go since it fiddles with
// unexported data structures.
-func CheckRuntimeTimerOverflow() {
- // We manually create a runtimeTimer to bypass the overflow
- // detection logic in NewTimer: we're testing the underlying
- // runtime.addtimer function.
+func CheckRuntimeTimerPeriodOverflow() {
+ // We manually create a runtimeTimer with huge period, but that expires
+ // immediately. The public Timer interface would require waiting for
+ // the entire period before the first update.
r := &runtimeTimer{
- when: runtimeNano() + (1<<63 - 1),
- f: empty,
- arg: nil,
+ when: runtimeNano(),
+ period: 1<<63 - 1,
+ f: empty,
+ arg: nil,
}
startTimer(r)
+ defer stopTimer(r)
- // Start a goroutine that should send on t.C right away.
- t := NewTimer(1)
-
- defer func() {
- // Subsequent tests won't work correctly if we don't stop the
- // overflow timer and kick the timer proc back into service.
- //
- // The timer proc is now sleeping and can only be awoken by
- // adding a timer to the *beginning* of the heap. We can't
- // wake it up by calling NewTimer since other tests may have
- // left timers running that should have expired before ours.
- // Instead we zero the overflow timer duration and start it
- // once more.
- stopTimer(r)
- t.Stop()
- resetTimer(r, 0)
- }()
-
- // If the test fails, we will hang here until the timeout in the
- // testing package fires, which is 10 minutes. It would be nice to
- // catch the problem sooner, but there is no reliable way to guarantee
- // that timers are run without doing something involving the scheduler.
- // Previous failed attempts have tried calling runtime.Gosched and
- // runtime.GC, but neither is reliable. So we fall back to hope:
- // We hope we don't hang here.
- <-t.C
+ // If this test fails, we will either throw (when siftdownTimer detects
+ // bad when on update), or other timers will hang (if the timer in a
+ // heap is in a bad state). There is no reliable way to test this, but
+ // we wait on a short timer here as a smoke test (alternatively, timers
+ // in later tests may hang).
+ <-After(25 * Millisecond)
}
var (
diff --git a/src/time/sleep.go b/src/time/sleep.go
index 22ffd68282..90d8a18a68 100644
--- a/src/time/sleep.go
+++ b/src/time/sleep.go
@@ -31,6 +31,8 @@ func when(d Duration) int64 {
}
t := runtimeNano() + int64(d)
if t < 0 {
+ // N.B. runtimeNano() and d are always positive, so addition
+ // (including overflow) will never result in t == 0.
t = 1<<63 - 1 // math.MaxInt64
}
return t
diff --git a/src/time/sleep_test.go b/src/time/sleep_test.go
index ba0016bf49..084ac33f51 100644
--- a/src/time/sleep_test.go
+++ b/src/time/sleep_test.go
@@ -434,17 +434,29 @@ func TestReset(t *testing.T) {
t.Error(err)
}
-// Test that sleeping for an interval so large it overflows does not
-// result in a short sleep duration.
+// Test that sleeping (via Sleep or Timer) for an interval so large it
+// overflows does not result in a short sleep duration. Nor does it interfere
+// with execution of other timers. If it does, timers in this or subsequent
+// tests may not fire.
func TestOverflowSleep(t *testing.T) {
const big = Duration(int64(1<<63 - 1))
+
+ go func() {
+ Sleep(big)
+ // On failure, this may return after the test has completed, so
+ // we need to panic instead.
+ panic("big sleep returned")
+ }()
+
select {
case <-After(big):
t.Fatalf("big timeout fired")
case <-After(25 * Millisecond):
// OK
}
+
const neg = Duration(-1 << 63)
+ Sleep(neg) // Returns immediately.
select {
case <-After(neg):
// OK
@@ -473,13 +485,10 @@ func TestIssue5745(t *testing.T) {
t.Error("Should be unreachable.")
}
-func TestOverflowRuntimeTimer(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping in short mode, see issue 6874")
- }
+func TestOverflowPeriodRuntimeTimer(t *testing.T) {
// This may hang forever if timers are broken. See comment near
// the end of CheckRuntimeTimerOverflow in internal_test.go.
- CheckRuntimeTimerOverflow()
+ CheckRuntimeTimerPeriodOverflow()
}
func checkZeroPanicString(t *testing.T) {
diff --git a/src/time/tzdata/generate_zipdata.go b/src/time/tzdata/generate_zipdata.go
index d8b47e7878..21357fbf1c 100644
--- a/src/time/tzdata/generate_zipdata.go
+++ b/src/time/tzdata/generate_zipdata.go
@@ -10,7 +10,6 @@ package main
import (
"bufio"
"fmt"
- "io/ioutil"
"os"
"strconv"
)
@@ -40,7 +39,7 @@ const zipdata = `
func main() {
// We should be run in the $GOROOT/src/time/tzdata directory.
- data, err := ioutil.ReadFile("../../../lib/time/zoneinfo.zip")
+ data, err := os.ReadFile("../../../lib/time/zoneinfo.zip")
if err != nil {
die("cannot find zoneinfo.zip file: %v", err)
}
diff --git a/src/time/zoneinfo_read.go b/src/time/zoneinfo_read.go
index 22a60f3211..c739864815 100644
--- a/src/time/zoneinfo_read.go
+++ b/src/time/zoneinfo_read.go
@@ -546,7 +546,7 @@ func loadLocation(name string, sources []string) (z *Location, firstErr error) {
}
// readFile reads and returns the content of the named file.
-// It is a trivial implementation of ioutil.ReadFile, reimplemented
+// It is a trivial implementation of os.ReadFile, reimplemented
// here to avoid depending on io/ioutil or os.
// It returns an error if name exceeds maxFileSize bytes.
func readFile(name string) ([]byte, error) {
diff --git a/src/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/src/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
index 06f84b8555..6b4027b33f 100644
--- a/src/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
+++ b/src/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/src/vendor/golang.org/x/sys/cpu/cpu_arm64.s
index a54436e390..cfc08c9794 100644
--- a/src/vendor/golang.org/x/sys/cpu/cpu_arm64.s
+++ b/src/vendor/golang.org/x/sys/cpu/cpu_arm64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/src/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
index 7b88e865a4..7f7f272a01 100644
--- a/src/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
+++ b/src/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
package cpu
diff --git a/src/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/src/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
index 568bcd031a..75a9556616 100644
--- a/src/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
+++ b/src/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
package cpu
diff --git a/src/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/src/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
index f7cb46971c..4adb89cf9c 100644
--- a/src/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
+++ b/src/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build 386 amd64 amd64p32
-// +build !gccgo
+// +build gc
package cpu
diff --git a/src/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/src/vendor/golang.org/x/sys/cpu/cpu_s390x.s
index e5037d92e0..964946df95 100644
--- a/src/vendor/golang.org/x/sys/cpu/cpu_s390x.s
+++ b/src/vendor/golang.org/x/sys/cpu/cpu_s390x.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/vendor/golang.org/x/sys/cpu/cpu_x86.s b/src/vendor/golang.org/x/sys/cpu/cpu_x86.s
index 47f084128c..2f557a5887 100644
--- a/src/vendor/golang.org/x/sys/cpu/cpu_x86.s
+++ b/src/vendor/golang.org/x/sys/cpu/cpu_x86.s
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build 386 amd64 amd64p32
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
index 78fe25e86f..5b427d67e2 100644
--- a/src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
+++ b/src/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
@@ -7,7 +7,7 @@
// (See golang.org/issue/32102)
// +build aix,ppc64
-// +build !gccgo
+// +build gc
package cpu
diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
index 24a3751400..de727ef71f 100644
--- a/src/vendor/modules.txt
+++ b/src/vendor/modules.txt
@@ -18,7 +18,7 @@ golang.org/x/net/idna
golang.org/x/net/lif
golang.org/x/net/nettest
golang.org/x/net/route
-# golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65
+# golang.org/x/sys v0.0.0-20201204225414-ed752295db88
## explicit
golang.org/x/sys/cpu
# golang.org/x/text v0.3.4
diff --git a/test/assign.go b/test/assign.go
index 6611f8ce3e..62fd3b5be3 100644
--- a/test/assign.go
+++ b/test/assign.go
@@ -56,13 +56,13 @@ func main() {
{
var x = 1
{
- x, x := 2, 3 // ERROR "x repeated on left side of :="
+ x, x := 2, 3 // ERROR ".*x.* repeated on left side of :="
_ = x
}
_ = x
}
{
- a, a := 1, 2 // ERROR "a repeated on left side of :="
+ a, a := 1, 2 // ERROR ".*a.* repeated on left side of :="
_ = a
}
}
diff --git a/test/fixedbugs/bug487.go b/test/fixedbugs/bug487.go
index ab61a19a94..e60af6c8e2 100644
--- a/test/fixedbugs/bug487.go
+++ b/test/fixedbugs/bug487.go
@@ -14,8 +14,8 @@ func G() (int, int, int) {
}
func F() {
- a, b := G() // ERROR "assignment mismatch"
- a, b = G() // ERROR "assignment mismatch"
+ a, b := G() // ERROR "mismatch"
+ a, b = G() // ERROR "mismatch"
_, _ = a, b
}
diff --git a/test/fixedbugs/bug510.dir/a.go b/test/fixedbugs/bug510.dir/a.go
new file mode 100644
index 0000000000..db1cfef366
--- /dev/null
+++ b/test/fixedbugs/bug510.dir/a.go
@@ -0,0 +1,13 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+import "reflect"
+
+type A = map[int] bool
+
+func F() interface{} {
+ return reflect.New(reflect.TypeOf((*A)(nil))).Elem().Interface()
+}
diff --git a/src/internal/cpu/cpu_freebsd.go b/test/fixedbugs/bug510.dir/b.go
index dc37173dac..56b0201858 100644
--- a/src/internal/cpu/cpu_freebsd.go
+++ b/test/fixedbugs/bug510.dir/b.go
@@ -2,6 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package cpu
+package main
-const GOOS = "freebsd"
+import "./a"
+
+func main() {
+ _, ok := a.F().(*map[int]bool)
+ if !ok {
+ panic("bad type")
+ }
+}
diff --git a/src/internal/cpu/cpu_android.go b/test/fixedbugs/bug510.go
index d995e8d5a7..8a6da5dfd6 100644
--- a/src/internal/cpu/cpu_android.go
+++ b/test/fixedbugs/bug510.go
@@ -1,7 +1,9 @@
+// rundir
+
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package cpu
+// Gccgo confused type descriptors for aliases.
-const GOOS = "android"
+package ignored
diff --git a/test/fixedbugs/issue42944.go b/test/fixedbugs/issue42944.go
new file mode 100644
index 0000000000..bb947bc609
--- /dev/null
+++ b/test/fixedbugs/issue42944.go
@@ -0,0 +1,24 @@
+// errorcheck -0 -live
+
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 42944: address of callee args area should only be short-lived
+// and never across a call.
+
+package p
+
+type T [10]int // trigger DUFFCOPY when passing by value, so it uses the address
+
+func F() {
+ var x T
+ var i int
+ for {
+ x = G(i) // no autotmp live at this and next calls
+ H(i, x)
+ }
+}
+
+func G(int) T
+func H(int, T)
diff --git a/test/fixedbugs/issue43099.go b/test/fixedbugs/issue43099.go
new file mode 100644
index 0000000000..16f18e5f96
--- /dev/null
+++ b/test/fixedbugs/issue43099.go
@@ -0,0 +1,34 @@
+// compile
+
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Check to make sure we don't try to constant fold a divide by zero.
+// This is a tricky test, as we need a value that's not recognized as 0
+// until lowering (otherwise it gets handled in a different path).
+
+package p
+
+func f() {
+ var i int
+ var s string
+ for i > 0 {
+ _ = s[0]
+ i++
+ }
+
+ var c chan int
+ c <- 1 % i
+}
+
+func f32() uint32 {
+ s := "\x00\x00\x00\x00"
+ c := uint32(s[0]) | uint32(s[1])<<8 | uint32(s[2])<<16 | uint32(s[3])<<24
+ return 1 / c
+}
+func f64() uint64 {
+ s := "\x00\x00\x00\x00\x00\x00\x00\x00"
+ c := uint64(s[0]) | uint64(s[1])<<8 | uint64(s[2])<<16 | uint64(s[3])<<24 | uint64(s[4])<<32 | uint64(s[5])<<40 | uint64(s[6])<<48 | uint64(s[7])<<56
+ return 1 / c
+}
diff --git a/test/fixedbugs/issue6977.go b/test/fixedbugs/issue6977.go
index 0f657eec41..4525e406b8 100644
--- a/test/fixedbugs/issue6977.go
+++ b/test/fixedbugs/issue6977.go
@@ -34,7 +34,7 @@ type U3 interface { M; m() }
type U4 interface { M; M; M }
type U5 interface { U1; U2; U3; U4 }
-type U6 interface { m(); m() } // ERROR "duplicate method m"
-type U7 interface { M32; m() } // ERROR "duplicate method m"
-type U8 interface { m(); M32 } // ERROR "duplicate method m"
-type U9 interface { M32; M64 } // ERROR "duplicate method m"
+type U6 interface { m(); m() } // ERROR "duplicate method .*m"
+type U7 interface { M32; m() } // ERROR "duplicate method .*m"
+type U8 interface { m(); M32 } // ERROR "duplicate method .*m"
+type U9 interface { M32; M64 } // ERROR "duplicate method .*m"
diff --git a/test/method2.go b/test/method2.go
index 7feb675055..ac1d771c05 100644
--- a/test/method2.go
+++ b/test/method2.go
@@ -33,8 +33,8 @@ var _ = (*Val).val // ERROR "method"
var v Val
var pv = &v
-var _ = pv.val() // ERROR "undefined"
-var _ = pv.val // ERROR "undefined"
+var _ = pv.val() // ERROR "undefined|pointer to interface"
+var _ = pv.val // ERROR "undefined|pointer to interface"
func (t *T) g() int { return t.a }