check / check (push) Waiting to run
The Go module moves from backend/ to the root (go.mod, go.sum, .golangci.yml, cmd/, internal/), the page's source to web/, and nginx's two files to configs/. backend/ is gone: its LICENSE and .dockerignore are deleted, and its .gitignore entries, README and scripts are folded into the root ones. script/build builds the server binary after the frontend; script/run and script/clean move up from backend/script/; make test, lint, fmt and fmt-check do what the backend's did. Vite's root is web/ and it still builds into dist/. go.mod ignores node_modules/, whose npm packages can ship .go files. script/bootstrap no longer installs gcc, which only the host Go tests needed. Model: opus-5-5
30 lines
847 B
Go
30 lines
847 B
Go
package reportbuf
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
// FlushSizeThreshold exposes the buffer size at which Append starts
|
|
// writing a report file to the external tests.
|
|
const FlushSizeThreshold = flushSizeThreshold
|
|
|
|
// Flush writes the buffered reports to a file now, as the periodic
|
|
// flush does, so tests need not wait a minute for it.
|
|
func (b *Buffer) Flush() error {
|
|
return b.flushLocked()
|
|
}
|
|
|
|
// StopClock makes every report file the buffer writes from now on
|
|
// carry the timestamp at, as if all were written in one millisecond.
|
|
func (b *Buffer) StopClock(at time.Time) {
|
|
b.now = func() time.Time { return at }
|
|
}
|
|
|
|
// OnFileCreated makes the buffer call fn with each report file it
|
|
// writes from now on, once the file is created and before anything is
|
|
// written to it.
|
|
func (b *Buffer) OnFileCreated(fn func(f *os.File)) {
|
|
b.fileCreated = fn
|
|
}
|