Skip to content

Commit

Permalink
ci: golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fufuok committed Feb 19, 2024
1 parent 2da9eee commit a73b211
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions common/init.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package common

import (
"fmt"
"errors"

"github.com/fufuok/utils/myip"

Expand Down Expand Up @@ -44,7 +44,7 @@ func (m *M) Start() error {
// Runtime 重新加载配置时运行
func (m *M) Runtime() error {
if err := loadLogger(); err != nil {
return fmt.Errorf("unable to reinitialize logger")
return errors.New("unable to reinitialize logger")
}
loadReq()
return nil
Expand Down
8 changes: 4 additions & 4 deletions config/remote.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"errors"
"fmt"
"os"
"strconv"
Expand Down Expand Up @@ -29,7 +30,7 @@ type DataSourceArgs struct {
func GetDataSource(args any) error {
params, ok := args.(DataSourceArgs)
if !ok {
return fmt.Errorf("invalid data source configuration")
return errors.New("invalid data source configuration")
}

body, err := GetDataSourceBody(params)
Expand All @@ -41,8 +42,7 @@ func GetDataSource(args any) error {
md5Old := xhash.MustMD5Sum(params.Conf.Path)
md5New := xhash.MD5Hex(body)
if md5New != md5Old {
// #nosec G306
if err = os.WriteFile(params.Conf.Path, []byte(body), 0644); err != nil {
if err = os.WriteFile(params.Conf.Path, []byte(body), 0600); err != nil {
return err
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ func GetDataSourceBody(params DataSourceArgs) (string, error) {

body = strings.TrimSpace(body)
if body == "" {
return "", fmt.Errorf("data source result is empty")
return "", errors.New("data source result is empty")
}
return body, nil
}
1 change: 0 additions & 1 deletion stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func SYSStats() map[string]any {
"NumCgoCall": utils.Comma(runtime.NumCgoCall()),
"InternalIPv4": common.InternalIPv4,
"ExternalIPv4": common.ExternalIPv4,
"HTTPS": config.Config().WebConf.ServerHttpsAddr != "",
"JSON": json.Name,
"GoPool": ants.Running(),
}
Expand Down

0 comments on commit a73b211

Please sign in to comment.