Skip to content

Commit 43d410f

Browse files
committed
Merge branch 'improve-1'
2 parents 5597ed8 + 7cb3f4b commit 43d410f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

errgoengine.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (e *ErrgoEngine) Analyze(workingPath, msg string) (*CompiledErrorTemplate,
160160
return template, contextData, nil
161161
}
162162

163-
func (e *ErrgoEngine) Translate(template *CompiledErrorTemplate, contextData *ContextData) string {
163+
func (e *ErrgoEngine) Translate(template *CompiledErrorTemplate, contextData *ContextData) (mainExp string, fullExp string) {
164164
expGen := &ExplainGenerator{errorName: template.Name}
165165
fixGen := &BugFixGenerator{}
166166

@@ -170,5 +170,6 @@ func (e *ErrgoEngine) Translate(template *CompiledErrorTemplate, contextData *Co
170170

171171
output := e.OutputGen.Generate(contextData, expGen, fixGen)
172172
defer e.OutputGen.Reset()
173-
return output
173+
174+
return expGen.mainExp.String(), output
174175
}

error_templates/test_utils/test_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (cases TestCases) Execute(t *testing.T) {
183183
)
184184
}
185185

186-
output := cases.engine.Translate(template, data)
186+
_, output := cases.engine.Translate(template, data)
187187
if output != tCase.ExpectedOutput {
188188
diff := dmp.DiffMain(escapeOutput(tCase.ExpectedOutput), escapeOutput(output), true)
189189
t.Errorf("\n======== Expected ========\n%s\n=========== Got ===========\n%s\n=========== Diff===========\n%s", tCase.ExpectedOutput, output, dmp.DiffPrettyText(diff))

0 commit comments

Comments
 (0)