Skip to content

Commit

Permalink
fix return
Browse files Browse the repository at this point in the history
  • Loading branch information
fmhr committed Sep 20, 2023
1 parent 6e04b8f commit 2e80794
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions reactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"os/exec"
)

func ReactiveRun(ctf *Config, seed int) error {
func ReactiveRun(ctf *Config, seed int) (map[string]float64, error) {
rtn, err := reactiveRun(ctf, seed)
if err != nil {
return err
return rtn, err
}
fmt.Fprintln(os.Stderr, mapString(rtn))
fmt.Println(rtn["Score"]) // ここだけ標準出力
return nil
return nil, nil
}

func reactiveRun(ctf *Config, seed int) (map[string]float64, error) {
Expand Down
6 changes: 3 additions & 3 deletions runVis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"sort"
)

func RunVis(cnf *Config, seed int) error {
func RunVis(cnf *Config, seed int) (map[string]float64, error) {
rtn, err := runVis(cnf, seed)
if err != nil {
return err
return rtn, err
}
fmt.Fprintln(os.Stderr, mapString(rtn))
fmt.Println(rtn["Score"]) // ここだけ標準出力
return nil
return rtn, nil
}

// runVis は指定された設定とシードに基づいてコマンドを実行して、
Expand Down
4 changes: 2 additions & 2 deletions script.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func Fj() {
if len(seeds) == 0 {
var err error
if cnf.Reactive {
err = ReactiveRun(cnf, *seed)
_, err = ReactiveRun(cnf, *seed)
} else {
err = RunVis(cnf, *seed)
_, err = RunVis(cnf, *seed)
}
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 2e80794

Please sign in to comment.