fix: use -a build flag

This commit is contained in:
Kevin Franklin Kim 2023-01-10 14:44:59 +01:00
parent 378a4cb8bc
commit 53d127ce6b
3 changed files with 3 additions and 4 deletions

View File

@ -6,8 +6,6 @@ builds:
main: ./main.go
env:
- CGO_ENABLED=1
flags:
- -trimpath
ldflags:
- -s -w
- -X github.com/foomo/posh/internal/version.Version={{.Version}}

View File

@ -46,13 +46,13 @@ lint.super:
.PHONY: install
## Run go install
install:
@go install main.go
@go install -a main.go
@mv "${GOPATH}/bin/main" "${GOPATH}/bin/posh"
.PHONY: install.debug
## Run go install with debug
install.debug:
@go install -gcflags "all=-N -l" main.go
@go install -a -gcflags "all=-N -l" main.go
## === Utils ===

View File

@ -59,6 +59,7 @@ func (m *Manager) Build(ctx context.Context, filename string) error {
base := path.Base(filename)
cmd := exec.CommandContext(ctx, "go", "build",
"-buildmode=plugin",
"-a",
"-o", strings.ReplaceAll(base, ".go", ".so"),
base,
)