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

lint: Add testableexamples linter to have examples correctly tested. #1812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Matovidlo
Copy link
Contributor

@Matovidlo Matovidlo commented Jun 4, 2024

Jira: PSGO-682

Changes:

  • Add testableexamples linter to have Example correctly tested. (output have to be tested otherwise it makes no sense).

@Matovidlo Matovidlo force-pushed the lint-add-testableexamples-linter branch 2 times, most recently from 51b7c18 to f2cf032 Compare June 4, 2024 11:56
@Matovidlo Matovidlo force-pushed the lint-add-testableexamples-linter branch from f2cf032 to a7d1fac Compare June 5, 2024 06:08
@Matovidlo Matovidlo requested a review from michaljurecko June 14, 2024 08:54
Comment on lines -41 to 46
fmt.Println(errors.Format(err, errors.FormatWithStack()))
re := regexp.MustCompile(`\[.*/internal`)
fmt.Println(string(re.ReplaceAll([]byte(errors.Format(err, errors.FormatWithStack())), []byte("["))))
// output:
// original error [/pkg/utils/errors/example_test.go:40]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Examples without tests also make sense, for documentation.

Is it possible to define the output for each example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants