Skip to content

Commit

Permalink
treewide: make every compilation statically linked
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSom3body committed Dec 29, 2024
1 parent 7fdeee3 commit 253ea6e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
go-version-file: 'go.mod'

- name: Build
env:
CGO_ENABLED: 0
run: go build -v ./...

- name: Test
env:
CGO_ENABLED: 0
run: go test -v ./...
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ jobs:

- name: Compile go binary
env:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
run: |
mkdir -p dist
go build -o dist/
go build \
-ldflags="-s -w -extldflags '-static'"
-o dist/
- name: Create release
env:
Expand Down
4 changes: 4 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ buildGoModule {
src = ./..;
vendorHash = "sha256-hocnLCzWN8srQcO3BMNkd2lt0m54Qe7sqAhUxVZlz1k=";

env.CGO_ENABLED = 0;

ldflags = [
"-s -w"
"-X 'github.com/MrSom3body/gotcha/cmd.ifaceName=${interface}'"
"-extldflags '-static'"
];
}

0 comments on commit 253ea6e

Please sign in to comment.