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

Skip to content

Conversation

lunny
Copy link
Member

@lunny lunny commented Apr 8, 2025

Follow #31035

@lunny lunny added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Apr 8, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 8, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 8, 2025
@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 Apr 8, 2025
// 2 - check whether the repository with the same storage exists
isExist, err := gitrepo.IsRepositoryExist(ctx, generateRepo)
var isExist bool
isExist, err = gitrepo.IsRepositoryExist(ctx, generateRepo)
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not think it is a bug

Copy link
Member Author

Choose a reason for hiding this comment

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

line 103 will check if err is nil. Since the directory exist, we need to cleanupReposioty, so that this err should be the returned parameter but not a local variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Show me why


func TestError(t *testing.T) {
	f := func(t *testing.T) (err error) {
		defer func() {
			assert.ErrorContains(t, err, "error")
		}()
		val, err := 1, nil
		_ = val
		_ = err
		assert.NoError(t, err)
		return errors.New("error")
	}
	assert.ErrorContains(t, f(t), "error")
}

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. I see. The return will assign the error to the returned parameter err.

@wxiaoguang wxiaoguang marked this pull request as draft April 8, 2025 06:03
@lunny lunny closed this Apr 8, 2025
@lunny lunny deleted the lunny/fix_temp_check branch April 8, 2025 06:34
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/go Pull requests that update Go code skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants