Skip to content

Commit f1ebc26

Browse files
committed
Go 1.17
1 parent 8a8cc34 commit f1ebc26

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
name: Set up Go
5353
uses: actions/setup-go@v2
5454
with:
55-
go-version: 1.16
55+
go-version: 1.17
5656
-
5757
name: Mage build
5858
uses: magefile/mage-action@v1

.github/workflows/gosum.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: Set up Go
2121
uses: actions/setup-go@v2
2222
with:
23-
go-version: 1.16
23+
go-version: 1.17
2424
-
2525
name: Tidy
2626
run: |

app/utils/cmd/cmd.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import (
44
"bytes"
55
"os/exec"
66
"strings"
7-
"syscall"
7+
8+
"golang.org/x/sys/windows"
89
)
910

1011
// Options of command
@@ -32,7 +33,7 @@ func Exec(options Options) (Result, error) {
3233
command.Stdout = commandStdout
3334
commandStderr := &bytes.Buffer{}
3435
command.Stderr = commandStderr
35-
command.SysProcAttr = &syscall.SysProcAttr{HideWindow: options.HideWindow}
36+
command.SysProcAttr = &windows.SysProcAttr{HideWindow: options.HideWindow}
3637

3738
if options.WorkingDir != "" {
3839
command.Dir = options.WorkingDir
@@ -43,7 +44,7 @@ func Exec(options Options) (Result, error) {
4344
}
4445

4546
command.Wait()
46-
waitStatus := command.ProcessState.Sys().(syscall.WaitStatus)
47+
waitStatus := command.ProcessState.Sys().(windows.WaitStatus)
4748

4849
result.ExitCode = waitStatus.ExitCode
4950
result.Stdout = strings.TrimSpace(commandStdout.String())

app/utils/windows/windows.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/akyoto/color"
1111
"github.com/crazy-max/WindowsSpyBlocker/app/utils/print"
12+
"golang.org/x/sys/windows"
1213
"golang.org/x/sys/windows/registry"
1314
)
1415

@@ -63,20 +64,20 @@ func SetRegString(key registry.Key, name string, value string) error {
6364

6465
// SetConsoleTitle sets windows console title
6566
func SetConsoleTitle(title string) (int, error) {
66-
handle, err := syscall.LoadLibrary("kernel32.dll")
67+
handle, err := windows.LoadLibrary("kernel32.dll")
6768
if err != nil {
6869
print.Error(err)
6970
return 0, err
7071
}
71-
defer syscall.FreeLibrary(handle)
72+
defer windows.FreeLibrary(handle)
7273

73-
proc, err := syscall.GetProcAddress(handle, "SetConsoleTitleW")
74+
proc, err := windows.GetProcAddress(handle, "SetConsoleTitleW")
7475
if err != nil {
7576
print.Error(err)
7677
return 0, err
7778
}
7879

79-
rTitle, err := syscall.UTF16PtrFromString(title)
80+
rTitle, err := windows.UTF16PtrFromString(title)
8081
if err != nil {
8182
print.Error(err)
8283
return 0, err

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build windows
2+
// +build windows
3+
14
//go:generate go install github.com/kevinburke/go-bindata/go-bindata
25
//go:generate go-bindata -pkg bindata -o app/bindata/bindata.go app/settings.json data/... app.conf
36
//go:generate go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo

0 commit comments

Comments
 (0)