1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-07 13:31:37 +02:00

refactor: small improvements

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos A Becker 2022-11-11 23:42:45 -03:00
parent e47bad4997
commit 22a7a9a835
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

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