Skip to content

Commit 7d21f8c

Browse files
authored
Use ShellExecute from golang.org/x/sys/windows (#34)
Use the ShellExecute wrapper function provided by the golang.org/x/sys/windows package rather than generating the wrapper as part of this package.
1 parent c198bc9 commit 7d21f8c

File tree

4 files changed

+5
-81
lines changed

4 files changed

+5
-81
lines changed

browser_windows.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
//go:generate mkwinsyscall -output zbrowser_windows.go browser_windows.go
2-
//sys shellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) = shell32.ShellExecuteW
31
package browser
42

5-
const sW_SHOWNORMAL = 1
3+
import "golang.org/x/sys/windows"
64

75
func openBrowser(url string) error {
8-
return shellExecute(0, "", url, "", "", sW_SHOWNORMAL)
6+
return windows.ShellExecute(0, nil, windows.StringToUTF16Ptr(url), nil, nil, windows.SW_SHOWNORMAL)
97
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/pkg/browser
22

33
go 1.14
44

5-
require golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d // indirect
5+
require golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71 h1:X/2sJAybVknnUnV7AD2HdT6rm2p5BP6eH2j+igduWgk=
2+
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

zbrowser_windows.go

-76
This file was deleted.

0 commit comments

Comments
 (0)