Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix minor unreachable code caused by t.Fatal #14045

Merged
merged 1 commit into from
Aug 8, 2022
Merged

Conversation

Abirdcfly
Copy link
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
Copy link

hashicorp-cla commented Aug 8, 2022

CLA assistant check
All committers have signed the CLA.

@shoenig
Copy link
Member

shoenig commented Aug 8, 2022

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
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.

Copy link
Member

@shoenig shoenig left a comment

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
Copy link

github-actions bot commented Dec 7, 2022

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