Skip to content

Commit

Permalink
✏️ make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Dec 19, 2021
1 parent a9f9876 commit 4ad7ff7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
5 changes: 1 addition & 4 deletions control/web/gui.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// Package webctrl
/*
* 一个用户webui的包,里面包含了webui所需的所有内容
*/
// Package webctrl 包含 webui 所需的所有内容
package webctrl

import (
Expand Down
1 change: 1 addition & 0 deletions utils/file/dir_nowin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package file

import "os"

// Pwd 获取当前路径
func Pwd() (path string) {
path, _ = os.Getwd()
return
Expand Down
1 change: 1 addition & 0 deletions utils/file/dir_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
)

// Pwd 获取当前路径的正斜杠表示
func Pwd() string {
path, _ := os.Getwd()
return strings.ReplaceAll(path, "\\", "/")
Expand Down
3 changes: 2 additions & 1 deletion utils/file/f.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package file

import "os"

// BOT_PATH BOT当前路径
var BOT_PATH = Pwd()

// IsExist 文件/路径存在
Expand All @@ -10,7 +11,7 @@ func IsExist(path string) bool {
return err == nil || os.IsExist(err)
}

// IsExist 文件/路径不存在
// IsNotExist 文件/路径不存在
func IsNotExist(path string) bool {
_, err := os.Stat(path)
return err != nil && os.IsNotExist(err)
Expand Down
2 changes: 1 addition & 1 deletion utils/file/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func GetLazyData(path string, isReturnDataBytes, isDataMustEqual bool) ([]byte,
if err != nil {
return nil, err
}
if len(data) <= 0 {
if len(data) == 0 {
return nil, errors.New("read body len <= 0")
}
if filemd5 != nil {
Expand Down
2 changes: 2 additions & 0 deletions utils/process/sleep.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Package process 流程控制相关
package process

import (
"math/rand"
"time"
)

// SleepAbout1sTo2s 随机阻塞等待 1 ~ 2s
func SleepAbout1sTo2s() {
time.Sleep(time.Second + time.Millisecond*time.Duration(rand.Intn(1000)))
}
3 changes: 3 additions & 0 deletions utils/web/http.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package web 网络处理相关
package web

import (
Expand All @@ -6,6 +7,7 @@ import (
"net/http"
)

// ReqWith 使用自定义请求头获取数据
func ReqWith(url string, method string, referer string, ua string) (data []byte, err error) {
client := &http.Client{}
// 提交请求
Expand All @@ -25,6 +27,7 @@ func ReqWith(url string, method string, referer string, ua string) (data []byte,
return
}

// GetData 获取数据
func GetData(url string) (data []byte, err error) {
var response *http.Response
response, err = http.Get(url)
Expand Down

0 comments on commit 4ad7ff7

Please sign in to comment.