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

[chore] Different error message for email validation from net/mail parsing on go 1.21.8 and above #2760

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

blakesmith
Copy link
Contributor

@blakesmith blakesmith commented Mar 15, 2024

go 1.21.8 fixed some minor issues in net/mail that causes the test suite to fail for some mail validation cases. Although we're not on go 1.21.8 yet, make the test forward and backwards compatible.

See: golang/go@263c059

Running the test suite with go 1.21.8 leads to test failures like:

-- FAIL: TestValidationTestSuite (0.00s)
    --- FAIL: TestValidationTestSuite/TestValidateEmail (0.00s)
        formvalidation_test.go:147:
                Error Trace:    /home/blake/src/gotosocial/internal/validate/formvalidation_test.go:147
                Error:          Not equal:
                                expected: &errors.errorString{s:"mail: no angle-addr"}
                                actual  : &errors.errorString{s:"mail: missing word in phrase: mail: invalid string"}

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -1,3 +1,3 @@
                                 (*errors.errorString)({
                                - s: (string) (len=19) "mail: no angle-addr"
                                + s: (string) (len=50) "mail: missing word in phrase: mail: invalid string"
                                 })
                Test:           TestValidationTestSuite/TestValidateEmail
FAIL
FAIL    github.com/superseriousbusiness/gotosocial/internal/validate    0.006s

This cropped up when trying to update the gotosocial nix package to 0.14.2, while at the same time nix updated its go release to 1.21.8. NixOS/nixpkgs#295584

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have not leveraged AI to create the proposed changes.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

… above

go 1.21.8 fixed some minor issues in net/mail that causes the test suite to fail
for some mail validation cases. Although we're not on go 1.21.8 yet, make the test
forward and backwards compatible.

See: golang/go@263c059
@tsmethurst
Copy link
Contributor

Looks good, thanks for the fix :)

@tsmethurst tsmethurst merged commit 1557883 into superseriousbusiness:main Mar 15, 2024
2 checks passed
blakesmith added a commit to blakesmith/nixpkgs that referenced this pull request Mar 15, 2024
golang 1.21.8 introduced some minor test suite breakages in gotosocial. Skip
these tests for now. See: superseriousbusiness/gotosocial#2760
yayayayaka pushed a commit to NixOS/nixpkgs that referenced this pull request Mar 18, 2024
golang 1.21.8 introduced some minor test suite breakages in gotosocial. Skip
these tests for now. See: superseriousbusiness/gotosocial#2760
github-actions bot pushed a commit to NixOS/nixpkgs that referenced this pull request Mar 18, 2024
golang 1.21.8 introduced some minor test suite breakages in gotosocial. Skip
these tests for now. See: superseriousbusiness/gotosocial#2760

(cherry picked from commit 3fe3493)
blakesmith added a commit to blakesmith/nixpkgs that referenced this pull request Mar 23, 2024
golang 1.21.8 introduced some minor test suite breakages in gotosocial. Skip
these tests for now. See: superseriousbusiness/gotosocial#2760

(cherry picked from commit e5b3215)
jugendhacker added a commit to jugendhacker/nixpkgs that referenced this pull request Apr 20, 2024
zeme-wana pushed a commit to input-output-hk/nixpkgs that referenced this pull request May 8, 2024
golang 1.21.8 introduced some minor test suite breakages in gotosocial. Skip
these tests for now. See: superseriousbusiness/gotosocial#2760

(cherry picked from commit e5b3215)
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.

2 participants