Skip to content

Commit

Permalink
change(lint): fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
l3uddz committed Apr 23, 2020
1 parent e17579c commit 5efb7b4
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 21 deletions.
1 change: 0 additions & 1 deletion cache/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func IsBanned(key string) (bool, time.Time) {

// this key is still banned
return true, item.Expires

}

func SetBanned(key string, hours int) error {
Expand Down
9 changes: 0 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"fmt"
"github.com/json-iterator/go"
"os"

"github.com/l3uddz/crop/logger"
Expand Down Expand Up @@ -38,18 +37,11 @@ var (

// Internal
log = logger.GetLogger("cfg")
json = jsoniter.ConfigCompatibleWithStandardLibrary
newOptionLen = 0
)

/* Public */

func (cfg Configuration) ToJsonString() (string, error) {
c := viper.AllSettings()
bs, err := json.MarshalIndent(c, "", " ")
return string(bs), err
}

func Init(configFilePath string) error {
// set package variables
cfgPath = configFilePath
Expand Down Expand Up @@ -101,7 +93,6 @@ func Init(configFilePath string) error {

func ShowUsing() {
log.Infof("Using %s = %q", stringutils.LeftJust("CONFIG", " ", 10), cfgPath)

}

/* Private */
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-cmd/cmd v1.2.0
github.com/golang/protobuf v1.4.0 // indirect
github.com/json-iterator/go v1.1.9
github.com/json-iterator/go v1.1.9 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
Expand Down
1 change: 1 addition & 0 deletions logger/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func Init(logLevel int, logFilePath string) error {
logrus.WithError(err).Errorf("Failed initializing rotating file log to %q", logFilePath)
return errors.Wrap(err, "failed initializing rotating file hook")
}

logrus.AddHook(rotateFileHook)

// set console formatter
Expand Down
3 changes: 0 additions & 3 deletions pathutils/file.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package pathutils

import (
"github.com/l3uddz/crop/logger"
"os"
"path/filepath"
)

var log = logger.GetLogger("paths")

/* Public */

func GetCurrentBinaryPath() string {
Expand Down
14 changes: 10 additions & 4 deletions pathutils/find.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package pathutils

import (
"github.com/l3uddz/crop/logger"

"os"
"path/filepath"
"strings"
"time"
)

var (
log = logger.GetLogger("paths")
)

type Path struct {
Path string
RealPath string
Expand Down Expand Up @@ -47,12 +53,13 @@ func GetPathsInFolder(folder string, includeFiles bool, includeFolders bool, acc
}

if acceptFn != nil {
if acceptedPath := acceptFn(path); acceptedPath == nil {
acceptedPath := acceptFn(path)
if acceptedPath == nil {
log.Tracef("Skipping rejected path: %s", path)
return nil
} else {
finalPath = *acceptedPath
}

finalPath = *acceptedPath
}

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

return nil

})

if err != nil {
Expand Down
1 change: 0 additions & 1 deletion runtime/runtime.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package runtime

var (
// Build Vars
Version string
Timestamp string
GitCommit string
Expand Down
2 changes: 0 additions & 2 deletions uploader/checker/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
type Size struct{}

func (_ Size) Check(cfg *config.UploaderCheck, log *logrus.Entry, paths []pathutils.Path, size uint64) (bool, error) {

// Check Total Size
if size > cfg.Limit {
log.WithFields(logrus.Fields{
Expand All @@ -25,7 +24,6 @@ func (_ Size) Check(cfg *config.UploaderCheck, log *logrus.Entry, paths []pathut
}

func (_ Size) CheckFile(cfg *config.UploaderCheck, log *logrus.Entry, path pathutils.Path, size uint64) (bool, error) {

// Check Total Size
if size > cfg.Limit {
return true, nil
Expand Down

0 comments on commit 5efb7b4

Please sign in to comment.