// Copyright 2011 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.//go:build unix || (js && wasm) || wasip1package timeimport ()// for testing: whatever interrupts a sleepfunc interrupt() {// There is no mechanism in wasi to interrupt the call to poll_oneoff // used to implement runtime.usleep so this function does nothing, which // somewhat defeats the purpose of TestSleep but we are still better off // validating that time elapses when the process calls time.Sleep than // skipping the test altogether.ifruntime.GOOS != "wasip1" {syscall.Kill(syscall.Getpid(), syscall.SIGCHLD) }}func open( string) (uintptr, error) { , := syscall.Open(, syscall.O_RDONLY, 0)if != nil {return0, }returnuintptr(), nil}func read( uintptr, []byte) (int, error) {returnsyscall.Read(int(), )}func closefd( uintptr) {syscall.Close(int())}func preadn( uintptr, []byte, int) error { := seekStartif < 0 { = seekEnd }if , := syscall.Seek(int(), int64(), ); != nil {return }forlen() > 0 { , := syscall.Read(int(), )if <= 0 {if == nil {returnerrors.New("short read") }return } = [:] }returnnil}
The pages are generated with Goldsv0.7.3-preview. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.