Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mnako
Copy link
Owner

@mnako mnako commented Jan 26, 2025

#119 is going to need a lot of tests to make sure that it didn't break anything.

As pre-work, I want to clean up tests by moving them to a separate letters_test package to enforce testing through public interfaces[1][2]. This has already helped me uncover a minor mistake, in which attachment ContentDisposition and inline ContentDisposition were not exported from structs.go and therefore could not be used outside of the package.

(This was minor, because ContentDisposition is just a string type, so the relevant comparison could still be made by our users, but it was inelegant and defeated the purpose of having the ContentDisposition type.)

This PR adds a .golangci.yaml file for the linter and explicitly enables testpackage that enforces just that.

There is a number of linters that I have left commented out. Those are mainly formatting- and complexity-related. I would like to have them all enabled before letters hits 1.0, but since some of them require reformatting huge chunks of code, I plan to enable them one-by-one in separate PRs.


[1] https://pkg.go.dev/testing
[2] https://jdkaplan.dev/thinkin-logs/2021-10-07/

…ackage to enforce testing through public interfaces
@mnako mnako requested a review from ValleyCrisps January 26, 2025 12:52
@mnako mnako self-assigned this Jan 26, 2025
bump golangci-lint from v1.61.0 to v1.63.4.
@mnako mnako merged commit b86e62c into main Jan 26, 2025
6 checks passed
@mnako mnako deleted the feature/testpackage branch January 26, 2025 13:28
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