diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-11-11 15:44:11 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-11-12 17:39:42 +0300 |
commit | 535484153103e4706439e39015c7852da2d14531 (patch) | |
tree | 475662426c97e1470ba888c1b27ea6646cb3fad4 | |
parent | f8fb50aa1610d9f2cdeab79ddf2d46ae671f8cee (diff) |
lint: Enable linter for unkeyed fields
We've added a special exclude rule for the govet linter such that it
doesn't bug us about use of unkeyed fields in composite literals. We
only have two callsites which get this wrong though, and using field
names is preferable such that we don't by mistake assign a value to the
wrong field.
Reenable this linter and fix the two violations.
-rw-r--r-- | .golangci.yml | 3 | ||||
-rw-r--r-- | internal/gitaly/service/repository/redirecting_test_server_test.go | 2 | ||||
-rw-r--r-- | internal/gitaly/service/ssh/upload_pack_test.go | 2 |
3 files changed, 2 insertions, 5 deletions
diff --git a/.golangci.yml b/.golangci.yml index 6eefcc7f3..54f068ed3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -712,9 +712,6 @@ issues: ## END staticcheck exclusions # govet checks all struct initializations must be keyed by field names - linters: - - govet - text: "composite literal uses unkeyed fields" - - linters: - stylecheck text: "at least one file in a package should have a package comment" - path: "_test.go" diff --git a/internal/gitaly/service/repository/redirecting_test_server_test.go b/internal/gitaly/service/repository/redirecting_test_server_test.go index 82fe85e51..aa63eccab 100644 --- a/internal/gitaly/service/repository/redirecting_test_server_test.go +++ b/internal/gitaly/service/repository/redirecting_test_server_test.go @@ -51,7 +51,7 @@ func TestRedirectingServerRedirects(t *testing.T) { cmd, err := git.NewExecCommandFactory(cfg).NewWithoutRepo(ctx, git.SubCmd{ Name: "clone", Flags: []git.Option{ - git.Flag{"--bare"}, + git.Flag{Name: "--bare"}, }, Args: []string{ redirectingServer.URL, dir, diff --git a/internal/gitaly/service/ssh/upload_pack_test.go b/internal/gitaly/service/ssh/upload_pack_test.go index cfdff03e7..02d8893cf 100644 --- a/internal/gitaly/service/ssh/upload_pack_test.go +++ b/internal/gitaly/service/ssh/upload_pack_test.go @@ -243,7 +243,7 @@ func testUploadPackCloneSuccess(t *testing.T, opts ...testcfg.Option) { cmd: git.SubCmd{ Name: "clone", Flags: []git.Option{ - git.ValueFlag{"--depth", "1"}, + git.ValueFlag{Name: "--depth", Value: "1"}, }, Args: []string{"git@localhost:test/test.git", localRepoPath}, }, |