From 22a7a9a8357703e95a2302270d7e6f178343e02b Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Fri, 11 Nov 2022 23:42:45 -0300 Subject: [PATCH] refactor: small improvements Signed-off-by: Carlos A Becker --- internal/pipe/build/build.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/internal/pipe/build/build.go b/internal/pipe/build/build.go index 003c715ed15..d2ae35d53c8 100644 --- a/internal/pipe/build/build.go +++ b/internal/pipe/build/build.go @@ -212,15 +212,10 @@ func buildOptionsForTarget(ctx *context.Context, build config.Build, target stri } func extFor(target string, build config.BuildDetails) string { - if target == "js_wasm" { - return ".wasm" - } - // Configure the extensions for shared and static libraries - by default .so and .a respectively - // with overrides for Windows (.dll for shared and .lib for static) and .dylib for macOS. - buildmode := build.Buildmode - - if buildmode == "c-shared" { + switch build.Buildmode { + case "c-shared": if strings.Contains(target, "darwin") { return ".dylib" } @@ -228,15 +223,17 @@ func extFor(target string, build config.BuildDetails) string { return ".dll" } return ".so" - } - - if buildmode == "c-archive" { + case "c-archive": if strings.Contains(target, "windows") { return ".lib" } return ".a" } + if target == "js_wasm" { + return ".wasm" + } + if strings.Contains(target, "windows") { return ".exe" }