mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
Made linter happy in cmd folder
This commit is contained in:
parent
212a04a45e
commit
5b5af7daee
7 changed files with 14 additions and 5 deletions
|
@ -14,6 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// CmdAdmin represents the available admin sub-command.
|
||||||
CmdAdmin = cli.Command{
|
CmdAdmin = cli.Command{
|
||||||
Name: "admin",
|
Name: "admin",
|
||||||
Usage: "Preform admin operations on command line",
|
Usage: "Preform admin operations on command line",
|
||||||
|
|
|
@ -25,10 +25,11 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdCert represents the available cert sub-command.
|
||||||
var CmdCert = cli.Command{
|
var CmdCert = cli.Command{
|
||||||
Name: "cert",
|
Name: "cert",
|
||||||
Usage: "Generate self-signed certificate",
|
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.`,
|
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
|
||||||
Action: runCert,
|
Action: runCert,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -13,6 +14,7 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdCert represents the available cert sub-command.
|
||||||
var CmdCert = cli.Command{
|
var CmdCert = cli.Command{
|
||||||
Name: "cert",
|
Name: "cert",
|
||||||
Usage: "Generate self-signed certificate",
|
Usage: "Generate self-signed certificate",
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"github.com/go-gitea/gitea/modules/setting"
|
"github.com/go-gitea/gitea/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdDump represents the available dump sub-command.
|
||||||
var CmdDump = cli.Command{
|
var CmdDump = cli.Command{
|
||||||
Name: "dump",
|
Name: "dump",
|
||||||
Usage: "Dump Gogs files and database",
|
Usage: "Dump Gogs files and database",
|
||||||
|
|
|
@ -26,9 +26,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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{
|
var CmdServ = cli.Command{
|
||||||
Name: "serv",
|
Name: "serv",
|
||||||
Usage: "This command should only be called by SSH shell",
|
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)
|
repo, err := models.GetRepositoryByName(repoUser.ID, reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if models.IsErrRepoNotExist(err) {
|
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)
|
fail("Internal error", "Failed to get repository: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -241,7 +242,7 @@ func runServ(c *cli.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fail("Internal error", "Fail to check access: %v", err)
|
fail("Internal error", "Fail to check access: %v", err)
|
||||||
} else if mode < requestedMode {
|
} else if mode < requestedMode {
|
||||||
clientMessage := _ACCESS_DENIED_MESSAGE
|
clientMessage := accessDenied
|
||||||
if mode >= models.ACCESS_MODE_READ {
|
if mode >= models.ACCESS_MODE_READ {
|
||||||
clientMessage = "You do not have sufficient authorization for this action"
|
clientMessage = "You do not have sufficient authorization for this action"
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/go-gitea/gitea/modules/setting"
|
"github.com/go-gitea/gitea/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdUpdate represents the available update sub-command.
|
||||||
var CmdUpdate = cli.Command{
|
var CmdUpdate = cli.Command{
|
||||||
Name: "update",
|
Name: "update",
|
||||||
Usage: "This command should only be called by Git hook",
|
Usage: "This command should only be called by Git hook",
|
||||||
|
|
|
@ -48,6 +48,7 @@ import (
|
||||||
"github.com/go-gitea/gitea/routers/user"
|
"github.com/go-gitea/gitea/routers/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CmdWeb represents the available web sub-command.
|
||||||
var CmdWeb = cli.Command{
|
var CmdWeb = cli.Command{
|
||||||
Name: "web",
|
Name: "web",
|
||||||
Usage: "Start Gogs web server",
|
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 {
|
type VerChecker struct {
|
||||||
ImportPath string
|
ImportPath string
|
||||||
Version func() string
|
Version func() string
|
||||||
|
@ -99,7 +101,7 @@ func checkVersion() {
|
||||||
for _, c := range checkers {
|
for _, c := range checkers {
|
||||||
if !version.Compare(c.Version(), c.Expected, ">=") {
|
if !version.Compare(c.Version(), c.Expected, ">=") {
|
||||||
log.Fatal(4, `Dependency outdated!
|
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:
|
please use following command to update this package and recompile Gogs:
|
||||||
go get -u %[1]s`, c.ImportPath, c.Version(), c.Expected)
|
go get -u %[1]s`, c.ImportPath, c.Version(), c.Expected)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue