mirror of
https://github.com/rwinkhart/go-winio.git
synced 2026-08-31 06:16:46 -04:00
Some new upcoming changes require us to use Go 1.23. However, if we switch to Go 1.23 some new linter errors are showing up. This commit fixes most of the errors and adds an exclusion for integer overflow errors. Signed-off-by: Amit <ambarve@microsoft.com>
24 lines
456 B
Go
24 lines
456 B
Go
//go:build windows
|
|
|
|
package winio
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestRunWithUnavailablePrivilege(t *testing.T) {
|
|
err := RunWithPrivilege("SeCreateTokenPrivilege", func() error { return nil })
|
|
var perr *PrivilegeError
|
|
if !errors.As(err, &perr) {
|
|
t.Fatal("expected PrivilegeError")
|
|
}
|
|
}
|
|
|
|
func TestRunWithPrivileges(t *testing.T) {
|
|
err := RunWithPrivilege("SeShutdownPrivilege", func() error { return nil })
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|