chore: change interface{} to any (#2818)
* chore: change interface{} to any
* chore: update goctl version to 1.5.0
* chore: update goctl deps
This commit is contained in:
@@ -42,7 +42,7 @@ func NewChunkExecutor(execute Execute, opts ...ChunkOption) *ChunkExecutor {
|
||||
}
|
||||
|
||||
// Add adds task with given chunk size into ce.
|
||||
func (ce *ChunkExecutor) Add(task interface{}, size int) error {
|
||||
func (ce *ChunkExecutor) Add(task any, size int) error {
|
||||
ce.executor.Add(chunk{
|
||||
val: task,
|
||||
size: size,
|
||||
@@ -82,25 +82,25 @@ func newChunkOptions() chunkOptions {
|
||||
}
|
||||
|
||||
type chunkContainer struct {
|
||||
tasks []interface{}
|
||||
tasks []any
|
||||
execute Execute
|
||||
size int
|
||||
maxChunkSize int
|
||||
}
|
||||
|
||||
func (bc *chunkContainer) AddTask(task interface{}) bool {
|
||||
func (bc *chunkContainer) AddTask(task any) bool {
|
||||
ck := task.(chunk)
|
||||
bc.tasks = append(bc.tasks, ck.val)
|
||||
bc.size += ck.size
|
||||
return bc.size >= bc.maxChunkSize
|
||||
}
|
||||
|
||||
func (bc *chunkContainer) Execute(tasks interface{}) {
|
||||
vals := tasks.([]interface{})
|
||||
func (bc *chunkContainer) Execute(tasks any) {
|
||||
vals := tasks.([]any)
|
||||
bc.execute(vals)
|
||||
}
|
||||
|
||||
func (bc *chunkContainer) RemoveAll() interface{} {
|
||||
func (bc *chunkContainer) RemoveAll() any {
|
||||
tasks := bc.tasks
|
||||
bc.tasks = nil
|
||||
bc.size = 0
|
||||
@@ -108,6 +108,6 @@ func (bc *chunkContainer) RemoveAll() interface{} {
|
||||
}
|
||||
|
||||
type chunk struct {
|
||||
val interface{}
|
||||
val any
|
||||
size int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user