Skip to content

Commit

Permalink
refactor: small improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Nov 12, 2022
1 parent e47bad4 commit 22a7a9a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions internal/pipe/build/build.go
Expand Up @@ -212,31 +212,28 @@ 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"
}
if strings.Contains(target, "windows") {
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"
}
Expand Down

0 comments on commit 22a7a9a

Please sign in to comment.