Extract correct version when using --with flag to replace Caddy core (#216)

This commit is contained in:
jshenguru 2024-12-01 12:53:17 -05:00 committed by GitHub
parent c548f44e2d
commit c0aca26dd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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