refactor: rand.Seed not required anymore
This commit is contained in:
		
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							| @@ -6,13 +6,11 @@ package main | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"math/rand" |  | ||||||
| 	"os" | 	"os" | ||||||
| 	"os/exec" | 	"os/exec" | ||||||
| 	"runtime" | 	"runtime" | ||||||
| 	"runtime/debug" | 	"runtime/debug" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" |  | ||||||
|  |  | ||||||
| 	"github.com/natefinch/lumberjack" | 	"github.com/natefinch/lumberjack" | ||||||
| 	"github.com/rs/zerolog" | 	"github.com/rs/zerolog" | ||||||
| @@ -99,8 +97,6 @@ func (v VersionFlag) BeforeApply(app *kong.Kong, vars kong.Vars) error { | |||||||
| } | } | ||||||
|  |  | ||||||
| func main() { | func main() { | ||||||
| 	rand.Seed(time.Now().UnixNano()) |  | ||||||
|  |  | ||||||
| 	cli := CLI{} | 	cli := CLI{} | ||||||
| 	ctx := kong.Parse(&cli, | 	ctx := kong.Parse(&cli, | ||||||
| 		kong.Name("out-of-tree"), | 		kong.Name("out-of-tree"), | ||||||
|   | |||||||
| @@ -282,8 +282,6 @@ func (q *System) Args() (qemuArgs []string) { | |||||||
|  |  | ||||||
| // Start qemu process | // Start qemu process | ||||||
| func (q *System) Start() (err error) { | func (q *System) Start() (err error) { | ||||||
| 	rand.Seed(time.Now().UnixNano()) // Are you sure? |  | ||||||
|  |  | ||||||
| 	q.cmd = exec.Command(q.Executable(), q.Args()...) | 	q.cmd = exec.Command(q.Executable(), q.Args()...) | ||||||
| 	q.Log.Debug().Msgf("%v", q.cmd) | 	q.Log.Debug().Msgf("%v", q.cmd) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,10 +15,6 @@ import ( | |||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { |  | ||||||
| 	rand.Seed(time.Now().UnixNano()) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func TestSystemNew_InvalidKernelPath(t *testing.T) { | func TestSystemNew_InvalidKernelPath(t *testing.T) { | ||||||
| 	kernel := Kernel{Name: "Invalid", KernelPath: "/invalid/path"} | 	kernel := Kernel{Name: "Invalid", KernelPath: "/invalid/path"} | ||||||
| 	if _, err := NewSystem(X86x64, kernel, "/bin/sh"); err == nil { | 	if _, err := NewSystem(X86x64, kernel, "/bin/sh"); err == nil { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user