您可以在 Go 1.18 中已弃用的 syscall.Syscall6 的文档中查找有关 SyscallN 的信息。

huangapple go评论99阅读模式
英文:

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)

我想比较SyscallNsyscall.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

您可以在 Go 1.18 中已弃用的 syscall.Syscall6 的文档中查找有关 SyscallN 的信息。

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:

您可以在 Go 1.18 中已弃用的 syscall.Syscall6 的文档中查找有关 SyscallN 的信息。

to windows/amd64 like this:

您可以在 Go 1.18 中已弃用的 syscall.Syscall6 的文档中查找有关 SyscallN 的信息。

The documentation for syscall.SyscallN is available here (note the query component in the URL): https://pkg.go.dev/syscall?GOOS=windows#SyscallN

huangapple
  • 本文由 发表于 2023年8月4日 03:09:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76830993.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定