From 9a402ede2edc56ee078bb5fdbe4ea8491e663c95 Mon Sep 17 00:00:00 2001 From: Jerry Jacobs Date: Mon, 29 Jul 2024 21:59:03 +0200 Subject: [PATCH] Build dll runner with goreleaser --- .goreleaser.yaml | 23 ++++++++++++++++++++--- cmd/win-dll-runner/main.go | 3 +-- go.mod | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ec55a66..8ff2b03 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -26,13 +26,30 @@ builds: goarch: - amd64 ldflags: - - -s -trimpath + - -w -trimpath gobinary: "scripts/garble.sh" buildmode: c-shared tags: - release - dll + - id: "win-dll-loader" + env: + - CGO_ENABLED=1 + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + main: ./cmd/win-dll-runner/main.go + ldflags: + - -w + gobinary: "scripts/garble.sh" + goos: + - windows + goarch: + - amd64 + tags: + - release + + - id: "win-release" env: - CGO_ENABLED=1 @@ -43,7 +60,7 @@ builds: goarch: - amd64 ldflags: - - -H=windowsgui + - -w -H=windowsgui gobinary: "scripts/garble.sh" tags: - release @@ -52,7 +69,7 @@ upx: - # Whether to enable it or not. # # Templates: allowed. - enabled: true + enabled: false # Filter by build ID. #ids: [build1, build2] diff --git a/cmd/win-dll-runner/main.go b/cmd/win-dll-runner/main.go index 34d69c0..1b81151 100644 --- a/cmd/win-dll-runner/main.go +++ b/cmd/win-dll-runner/main.go @@ -5,7 +5,6 @@ package main import ( "golang.org/x/sys/windows" - "os" ) func runMainFromDLL() { @@ -17,7 +16,7 @@ func runMainFromDLL() { return } - _, _, _ := runMainFunc.Call() + _, _, _ = runMainFunc.Call() } func main() { diff --git a/go.mod b/go.mod index 1f9ca33..cd90e2a 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,13 @@ require ( github.com/cloudfoundry/socks5-proxy v0.2.120 github.com/xor-gate/sshfp v0.0.0-20200411085609-13942eb67330 golang.org/x/crypto v0.25.0 + golang.org/x/sys v0.22.0 ) require ( github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e // indirect github.com/miekg/dns v1.1.29 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect ) replace github.com/cloudfoundry/socks5-proxy v0.2.120 => github.com/xor-gate/socks5-proxy v0.0.0-20240724155447-4b9ab1a56d38