From 46ed0fcd159d2de1639a8d73968114168f4a9c90 Mon Sep 17 00:00:00 2001 From: Chris Koch Date: Fri, 16 Feb 2024 04:36:11 +0000 Subject: [PATCH] Add WithCoveredCommands alias Signed-off-by: Chris Koch --- uimage/uimage.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/uimage/uimage.go b/uimage/uimage.go index 49e7ff7..c52e123 100644 --- a/uimage/uimage.go +++ b/uimage/uimage.go @@ -386,6 +386,14 @@ func WithBinaryCommandsOpts(gbOpts *golang.BuildOpts, cmd ...string) Modifier { return WithCommands(gbOpts, builder.Binary, cmd...) } +// WithCoveredCommands adds Go commands to compile as individual binaries with +// -cover and -covermode=atomic for integration test coverage. +// +// Allowed formats for cmd are documented in [WithCommands]. +func WithCoveredCommands(cmd ...string) Modifier { + return WithCommands(&golang.BuildOpts{ExtraArgs: []string{"-cover", "covermode=atomic"}}, builder.Binary, cmd...) +} + // WithOutput sets the archive output file. func WithOutput(w initramfs.WriteOpener) Modifier { return func(o *Opts) error {