Skip to content

Commit

Permalink
Go 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Sep 26, 2021
1 parent 8a8cc34 commit 25e54c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
-
name: Mage build
uses: magefile/mage-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gosum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
-
name: Tidy
run: |
Expand Down
7 changes: 4 additions & 3 deletions app/utils/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"bytes"
"os/exec"
"strings"
"syscall"

"golang.org/x/sys/windows"
)

// Options of command
Expand Down Expand Up @@ -32,7 +33,7 @@ func Exec(options Options) (Result, error) {
command.Stdout = commandStdout
commandStderr := &bytes.Buffer{}
command.Stderr = commandStderr
command.SysProcAttr = &syscall.SysProcAttr{HideWindow: options.HideWindow}
command.SysProcAttr = &windows.SysProcAttr{HideWindow: options.HideWindow}

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

command.Wait()
waitStatus := command.ProcessState.Sys().(syscall.WaitStatus)
waitStatus := command.ProcessState.Sys().(windows.WaitStatus)

result.ExitCode = waitStatus.ExitCode
result.Stdout = strings.TrimSpace(commandStdout.String())
Expand Down
9 changes: 5 additions & 4 deletions app/utils/windows/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/akyoto/color"
"github.com/crazy-max/WindowsSpyBlocker/app/utils/print"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
)

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

// SetConsoleTitle sets windows console title
func SetConsoleTitle(title string) (int, error) {
handle, err := syscall.LoadLibrary("kernel32.dll")
handle, err := windows.LoadLibrary("kernel32.dll")
if err != nil {
print.Error(err)
return 0, err
}
defer syscall.FreeLibrary(handle)
defer windows.FreeLibrary(handle)

proc, err := syscall.GetProcAddress(handle, "SetConsoleTitleW")
proc, err := windows.GetProcAddress(handle, "SetConsoleTitleW")
if err != nil {
print.Error(err)
return 0, err
}

rTitle, err := syscall.UTF16PtrFromString(title)
rTitle, err := windows.UTF16PtrFromString(title)
if err != nil {
print.Error(err)
return 0, err
Expand Down

0 comments on commit 25e54c0

Please sign in to comment.