Skip to content

Commit 0fc43a2

Browse files
committed
internal/gojunitreport: Refactor testFileConfig to drop else block
1 parent ddf6b16 commit 0fc43a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/gojunitreport/go-junit-report_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ func testRun(inputFile, reportFile string, config Config, t *testing.T) {
8686
}
8787

8888
func testFileConfig(filename string) (config Config, reportFile string, err error) {
89-
var prefix string
90-
if idx := strings.IndexByte(filename, '-'); idx < 0 {
89+
idx := strings.IndexByte(filename, '-')
90+
if idx < 0 {
9191
return config, "", fmt.Errorf("testdata file does not contain a dash (-); expected name `{id}-{name}.txt` got `%s`", filename)
92-
} else {
93-
prefix = filename[:idx]
9492
}
93+
94+
prefix := filename[:idx]
9595
id, err := strconv.Atoi(prefix)
9696
if err != nil {
9797
return config, "", fmt.Errorf("testdata file did not start with a valid number: %w", err)

0 commit comments

Comments
 (0)