mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
Fix some typos in rules tests
This commit is contained in:
parent
e100f6b862
commit
23ef7009f9
1 changed files with 9 additions and 9 deletions
|
@ -699,7 +699,7 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
_, err := io.Copy(os.Stdout, r)
|
_, err = io.Copy(os.Stdout, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -725,7 +725,7 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
buf := make([]byte, 8)
|
buf := make([]byte, 8)
|
||||||
_, err := io.CopyBuffer(os.Stdout, r, buf)
|
_, err = io.CopyBuffer(os.Stdout, r, buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -1217,6 +1217,7 @@ func main() {
|
||||||
// command line arguments as it's arguments is considered dangerous
|
// command line arguments as it's arguments is considered dangerous
|
||||||
package main
|
package main
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -1311,7 +1312,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunCmd(command string) {
|
func RunCmd(command string) {
|
||||||
_, err := syscall.StartProcess(command, []string{}, nil)
|
_, _, err := syscall.StartProcess(command, []string{}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Error: %v\n", err)
|
fmt.Printf("Error: %v\n", err)
|
||||||
}
|
}
|
||||||
|
@ -1597,7 +1598,7 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
repoFile := "path_of_file"
|
repoFile := "path_of_file"
|
||||||
cleanRepoFile := filepath.Clean(repoFile)
|
cleanRepoFile := filepath.Clean(repoFile)
|
||||||
byContext, err := os.OpenFile(cleanRepoFile, os.O_RDONLY, 0600)
|
_, err := os.OpenFile(cleanRepoFile, os.O_RDONLY, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -1611,7 +1612,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func openFile(filePath string) {
|
func openFile(filePath string) {
|
||||||
byContext, err := os.OpenFile(filepath.Clean(filePath), os.O_RDONLY, 0600)
|
_, err := os.OpenFile(filepath.Clean(filePath), os.O_RDONLY, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -1632,7 +1633,7 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
repoFile := "path_of_file"
|
repoFile := "path_of_file"
|
||||||
relFile := filepath.Rel(repoFile)
|
relFile := filepath.Rel(repoFile)
|
||||||
byContext, err := os.OpenFile(relFile, os.O_RDONLY, 0600)
|
_, err := os.OpenFile(relFile, os.O_RDONLY, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -2054,7 +2055,6 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}`}, 0, gosec.NewConfig()}}
|
}`}, 0, gosec.NewConfig()}}
|
||||||
|
|
||||||
// SampleCodeG403 - weak key strength
|
// SampleCodeG403 - weak key strength
|
||||||
|
@ -2109,7 +2109,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
)
|
)
|
||||||
func main() {
|
func main() {
|
||||||
gen := rand.New(rand.NewSource(10.4))
|
gen := rand.New(rand.NewSource(10))
|
||||||
bad := gen.Int()
|
bad := gen.Int()
|
||||||
println(bad)
|
println(bad)
|
||||||
}`}, 1, gosec.NewConfig()},
|
}`}, 1, gosec.NewConfig()},
|
||||||
|
@ -2243,7 +2243,7 @@ func main() {
|
||||||
printVector()
|
printVector()
|
||||||
|
|
||||||
zero, c_star, c := foo()
|
zero, c_star, c := foo()
|
||||||
fmt.Printf("%d %v %s", zero, c_start, c)
|
fmt.Printf("%d %v %s", zero, c_star, c)
|
||||||
}`,
|
}`,
|
||||||
}, 1, gosec.NewConfig()},
|
}, 1, gosec.NewConfig()},
|
||||||
{[]string{`
|
{[]string{`
|
||||||
|
|
Loading…
Reference in a new issue