logbuffer: split out LineBuffer
We want to be able to use similar line-oriented buffering in LogTree.
Rather than repeat ourselves, let's fact this out into a nice little
library.
Test Plan: Covered by existing logbuffer tests, added some extra linebuffer-specific ones.
X-Origin-Diff: phab/D636
GitOrigin-RevId: 38e832d323ed9f1723feaa9f9169caad18619e55
diff --git a/core/pkg/logbuffer/BUILD.bazel b/core/pkg/logbuffer/BUILD.bazel
index a53cb7a..fb7512a 100644
--- a/core/pkg/logbuffer/BUILD.bazel
+++ b/core/pkg/logbuffer/BUILD.bazel
@@ -2,14 +2,20 @@
go_library(
name = "go_default_library",
- srcs = ["logbuffer.go"],
+ srcs = [
+ "linebuffer.go",
+ "logbuffer.go",
+ ],
importpath = "git.monogon.dev/source/nexantic.git/core/pkg/logbuffer",
visibility = ["//visibility:public"],
)
go_test(
name = "go_default_test",
- srcs = ["logbuffer_test.go"],
+ srcs = [
+ "linebuffer_test.go",
+ "logbuffer_test.go",
+ ],
embed = [":go_default_library"],
deps = ["@com_github_stretchr_testify//require:go_default_library"],
)