Skip to content

Commit 5efb7b4

Browse files
committed
change(lint): fixes
1 parent e17579c commit 5efb7b4

File tree

8 files changed

+12
-21
lines changed

8 files changed

+12
-21
lines changed

cache/sa.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func IsBanned(key string) (bool, time.Time) {
4040

4141
// this key is still banned
4242
return true, item.Expires
43-
4443
}
4544

4645
func SetBanned(key string, hours int) error {

config/config.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package config
22

33
import (
44
"fmt"
5-
"github.com/json-iterator/go"
65
"os"
76

87
"github.com/l3uddz/crop/logger"
@@ -38,18 +37,11 @@ var (
3837

3938
// Internal
4039
log = logger.GetLogger("cfg")
41-
json = jsoniter.ConfigCompatibleWithStandardLibrary
4240
newOptionLen = 0
4341
)
4442

4543
/* Public */
4644

47-
func (cfg Configuration) ToJsonString() (string, error) {
48-
c := viper.AllSettings()
49-
bs, err := json.MarshalIndent(c, "", " ")
50-
return string(bs), err
51-
}
52-
5345
func Init(configFilePath string) error {
5446
// set package variables
5547
cfgPath = configFilePath
@@ -101,7 +93,6 @@ func Init(configFilePath string) error {
10193

10294
func ShowUsing() {
10395
log.Infof("Using %s = %q", stringutils.LeftJust("CONFIG", " ", 10), cfgPath)
104-
10596
}
10697

10798
/* Private */

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/fsnotify/fsnotify v1.4.9 // indirect
1111
github.com/go-cmd/cmd v1.2.0
1212
github.com/golang/protobuf v1.4.0 // indirect
13-
github.com/json-iterator/go v1.1.9
13+
github.com/json-iterator/go v1.1.9 // indirect
1414
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
1515
github.com/mattn/go-colorable v0.1.6 // indirect
1616
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect

logger/log.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func Init(logLevel int, logFilePath string) error {
4848
logrus.WithError(err).Errorf("Failed initializing rotating file log to %q", logFilePath)
4949
return errors.Wrap(err, "failed initializing rotating file hook")
5050
}
51+
5152
logrus.AddHook(rotateFileHook)
5253

5354
// set console formatter

pathutils/file.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
package pathutils
22

33
import (
4-
"github.com/l3uddz/crop/logger"
54
"os"
65
"path/filepath"
76
)
87

9-
var log = logger.GetLogger("paths")
10-
118
/* Public */
129

1310
func GetCurrentBinaryPath() string {

pathutils/find.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
package pathutils
22

33
import (
4+
"github.com/l3uddz/crop/logger"
5+
46
"os"
57
"path/filepath"
68
"strings"
79
"time"
810
)
911

12+
var (
13+
log = logger.GetLogger("paths")
14+
)
15+
1016
type Path struct {
1117
Path string
1218
RealPath string
@@ -47,12 +53,13 @@ func GetPathsInFolder(folder string, includeFiles bool, includeFolders bool, acc
4753
}
4854

4955
if acceptFn != nil {
50-
if acceptedPath := acceptFn(path); acceptedPath == nil {
56+
acceptedPath := acceptFn(path)
57+
if acceptedPath == nil {
5158
log.Tracef("Skipping rejected path: %s", path)
5259
return nil
53-
} else {
54-
finalPath = *acceptedPath
5560
}
61+
62+
finalPath = *acceptedPath
5663
}
5764

5865
foundPath := Path{
@@ -70,7 +77,6 @@ func GetPathsInFolder(folder string, includeFiles bool, includeFolders bool, acc
7077
size += uint64(info.Size())
7178

7279
return nil
73-
7480
})
7581

7682
if err != nil {

runtime/runtime.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package runtime
22

33
var (
4-
// Build Vars
54
Version string
65
Timestamp string
76
GitCommit string

uploader/checker/size.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
type Size struct{}
1111

1212
func (_ Size) Check(cfg *config.UploaderCheck, log *logrus.Entry, paths []pathutils.Path, size uint64) (bool, error) {
13-
1413
// Check Total Size
1514
if size > cfg.Limit {
1615
log.WithFields(logrus.Fields{
@@ -25,7 +24,6 @@ func (_ Size) Check(cfg *config.UploaderCheck, log *logrus.Entry, paths []pathut
2524
}
2625

2726
func (_ Size) CheckFile(cfg *config.UploaderCheck, log *logrus.Entry, path pathutils.Path, size uint64) (bool, error) {
28-
2927
// Check Total Size
3028
if size > cfg.Limit {
3129
return true, nil

0 commit comments

Comments
 (0)