aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/timonwong/loggercheck/internal/bytebufferpool
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/timonwong/loggercheck/internal/bytebufferpool')
-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)
+}