Skip to content

Commit

Permalink
Fixing linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyToumieh authored Dec 12, 2024
1 parent 33409a0 commit b793c59
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions cmd/gcsim/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ can be viewed in the browser via "go tool pprof -http=localhost:3000 mem.prof" (
shareKey = os.Getenv("GCSIM_SHARE_KEY")
}

var secondaryOutput string
var secondaryOutputGZ bool = false
var secondOutput string
var secondOutputGZ = false

if opt.serve {
// save output information in case -s and -out were both used in the same command
if opt.out != "" {
secondaryOutput = opt.out;
secondaryOutputGZ = opt.gz;
secondOutput = opt.out;

Check failure on line 140 in cmd/gcsim/main.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofmt`-ed with `-s` (gofmt)
secondOutputGZ = opt.gz;
}

opt.out = resultServeFile
Expand Down Expand Up @@ -179,18 +180,14 @@ can be viewed in the browser via "go tool pprof -http=localhost:3000 mem.prof" (
hash, _ = res.Sign(shareKey)
fmt.Println(res.PrettyPrint())

if simopt.ResultSaveToPath != "" {
err = res.Save(simopt.ResultSaveToPath, simopt.GZIPResult)
if err != nil {
return err
}
err = saveResult(res, simopt.ResultSaveToPath, simopt.GZIPResult);
if err != nil {
return err
}

if secondaryOutput != "" {
err = res.Save(secondaryOutput, secondaryOutputGZ)
if err != nil {
return err
}
err = saveResult(res, secondOutput, secondOutputGZ);

Check failure on line 188 in cmd/gcsim/main.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed (goimports)
if err != nil {
return err
}
}

Expand Down Expand Up @@ -339,6 +336,14 @@ func writeSample(seed uint64, outputPath, config string, gz bool, simopt simulat
return nil
}

func saveResult(res *model.SimulationResult, path string, gz bool) error {
if path == "" {
return nil
}

return res.Save(path, gz)
}

func update(version string) error {
src, err := selfupdate.NewGitHubSource(selfupdate.GitHubConfig{})
if err != nil {
Expand Down

0 comments on commit b793c59

Please sign in to comment.