From e73015f852cdd7bffe20834acd10375bfe6b25ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 12:47:04 +0100
Subject: [PATCH 01/18] Run tests on any branch/PR

---
 .github/workflows/push.yml | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index cef9b50..d6f51ff 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -1,8 +1,6 @@
-on:
-  push:
-    branches:
-    - master
-name: Push Event
+on: [push, pull_request]
+
+name: CI
 jobs:
   test:
     runs-on: ubuntu-latest

From 6d471202e19b9045d63d04c83d7b688cd7d09c2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 12:48:14 +0100
Subject: [PATCH 02/18] Rename to `cli/browser`

---
 examples/Open/main.go | 2 +-
 go.mod                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/Open/main.go b/examples/Open/main.go
index fe73fe0..a303470 100644
--- a/examples/Open/main.go
+++ b/examples/Open/main.go
@@ -18,7 +18,7 @@ import (
 	"log"
 	"os"
 
-	"github.com/pkg/browser"
+	"github.com/cli/browser"
 )
 
 func usage() {
diff --git a/go.mod b/go.mod
index 04355d2..15942d4 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
-module github.com/pkg/browser
+module github.com/cli/browser
 
 go 1.14

From 5af71e309e6883e7ed88617609ab78eec1dca593 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 12:48:59 +0100
Subject: [PATCH 03/18] Allow Go 1.13

---
 go.mod | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/go.mod b/go.mod
index 15942d4..13915e7 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
 module github.com/cli/browser
 
-go 1.14
+go 1.13

From fa777652a9637840322dc8783995e6e41a7623f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 13:45:12 +0100
Subject: [PATCH 04/18] Use safeexec on Windows

---
 browser_windows.go | 8 +++++++-
 go.mod             | 2 ++
 go.sum             | 2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 go.sum

diff --git a/browser_windows.go b/browser_windows.go
index a964c7b..d9f95de 100644
--- a/browser_windows.go
+++ b/browser_windows.go
@@ -4,11 +4,17 @@ import (
 	"os/exec"
 	"strings"
 	"syscall"
+
+	"github.com/cli/safeexec"
 )
 
 func openBrowser(url string) error {
+	cmdPath, err := safeexec.LookPath("cmd")
+	if err != nil {
+		return err
+	}
 	r := strings.NewReplacer("&", "^&")
-	return runCmd("cmd", "/c", "start", r.Replace(url))
+	return runCmd(cmdPath, "/c", "start", r.Replace(url))
 }
 
 func setFlags(cmd *exec.Cmd) {
diff --git a/go.mod b/go.mod
index 13915e7..fd7f3c2 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,5 @@
 module github.com/cli/browser
 
 go 1.13
+
+require github.com/cli/safeexec v1.0.0
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..c35ac6b
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,2 @@
+github.com/cli/safeexec v1.0.0 h1:0VngyaIyqACHdcMNWfo6+KdUYnqEr2Sg+bSP1pdF+dI=
+github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=

From 2d6020680f0a451e99d192af09fdae2d692aa07c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 13:46:10 +0100
Subject: [PATCH 05/18] Add WSL fallback for Linux

---
 browser_linux.go | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/browser_linux.go b/browser_linux.go
index 656c693..2396d6e 100644
--- a/browser_linux.go
+++ b/browser_linux.go
@@ -1,9 +1,26 @@
 package browser
 
-import "os/exec"
+import (
+	"errors"
+	"os/exec"
+)
 
 func openBrowser(url string) error {
-	return runCmd("xdg-open", url)
+	browserPath, err := lookPath("xdg-open", "wslview")
+	if err != nil {
+		return err
+	}
+	return runCmd(browserPath, url)
+}
+
+func lookPath(cmdName, fallbackName string) (string, error) {
+	cmdPath, err := exec.LookPath(cmdName)
+	if errors.Is(err, exec.ErrNotFound) {
+		if wslPath, err := exec.LookPath(fallbackName); err == nil {
+			return wslPath, nil
+		}
+	}
+	return cmdPath, err
 }
 
 func setFlags(cmd *exec.Cmd) {}

From 146a49626775a25de22a35e08cd5b1b85818b375 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 13:48:40 +0100
Subject: [PATCH 06/18] Ensure original ErrNotFound is wrapped on BSD

---
 browser_freebsd.go | 5 +++--
 browser_openbsd.go | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/browser_freebsd.go b/browser_freebsd.go
index 8cc0a7f..b0f244b 100644
--- a/browser_freebsd.go
+++ b/browser_freebsd.go
@@ -2,13 +2,14 @@ package browser
 
 import (
 	"errors"
+	"fmt"
 	"os/exec"
 )
 
 func openBrowser(url string) error {
 	err := runCmd("xdg-open", url)
-	if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound {
-		return errors.New("xdg-open: command not found - install xdg-utils from ports(8)")
+	if errors.Is(err, exec.ErrNotFound) {
+		return fmt.Errorf("%w - install xdg-utils from ports(8)", err)
 	}
 	return err
 }
diff --git a/browser_openbsd.go b/browser_openbsd.go
index 8cc0a7f..b0f244b 100644
--- a/browser_openbsd.go
+++ b/browser_openbsd.go
@@ -2,13 +2,14 @@ package browser
 
 import (
 	"errors"
+	"fmt"
 	"os/exec"
 )
 
 func openBrowser(url string) error {
 	err := runCmd("xdg-open", url)
-	if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNotFound {
-		return errors.New("xdg-open: command not found - install xdg-utils from ports(8)")
+	if errors.Is(err, exec.ErrNotFound) {
+		return fmt.Errorf("%w - install xdg-utils from ports(8)", err)
 	}
 	return err
 }

From 08e28c44f8e37acaf638a4e899275c73d711dfbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 13:49:13 +0100
Subject: [PATCH 07/18] Appease linter in tests

---
 example_test.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/example_test.go b/example_test.go
index a6fbe16..c766ce7 100644
--- a/example_test.go
+++ b/example_test.go
@@ -3,7 +3,7 @@ package browser
 import "strings"
 
 func ExampleOpenFile() {
-	OpenFile("index.html")
+	_ = OpenFile("index.html")
 }
 
 func ExampleOpenReader() {
@@ -14,10 +14,10 @@ Perceptions of the most maddeningly untransmissible sort thronged upon us;
 perceptions of infinity which at the time convulsed us with joy, yet which
 are now partly lost to my memory and partly incapable of presentation to others.`
 	r := strings.NewReader(quote)
-	OpenReader(r)
+	_ = OpenReader(r)
 }
 
 func ExampleOpenURL() {
 	const url = "http://golang.org/"
-	OpenURL(url)
+	_ = OpenURL(url)
 }

From bdae545a0c126855ce9239fdbe94008bbe86377b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 13:49:32 +0100
Subject: [PATCH 08/18] Run tests across different OS's

---
 .github/workflows/push.yml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index d6f51ff..ace273d 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -3,11 +3,15 @@ on: [push, pull_request]
 name: CI
 jobs:
   test:
-    runs-on: ubuntu-latest
     strategy:
       matrix:
-        go: [ '1.15' ]
-    name: Go ${{ matrix.go }} test
+        go: [ '1.13', '1.15' ]
+        os: [ ubuntu-latest, macos-latest, windows-latest ]
+      fail-fast: false
+    
+    runs-on: ${{ matrix.os }}
+    name: Test suite
+
     steps:
       - uses: actions/checkout@v2
       - name: Setup go

From b7757987bec02bf336f64143601371b8aeb52bb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 14:22:43 +0100
Subject: [PATCH 09/18] Improve example

---
 examples/Open/main.go | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/examples/Open/main.go b/examples/Open/main.go
index a303470..40cb0f6 100644
--- a/examples/Open/main.go
+++ b/examples/Open/main.go
@@ -17,12 +17,14 @@ import (
 	"fmt"
 	"log"
 	"os"
+	"path/filepath"
+	"strings"
 
 	"github.com/cli/browser"
 )
 
 func usage() {
-	fmt.Fprintf(os.Stderr, "Usage:\n  %s [file]\n", os.Args[0])
+	fmt.Fprintf(os.Stderr, "Usage:\n  %s {<url> | <file> | -}\n", filepath.Base(os.Args[0]))
 	flag.PrintDefaults()
 }
 
@@ -39,12 +41,21 @@ func check(err error) {
 
 func main() {
 	args := flag.Args()
-	switch len(args) {
-	case 0:
-		check(browser.OpenReader(os.Stdin))
-	case 1:
-		check(browser.OpenFile(args[0]))
-	default:
+
+	if len(args) != 1 {
 		usage()
+		os.Exit(1)
+	}
+
+	if args[0] == "-" {
+		check(browser.OpenReader(os.Stdin))
+		return
+	}
+
+	if strings.HasPrefix(args[0], "http:") || strings.HasPrefix(args[0], "https:") {
+		check(browser.OpenURL(args[0]))
+		return
 	}
+
+	check(browser.OpenFile(args[0]))
 }

From 475b091c2d19088ccfdb37d2518228f17cca50d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 14:23:27 +0100
Subject: [PATCH 10/18] Update README

---
 README.md | 56 +++++++++++--------------------------------------------
 1 file changed, 11 insertions(+), 45 deletions(-)

diff --git a/README.md b/README.md
index 72b1976..aba72b6 100644
--- a/README.md
+++ b/README.md
@@ -1,55 +1,21 @@
 
 # browser
-    import "github.com/pkg/browser"
 
-Package browser provides helpers to open files, readers, and urls in a browser window.
+Helpers to open URLs, readers, or files in the system default web browser.
 
-The choice of which browser is started is entirely client dependant.
+This fork adds:
 
+- [safety](https://github.com/cli/safeexec#readme) when running inside of an untrusted directory on Windows;
+- WSL compatibility;
+- `ErrNotFound` error wrapping on BSD;
+- Go 1.13 support.
 
+## Usage
 
-
-
-## Variables
 ``` go
-var Stderr io.Writer = os.Stderr
-```
-Stderr is the io.Writer to which executed commands write standard error.
+import "github.com/cli/browser"
 
-``` go
-var Stdout io.Writer = os.Stdout
+err = browser.OpenURL(url)
+err = browser.OpenFile(path)
+err = browser.OpenReader(reader)
 ```
-Stdout is the io.Writer to which executed commands write standard output.
-
-
-## func OpenFile
-``` go
-func OpenFile(path string) error
-```
-OpenFile opens new browser window for the file path.
-
-
-## func OpenReader
-``` go
-func OpenReader(r io.Reader) error
-```
-OpenReader consumes the contents of r and presents the
-results in a new browser window.
-
-
-## func OpenURL
-``` go
-func OpenURL(url string) error
-```
-OpenURL opens a new browser window pointing to url.
-
-
-
-
-
-
-
-
-
-- - -
-Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)

From 54076059990bd5ebf1aee0d15e6e44096003c74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Sun, 6 Dec 2020 14:52:30 +0100
Subject: [PATCH 11/18] Wrap OpenReader errors

---
 README.md  | 1 +
 browser.go | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index aba72b6..f27c9c6 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ This fork adds:
 
 - [safety](https://github.com/cli/safeexec#readme) when running inside of an untrusted directory on Windows;
 - WSL compatibility;
+- `OpenReader` error wrapping;
 - `ErrNotFound` error wrapping on BSD;
 - Go 1.13 support.
 
diff --git a/browser.go b/browser.go
index 3e59690..5ba3c72 100644
--- a/browser.go
+++ b/browser.go
@@ -32,19 +32,19 @@ func OpenFile(path string) error {
 func OpenReader(r io.Reader) error {
 	f, err := ioutil.TempFile("", "browser")
 	if err != nil {
-		return fmt.Errorf("browser: could not create temporary file: %v", err)
+		return fmt.Errorf("browser: could not create temporary file: %w", err)
 	}
 	if _, err := io.Copy(f, r); err != nil {
 		f.Close()
-		return fmt.Errorf("browser: caching temporary file failed: %v", err)
+		return fmt.Errorf("browser: caching temporary file failed: %w", err)
 	}
 	if err := f.Close(); err != nil {
-		return fmt.Errorf("browser: caching temporary file failed: %v", err)
+		return fmt.Errorf("browser: caching temporary file failed: %w", err)
 	}
 	oldname := f.Name()
 	newname := oldname + ".html"
 	if err := os.Rename(oldname, newname); err != nil {
-		return fmt.Errorf("browser: renaming temporary file failed: %v", err)
+		return fmt.Errorf("browser: renaming temporary file failed: %w", err)
 	}
 	return OpenFile(newname)
 }

From 2a4e89aa517a62644e40121f01d564980527e6bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <mislav@github.com>
Date: Fri, 19 Mar 2021 18:52:27 +0100
Subject: [PATCH 12/18] Allow running project on Windows

---
 go.mod | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/go.mod b/go.mod
index 04355d2..39cdc0d 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,5 @@
 module github.com/pkg/browser
 
 go 1.14
+
+require golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d // indirect

From dfaaea7e025733f271660a10b6be708b3a82914b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <mislav@github.com>
Date: Fri, 19 Mar 2021 18:52:59 +0100
Subject: [PATCH 13/18] Un-export Window-specific identifiers

---
 browser_windows.go  | 6 +++---
 zbrowser_windows.go | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/browser_windows.go b/browser_windows.go
index a2b30d3..b603287 100644
--- a/browser_windows.go
+++ b/browser_windows.go
@@ -1,12 +1,12 @@
 //go:generate mkwinsyscall -output zbrowser_windows.go browser_windows.go
-//sys ShellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) = shell32.ShellExecuteW
+//sys shellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) = shell32.ShellExecuteW
 package browser
 
 import "os/exec"
-const SW_SHOWNORMAL = 1
+const sW_SHOWNORMAL = 1
 
 func openBrowser(url string) error {
-   return ShellExecute(0, "", url, "", "", SW_SHOWNORMAL)
+   return shellExecute(0, "", url, "", "", sW_SHOWNORMAL)
 }
 
 func setFlags(cmd *exec.Cmd) {
diff --git a/zbrowser_windows.go b/zbrowser_windows.go
index cbb25ba..4b2d9eb 100644
--- a/zbrowser_windows.go
+++ b/zbrowser_windows.go
@@ -43,7 +43,7 @@ var (
 	procShellExecuteW = modshell32.NewProc("ShellExecuteW")
 )
 
-func ShellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) {
+func shellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) {
 	var _p0 *uint16
 	_p0, err = syscall.UTF16PtrFromString(verb)
 	if err != nil {
@@ -64,10 +64,10 @@ func ShellExecute(hwnd int, verb string, file string, args string, cwd string, s
 	if err != nil {
 		return
 	}
-	return _ShellExecute(hwnd, _p0, _p1, _p2, _p3, showCmd)
+	return _shellExecute(hwnd, _p0, _p1, _p2, _p3, showCmd)
 }
 
-func _ShellExecute(hwnd int, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int) (err error) {
+func _shellExecute(hwnd int, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int) (err error) {
 	r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd))
 	if r1 == 0 {
 		err = errnoErr(e1)

From 38f8067bcf5aa9757803ff65d054299f244c0f87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Fri, 19 Mar 2021 19:13:02 +0100
Subject: [PATCH 14/18] Remove lies from README

---
 README.md | 2 --
 1 file changed, 2 deletions(-)

diff --git a/README.md b/README.md
index f27c9c6..30e55ef 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,6 @@ Helpers to open URLs, readers, or files in the system default web browser.
 
 This fork adds:
 
-- [safety](https://github.com/cli/safeexec#readme) when running inside of an untrusted directory on Windows;
-- WSL compatibility;
 - `OpenReader` error wrapping;
 - `ErrNotFound` error wrapping on BSD;
 - Go 1.13 support.

From 4901bee8d7d336667af7a9a80c0ecaadfdc1e895 Mon Sep 17 00:00:00 2001
From: Edward Betts <edward@4angle.com>
Date: Fri, 27 May 2022 16:37:53 +0200
Subject: [PATCH 15/18] Correct spelling mistake

---
 browser.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/browser.go b/browser.go
index 5ba3c72..51559ac 100644
--- a/browser.go
+++ b/browser.go
@@ -1,6 +1,6 @@
 // Package browser provides helpers to open files, readers, and urls in a browser window.
 //
-// The choice of which browser is started is entirely client dependant.
+// The choice of which browser is started is entirely client dependent.
 package browser
 
 import (

From 419c10c56bd56293c8f898ef5c6be291eb099120 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mislav=20Marohni=C4=87?= <git@mislav.net>
Date: Mon, 22 May 2023 12:17:19 +0200
Subject: [PATCH 16/18] Test in Go 1.20

---
 .github/workflows/push.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index ace273d..ba824bd 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -5,7 +5,7 @@ jobs:
   test:
     strategy:
       matrix:
-        go: [ '1.13', '1.15' ]
+        go: [ '1.14', '1.20' ]
         os: [ ubuntu-latest, macos-latest, windows-latest ]
       fail-fast: false
     

From 708f5e216d0e45e1c7591d4c1a226ad4e9ab08aa Mon Sep 17 00:00:00 2001
From: Sam Coe <samcoe@users.noreply.github.com>
Date: Thu, 5 Oct 2023 16:18:40 +0200
Subject: [PATCH 17/18] Update Go to 1.21, actions workflow dependencies, and
 golang.org/x/sys to address security vulnerability

---
 .github/workflows/push.yml | 8 ++++----
 README.md                  | 2 +-
 go.mod                     | 4 ++--
 go.sum                     | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index ba824bd..8e3ab5e 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -5,17 +5,17 @@ jobs:
   test:
     strategy:
       matrix:
-        go: [ '1.14', '1.20' ]
+        go: [ '1.21' ]
         os: [ ubuntu-latest, macos-latest, windows-latest ]
       fail-fast: false
-    
+
     runs-on: ${{ matrix.os }}
     name: Test suite
 
     steps:
-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v4
       - name: Setup go
-        uses: actions/setup-go@v1
+        uses: actions/setup-go@v4
         with:
           go-version: ${{ matrix.go }}
       - run: go test -v ./...
diff --git a/README.md b/README.md
index 30e55ef..8a46315 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ This fork adds:
 
 - `OpenReader` error wrapping;
 - `ErrNotFound` error wrapping on BSD;
-- Go 1.13 support.
+- Go 1.21 support.
 
 ## Usage
 
diff --git a/go.mod b/go.mod
index aee2bb2..7e06cbb 100644
--- a/go.mod
+++ b/go.mod
@@ -1,5 +1,5 @@
 module github.com/cli/browser
 
-go 1.14
+go 1.21
 
-require golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71
+require golang.org/x/sys v0.13.0
diff --git a/go.sum b/go.sum
index b459315..d4673ec 100644
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,2 @@
-golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71 h1:X/2sJAybVknnUnV7AD2HdT6rm2p5BP6eH2j+igduWgk=
-golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
+golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

From 7b54e0ad9a106b3ef8c6f66652d1614354ee4ed3 Mon Sep 17 00:00:00 2001
From: GreyXor <greyxor@protonmail.com>
Date: Fri, 6 Oct 2023 10:49:18 +0200
Subject: [PATCH 18/18] replace deprecated tempfile with createtemp

---
 browser.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/browser.go b/browser.go
index a0bd87e..63156ec 100644
--- a/browser.go
+++ b/browser.go
@@ -6,7 +6,6 @@ package browser
 import (
 	"fmt"
 	"io"
-	"io/ioutil"
 	"os"
 	"os/exec"
 	"path/filepath"
@@ -30,7 +29,7 @@ func OpenFile(path string) error {
 // OpenReader consumes the contents of r and presents the
 // results in a new browser window.
 func OpenReader(r io.Reader) error {
-	f, err := ioutil.TempFile("", "browser.*.html")
+	f, err := os.CreateTemp("", "browser.*.html")
 	if err != nil {
 		return fmt.Errorf("browser: could not create temporary file: %w", err)
 	}
