refactor: rename output field

This commit is contained in:
张泊明518370910136 2024-03-05 05:37:01 -05:00
parent cf53fc7947
commit 2e80543abf
GPG Key ID: D47306D7062CDA9D
3 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ go build -o ./build/joj3 ./cmd/joj3
+ cd ./_example/simple + cd ./_example/simple
+ ./../../build/joj3 + ./../../build/joj3
+ cat ./joj3_result.json + cat ./joj3_result.json
[{"Name":"compile","ParserResults":[{"Score":100,"Comment":"compile done, executor status: run time: 265269232 ns, memory: 57790464 bytes"}]},{"Name":"run","ParserResults":[{"Score":100,"Comment":"executor status: run time: 2033735 ns, memory: 13225984 bytes"},{"Score":100,"Comment":"executor status: run time: 3117399 ns, memory: 14548992 bytes"}]}] [{"Name":"compile","Results":[{"Score":100,"Comment":"compile done, executor status: run time: 265269232 ns, memory: 57790464 bytes"}]},{"Name":"run","Results":[{"Score":100,"Comment":"executor status: run time: 2033735 ns, memory: 13225984 bytes"},{"Score":100,"Comment":"executor status: run time: 3117399 ns, memory: 14548992 bytes"}]}]
+ rm -f ./joj3_result.json + rm -f ./joj3_result.json
+ cd - + cd -
``` ```
@ -27,7 +27,7 @@ Each stage contains a executor and parser.
Executor takes a `Cmd` and returns a `ExecutorResult`. Executor takes a `Cmd` and returns a `ExecutorResult`.
Parser takes a `ExecutorResult` and its config and returns a `ParserResult`. Parser takes a `ExecutorResult` and its config and returns a `ParserResult` and `bool` to indicate whether we should skip the rest stages.
### `Cmd` ### `Cmd`

View File

@ -164,6 +164,6 @@ type ParserResult struct {
} }
type StageResult struct { type StageResult struct {
Name string Name string
ParserResults []ParserResult Results []ParserResult
} }

View File

@ -25,8 +25,8 @@ func Run(stages []Stage) []StageResult {
} }
slog.Debug("parser run done", "results", parserResults) slog.Debug("parser run done", "results", parserResults)
stageResults = append(stageResults, StageResult{ stageResults = append(stageResults, StageResult{
Name: stage.Name, Name: stage.Name,
ParserResults: parserResults, Results: parserResults,
}) })
if end { if end {
break break