diff --git a/src/syscall/dir_plan9.go b/src/syscall/dir_plan9.go index 1667cbc02f4..464fe748f70 100644 --- a/src/syscall/dir_plan9.go +++ b/src/syscall/dir_plan9.go @@ -54,12 +54,12 @@ var nullDir = Dir{ } // Null assigns special "don't touch" values to members of d to -// avoid modifying them during syscall.Wstat. +// avoid modifying them during [Wstat]. func (d *Dir) Null() { *d = nullDir } // Marshal encodes a 9P stat message corresponding to d into b // -// If there isn't enough space in b for a stat message, ErrShortStat is returned. +// If there isn't enough space in b for a stat message, [ErrShortStat] is returned. func (d *Dir) Marshal(b []byte) (n int, err error) { n = STATFIXLEN + len(d.Name) + len(d.Uid) + len(d.Gid) + len(d.Muid) if n > len(b) { @@ -92,9 +92,9 @@ func (d *Dir) Marshal(b []byte) (n int, err error) { // UnmarshalDir decodes a single 9P stat message from b and returns the resulting Dir. // -// If b is too small to hold a valid stat message, ErrShortStat is returned. +// If b is too small to hold a valid stat message, [ErrShortStat] is returned. // -// If the stat message itself is invalid, ErrBadStat is returned. +// If the stat message itself is invalid, [ErrBadStat] is returned. func UnmarshalDir(b []byte) (*Dir, error) { if len(b) < STATFIXLEN { return nil, ErrShortStat diff --git a/src/syscall/dll_windows.go b/src/syscall/dll_windows.go index 5f62b5512ca..81134cb0bd2 100644 --- a/src/syscall/dll_windows.go +++ b/src/syscall/dll_windows.go @@ -24,22 +24,22 @@ func (e *DLLError) Unwrap() error { return e.Err } // Implemented in ../runtime/syscall_windows.go. -// Deprecated: Use SyscallN instead. +// Deprecated: Use [SyscallN] instead. func Syscall(trap, nargs, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) -// Deprecated: Use SyscallN instead. +// Deprecated: Use [SyscallN] instead. func Syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) -// Deprecated: Use SyscallN instead. +// Deprecated: Use [SyscallN] instead. func Syscall9(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) -// Deprecated: Use SyscallN instead. +// Deprecated: Use [SyscallN] instead. func Syscall12(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 uintptr) (r1, r2 uintptr, err Errno) -// Deprecated: Use SyscallN instead. +// Deprecated: Use [SyscallN] instead. func Syscall15(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15 uintptr) (r1, r2 uintptr, err Errno) -// Deprecated: Use SyscallN instead. +// Deprecated: Use [SyscallN] instead. func Syscall18(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 uintptr) (r1, r2 uintptr, err Errno) func SyscallN(trap uintptr, args ...uintptr) (r1, r2 uintptr, err Errno) @@ -59,7 +59,7 @@ type DLL struct { // Go, Windows will search for the named DLL in many locations, causing // potential DLL preloading attacks. // -// Use LazyDLL in golang.org/x/sys/windows for a secure way to +// Use [LazyDLL] in golang.org/x/sys/windows for a secure way to // load system DLLs. func LoadDLL(name string) (*DLL, error) { namep, err := UTF16PtrFromString(name) @@ -87,7 +87,7 @@ func LoadDLL(name string) (*DLL, error) { return d, nil } -// MustLoadDLL is like LoadDLL but panics if load operation fails. +// MustLoadDLL is like [LoadDLL] but panics if load operation fails. func MustLoadDLL(name string) *DLL { d, e := LoadDLL(name) if e != nil { @@ -96,7 +96,7 @@ func MustLoadDLL(name string) *DLL { return d } -// FindProc searches DLL d for procedure named name and returns *Proc +// FindProc searches [DLL] d for procedure named name and returns [*Proc] // if found. It returns an error if search fails. func (d *DLL) FindProc(name string) (proc *Proc, err error) { namep, err := BytePtrFromString(name) @@ -119,7 +119,7 @@ func (d *DLL) FindProc(name string) (proc *Proc, err error) { return p, nil } -// MustFindProc is like FindProc but panics if search fails. +// MustFindProc is like [DLL.FindProc] but panics if search fails. func (d *DLL) MustFindProc(name string) *Proc { p, e := d.FindProc(name) if e != nil { @@ -128,12 +128,12 @@ func (d *DLL) MustFindProc(name string) *Proc { return p } -// Release unloads DLL d from memory. +// Release unloads [DLL] d from memory. func (d *DLL) Release() (err error) { return FreeLibrary(d.Handle) } -// A Proc implements access to a procedure inside a DLL. +// A Proc implements access to a procedure inside a [DLL]. type Proc struct { Dll *DLL Name string @@ -151,28 +151,28 @@ func (p *Proc) Addr() uintptr { // The returned error is always non-nil, constructed from the result of GetLastError. // Callers must inspect the primary return value to decide whether an error occurred // (according to the semantics of the specific function being called) before consulting -// the error. The error always has type syscall.Errno. +// the error. The error always has type [Errno]. // // On amd64, Call can pass and return floating-point values. To pass // an argument x with C type "float", use // uintptr(math.Float32bits(x)). To pass an argument with C type // "double", use uintptr(math.Float64bits(x)). Floating-point return // values are returned in r2. The return value for C type "float" is -// math.Float32frombits(uint32(r2)). For C type "double", it is -// math.Float64frombits(uint64(r2)). +// [math.Float32frombits](uint32(r2)). For C type "double", it is +// [math.Float64frombits](uint64(r2)). // //go:uintptrescapes func (p *Proc) Call(a ...uintptr) (uintptr, uintptr, error) { return SyscallN(p.Addr(), a...) } -// A LazyDLL implements access to a single DLL. +// A LazyDLL implements access to a single [DLL]. // It will delay the load of the DLL until the first -// call to its Handle method or to one of its -// LazyProc's Addr method. +// call to its [LazyDLL.Handle] method or to one of its +// [LazyProc]'s Addr method. // // LazyDLL is subject to the same DLL preloading attacks as documented -// on LoadDLL. +// on [LoadDLL]. // // Use LazyDLL in golang.org/x/sys/windows for a secure way to // load system DLLs. @@ -217,18 +217,18 @@ func (d *LazyDLL) Handle() uintptr { return uintptr(d.dll.Handle) } -// NewProc returns a LazyProc for accessing the named procedure in the DLL d. +// NewProc returns a [LazyProc] for accessing the named procedure in the [DLL] d. func (d *LazyDLL) NewProc(name string) *LazyProc { return &LazyProc{l: d, Name: name} } -// NewLazyDLL creates new LazyDLL associated with DLL file. +// NewLazyDLL creates new [LazyDLL] associated with [DLL] file. func NewLazyDLL(name string) *LazyDLL { return &LazyDLL{Name: name} } -// A LazyProc implements access to a procedure inside a LazyDLL. -// It delays the lookup until the Addr, Call, or Find method is called. +// A LazyProc implements access to a procedure inside a [LazyDLL]. +// It delays the lookup until the [LazyProc.Addr], [LazyProc.Call], or [LazyProc.Find] method is called. type LazyProc struct { mu sync.Mutex Name string @@ -236,7 +236,7 @@ type LazyProc struct { proc *Proc } -// Find searches DLL for procedure named p.Name. It returns +// Find searches [DLL] for procedure named p.Name. It returns // an error if search fails. Find will not search procedure, // if it is already found and loaded into memory. func (p *LazyProc) Find() error { diff --git a/src/syscall/exec_plan9.go b/src/syscall/exec_plan9.go index 8762237825c..91705e175ed 100644 --- a/src/syscall/exec_plan9.go +++ b/src/syscall/exec_plan9.go @@ -69,7 +69,7 @@ func StringSlicePtr(ss []string) []*byte { // SlicePtrFromStrings converts a slice of strings to a slice of // pointers to NUL-terminated byte arrays. If any string contains -// a NUL byte, it returns (nil, EINVAL). +// a NUL byte, it returns (nil, [EINVAL]). func SlicePtrFromStrings(ss []string) ([]*byte, error) { var err error bb := make([]*byte, len(ss)+1) @@ -528,7 +528,7 @@ func ForkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error) return startProcess(argv0, argv, attr) } -// StartProcess wraps ForkExec for package os. +// StartProcess wraps [ForkExec] for package os. func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) { pid, err = startProcess(argv0, argv, attr) return pid, 0, err @@ -581,7 +581,7 @@ func Exec(argv0 string, argv []string, envv []string) (err error) { // WaitProcess waits until the pid of a // running process is found in the queue of // wait messages. It is used in conjunction -// with ForkExec/StartProcess to wait for a +// with [ForkExec]/[StartProcess] to wait for a // running process to exit. func WaitProcess(pid int, w *Waitmsg) (err error) { procs.Lock() diff --git a/src/syscall/exec_unix.go b/src/syscall/exec_unix.go index 469b6601982..1b90aa7e72e 100644 --- a/src/syscall/exec_unix.go +++ b/src/syscall/exec_unix.go @@ -54,13 +54,13 @@ import ( // The rules for which file descriptor-creating operations use the // ForkLock are as follows: // -// - Pipe. Use pipe2 if available. Otherwise, does not block, +// - [Pipe]. Use pipe2 if available. Otherwise, does not block, // so use ForkLock. -// - Socket. Use SOCK_CLOEXEC if available. Otherwise, does not +// - [Socket]. Use SOCK_CLOEXEC if available. Otherwise, does not // block, so use ForkLock. -// - Open. Use O_CLOEXEC if available. Otherwise, may block, +// - [Open]. Use [O_CLOEXEC] if available. Otherwise, may block, // so live with the race. -// - Dup. Use F_DUPFD_CLOEXEC or dup3 if available. Otherwise, +// - [Dup]. Use [F_DUPFD_CLOEXEC] or dup3 if available. Otherwise, // does not block, so use ForkLock. var ForkLock sync.RWMutex @@ -68,7 +68,7 @@ var ForkLock sync.RWMutex // to NUL-terminated byte arrays. If any string contains a NUL byte // this function panics instead of returning an error. // -// Deprecated: Use SlicePtrFromStrings instead. +// Deprecated: Use [SlicePtrFromStrings] instead. func StringSlicePtr(ss []string) []*byte { bb := make([]*byte, len(ss)+1) for i := 0; i < len(ss); i++ { @@ -80,7 +80,7 @@ func StringSlicePtr(ss []string) []*byte { // SlicePtrFromStrings converts a slice of strings to a slice of // pointers to NUL-terminated byte arrays. If any string contains -// a NUL byte, it returns (nil, EINVAL). +// a NUL byte, it returns (nil, [EINVAL]). func SlicePtrFromStrings(ss []string) ([]*byte, error) { n := 0 for _, s := range ss { @@ -120,7 +120,7 @@ func SetNonblock(fd int, nonblocking bool) (err error) { } // Credential holds user and group identities to be assumed -// by a child process started by StartProcess. +// by a child process started by [StartProcess]. type Credential struct { Uid uint32 // User ID. Gid uint32 // Group ID. @@ -129,7 +129,7 @@ type Credential struct { } // ProcAttr holds attributes that will be applied to a new process started -// by StartProcess. +// by [StartProcess]. type ProcAttr struct { Dir string // Current working directory. Env []string // Environment. @@ -249,7 +249,7 @@ func ForkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error) return forkExec(argv0, argv, attr) } -// StartProcess wraps ForkExec for package os. +// StartProcess wraps [ForkExec] for package os. func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) { pid, err = forkExec(argv0, argv, attr) return pid, 0, err diff --git a/src/syscall/flock_aix.go b/src/syscall/flock_aix.go index c9eab43b6bc..d8be7ab504b 100644 --- a/src/syscall/flock_aix.go +++ b/src/syscall/flock_aix.go @@ -8,7 +8,7 @@ import "unsafe" // On AIX, there is no flock() system call. -// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +// FcntlFlock performs a fcntl syscall for the [F_GETLK], [F_SETLK] or [F_SETLKW] command. func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) { _, _, e1 := syscall6(uintptr(unsafe.Pointer(&libc_fcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0) if e1 != 0 { diff --git a/src/syscall/flock_bsd.go b/src/syscall/flock_bsd.go index 68d34708483..3be2656be7a 100644 --- a/src/syscall/flock_bsd.go +++ b/src/syscall/flock_bsd.go @@ -8,7 +8,7 @@ package syscall import "unsafe" -// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +// FcntlFlock performs a fcntl syscall for the [F_GETLK], [F_SETLK] or [F_SETLKW] command. func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { _, err := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk)) return err diff --git a/src/syscall/flock_linux.go b/src/syscall/flock_linux.go index 7d1169b4286..2e87b2e0e43 100644 --- a/src/syscall/flock_linux.go +++ b/src/syscall/flock_linux.go @@ -10,7 +10,7 @@ import "unsafe" // systems by flock_linux_32bit.go to be SYS_FCNTL64. var fcntl64Syscall uintptr = SYS_FCNTL -// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +// FcntlFlock performs a fcntl syscall for the [F_GETLK], [F_SETLK] or [F_SETLKW] command. func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) if errno == 0 { diff --git a/src/syscall/pwd_plan9.go b/src/syscall/pwd_plan9.go index 28e99565eed..b81018873f9 100644 --- a/src/syscall/pwd_plan9.go +++ b/src/syscall/pwd_plan9.go @@ -23,7 +23,7 @@ var ( ) // Ensure current working directory seen by this goroutine matches -// the most recent Chdir called in any goroutine. It's called internally +// the most recent [Chdir] called in any goroutine. It's called internally // before executing any syscall which uses a relative pathname. Must // be called with the goroutine locked to the OS thread, to prevent // rescheduling on a different thread (potentially with a different diff --git a/src/syscall/route_bsd.go b/src/syscall/route_bsd.go index 8e47ff888e9..46680d645a6 100644 --- a/src/syscall/route_bsd.go +++ b/src/syscall/route_bsd.go @@ -325,7 +325,7 @@ func (m *InterfaceAddrMessage) sockaddr() ([]Sockaddr, error) { } // ParseRoutingMessage parses b as routing messages and returns the -// slice containing the RoutingMessage interfaces. +// slice containing the [RoutingMessage] interfaces. // // Deprecated: Use golang.org/x/net/route instead. func ParseRoutingMessage(b []byte) (msgs []RoutingMessage, err error) { @@ -352,7 +352,7 @@ func ParseRoutingMessage(b []byte) (msgs []RoutingMessage, err error) { } // ParseRoutingSockaddr parses msg's payload as raw sockaddrs and -// returns the slice containing the Sockaddr interfaces. +// returns the slice containing the [Sockaddr] interfaces. // // Deprecated: Use golang.org/x/net/route instead. func ParseRoutingSockaddr(msg RoutingMessage) ([]Sockaddr, error) { diff --git a/src/syscall/sockcmsg_unix.go b/src/syscall/sockcmsg_unix.go index 6ade73e87e0..a4b45739b89 100644 --- a/src/syscall/sockcmsg_unix.go +++ b/src/syscall/sockcmsg_unix.go @@ -12,7 +12,7 @@ import ( "unsafe" ) -// CmsgLen returns the value to store in the Len field of the Cmsghdr +// CmsgLen returns the value to store in the Len field of the [Cmsghdr] // structure, taking into account any necessary alignment. func CmsgLen(datalen int) int { return cmsgAlignOf(SizeofCmsghdr) + datalen diff --git a/src/syscall/syscall.go b/src/syscall/syscall.go index f75ba31f5fb..a46f22ddb53 100644 --- a/src/syscall/syscall.go +++ b/src/syscall/syscall.go @@ -16,7 +16,7 @@ // the manuals for the appropriate operating system. // These calls return err == nil to indicate success; otherwise // err is an operating system error describing the failure. -// On most systems, that error has type syscall.Errno. +// On most systems, that error has type [Errno]. // // NOTE: Most of the functions, types, and constants defined in // this package are also available in the [golang.org/x/sys] package. @@ -44,7 +44,7 @@ func StringByteSlice(s string) []byte { // ByteSliceFromString returns a NUL-terminated slice of bytes // containing the text of s. If s contains a NUL byte at any -// location, it returns (nil, EINVAL). +// location, it returns (nil, [EINVAL]). func ByteSliceFromString(s string) ([]byte, error) { if bytealg.IndexByteString(s, 0) != -1 { return nil, EINVAL @@ -58,12 +58,12 @@ func ByteSliceFromString(s string) ([]byte, error) { // If s contains a NUL byte this function panics instead of returning // an error. // -// Deprecated: Use BytePtrFromString instead. +// Deprecated: Use [BytePtrFromString] instead. func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] } // BytePtrFromString returns a pointer to a NUL-terminated array of // bytes containing the text of s. If s contains a NUL byte at any -// location, it returns (nil, EINVAL). +// location, it returns (nil, [EINVAL]). func BytePtrFromString(s string) (*byte, error) { a, err := ByteSliceFromString(s) if err != nil { diff --git a/src/syscall/syscall_js.go b/src/syscall/syscall_js.go index c1b28942e8e..0e529e03437 100644 --- a/src/syscall/syscall_js.go +++ b/src/syscall/syscall_js.go @@ -48,7 +48,7 @@ const PathMax = 256 // err = errno // } // -// Errno values can be tested against error values using errors.Is. +// Errno values can be tested against error values using [errors.Is]. // For example: // // _, _, err := syscall.Syscall(...) @@ -88,7 +88,7 @@ func (e Errno) Timeout() bool { } // A Signal is a number describing a process signal. -// It implements the os.Signal interface. +// It implements the [os.Signal] interface. type Signal int const ( diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go index 5c6a91265d4..7186d137487 100644 --- a/src/syscall/syscall_linux.go +++ b/src/syscall/syscall_linux.go @@ -1107,7 +1107,7 @@ func runtime_doAllThreadsSyscall(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, // // AllThreadsSyscall is unaware of any threads that are launched // explicitly by cgo linked code, so the function always returns -// ENOTSUP in binaries that use cgo. +// [ENOTSUP] in binaries that use cgo. // //go:uintptrescapes func AllThreadsSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { @@ -1118,7 +1118,7 @@ func AllThreadsSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { return r1, r2, Errno(errno) } -// AllThreadsSyscall6 is like AllThreadsSyscall, but extended to six +// AllThreadsSyscall6 is like [AllThreadsSyscall], but extended to six // arguments. // //go:uintptrescapes diff --git a/src/syscall/syscall_plan9.go b/src/syscall/syscall_plan9.go index 7af10ba322a..968782008d1 100644 --- a/src/syscall/syscall_plan9.go +++ b/src/syscall/syscall_plan9.go @@ -23,7 +23,7 @@ const bitSize16 = 2 // ErrorString implements Error's String method by returning itself. // -// ErrorString values can be tested against error values using errors.Is. +// ErrorString values can be tested against error values using [errors.Is]. // For example: // // _, _, err := syscall.Syscall(...) @@ -99,7 +99,7 @@ var ( ) // For testing: clients can set this flag to force -// creation of IPv6 sockets to return EAFNOSUPPORT. +// creation of IPv6 sockets to return [EAFNOSUPPORT]. var SocketDisableIPv6 bool func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err ErrorString) diff --git a/src/syscall/syscall_solaris.go b/src/syscall/syscall_solaris.go index 28d3727db66..30400b4fac8 100644 --- a/src/syscall/syscall_solaris.go +++ b/src/syscall/syscall_solaris.go @@ -299,7 +299,7 @@ func UtimesNano(path string, ts []Timespec) error { //sys fcntl(fd int, cmd int, arg int) (val int, err error) -// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +// FcntlFlock performs a fcntl syscall for the [F_GETLK], [F_SETLK] or [F_SETLKW] command. func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_fcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0) if e1 != 0 { diff --git a/src/syscall/syscall_unix.go b/src/syscall/syscall_unix.go index 4c48f29744a..0d3fe31e7a6 100644 --- a/src/syscall/syscall_unix.go +++ b/src/syscall/syscall_unix.go @@ -98,7 +98,7 @@ func (m *mmapper) Munmap(data []byte) (err error) { // err = errno // } // -// Errno values can be tested against error values using errors.Is. +// Errno values can be tested against error values using [errors.Is]. // For example: // // _, _, err := syscall.Syscall(...) @@ -162,7 +162,7 @@ func errnoErr(e Errno) error { } // A Signal is a number describing a process signal. -// It implements the os.Signal interface. +// It implements the [os.Signal] interface. type Signal int func (s Signal) Signal() {} @@ -257,7 +257,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } // For testing: clients can set this flag to force -// creation of IPv6 sockets to return EAFNOSUPPORT. +// creation of IPv6 sockets to return [EAFNOSUPPORT]. var SocketDisableIPv6 bool type Sockaddr interface { diff --git a/src/syscall/syscall_wasip1.go b/src/syscall/syscall_wasip1.go index e66afee5e9a..84c6bddc089 100644 --- a/src/syscall/syscall_wasip1.go +++ b/src/syscall/syscall_wasip1.go @@ -97,7 +97,7 @@ func (e Errno) Timeout() bool { } // A Signal is a number describing a process signal. -// It implements the os.Signal interface. +// It implements the [os.Signal] interface. type Signal uint8 const ( @@ -305,7 +305,7 @@ func (w WaitStatus) Continued() bool { return false } func (w WaitStatus) StopSignal() Signal { return 0 } func (w WaitStatus) TrapCause() int { return 0 } -// Rusage is a placeholder to allow compilation of the os/exec package +// Rusage is a placeholder to allow compilation of the [os/exec] package // because we need Go programs to be portable across platforms. WASI does // not have a mechanism to to spawn processes so there is no reason for an // application to take a dependency on this type. @@ -314,7 +314,7 @@ type Rusage struct { Stime Timeval } -// ProcAttr is a placeholder to allow compilation of the os/exec package +// ProcAttr is a placeholder to allow compilation of the [os/exec] package // because we need Go programs to be portable across platforms. WASI does // not have a mechanism to to spawn processes so there is no reason for an // application to take a dependency on this type. diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go index 1f46dec0a82..c51ce04b84c 100644 --- a/src/syscall/syscall_windows.go +++ b/src/syscall/syscall_windows.go @@ -25,7 +25,7 @@ const InvalidHandle = ^Handle(0) // with a terminating NUL added. If s contains a NUL byte this // function panics instead of returning an error. // -// Deprecated: Use UTF16FromString instead. +// Deprecated: Use [UTF16FromString] instead. func StringToUTF16(s string) []uint16 { a, err := UTF16FromString(s) if err != nil { @@ -36,7 +36,7 @@ func StringToUTF16(s string) []uint16 { // UTF16FromString returns the UTF-16 encoding of the UTF-8 string // s, with a terminating NUL added. If s contains a NUL byte at any -// location, it returns (nil, EINVAL). Unpaired surrogates +// location, it returns (nil, [EINVAL]). Unpaired surrogates // are encoded using WTF-8. func UTF16FromString(s string) ([]uint16, error) { if bytealg.IndexByteString(s, 0) != -1 { @@ -102,7 +102,7 @@ func utf16PtrToString(p *uint16) string { // contains a NUL byte this function panics instead of // returning an error. // -// Deprecated: Use UTF16PtrFromString instead. +// Deprecated: Use [UTF16PtrFromString] instead. func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] } // UTF16PtrFromString returns pointer to the UTF-16 encoding of @@ -119,7 +119,7 @@ func UTF16PtrFromString(s string) (*uint16, error) { // Errno is the Windows error number. // -// Errno values can be tested against error values using errors.Is. +// Errno values can be tested against error values using [errors.Is]. // For example: // // _, _, err := syscall.Syscall(...) @@ -768,7 +768,7 @@ const socket_error = uintptr(^uint32(0)) //sys WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) [failretval==-1] = ws2_32.WSAEnumProtocolsW // For testing: clients can set this flag to force -// creation of IPv6 sockets to return EAFNOSUPPORT. +// creation of IPv6 sockets to return [EAFNOSUPPORT]. var SocketDisableIPv6 bool type RawSockaddrInet4 struct { @@ -1438,7 +1438,7 @@ func newProcThreadAttributeList(maxAttrCount uint32) (*_PROC_THREAD_ATTRIBUTE_LI // decrementing until index 0 is enumerated. // // Successive calls to this API must happen on the same OS thread, -// so call runtime.LockOSThread before calling this function. +// so call [runtime.LockOSThread] before calling this function. func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { return regEnumKeyEx(key, index, name, nameLen, reserved, class, classLen, lastWriteTime) } diff --git a/src/syscall/timestruct.go b/src/syscall/timestruct.go index 4fca63cc40c..b1d03ef25c4 100644 --- a/src/syscall/timestruct.go +++ b/src/syscall/timestruct.go @@ -9,7 +9,7 @@ package syscall // TimespecToNsec returns the time stored in ts as nanoseconds. func TimespecToNsec(ts Timespec) int64 { return ts.Nano() } -// NsecToTimespec converts a number of nanoseconds into a Timespec. +// NsecToTimespec converts a number of nanoseconds into a [Timespec]. func NsecToTimespec(nsec int64) Timespec { sec := nsec / 1e9 nsec = nsec % 1e9 @@ -23,7 +23,7 @@ func NsecToTimespec(nsec int64) Timespec { // TimevalToNsec returns the time stored in tv as nanoseconds. func TimevalToNsec(tv Timeval) int64 { return tv.Nano() } -// NsecToTimeval converts a number of nanoseconds into a Timeval. +// NsecToTimeval converts a number of nanoseconds into a [Timeval]. func NsecToTimeval(nsec int64) Timeval { nsec += 999 // round up to microsecond usec := nsec % 1e9 / 1e3