mirror of
https://gitee.com/mirrors_adrian-thurston/yq.git
synced 2026-01-15 07:53:35 +08:00
Include secure as part of build process
This commit is contained in:
@@ -3,7 +3,6 @@ package test
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -69,24 +68,3 @@ func AssertResultWithContext(t *testing.T, expectedValue interface{}, actualValu
|
||||
t.Error(": expected <", expectedValue, "> but got <", actualValue, ">")
|
||||
}
|
||||
}
|
||||
|
||||
func WriteTempYamlFile(content string) string {
|
||||
tmpfile, _ := ioutil.TempFile("", "testyaml")
|
||||
defer func() {
|
||||
_ = tmpfile.Close()
|
||||
}()
|
||||
|
||||
_, _ = tmpfile.Write([]byte(content))
|
||||
return tmpfile.Name()
|
||||
}
|
||||
|
||||
func ReadTempYamlFile(name string) string {
|
||||
// ignore CWE-22 gosec issue - that's more targetted for http based apps that run in a public directory,
|
||||
// and ensuring that it's not possible to give a path to a file outside thar directory.
|
||||
content, _ := ioutil.ReadFile(name) // #nosec
|
||||
return string(content)
|
||||
}
|
||||
|
||||
func RemoveTempYamlFile(name string) {
|
||||
_ = os.Remove(name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user