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-11-11 16:34:20 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-11-12 17:39:42 +0300
commite55a44689f4a787726df6e230477e77a2b2d9e42 (patch)
tree07fb68546522fb1fc1747ee989df70e1d7e33b18 /cmd
parent71c6643aae2f1b3c9380c5e66d10a142947078f4 (diff)
lint: Clean up various exception for the errcheck linter
Clean up various exceptions for the errcheck linter, either by removing exceptions which don't apply anymore, by handling the errors or by ignoring errors.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gitaly-git2go/main.go9
-rw-r--r--cmd/praefect/main.go6
-rw-r--r--cmd/praefect/subcmd.go4
-rw-r--r--cmd/praefect/subcmd_check.go2
-rw-r--r--cmd/praefect/subcmd_list_untracked_repositories.go4
-rw-r--r--cmd/praefect/subcmd_remove_repository.go4
-rw-r--r--cmd/praefect/subcmd_sql_migrate_down.go4
-rw-r--r--cmd/praefect/subcmd_track_repository.go2
8 files changed, 22 insertions, 13 deletions
diff --git a/cmd/gitaly-git2go/main.go b/cmd/gitaly-git2go/main.go
index b80e65039..c3a7ad906 100644
--- a/cmd/gitaly-git2go/main.go
+++ b/cmd/gitaly-git2go/main.go
@@ -37,7 +37,10 @@ func fatalf(format string, args ...interface{}) {
func main() {
flags := flag.NewFlagSet(git2go.BinaryName, flag.ExitOnError)
- flags.Parse(os.Args)
+
+ if err := flags.Parse(os.Args); err != nil {
+ fatalf("parsing flags: %s", err)
+ }
if flags.NArg() < 2 {
fatalf("missing subcommand")
@@ -49,7 +52,9 @@ func main() {
}
subcmdFlags := subcmd.Flags()
- subcmdFlags.Parse(flags.Args()[2:])
+ if err := subcmdFlags.Parse(flags.Args()[2:]); err != nil {
+ fatalf("parsing flags of %q: %s", subcmdFlags.Name(), err)
+ }
if subcmdFlags.NArg() != 0 {
fatalf("%s: trailing arguments", subcmdFlags.Name())
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index 262b2f90d..1976aa33f 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -448,7 +448,11 @@ func run(cfgs []starter.Config, conf config.Config, b bootstrap.Listener, promre
conf.Reconciliation.HistogramBuckets,
)
promreg.MustRegister(r)
- go r.Run(ctx, helper.NewTimerTicker(interval))
+ go func() {
+ if err := r.Run(ctx, helper.NewTimerTicker(interval)); err != nil {
+ logger.WithError(err).Error("reconciler finished execution")
+ }
+ }()
}
}
diff --git a/cmd/praefect/subcmd.go b/cmd/praefect/subcmd.go
index 21279939c..253c4d38f 100644
--- a/cmd/praefect/subcmd.go
+++ b/cmd/praefect/subcmd.go
@@ -103,8 +103,8 @@ func openDB(conf config.DB) (*sql.DB, func(), error) {
return db, clean, nil
}
-func printfErr(format string, a ...interface{}) (int, error) {
- return fmt.Fprintf(os.Stderr, format, a...)
+func printfErr(format string, a ...interface{}) {
+ fmt.Fprintf(os.Stderr, format, a...)
}
func subCmdDial(ctx context.Context, addr, token string, timeout time.Duration, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
diff --git a/cmd/praefect/subcmd_check.go b/cmd/praefect/subcmd_check.go
index d84bef069..246e6e0bf 100644
--- a/cmd/praefect/subcmd_check.go
+++ b/cmd/praefect/subcmd_check.go
@@ -31,7 +31,7 @@ func newCheckSubcommand(writer io.Writer, checkFuncs ...praefect.CheckFunc) *che
func (cmd *checkSubcommand) FlagSet() *flag.FlagSet {
fs := flag.NewFlagSet(checkCmdName, flag.ExitOnError)
fs.Usage = func() {
- _, _ = printfErr("Description:\n" +
+ printfErr("Description:\n" +
" This command runs startup checks for Praefect.")
fs.PrintDefaults()
}
diff --git a/cmd/praefect/subcmd_list_untracked_repositories.go b/cmd/praefect/subcmd_list_untracked_repositories.go
index e74f02315..87e675078 100644
--- a/cmd/praefect/subcmd_list_untracked_repositories.go
+++ b/cmd/praefect/subcmd_list_untracked_repositories.go
@@ -39,12 +39,12 @@ func (cmd *listUntrackedRepositories) FlagSet() *flag.FlagSet {
fs := flag.NewFlagSet(listUntrackedRepositoriesName, flag.ExitOnError)
fs.StringVar(&cmd.delimiter, "delimiter", "\n", "string used as a delimiter in output")
fs.Usage = func() {
- _, _ = printfErr("Description:\n" +
+ printfErr("Description:\n" +
" This command checks if all repositories on all gitaly nodes tracked by praefect.\n" +
" If repository is found on the disk, but it is not known to praefect the location of\n" +
" that repository will be written into stdout stream in JSON format.\n")
fs.PrintDefaults()
- _, _ = printfErr("NOTE:\n" +
+ printfErr("NOTE:\n" +
" All errors and log messages directed to the stderr stream.\n" +
" The output is produced as the new data appears, it doesn't wait\n" +
" for the completion of the processing to produce the result.\n")
diff --git a/cmd/praefect/subcmd_remove_repository.go b/cmd/praefect/subcmd_remove_repository.go
index b9e0bfb07..1c0db75dd 100644
--- a/cmd/praefect/subcmd_remove_repository.go
+++ b/cmd/praefect/subcmd_remove_repository.go
@@ -40,12 +40,12 @@ func (cmd *removeRepository) FlagSet() *flag.FlagSet {
fs.StringVar(&cmd.virtualStorage, paramVirtualStorage, "", "name of the repository's virtual storage")
fs.StringVar(&cmd.relativePath, paramRelativePath, "", "relative path to the repository")
fs.Usage = func() {
- _, _ = printfErr("Description:\n" +
+ printfErr("Description:\n" +
" This command removes all state associated with a given repository from the Gitaly Cluster.\n" +
" This includes both on-disk repositories on all relevant Gitaly nodes as well as any potential\n" +
" database state as tracked by Praefect.\n")
fs.PrintDefaults()
- _, _ = printfErr("NOTE:\n" +
+ printfErr("NOTE:\n" +
" It may happen that parts of the repository continue to exist after this command, either because\n" +
" of an error that happened during deletion or because of in-flight RPC calls targeting the repository.\n" +
" It is safe and recommended to re-run this command in such a case.\n")
diff --git a/cmd/praefect/subcmd_sql_migrate_down.go b/cmd/praefect/subcmd_sql_migrate_down.go
index 14e6c510b..c0418f11d 100644
--- a/cmd/praefect/subcmd_sql_migrate_down.go
+++ b/cmd/praefect/subcmd_sql_migrate_down.go
@@ -20,8 +20,8 @@ func (s *sqlMigrateDownSubcommand) FlagSet() *flag.FlagSet {
flags := flag.NewFlagSet(sqlMigrateDownCmdName, flag.ExitOnError)
flags.Usage = func() {
flag.PrintDefaults()
- _, _ = printfErr(" MAX_MIGRATIONS\n")
- _, _ = printfErr("\tNumber of migrations to roll back\n")
+ printfErr(" MAX_MIGRATIONS\n")
+ printfErr("\tNumber of migrations to roll back\n")
}
flags.BoolVar(&s.force, "f", false, "apply down-migrations (default is dry run)")
return flags
diff --git a/cmd/praefect/subcmd_track_repository.go b/cmd/praefect/subcmd_track_repository.go
index 335b353a1..c1c50b359 100644
--- a/cmd/praefect/subcmd_track_repository.go
+++ b/cmd/praefect/subcmd_track_repository.go
@@ -42,7 +42,7 @@ func (cmd *trackRepository) FlagSet() *flag.FlagSet {
fs.StringVar(&cmd.relativePath, paramRelativePath, "", "relative path to the repository")
fs.StringVar(&cmd.authoritativeStorage, paramAuthoritativeStorage, "", "storage with the repository to consider as authoritative")
fs.Usage = func() {
- _, _ = printfErr("Description:\n" +
+ printfErr("Description:\n" +
" This command adds a given repository to be tracked by Praefect.\n" +
" It checks if the repository exists on disk on the authoritative storage, " +
" and whether database records are absent from tracking the repository.")