Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-08-31 08:53:45 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-08-31 08:53:45 +0300
commitda12f147d256dadc5da02ef039aa83c6e13ab2ac (patch)
tree82c5886ad32e3e20bf3fe104df3a182fb4908e1e /cmd
parent1fd682939f5b2697e80dbe70cca057887ec2077d (diff)
global: Reformat sources with gofumpt
Reformat sources with gofumpt.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gitaly-blackbox/main.go4
-rw-r--r--cmd/gitaly-git2go/cherry_pick_test.go2
-rw-r--r--cmd/gitaly-git2go/conflicts/conflicts_test.go34
-rw-r--r--cmd/gitaly-git2go/rebase_test.go4
-rw-r--r--cmd/gitaly-git2go/resolve_conflicts.go3
-rw-r--r--cmd/gitaly-git2go/set_config.go3
-rw-r--r--cmd/gitaly-hooks/hooks.go10
-rw-r--r--cmd/gitaly-hooks/hooks_test.go14
-rw-r--r--cmd/gitaly-lfs-smudge/lfs_smudge_test.go20
-rw-r--r--cmd/gitaly/main.go4
-rw-r--r--cmd/praefect/main_test.go10
-rw-r--r--cmd/praefect/subcmd.go22
-rw-r--r--cmd/praefect/subcmd_dataloss_test.go3
13 files changed, 62 insertions, 71 deletions
diff --git a/cmd/gitaly-blackbox/main.go b/cmd/gitaly-blackbox/main.go
index bcf31a194..cd5cc0647 100644
--- a/cmd/gitaly-blackbox/main.go
+++ b/cmd/gitaly-blackbox/main.go
@@ -13,9 +13,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/version"
)
-var (
- flagVersion = flag.Bool("version", false, "Print version and exit")
-)
+var flagVersion = flag.Bool("version", false, "Print version and exit")
func flagUsage() {
fmt.Println(version.GetVersionString())
diff --git a/cmd/gitaly-git2go/cherry_pick_test.go b/cmd/gitaly-git2go/cherry_pick_test.go
index 1ac5c586c..33d50e6f3 100644
--- a/cmd/gitaly-git2go/cherry_pick_test.go
+++ b/cmd/gitaly-git2go/cherry_pick_test.go
@@ -153,7 +153,7 @@ func TestCherryPick(t *testing.T) {
base := cmdtesthelper.BuildCommit(t, repoPath, []*git.Oid{nil}, tc.base)
- var ours, commit = "nonexistent", "nonexistent"
+ ours, commit := "nonexistent", "nonexistent"
if len(tc.ours) > 0 {
ours = cmdtesthelper.BuildCommit(t, repoPath, []*git.Oid{base}, tc.ours).String()
}
diff --git a/cmd/gitaly-git2go/conflicts/conflicts_test.go b/cmd/gitaly-git2go/conflicts/conflicts_test.go
index 9799c285d..8c28eb952 100644
--- a/cmd/gitaly-git2go/conflicts/conflicts_test.go
+++ b/cmd/gitaly-git2go/conflicts/conflicts_test.go
@@ -60,9 +60,9 @@ func TestConflicts(t *testing.T) {
},
conflicts: []git2go.Conflict{
{
- Ancestor: git2go.ConflictEntry{Path: "file", Mode: 0100644},
- Our: git2go.ConflictEntry{Path: "file", Mode: 0100644},
- Their: git2go.ConflictEntry{Path: "file", Mode: 0100644},
+ Ancestor: git2go.ConflictEntry{Path: "file", Mode: 0o100644},
+ Our: git2go.ConflictEntry{Path: "file", Mode: 0o100644},
+ Their: git2go.ConflictEntry{Path: "file", Mode: 0o100644},
Content: []byte("<<<<<<< file\nb\n=======\nc\n>>>>>>> file\n"),
},
},
@@ -83,9 +83,9 @@ func TestConflicts(t *testing.T) {
},
conflicts: []git2go.Conflict{
{
- Ancestor: git2go.ConflictEntry{Path: "file-2", Mode: 0100644},
- Our: git2go.ConflictEntry{Path: "file-2", Mode: 0100644},
- Their: git2go.ConflictEntry{Path: "file-2", Mode: 0100644},
+ Ancestor: git2go.ConflictEntry{Path: "file-2", Mode: 0o100644},
+ Our: git2go.ConflictEntry{Path: "file-2", Mode: 0o100644},
+ Their: git2go.ConflictEntry{Path: "file-2", Mode: 0o100644},
Content: []byte("<<<<<<< file-2\nb\n=======\nc\n>>>>>>> file-2\n"),
},
},
@@ -106,15 +106,15 @@ func TestConflicts(t *testing.T) {
},
conflicts: []git2go.Conflict{
{
- Ancestor: git2go.ConflictEntry{Path: "file-1", Mode: 0100644},
- Our: git2go.ConflictEntry{Path: "file-1", Mode: 0100644},
- Their: git2go.ConflictEntry{Path: "file-1", Mode: 0100644},
+ Ancestor: git2go.ConflictEntry{Path: "file-1", Mode: 0o100644},
+ Our: git2go.ConflictEntry{Path: "file-1", Mode: 0o100644},
+ Their: git2go.ConflictEntry{Path: "file-1", Mode: 0o100644},
Content: []byte("<<<<<<< file-1\nb\n=======\nc\n>>>>>>> file-1\n"),
},
{
- Ancestor: git2go.ConflictEntry{Path: "file-2", Mode: 0100644},
- Our: git2go.ConflictEntry{Path: "file-2", Mode: 0100644},
- Their: git2go.ConflictEntry{Path: "file-2", Mode: 0100644},
+ Ancestor: git2go.ConflictEntry{Path: "file-2", Mode: 0o100644},
+ Our: git2go.ConflictEntry{Path: "file-2", Mode: 0o100644},
+ Their: git2go.ConflictEntry{Path: "file-2", Mode: 0o100644},
Content: []byte("<<<<<<< file-2\nb\n=======\nc\n>>>>>>> file-2\n"),
},
},
@@ -132,8 +132,8 @@ func TestConflicts(t *testing.T) {
},
conflicts: []git2go.Conflict{
{
- Ancestor: git2go.ConflictEntry{Path: "file", Mode: 0100644},
- Our: git2go.ConflictEntry{Path: "file", Mode: 0100644},
+ Ancestor: git2go.ConflictEntry{Path: "file", Mode: 0o100644},
+ Our: git2go.ConflictEntry{Path: "file", Mode: 0o100644},
Their: git2go.ConflictEntry{},
Content: []byte("<<<<<<< file\nchanged\n=======\n>>>>>>> \n"),
},
@@ -155,21 +155,21 @@ func TestConflicts(t *testing.T) {
},
conflicts: []git2go.Conflict{
{
- Ancestor: git2go.ConflictEntry{Path: "file", Mode: 0100644},
+ Ancestor: git2go.ConflictEntry{Path: "file", Mode: 0o100644},
Our: git2go.ConflictEntry{},
Their: git2go.ConflictEntry{},
Content: []byte{},
},
{
Ancestor: git2go.ConflictEntry{},
- Our: git2go.ConflictEntry{Path: "renamed-1", Mode: 0100644},
+ Our: git2go.ConflictEntry{Path: "renamed-1", Mode: 0o100644},
Their: git2go.ConflictEntry{},
Content: []byte("a\nb\nc\nd\ne\nf\ng\n"),
},
{
Ancestor: git2go.ConflictEntry{},
Our: git2go.ConflictEntry{},
- Their: git2go.ConflictEntry{Path: "renamed-2", Mode: 0100644},
+ Their: git2go.ConflictEntry{Path: "renamed-2", Mode: 0o100644},
Content: []byte("a\nb\nc\nd\ne\nf\ng\n"),
},
},
diff --git a/cmd/gitaly-git2go/rebase_test.go b/cmd/gitaly-git2go/rebase_test.go
index 42f66cf9a..82fce076b 100644
--- a/cmd/gitaly-git2go/rebase_test.go
+++ b/cmd/gitaly-git2go/rebase_test.go
@@ -19,9 +19,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg"
)
-var (
- masterRevision = "1e292f8fedd741b75372e19097c76d327140c312"
-)
+var masterRevision = "1e292f8fedd741b75372e19097c76d327140c312"
func TestRebase_validation(t *testing.T) {
cfg, repo, repoPath := testcfg.BuildWithRepo(t)
diff --git a/cmd/gitaly-git2go/resolve_conflicts.go b/cmd/gitaly-git2go/resolve_conflicts.go
index 993152a5c..5f64fd6ca 100644
--- a/cmd/gitaly-git2go/resolve_conflicts.go
+++ b/cmd/gitaly-git2go/resolve_conflicts.go
@@ -19,8 +19,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
)
-type resolveSubcommand struct {
-}
+type resolveSubcommand struct{}
func (cmd *resolveSubcommand) Flags() *flag.FlagSet {
return flag.NewFlagSet("resolve", flag.ExitOnError)
diff --git a/cmd/gitaly-git2go/set_config.go b/cmd/gitaly-git2go/set_config.go
index e1c7b48b8..a68c38efc 100644
--- a/cmd/gitaly-git2go/set_config.go
+++ b/cmd/gitaly-git2go/set_config.go
@@ -14,8 +14,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
)
-type setConfigSubcommand struct {
-}
+type setConfigSubcommand struct{}
func (cmd *setConfigSubcommand) Flags() *flag.FlagSet {
return flag.NewFlagSet("set_config", flag.ExitOnError)
diff --git a/cmd/gitaly-hooks/hooks.go b/cmd/gitaly-hooks/hooks.go
index 9e177b03f..d65406cd6 100644
--- a/cmd/gitaly-hooks/hooks.go
+++ b/cmd/gitaly-hooks/hooks.go
@@ -37,23 +37,23 @@ type hookCommand struct {
var (
hooksBySubcommand = map[string]hookCommand{
- "update": hookCommand{
+ "update": {
exec: updateHook,
hookType: git.UpdateHook,
},
- "pre-receive": hookCommand{
+ "pre-receive": {
exec: preReceiveHook,
hookType: git.PreReceiveHook,
},
- "post-receive": hookCommand{
+ "post-receive": {
exec: postReceiveHook,
hookType: git.PostReceiveHook,
},
- "reference-transaction": hookCommand{
+ "reference-transaction": {
exec: referenceTransactionHook,
hookType: git.ReferenceTransactionHook,
},
- "git": hookCommand{
+ "git": {
exec: packObjectsHook,
hookType: git.PackObjectsHook,
},
diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go
index 60154b70b..213f92d9d 100644
--- a/cmd/gitaly-hooks/hooks_test.go
+++ b/cmd/gitaly-hooks/hooks_test.go
@@ -46,8 +46,10 @@ type proxyValues struct {
HTTPProxy, HTTPSProxy, NoProxy string
}
-var enabledFeatureFlag = featureflag.FeatureFlag{Name: "enabled-feature-flag", OnByDefault: false}
-var disabledFeatureFlag = featureflag.FeatureFlag{Name: "disabled-feature-flag", OnByDefault: true}
+var (
+ enabledFeatureFlag = featureflag.FeatureFlag{Name: "enabled-feature-flag", OnByDefault: false}
+ disabledFeatureFlag = featureflag.FeatureFlag{Name: "disabled-feature-flag", OnByDefault: true}
+)
func rawFeatureFlags(ctx context.Context) featureflag.Raw {
ctx = featureflag.IncomingCtxWithFeatureFlag(ctx, enabledFeatureFlag)
@@ -514,7 +516,7 @@ func TestCheckOK(t *testing.T) {
tempDir := testhelper.TempDir(t)
gitlabShellDir := filepath.Join(tempDir, "gitlab-shell")
- require.NoError(t, os.MkdirAll(gitlabShellDir, 0755))
+ require.NoError(t, os.MkdirAll(gitlabShellDir, 0o755))
gitlab.WriteShellSecretFile(t, gitlabShellDir, "the secret")
configPath, cleanup := writeTemporaryGitalyConfigFile(t, tempDir, serverURL, user, password, path.Join(gitlabShellDir, ".gitlab_shell_secret"))
@@ -558,7 +560,7 @@ func TestCheckBadCreds(t *testing.T) {
tempDir := testhelper.TempDir(t)
gitlabShellDir := filepath.Join(tempDir, "gitlab-shell")
- require.NoError(t, os.MkdirAll(gitlabShellDir, 0755))
+ require.NoError(t, os.MkdirAll(gitlabShellDir, 0o755))
gitlab.WriteShellSecretFile(t, gitlabShellDir, "the secret")
configPath, cleanup := writeTemporaryGitalyConfigFile(t, tempDir, serverURL, "wrong", password, path.Join(gitlabShellDir, ".gitlab_shell_secret"))
@@ -660,7 +662,7 @@ func TestFixFilterQuoteBug(t *testing.T) {
func TestGitalyHooksPackObjects(t *testing.T) {
logDir, err := filepath.Abs("testdata")
require.NoError(t, err)
- require.NoError(t, os.MkdirAll(logDir, 0755))
+ require.NoError(t, os.MkdirAll(logDir, 0o755))
cfg, repo, repoPath := testcfg.BuildWithRepo(t, testcfg.WithBase(config.Cfg{
Auth: auth.Config{Token: "abc123"},
@@ -784,7 +786,7 @@ func writeTemporaryGitalyConfigFile(t testing.TB, tempDir, gitlabURL, user, pass
password = %q
`, gitlabURL, secretFile, user, password)
- require.NoError(t, ioutil.WriteFile(path, []byte(contents), 0644))
+ require.NoError(t, ioutil.WriteFile(path, []byte(contents), 0o644))
return path, func() {
require.NoError(t, os.RemoveAll(path))
}
diff --git a/cmd/gitaly-lfs-smudge/lfs_smudge_test.go b/cmd/gitaly-lfs-smudge/lfs_smudge_test.go
index 6b60c0e7b..5136587d9 100644
--- a/cmd/gitaly-lfs-smudge/lfs_smudge_test.go
+++ b/cmd/gitaly-lfs-smudge/lfs_smudge_test.go
@@ -37,17 +37,15 @@ size 177735`
keyPath = "../../internal/gitlab/testdata/certs/server.key"
)
-var (
- defaultOptions = gitlab.TestServerOptions{
- SecretToken: secretToken,
- LfsBody: testData,
- LfsOid: lfsOid,
- GlRepository: glRepository,
- ClientCACertPath: certPath,
- ServerCertPath: certPath,
- ServerKeyPath: keyPath,
- }
-)
+var defaultOptions = gitlab.TestServerOptions{
+ SecretToken: secretToken,
+ LfsBody: testData,
+ LfsOid: lfsOid,
+ GlRepository: glRepository,
+ ClientCACertPath: certPath,
+ ServerCertPath: certPath,
+ ServerKeyPath: keyPath,
+}
type mapConfig struct {
env map[string]string
diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go
index f9f5baa02..82b136d3e 100644
--- a/cmd/gitaly/main.go
+++ b/cmd/gitaly/main.go
@@ -38,9 +38,7 @@ import (
"google.golang.org/grpc"
)
-var (
- flagVersion = flag.Bool("version", false, "Print version and exit")
-)
+var flagVersion = flag.Bool("version", false, "Print version and exit")
func loadConfig(configPath string) (config.Cfg, error) {
cfgFile, err := os.Open(configPath)
diff --git a/cmd/praefect/main_test.go b/cmd/praefect/main_test.go
index 21bd47fd9..5fb0619e4 100644
--- a/cmd/praefect/main_test.go
+++ b/cmd/praefect/main_test.go
@@ -62,15 +62,15 @@ func TestFlattenNodes(t *testing.T) {
},
},
expect: map[string]*nodePing{
- "tcp://example.com": &nodePing{
+ "tcp://example.com": {
address: "tcp://example.com",
storages: map[gitalyStorage][]virtualStorage{
- "foo": []virtualStorage{"meow"},
- "bar": []virtualStorage{"woof"},
+ "foo": {"meow"},
+ "bar": {"woof"},
},
vStorages: map[virtualStorage]struct{}{
- "meow": struct{}{},
- "woof": struct{}{},
+ "meow": {},
+ "woof": {},
},
token: "abc",
},
diff --git a/cmd/praefect/subcmd.go b/cmd/praefect/subcmd.go
index 17bd17b8d..855c73c15 100644
--- a/cmd/praefect/subcmd.go
+++ b/cmd/praefect/subcmd.go
@@ -23,18 +23,16 @@ type subcmd interface {
Exec(flags *flag.FlagSet, config config.Config) error
}
-var (
- subcommands = map[string]subcmd{
- "sql-ping": &sqlPingSubcommand{},
- "sql-migrate": &sqlMigrateSubcommand{},
- "dial-nodes": &dialNodesSubcommand{},
- "sql-migrate-down": &sqlMigrateDownSubcommand{},
- "sql-migrate-status": &sqlMigrateStatusSubcommand{},
- "dataloss": newDatalossSubcommand(),
- "accept-dataloss": &acceptDatalossSubcommand{},
- "set-replication-factor": newSetReplicatioFactorSubcommand(os.Stdout),
- }
-)
+var subcommands = map[string]subcmd{
+ "sql-ping": &sqlPingSubcommand{},
+ "sql-migrate": &sqlMigrateSubcommand{},
+ "dial-nodes": &dialNodesSubcommand{},
+ "sql-migrate-down": &sqlMigrateDownSubcommand{},
+ "sql-migrate-status": &sqlMigrateStatusSubcommand{},
+ "dataloss": newDatalossSubcommand(),
+ "accept-dataloss": &acceptDatalossSubcommand{},
+ "set-replication-factor": newSetReplicatioFactorSubcommand(os.Stdout),
+}
// subCommand returns an exit code, to be fed into os.Exit.
func subCommand(conf config.Config, arg0 string, argRest []string) int {
diff --git a/cmd/praefect/subcmd_dataloss_test.go b/cmd/praefect/subcmd_dataloss_test.go
index 19acc6459..c9d0e38fa 100644
--- a/cmd/praefect/subcmd_dataloss_test.go
+++ b/cmd/praefect/subcmd_dataloss_test.go
@@ -80,7 +80,8 @@ func TestDatalossSubcommand(t *testing.T) {
require.NoError(t, gs.SetGeneration(ctx, "virtual-storage-1", "repository-2", "gitaly-3", 0))
ln, clean := listenAndServe(t, []svcRegistrar{
- registerPraefectInfoServer(info.NewServer(cfg, gs, nil, nil, nil))})
+ registerPraefectInfoServer(info.NewServer(cfg, gs, nil, nil, nil)),
+ })
defer clean()
for _, tc := range []struct {
desc string