summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorRyooooooga <eial5q265e5@gmail.com>2022-04-01 23:24:27 +0900
committerJesse Duffield <jessedduffield@gmail.com>2022-04-02 08:48:38 +1100
commit2fbb52fa2cc1eaed9952206b0091b9ac2ee63d8b (patch)
tree6eeef93cba19ac58b2c158845dbf666b6be98baa /pkg
parente35ab3c5fe37340a624a0cd87b9e49fe27d369b0 (diff)
chore: remove dead code
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/oscommands/os.go21
-rw-r--r--pkg/commands/oscommands/os_test.go33
2 files changed, 0 insertions, 54 deletions
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go
index b6f018af5..a9c38e482 100644
--- a/pkg/commands/oscommands/os.go
+++ b/pkg/commands/oscommands/os.go
@@ -117,27 +117,6 @@ func (c *OSCommand) AppendLineToFile(filename, line string) error {
return nil
}
-// CreateTempFile writes a string to a new temp file and returns the file's name
-func (c *OSCommand) CreateTempFile(filename, content string) (string, error) {
- tmpfile, err := ioutil.TempFile("", filename)
- if err != nil {
- c.Log.Error(err)
- return "", utils.WrapError(err)
- }
- c.LogCommand(fmt.Sprintf("Creating temp file '%s'", tmpfile.Name()), false)
-
- if _, err := tmpfile.WriteString(content); err != nil {
- c.Log.Error(err)
- return "", utils.WrapError(err)
- }
- if err := tmpfile.Close(); err != nil {
- c.Log.Error(err)
- return "", utils.WrapError(err)
- }
-
- return tmpfile.Name(), nil
-}
-
// CreateFileWithContent creates a file with the given content
func (c *OSCommand) CreateFileWithContent(path string, content string) error {
c.LogCommand(fmt.Sprintf("Creating file '%s'", path), false)
diff --git a/pkg/commands/oscommands/os_test.go b/pkg/commands/oscommands/os_test.go
index 9c2d9a2a7..9b289ea0a 100644
--- a/pkg/commands/oscommands/os_test.go
+++ b/pkg/commands/oscommands/os_test.go
@@ -1,7 +1,6 @@
package oscommands
import (
- "io/ioutil"
"os"
"testing"
@@ -164,35 +163,3 @@ func TestOSCommandFileType(t *testing.T) {
_ = os.RemoveAll(s.path)
}
}
-
-func TestOSCommandCreateTempFile(t *testing.T) {
- type scenario struct {
- testName string
- filename string
- content string
- test func(string, error)
- }
-
- scenarios := []scenario{
- {
- "valid case",
- "filename",
- "content",
- func(path string, err error) {
- assert.NoError(t, err)
-
- content, err := ioutil.ReadFile(path)
- assert.NoError(t, err)
-
- assert.Equal(t, "content", string(content))
- },
- },
- }
-
- for _, s := range scenarios {
- s := s
- t.Run(s.testName, func(t *testing.T) {
- s.test(NewDummyOSCommand().CreateTempFile(s.filename, s.content))
- })
- }
-}