From e52ec1de335fedf983e3e3f440f11cd6832cc832 Mon Sep 17 00:00:00 2001 From: John Shen Date: Sat, 30 Nov 2024 16:19:56 -0500 Subject: [PATCH] Extract correct version when using --with flag to replace Caddy core --- 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