英文:
Where can I find the documentation for SyscallN, since syscall.Syscall6 has been deprecated as of Go 1.18?
问题
当我在将我的go.mod
中的go
值从go 1.16
更改为go 1.20
后,在我的Go代码上运行golangci-lint后,我现在收到了以下的linter警告:
windows.go:210:16: SA1019: 自Go 1.18以来,syscall.Syscall6已被弃用:请改用SyscallN。(staticcheck)
err, _, _ := syscall.Syscall6(fn, 5, addr, uintptr(unsafe.Pointer(&size)), 1, uintptr(family), uintptr(class), 0)
我想比较SyscallN
和syscall.Syscall6
的文档,看看从被弃用的函数转换到推荐的替代函数是否有任何需要注意的地方,但我无法使用go doc
检索该函数的文档,也找不到该函数的文档在syscall包文档中。syscall包文档中有一个Syscall6
条目,但没有SyscallN
条目。当我尝试使用go doc
时,我得到了以下结果:
$ go doc syscall.SyscallN
doc: 在包syscall中找不到SyscallN符号
退出状态 1
SyscallN
是否在除syscall
之外的包中?我在哪里可以找到SyscallN
的文档?
请注意,这是针对windows.go
文件顶部带有//go:build windows
注释的Windows特定代码。
英文:
When I run golangci-lint on my Go code after changing the go
value in my go.mod
from go 1.16
to go 1.20
, I now get this linter warning:
windows.go:210:16: SA1019: syscall.Syscall6 has been deprecated since Go 1.18: Use SyscallN instead. (staticcheck)
err, _, _ := syscall.Syscall6(fn, 5, addr, uintptr(unsafe.Pointer(&size)), 1, uintptr(family), uintptr(class), 0)
I wanted to compare the documentation for SyscallN
to syscall.Syscall6
to see if there were any gotchas for moving from the deprecated function to the recommended replacement, but I cannot retrieve documentation for the function with go doc
or find documentation for the function in the syscall package docs. The syscall package docs have a Syscall6
entry, but no SycallN
entry. When I try to use go doc
, I get this:
$ go doc syscall.SyscallN
doc: no symbol SyscallN in package syscall
exit status 1
Is SyscallN
in a package other than syscall
? Where can I find the documentation for SyscallN
?
Note that this is for Windows-specific code guarded by a //go:build windows
comment at the top of the windows.go
file.
答案1
得分: 0
正如@SteffenUllrich指出的,我不得不将Rendered for
下拉框的值从linux/amd64
更改为如下所示的windows/amd64
:
syscall.SyscallN
的文档在此处可用(请注意URL中的查询组件):https://pkg.go.dev/syscall?GOOS=windows#SyscallN
英文:
As pointed out by @SteffenUllrich, I had to change the Rendered for
dropdown value from linux/amd64
like this:
to windows/amd64
like this:
The documentation for syscall.SyscallN
is available here (note the query component in the URL): https://pkg.go.dev/syscall?GOOS=windows#SyscallN
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论