Skip to content

Commit 5001bcc

Browse files
committed
add buffer
1 parent 93a5f11 commit 5001bcc

26 files changed

+738
-132
lines changed

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ linters:
368368
- errorlint
369369
- bodyclose
370370
- exportloopref
371-
- gci
372371
- gosec
373372
- lll
374373
fast: false

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2024, Mikhail Knyazhev <markus621@yandex.com>
3+
Copyright (c) 2024-2025, Mikhail Knyazhev <markus621@yandex.com>
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ build:
2323
tests:
2424
devtool test
2525

26-
.PHONY: pre-commite
27-
pre-commite: setup lint build tests
26+
.PHONY: pre-commit
27+
pre-commit: setup license lint build tests
2828

2929
.PHONY: ci
3030
ci: install setup lint build tests

ascii.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
2+
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
33
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
44
*/
55

cache/cache_simple.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
3+
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
4+
*/
5+
16
package cache
27

38
import (

cache/cache_time.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
3+
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
4+
*/
5+
16
package cache
27

38
import (

cache/cache_time_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
3+
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
4+
*/
5+
16
package cache
27

38
import (

cache/common.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
3+
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
4+
*/
5+
16
package cache
27

38
import "time"

codec/encdec.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
2+
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
33
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
44
*/
55

@@ -31,7 +31,7 @@ type (
3131
Codec struct {
3232
Encode func(in interface{}) ([]byte, error)
3333
Decode func(b []byte, out interface{}) error
34-
Merge func(dst map[string]interface{}, src map[string]interface{}) error
34+
Merge func(dst map[string]interface{}, src ...map[string]interface{})
3535
}
3636
encoders struct {
3737
list map[string]Codec
@@ -54,7 +54,7 @@ func (v *encoders) Add(
5454
ext string,
5555
enc func(interface{}) ([]byte, error),
5656
dec func([]byte, interface{}) error,
57-
merge func(map[string]interface{}, map[string]interface{}) error,
57+
merge func(map[string]interface{}, ...map[string]interface{}),
5858
) *encoders {
5959
v.mux.Lock(func() {
6060
v.list[ext] = Codec{

codec/encdec_blob.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
2+
* Copyright (c) 2024-2025 Mikhail Knyazhev <markus621@yandex.com>. All rights reserved.
33
* Use of this source code is governed by a BSD 3-Clause license that can be found in the LICENSE file.
44
*/
55

@@ -53,9 +53,7 @@ func (v *BlobEncoder) Encode(configs ...interface{}) error {
5353
if err = codec.Decode(bb, &tmp); err != nil {
5454
return err
5555
}
56-
if err = codec.Merge(out, tmp); err != nil {
57-
return err
58-
}
56+
codec.Merge(out, tmp)
5957
}
6058
v.Blob, err0 = codec.Encode(out)
6159
return err0

0 commit comments

Comments
 (0)