From c0aca26dd24cc0909911fd10583f2d2b4097e0ba Mon Sep 17 00:00:00 2001 From: jshenguru Date: Sun, 1 Dec 2024 12:53:17 -0500 Subject: [PATCH] Extract correct version when using --with flag to replace Caddy core (#216) --- builder.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder.go b/builder.go index 2dd7017..cc9990f 100644 --- a/builder.go +++ b/builder.go @@ -107,6 +107,10 @@ func (b Builder) Build(ctx context.Context, outputFile string) error { // output looks like: github.com/caddyserver/caddy/v2 v2.7.6 version := strings.TrimSpace(strings.TrimPrefix(buffer.String(), buildEnv.caddyModulePath)) + index := strings.Index(version, "=>") + if index != -1 { + version = strings.TrimSpace(version[:index]) + } err = utils.WindowsResource(version, outputFile, buildEnv.tempFolder) if err != nil { return err