Skip to content

Commit 6392fa4

Browse files
authored
Merge pull request #46 from progrium/drop-ioutil-usage
feat: remove ioutil usage
2 parents 7f6b374 + a9ea9d5 commit 6392fa4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

basher.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package basher
44
import (
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"log"
98
"os"
109
"os/exec"
@@ -165,12 +164,12 @@ func (c *Context) CopyEnv() {
165164
}
166165

167166
// Source adds a shell script to the Context environment. The loader argument can be nil
168-
// which means it will use ioutil.Readfile and load from disk, but it exists so you
167+
// which means it will use os.Readfile and load from disk, but it exists so you
169168
// can use the Asset function produced by go-bindata when including script files in
170169
// your Go binary. Calls to Source adds files to the environment in order.
171170
func (c *Context) Source(filepath string, loader func(string) ([]byte, error)) error {
172171
if loader == nil {
173-
loader = ioutil.ReadFile
172+
loader = os.ReadFile
174173
}
175174
data, err := loader(filepath)
176175
if err != nil {
@@ -218,7 +217,7 @@ func (c *Context) HandleFuncs(args []string) bool {
218217
}
219218

220219
func (c *Context) buildEnvfile() (string, error) {
221-
file, err := ioutil.TempFile(os.TempDir(), "bashenv.")
220+
file, err := os.CreateTemp(os.TempDir(), "bashenv.")
222221
if err != nil {
223222
return "", err
224223
}

0 commit comments

Comments
 (0)