Skip to content

unbind the CheckConsistency for some structs so that they can be moved to sub packages easier #17612

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

Merged
merged 3 commits into from
Nov 12, 2021

Conversation

lunny
Copy link
Member

@lunny lunny commented Nov 11, 2021

As title.

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Nov 11, 2021
@lunny lunny force-pushed the lunny/refactor_consistent_check branch from a601905 to 22bf7e7 Compare November 11, 2021 06:33
@wxiaoguang
Copy link
Contributor

I can see github.com/stretchr/testify/assert and t *testing.T in non-unit-test code.

Should they be moved into unit test code?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 11, 2021
@lunny
Copy link
Member Author

lunny commented Nov 11, 2021

I can see github.com/stretchr/testify/assert and t *testing.T in non-unit-test code.

Should they be moved into unit test code?

I have tried that. Unfortunately, they cannot. I think that's should be a limit of Golang test file. You cannot import a function on a test file.

@wxiaoguang
Copy link
Contributor

How about using a separate package for unit test related code, then maybe this package won't be compiled for releases.

@lunny
Copy link
Member Author

lunny commented Nov 11, 2021

How about using a separate package for unit test related code, then maybe this package won't be compiled for releases.

We can't do that. That will result in recycle import. The new package will depend models, but models will use method CheckConsistencyFor.

@lunny lunny force-pushed the lunny/refactor_consistent_check branch from 22bf7e7 to 7113f15 Compare November 11, 2021 12:24
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 11, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 11, 2021
@lunny lunny merged commit 0db7a32 into go-gitea:main Nov 12, 2021
@lunny lunny deleted the lunny/refactor_consistent_check branch November 12, 2021 00:56
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
…d to sub packages easier (go-gitea#17612)

* unbind the CheckConsistency for some structs so that they can be moved to sub packages easier

* Fix functions name

* Fix typo
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants