Skip to content

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
Contributor

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]

@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
Contributor

@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