Description
The syscall package was marked as deprecated by https://go.dev/cl/127657 (at the time, no proposal was required). A consequence is that various IDEs and similar tools express concern about code that uses the syscall package. However, while most of the functionality of the syscall package is available in various golang.org/x/sys packages, some are not:
syscall.SysProcAttr
(type ofos/exec.Cmd.SysProcAttr
)syscall.Signal
(referenced by documentation ofos.Signal
)syscall.WaitStatus
(referenced by documentation ofos.(*ProcessState).Sys
)syscall.Stat_t
(type returned byos.(*File).Stat().Sys()
on Unix systems)
It is difficult for certain kinds of code to avoid using these types. This list is not comprehensive; there may be other such types.
Therefore, I propose that we revert https://go.dev/cl/127657. This will have no effect on how programs behave, but will avoid unnecessary complains from IDEs.
If we come up with a syntax for "new code should use this instead", we can apply that to most of the names exported by the syscall package.
Activity
ulikunitz commentedon Jun 14, 2023
A Question: Am I correct to assume that the package will stay frozen?
syscall
package is deprecated since Go 1.11 dominikh/go-tools#1412ianlancetaylor commentedon Jun 14, 2023
Yes, the package will remain frozen. This is only about not marking it as deprecated.
rsc commentedon Aug 2, 2023
This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group
willfaught commentedon Aug 3, 2023
Why not port those to x/sys then and make it complete?
gophun commentedon Aug 3, 2023
@willfaught The point is that other packages such as
os
use types fromsyscall
in their public API, so you sometimes have to importsyscall
and notgolang.org/x/sys
.ianlancetaylor commentedon Aug 3, 2023
Also we don't particularly want the standard library to depend on the x/sys/unix package. We could if we had to, but so far we've avoided it. (That said, the standard library tools do vendor in x/sys/unix, because cmd/pprof depends on it via golang.org/x/term.)
rsc commentedon Aug 9, 2023
Go code has to use types like syscall.Signal. It is untenable to call all of syscall deprecated when it flags real uses like that.
rsc commentedon Aug 9, 2023
Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group
4 remaining items
[-]proposal: syscall: undeprecate[/-][+]syscall: undeprecate[/+]gopherbot commentedon Aug 16, 2023
Change https://go.dev/cl/520018 mentions this issue:
syscall: remove deprecation notice
syscall: remove deprecation notice