aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/timonwong/loggercheck/internal/bytebufferpool/pool.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-02-22 22:16:50 +0100
committerTaras Madan <tarasmadan@google.com>2023-02-24 12:47:23 +0100
commit4165372ec8fd142475a4e35fd0cf4f8042132208 (patch)
tree21cd62211b4dd80bee469054c5b65db77342333c /vendor/github.com/timonwong/loggercheck/internal/bytebufferpool/pool.go
parent2b3ed821a493b8936c8bacfa6f8b4f1c90a00855 (diff)
dependencies: update
set go min requirements to 1.19 update dependencies update vendor
Diffstat (limited to 'vendor/github.com/timonwong/loggercheck/internal/bytebufferpool/pool.go')
-rw-r--r--vendor/github.com/timonwong/loggercheck/internal/bytebufferpool/pool.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/timonwong/loggercheck/internal/bytebufferpool/pool.go b/vendor/github.com/timonwong/loggercheck/internal/bytebufferpool/pool.go
new file mode 100644
index 000000000..9d88d21c4
--- /dev/null
+++ b/vendor/github.com/timonwong/loggercheck/internal/bytebufferpool/pool.go
@@ -0,0 +1,22 @@
+package bytebufferpool
+
+import (
+ "bytes"
+ "sync"
+)
+
+var pool = sync.Pool{
+ New: func() interface{} {
+ return new(bytes.Buffer)
+ },
+}
+
+func Get() *bytes.Buffer {
+ buf := pool.Get().(*bytes.Buffer)
+ buf.Reset()
+ return buf
+}
+
+func Put(buf *bytes.Buffer) {
+ pool.Put(buf)
+}