Code Formats, Nits & Unused Func/Var deletions (#15286)
* _ to unused func options * rm useless brakets * rm trifial non used models functions * rm dead code * rm dead global vars * fix routers/api/v1/repo/issue.go * dont overload import module
This commit is contained in:
parent
0991f9aa42
commit
9c4601bdf8
33 changed files with 41 additions and 98 deletions
|
@ -122,9 +122,7 @@ func (s *linkifyParser) Parse(parent ast.Node, block text.Reader, pc parser.Cont
|
|||
}
|
||||
}
|
||||
}
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if consumes != 0 {
|
||||
s := segment.WithStop(segment.Start + 1)
|
||||
ast.MergeOrAppendTextSegment(parent, s)
|
||||
|
|
|
@ -8,7 +8,6 @@ package process
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os/exec"
|
||||
|
@ -22,10 +21,8 @@ import (
|
|||
// then we delete the singleton.
|
||||
|
||||
var (
|
||||
// ErrExecTimeout represent a timeout error
|
||||
ErrExecTimeout = errors.New("Process execution timeout")
|
||||
manager *Manager
|
||||
managerInit sync.Once
|
||||
manager *Manager
|
||||
managerInit sync.Once
|
||||
|
||||
// DefaultContext is the default context to run processing commands in
|
||||
DefaultContext = context.Background()
|
||||
|
|
|
@ -23,7 +23,7 @@ type UniqueByteFIFO interface {
|
|||
Has(data []byte) (bool, error)
|
||||
}
|
||||
|
||||
var _ (ByteFIFO) = &DummyByteFIFO{}
|
||||
var _ ByteFIFO = &DummyByteFIFO{}
|
||||
|
||||
// DummyByteFIFO represents a dummy fifo
|
||||
type DummyByteFIFO struct{}
|
||||
|
@ -48,7 +48,7 @@ func (*DummyByteFIFO) Len() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
var _ (UniqueByteFIFO) = &DummyUniqueByteFIFO{}
|
||||
var _ UniqueByteFIFO = &DummyUniqueByteFIFO{}
|
||||
|
||||
// DummyUniqueByteFIFO represents a dummy unique fifo
|
||||
type DummyUniqueByteFIFO struct {
|
||||
|
|
|
@ -50,7 +50,7 @@ func toConfig(exemplar, cfg interface{}) (interface{}, error) {
|
|||
var err error
|
||||
|
||||
configBytes, err = json.Marshal(cfg)
|
||||
ok = (err == nil)
|
||||
ok = err == nil
|
||||
}
|
||||
if !ok {
|
||||
// no ... we've tried hard enough at this point - throw an error!
|
||||
|
|
|
@ -21,7 +21,7 @@ type ByteFIFOQueueConfiguration struct {
|
|||
Name string
|
||||
}
|
||||
|
||||
var _ (Queue) = &ByteFIFOQueue{}
|
||||
var _ Queue = &ByteFIFOQueue{}
|
||||
|
||||
// ByteFIFOQueue is a Queue formed from a ByteFIFO and WorkerPool
|
||||
type ByteFIFOQueue struct {
|
||||
|
@ -196,7 +196,7 @@ func (q *ByteFIFOQueue) IsTerminated() <-chan struct{} {
|
|||
return q.terminated
|
||||
}
|
||||
|
||||
var _ (UniqueQueue) = &ByteFIFOUniqueQueue{}
|
||||
var _ UniqueQueue = &ByteFIFOUniqueQueue{}
|
||||
|
||||
// ByteFIFOUniqueQueue represents a UniqueQueue formed from a UniqueByteFifo
|
||||
type ByteFIFOUniqueQueue struct {
|
||||
|
|
|
@ -55,7 +55,7 @@ func NewLevelQueue(handle HandlerFunc, cfg, exemplar interface{}) (Queue, error)
|
|||
return queue, nil
|
||||
}
|
||||
|
||||
var _ (ByteFIFO) = &LevelQueueByteFIFO{}
|
||||
var _ ByteFIFO = &LevelQueueByteFIFO{}
|
||||
|
||||
// LevelQueueByteFIFO represents a ByteFIFO formed from a LevelQueue
|
||||
type LevelQueueByteFIFO struct {
|
||||
|
|
|
@ -69,7 +69,7 @@ type redisClient interface {
|
|||
Close() error
|
||||
}
|
||||
|
||||
var _ (ByteFIFO) = &RedisByteFIFO{}
|
||||
var _ ByteFIFO = &RedisByteFIFO{}
|
||||
|
||||
// RedisByteFIFO represents a ByteFIFO formed from a redisClient
|
||||
type RedisByteFIFO struct {
|
||||
|
|
|
@ -59,7 +59,7 @@ func NewLevelUniqueQueue(handle HandlerFunc, cfg, exemplar interface{}) (Queue,
|
|||
return queue, nil
|
||||
}
|
||||
|
||||
var _ (UniqueByteFIFO) = &LevelUniqueQueueByteFIFO{}
|
||||
var _ UniqueByteFIFO = &LevelUniqueQueueByteFIFO{}
|
||||
|
||||
// LevelUniqueQueueByteFIFO represents a ByteFIFO formed from a LevelUniqueQueue
|
||||
type LevelUniqueQueueByteFIFO struct {
|
||||
|
|
|
@ -62,7 +62,7 @@ func NewRedisUniqueQueue(handle HandlerFunc, cfg, exemplar interface{}) (Queue,
|
|||
return queue, nil
|
||||
}
|
||||
|
||||
var _ (UniqueByteFIFO) = &RedisUniqueByteFIFO{}
|
||||
var _ UniqueByteFIFO = &RedisUniqueByteFIFO{}
|
||||
|
||||
// RedisUniqueByteFIFO represents a UniqueByteFIFO formed from a redisClient
|
||||
type RedisUniqueByteFIFO struct {
|
||||
|
|
|
@ -296,7 +296,7 @@ func convertFullHTMLReferencesToShortRefs(re *regexp.Regexp, contentBytes *[]byt
|
|||
|
||||
// our new section has length endPos - match[3]
|
||||
// our old section has length match[9] - match[3]
|
||||
(*contentBytes) = (*contentBytes)[:len((*contentBytes))-match[9]+endPos]
|
||||
*contentBytes = (*contentBytes)[:len(*contentBytes)-match[9]+endPos]
|
||||
pos = endPos
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ func UpdateIssuesCommit(doer *models.User, repo *models.Repository, commits []*r
|
|||
continue
|
||||
}
|
||||
}
|
||||
close := (ref.Action == references.XRefActionCloses)
|
||||
close := ref.Action == references.XRefActionCloses
|
||||
if close && len(ref.TimeLog) > 0 {
|
||||
if err := issueAddTime(refIssue, doer, c.Timestamp, ref.TimeLog); err != nil {
|
||||
return err
|
||||
|
|
|
@ -318,7 +318,6 @@ var (
|
|||
LogRootPath string
|
||||
DisableRouterLog bool
|
||||
RouterLogLevel log.Level
|
||||
RouterLogMode string
|
||||
EnableAccessLog bool
|
||||
AccessLogTemplate string
|
||||
EnableXORMLog bool
|
||||
|
@ -408,10 +407,6 @@ var (
|
|||
IsWindows bool
|
||||
HasRobotsTxt bool
|
||||
InternalToken string // internal access token
|
||||
|
||||
// UILocation is the location on the UI, so that we can display the time on UI.
|
||||
// Currently only show the default time.Local, it could be added to app.ini after UI is ready
|
||||
UILocation = time.Local
|
||||
)
|
||||
|
||||
// IsProd if it's a production mode
|
||||
|
|
|
@ -50,7 +50,7 @@ func toConfig(exemplar, cfg interface{}) (interface{}, error) {
|
|||
var err error
|
||||
|
||||
configBytes, err = json.Marshal(cfg)
|
||||
ok = (err == nil)
|
||||
ok = err == nil
|
||||
}
|
||||
if !ok {
|
||||
// no ... we've tried hard enough at this point - throw an error!
|
||||
|
|
|
@ -19,8 +19,6 @@ import (
|
|||
var (
|
||||
// ErrURLNotSupported represents url is not supported
|
||||
ErrURLNotSupported = errors.New("url method not supported")
|
||||
// ErrIterateObjectsNotSupported represents IterateObjects not supported
|
||||
ErrIterateObjectsNotSupported = errors.New("iterateObjects method not supported")
|
||||
)
|
||||
|
||||
// ErrInvalidConfiguration is called when there is invalid configuration for a storage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue