Skip to content

fix minor unreachable code caused by t.Fatal#14045

Merged
shoenig merged 1 commit into
hashicorp:mainfrom
Abirdcfly:main
Aug 8, 2022
Merged

fix minor unreachable code caused by t.Fatal#14045
shoenig merged 1 commit into
hashicorp:mainfrom
Abirdcfly:main

Conversation

@Abirdcfly

Copy link
Copy Markdown
Contributor

https://pkg.go.dev/testing#T.Fatalf

Fatalf is equivalent to Logf followed by FailNow.

see https://go.dev/play/p/I6MX-QOTC9n for example:

package main

import (
	"testing"
)

func TestLastIndex(t *testing.T) {
	t.Errorf("first line")
	t.Errorf("second line")
	t.Fatalf("t.Fatalf will cause exit")
	t.Fatalf("so this line cant reach")
}

/* output:
=== RUN   TestLastIndex
    prog.go:8: first line
    prog.go:9: second line
    prog.go:10: t.Fatalf will cause exit
--- FAIL: TestLastIndex (0.00s)
FAIL

Program exited.
*/

@hashicorp-cla

hashicorp-cla commented Aug 8, 2022

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@shoenig

shoenig commented Aug 8, 2022

Copy link
Copy Markdown
Contributor

Hi @Abirdcfly! I'm not sure why our CI didn't kick off for this PR, but I'm pretty sure the removal of multierror is going to cause a build failure for testing,

nomad/nomad/structs on Abirdcfly/main 
➜ go test
# github.com/hashicorp/nomad/nomad/structs [github.com/hashicorp/nomad/nomad/structs.test]
./structs_test.go:2321:22: undefined: multierror
./structs_test.go:7097:20: undefined: multierror
FAIL	github.com/hashicorp/nomad/nomad/structs [build failed]

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
@Abirdcfly

Copy link
Copy Markdown
Contributor Author

Hi @Abirdcfly! I'm not sure why our CI didn't kick off for this PR, but I'm pretty sure the removal of multierror is going to cause a build failure for testing,

nomad/nomad/structs on Abirdcfly/main 
➜ go test
# github.com/hashicorp/nomad/nomad/structs [github.com/hashicorp/nomad/nomad/structs.test]
./structs_test.go:2321:22: undefined: multierror
./structs_test.go:7097:20: undefined: multierror
FAIL	github.com/hashicorp/nomad/nomad/structs [build failed]

Thanks. revert import deleting.

@shoenig shoenig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thanks @Abirdcfly !

@shoenig shoenig merged commit 355761b into hashicorp:main Aug 8, 2022
@github-actions

github-actions Bot commented Dec 7, 2022

Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants