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

Refactor New methods to use T interface #42

Merged
merged 2 commits into from
Sep 14, 2021

Conversation

pellared
Copy link
Contributor

@pellared pellared commented May 11, 2021

Why

There is no need to depend on testing package in the "production" code.

What

  • New and NewRelaxed methods accept t T instead of t *t.testing.

@@ -33,7 +33,7 @@ func callerName(skip int) string {
// the purpose of decorating log messages.
const maxStackLen = 50

var reIsSourceFile = regexp.MustCompile("is(-1.7)?\\.go$")
var reIsSourceFile = regexp.MustCompile(`is(-1.7)?\.go$`)
Copy link
Contributor Author

@pellared pellared May 11, 2021

Choose a reason for hiding this comment

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

Linter complained: https://staticcheck.io/docs/checks#S1007
So I decided to refactor this line as well.

@AlekSi
Copy link
Contributor

AlekSi commented Jul 23, 2021

There is no need to depend on testing package in the "production" code.

But why would you import that package in a non *_test.go files?

@pellared
Copy link
Contributor Author

pellared commented Jul 23, 2021

There is no need to depend on testing package in the "production" code.

But why would you import that package in a non *_test.go files?

So it can be used with https://github.com/goyek/goyek to make assertions

@matryer
Copy link
Owner

matryer commented Sep 14, 2021

Sorry I missed this.

@matryer matryer merged commit fb18f75 into matryer:master Sep 14, 2021
@pellared pellared deleted the refactor-new-method branch September 14, 2021 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants