Browse Source

Merge pull request #571 from taveek/patch-2

Fix all staticcheck errors
pull/576/head
Faissal Elamraoui 1 year ago
committed by GitHub
parent
commit
f7120a52bf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions
  1. +1
    -1
      cmd/commands/api/apiapp.go
  2. +1
    -1
      cmd/commands/dlv/dlv_amd64.go
  3. +1
    -1
      cmd/commands/new/new.go
  4. +2
    -2
      cmd/commands/run/watch.go
  5. +3
    -3
      generate/swaggergen/g_docs.go
  6. +1
    -1
      utils/utils.go

+ 1
- 1
cmd/commands/api/apiapp.go View File

@ -511,7 +511,7 @@ import (
)
func init() {
_, file, _, _ := runtime.Caller(1)
_, file, _, _ := runtime.Caller(0)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
beego.TestBeegoInit(apppath)
}

+ 1
- 1
cmd/commands/dlv/dlv_amd64.go View File

@ -227,7 +227,7 @@ func startWatcher(paths []string, ch chan int) {
// Wait 1s before re-build until there is no file change
scheduleTime := time.Now().Add(1 * time.Second)
time.Sleep(scheduleTime.Sub(time.Now()))
time.Sleep(time.Until(scheduleTime))
_, err := buildDebug()
if err != nil {
utils.Notify("Build Failed: "+err.Error(), "bee")

+ 1
- 1
cmd/commands/new/new.go View File

@ -101,7 +101,7 @@ import (
)
func init() {
_, file, _, _ := runtime.Caller(1)
_, file, _, _ := runtime.Caller(0)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
beego.TestBeegoInit(apppath)
}

+ 2
- 2
cmd/commands/run/watch.go View File

@ -85,7 +85,7 @@ func NewWatcher(paths []string, files []string, isgenerate bool) {
go func() {
// Wait 1s before autobuild until there is no file change.
scheduleTime = time.Now().Add(1 * time.Second)
time.Sleep(scheduleTime.Sub(time.Now()))
time.Sleep(time.Until(scheduleTime))
AutoBuild(files, isgenerate)
if config.Conf.EnableReload {
@ -148,7 +148,7 @@ func AutoBuild(files []string, isgenerate bool) {
}
appName := appname
if err == nil {
if runtime.GOOS == "windows" {
appName += ".exe"
}

+ 3
- 3
generate/swaggergen/g_docs.go View File

@ -32,7 +32,7 @@ import (
"strings"
"unicode"
"gopkg.in/yaml.v2"
yaml "gopkg.in/yaml.v2"
"github.com/astaxie/beego/swagger"
"github.com/astaxie/beego/utils"
@ -124,7 +124,7 @@ func ParsePackagesFromDir(dirpath string) {
err = parsePackageFromDir(fpath)
if err != nil {
// Send the error to through the channel and continue walking
c <- fmt.Errorf("Error while parsing directory: %s", err.Error())
c <- fmt.Errorf("error while parsing directory: %s", err.Error())
return nil
}
}
@ -541,7 +541,7 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
//TODO: resultMap := buildParamMap(f.Type.Results)
if comments != nil && comments.List != nil {
for _, c := range comments.List {
t := strings.TrimSpace(strings.TrimLeft(c.Text, "//"))
t := strings.TrimSpace(strings.TrimPrefix(c.Text, "//"))
if strings.HasPrefix(t, "@router") {
elements := strings.TrimSpace(t[len("@router"):])
e1 := strings.SplitN(elements, " ", 2)

+ 1
- 1
utils/utils.go View File

@ -328,7 +328,7 @@ func CheckEnv(appname string) (apppath, packpath string, err error) {
apppath = filepath.Join(gosrcpath, appname)
if _, e := os.Stat(apppath); !os.IsNotExist(e) {
err = fmt.Errorf("Cannot create application without removing '%s' first", apppath)
err = fmt.Errorf("cannot create application without removing '%s' first", apppath)
beeLogger.Log.Errorf("Path '%s' already exists", apppath)
return
}

Loading…
Cancel
Save