mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
Include secure as part of build process
This commit is contained in:
parent
ac57667887
commit
d7a34843af
@ -2,4 +2,4 @@
|
|||||||
set -ex
|
set -ex
|
||||||
go get golang.org/x/tools/cmd/goimports
|
go get golang.org/x/tools/cmd/goimports
|
||||||
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.37.1
|
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.37.1
|
||||||
# wget -O- -nv https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s v2.8.1
|
wget -O- -nv https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s v2.9.1
|
||||||
|
@ -3,7 +3,6 @@ package test
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
@ -69,24 +68,3 @@ func AssertResultWithContext(t *testing.T, expectedValue interface{}, actualValu
|
|||||||
t.Error(": expected <", expectedValue, "> but got <", actualValue, ">")
|
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)
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user