From 5b5af7daeeab40c570eabb7fe3b95c207856ea8a Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Fri, 4 Nov 2016 12:42:18 +0100 Subject: [PATCH] Made linter happy in cmd folder --- cmd/admin.go | 1 + cmd/cert.go | 3 ++- cmd/cert_stub.go | 2 ++ cmd/dump.go | 1 + cmd/serve.go | 7 ++++--- cmd/update.go | 1 + cmd/web.go | 4 +++- 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cmd/admin.go b/cmd/admin.go index a10e0e5fe5..de77143f29 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -14,6 +14,7 @@ import ( ) var ( + // CmdAdmin represents the available admin sub-command. CmdAdmin = cli.Command{ Name: "admin", Usage: "Preform admin operations on command line", diff --git a/cmd/cert.go b/cmd/cert.go index 6cd5bfade4..2212d2972d 100644 --- a/cmd/cert.go +++ b/cmd/cert.go @@ -25,10 +25,11 @@ import ( "github.com/urfave/cli" ) +// CmdCert represents the available cert sub-command. var CmdCert = cli.Command{ Name: "cert", Usage: "Generate self-signed certificate", - Description: `Generate a self-signed X.509 certificate for a TLS server. + Description: `Generate a self-signed X.509 certificate for a TLS server. Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`, Action: runCert, Flags: []cli.Flag{ diff --git a/cmd/cert_stub.go b/cmd/cert_stub.go index 1c076f6495..a97a497e1f 100644 --- a/cmd/cert_stub.go +++ b/cmd/cert_stub.go @@ -4,6 +4,7 @@ // Copyright 2014 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. + package cmd import ( @@ -13,6 +14,7 @@ import ( "github.com/urfave/cli" ) +// CmdCert represents the available cert sub-command. var CmdCert = cli.Command{ Name: "cert", Usage: "Generate self-signed certificate", diff --git a/cmd/dump.go b/cmd/dump.go index 1e03ef74f0..8af76e2fc7 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -20,6 +20,7 @@ import ( "github.com/go-gitea/gitea/modules/setting" ) +// CmdDump represents the available dump sub-command. var CmdDump = cli.Command{ Name: "dump", Usage: "Dump Gogs files and database", diff --git a/cmd/serve.go b/cmd/serve.go index 051e215db1..c4e7d13046 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -26,9 +26,10 @@ import ( ) const ( - _ACCESS_DENIED_MESSAGE = "Repository does not exist or you do not have access" + accessDenied = "Repository does not exist or you do not have access" ) +// CmdServ represents the available serv sub-command. var CmdServ = cli.Command{ Name: "serv", Usage: "This command should only be called by SSH shell", @@ -179,7 +180,7 @@ func runServ(c *cli.Context) error { repo, err := models.GetRepositoryByName(repoUser.ID, reponame) if err != nil { if models.IsErrRepoNotExist(err) { - fail(_ACCESS_DENIED_MESSAGE, "Repository does not exist: %s/%s", repoUser.Name, reponame) + fail(accessDenied, "Repository does not exist: %s/%s", repoUser.Name, reponame) } fail("Internal error", "Failed to get repository: %v", err) } @@ -241,7 +242,7 @@ func runServ(c *cli.Context) error { if err != nil { fail("Internal error", "Fail to check access: %v", err) } else if mode < requestedMode { - clientMessage := _ACCESS_DENIED_MESSAGE + clientMessage := accessDenied if mode >= models.ACCESS_MODE_READ { clientMessage = "You do not have sufficient authorization for this action" } diff --git a/cmd/update.go b/cmd/update.go index 450d18a08a..ef494121e9 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -14,6 +14,7 @@ import ( "github.com/go-gitea/gitea/modules/setting" ) +// CmdUpdate represents the available update sub-command. var CmdUpdate = cli.Command{ Name: "update", Usage: "This command should only be called by Git hook", diff --git a/cmd/web.go b/cmd/web.go index d5dae5badc..ee9ee4d951 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -48,6 +48,7 @@ import ( "github.com/go-gitea/gitea/routers/user" ) +// CmdWeb represents the available web sub-command. var CmdWeb = cli.Command{ Name: "web", Usage: "Start Gogs web server", @@ -60,6 +61,7 @@ and it takes care of all the other things for you`, }, } +// VerChecker is a listing of required dependency versions. type VerChecker struct { ImportPath string Version func() string @@ -99,7 +101,7 @@ func checkVersion() { for _, c := range checkers { if !version.Compare(c.Version(), c.Expected, ">=") { log.Fatal(4, `Dependency outdated! -Package '%s' current version (%s) is below requirement (%s), +Package '%s' current version (%s) is below requirement (%s), please use following command to update this package and recompile Gogs: go get -u %[1]s`, c.ImportPath, c.Version(), c.Expected) }