mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	format with gofumpt (#18184)
* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
This commit is contained in:
		| @@ -32,8 +32,8 @@ import ( | ||||
| ) | ||||
|  | ||||
| const ( | ||||
| 	littleSize = 1024              //1ko | ||||
| 	bigSize    = 128 * 1024 * 1024 //128Mo | ||||
| 	littleSize = 1024              // 1ko | ||||
| 	bigSize    = 128 * 1024 * 1024 // 128Mo | ||||
| ) | ||||
|  | ||||
| func TestGit(t *testing.T) { | ||||
| @@ -96,15 +96,15 @@ func testGit(t *testing.T, u *url.URL) { | ||||
| 		t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, sshContext.Username, perm.AccessModeRead)) | ||||
| 		t.Run("ForkFromDifferentUser", doAPIForkRepository(sshContext, forkedUserCtx.Username)) | ||||
|  | ||||
| 		//Setup key the user ssh key | ||||
| 		// Setup key the user ssh key | ||||
| 		withKeyFile(t, keyname, func(keyFile string) { | ||||
| 			t.Run("CreateUserKey", doAPICreateUserKey(sshContext, "test-key", keyFile)) | ||||
|  | ||||
| 			//Setup remote link | ||||
| 			//TODO: get url from api | ||||
| 			// Setup remote link | ||||
| 			// TODO: get url from api | ||||
| 			sshURL := createSSHUrl(sshContext.GitPath(), u) | ||||
|  | ||||
| 			//Setup clone folder | ||||
| 			// Setup clone folder | ||||
| 			dstPath, err := os.MkdirTemp("", sshContext.Reponame) | ||||
| 			assert.NoError(t, err) | ||||
| 			defer util.RemoveAll(dstPath) | ||||
| @@ -135,7 +135,6 @@ func ensureAnonymousClone(t *testing.T, u *url.URL) { | ||||
| 	assert.NoError(t, err) | ||||
| 	defer util.RemoveAll(dstLocalPath) | ||||
| 	t.Run("CloneAnonymous", doGitClone(dstLocalPath, u)) | ||||
|  | ||||
| } | ||||
|  | ||||
| func standardCommitAndPushTest(t *testing.T, dstPath string) (little, big string) { | ||||
| @@ -300,13 +299,13 @@ func lockFileTest(t *testing.T, filename, repoPath string) { | ||||
| func doCommitAndPush(t *testing.T, size int, repoPath, prefix string) string { | ||||
| 	name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two", prefix) | ||||
| 	assert.NoError(t, err) | ||||
| 	_, err = git.NewCommand("push", "origin", "master").RunInDir(repoPath) //Push | ||||
| 	_, err = git.NewCommand("push", "origin", "master").RunInDir(repoPath) // Push | ||||
| 	assert.NoError(t, err) | ||||
| 	return name | ||||
| } | ||||
|  | ||||
| func generateCommitWithNewData(size int, repoPath, email, fullName, prefix string) (string, error) { | ||||
| 	//Generate random file | ||||
| 	// Generate random file | ||||
| 	bufSize := 4 * 1024 | ||||
| 	if bufSize > size { | ||||
| 		bufSize = size | ||||
| @@ -339,7 +338,7 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin | ||||
| 		return "", err | ||||
| 	} | ||||
|  | ||||
| 	//Commit | ||||
| 	// Commit | ||||
| 	// Now here we should explicitly allow lfs filters to run | ||||
| 	globalArgs := allowLFSFilters() | ||||
| 	err = git.AddChangesWithArgs(repoPath, globalArgs, false, filepath.Base(tmpFile.Name())) | ||||
| @@ -639,7 +638,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB | ||||
| 		t.Run("CreateHeadBranch", doGitCreateBranch(dstPath, headBranch)) | ||||
|  | ||||
| 		t.Run("AddCommit", func(t *testing.T) { | ||||
| 			err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0666) | ||||
| 			err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content"), 0o666) | ||||
| 			if !assert.NoError(t, err) { | ||||
| 				return | ||||
| 			} | ||||
| @@ -713,7 +712,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB | ||||
| 		} | ||||
|  | ||||
| 		t.Run("AddCommit2", func(t *testing.T) { | ||||
| 			err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0666) | ||||
| 			err := os.WriteFile(path.Join(dstPath, "test_file"), []byte("## test content \n ## test content 2"), 0o666) | ||||
| 			if !assert.NoError(t, err) { | ||||
| 				return | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user