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: append, build variable and type switch #4940

Merged
merged 3 commits into from
May 28, 2019

Conversation

appleboy
Copy link
Member

  1. append chains to the same slice that can be done in a single append call
  2. when predeclared identifiers shadowed in assignments
  3. loops that copy big objects during each iteration
  4. type switches that can benefit from type guard clause with a variable

@appleboy appleboy added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Sep 15, 2018
@appleboy appleboy added this to the 1.6.0 milestone Sep 15, 2018
@lafriks lafriks modified the milestones: 1.6.0, 1.7.0 Sep 15, 2018
@lafriks lafriks added the status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR label Sep 15, 2018
@lafriks
Copy link
Member

lafriks commented Sep 15, 2018

Blocked till 1.6.0-rc1 is released

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 15, 2018
models/user.go Outdated
@@ -14,6 +14,7 @@ import (
"errors"
"fmt"
"image"

Copy link
Member

Choose a reason for hiding this comment

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

Why space?

Copy link
Member Author

Choose a reason for hiding this comment

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

See a4f370b

@lunny lunny removed the status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR label Oct 18, 2018
@techknowlogick techknowlogick modified the milestones: 1.7.0, 1.8.0 Dec 19, 2018
@stale
Copy link

stale bot commented Feb 17, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 17, 2019
@lafriks
Copy link
Member

lafriks commented Feb 17, 2019

Please resolve conflicts and sorry for forgetting to review it

@stale stale bot removed the issue/stale label Feb 17, 2019
@techknowlogick techknowlogick modified the milestones: 1.8.0, 1.9.0 Feb 19, 2019
@stale
Copy link

stale bot commented Apr 20, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Apr 20, 2019
@lafriks
Copy link
Member

lafriks commented Apr 20, 2019

@appleboy conflicts

@stale stale bot removed the issue/stale label Apr 20, 2019
@appleboy
Copy link
Member Author

@lafriks resolved conflicts.

isInt = false
}

switch right := right.(type) {
switch v := right.(type) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we not refactor this further to get rid of the code duplication completely?

@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 May 28, 2019
@@ -43,8 +43,7 @@ func TestUpdateAssignee(t *testing.T) {
assert.NoError(t, err)

var expectedAssignees []*User
expectedAssignees = append(expectedAssignees, user2)
expectedAssignees = append(expectedAssignees, user3)
expectedAssignees = append(expectedAssignees, user2, user3)
Copy link
Member

@lunny lunny May 28, 2019

Choose a reason for hiding this comment

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

I think this may changed the tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

@lunny I don't know what do you mean?

@codecov-io
Copy link

codecov-io commented May 28, 2019

Codecov Report

Merging #4940 into master will decrease coverage by <.01%.
The diff coverage is 56.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4940      +/-   ##
==========================================
- Coverage   41.43%   41.43%   -0.01%     
==========================================
  Files         442      442              
  Lines       59693    59692       -1     
==========================================
- Hits        24735    24733       -2     
- Misses      31721    31722       +1     
  Partials     3237     3237
Impacted Files Coverage Δ
routers/user/auth_openid.go 0% <0%> (ø) ⬆️
models/migrations/v64.go 0% <0%> (ø) ⬆️
modules/templates/helper.go 47.48% <0%> (+0.13%) ⬆️
modules/base/tool.go 72.54% <100%> (ø) ⬆️
models/user.go 51.45% <33.33%> (ø) ⬆️
modules/log/colors_router.go 83.33% <0%> (-4.17%) ⬇️
modules/log/event.go 64.46% <0%> (-1.53%) ⬇️
models/repo_list.go 73.09% <0%> (+1.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31557b1...37b81ed. Read the comment docs.

@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 May 28, 2019
@appleboy appleboy merged commit 743697a into go-gitea:master May 28, 2019
@appleboy appleboy deleted the refactor2 branch May 28, 2019 15:45
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this pull request Jul 18, 2019
* refactor: append, build variable and type switch

* fix: remove redundant space.
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
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.

None yet

9 participants