diff options
author | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-03-14 13:40:15 +0300 |
---|---|---|
committer | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2023-03-16 05:50:46 +0300 |
commit | 936640076881092ad60202823f2dc81828aa4b6d (patch) | |
tree | aa79a72dd5362f5185f5b55e8265d7106a9625a6 /internal/gitaly/service/operations/submodules_test.go | |
parent | 5c42c9509ff0fab716f7b903b9dc4be77f1c15d9 (diff) |
lint: Fix manual quote interpolation offenses
This commit fixes manually quoted string interpolation with '%s' and
"%s". Quoting this way doesn't escape special characters such as endline
and makes debugging harder later. We encourage to use %q verb instead.
Diffstat (limited to 'internal/gitaly/service/operations/submodules_test.go')
-rw-r--r-- | internal/gitaly/service/operations/submodules_test.go | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/internal/gitaly/service/operations/submodules_test.go b/internal/gitaly/service/operations/submodules_test.go index 88d2306e7..a5aac1610 100644 --- a/internal/gitaly/service/operations/submodules_test.go +++ b/internal/gitaly/service/operations/submodules_test.go @@ -55,7 +55,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -85,7 +85,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -115,7 +115,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "foo/sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "foo/sub", subRepoPath), }, gittest.TreeEntry{ Mode: "040000", @@ -161,7 +161,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -203,7 +203,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -232,7 +232,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -261,7 +261,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -290,7 +290,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -319,7 +319,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -349,7 +349,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -378,7 +378,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -407,7 +407,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -437,7 +437,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -469,7 +469,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -501,7 +501,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -584,7 +584,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -615,7 +615,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -648,7 +648,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, )) @@ -684,7 +684,7 @@ func testUserUpdateSubmodule(t *testing.T, ctx context.Context) { gittest.TreeEntry{ Mode: "100644", Path: ".gitmodules", - Content: fmt.Sprintf(`[submodule "%s"]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), + Content: fmt.Sprintf(`[submodule %q]\n\tpath = %s\n\turl = file://%s`, "sub", "sub", subRepoPath), }, gittest.TreeEntry{OID: subCommitID, Mode: "160000", Path: "sub"}, ), |