File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,17 @@ GORELEASER_IMAGE := ghcr.io/goreleaser/goreleaser-cross:v$(GOLANG_VERSION)
21
21
GOBIN := $(shell go env GOPATH) /bin
22
22
GIT_COMMIT := $(shell git rev-parse --short HEAD)
23
23
24
+ LDFLAGS := -ldflags "-X github.com/GoogleContainerTools/kpt/run.version=${GIT_COMMIT}
25
+ ifeq ($(OS ) ,Windows_NT)
26
+ # Do nothing
27
+ else
28
+ UNAME := $(shell uname -s)
29
+ ifeq ($(UNAME),Linux)
30
+ LDFLAGS += -extldflags '-z noexecstack'
31
+ endif
32
+ endif
33
+ LDFLAGS += "
34
+
24
35
# T refers to an e2e test case matcher. This enables running e2e tests
25
36
# selectively. For example,
26
37
# To invoke e2e tests related to fnconfig, run:
@@ -32,7 +43,7 @@ T ?= ".*"
32
43
all : generate license fix vet fmt lint license-check test build tidy
33
44
34
45
build :
35
- go build -ldflags " -X github.com/GoogleContainerTools/kpt/run.version= ${GIT_COMMIT} " -o $(GOBIN ) /kpt -v .
46
+ go build ${LDFLAGS} -o $(GOBIN ) /kpt -v .
36
47
37
48
update-deps-to-head :
38
49
go get sigs.k8s.io/cli-utils@master
@@ -90,7 +101,7 @@ license-check: install-go-licenses
90
101
$(GOBIN ) /go-licenses check github.com/GoogleContainerTools/kpt
91
102
92
103
test :
93
- go test -cover ./...
104
+ go test -cover ${LDFLAGS} ./...
94
105
95
106
# This target is used to run Go tests that require docker runtime.
96
107
# Some tests, like pipeline tests, need to have docker available to run.
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ builds:
51
51
env :
52
52
- CC=x86_64-linux-gnu-gcc
53
53
- CXX=x86_64-linux-gnu-g++
54
- ldflags : -s -w -X github.com/GoogleContainerTools/kpt/run.version={{.Version}} -linkmode external -extldflags "-static"
54
+ ldflags : -s -w -X github.com/GoogleContainerTools/kpt/run.version={{.Version}} -linkmode external -extldflags "-static -z noexecstack "
55
55
56
56
- id : linux-arm64
57
57
goos :
@@ -61,7 +61,7 @@ builds:
61
61
env :
62
62
- CC=aarch64-linux-gnu-gcc
63
63
- CXX=aarch64-linux-gnu-g++
64
- ldflags : -s -w -X github.com/GoogleContainerTools/kpt/run.version={{.Version}} -linkmode external -extldflags "-static"
64
+ ldflags : -s -w -X github.com/GoogleContainerTools/kpt/run.version={{.Version}} -linkmode external -extldflags "-static -z noexecstack "
65
65
66
66
dockers :
67
67
- ids :
You can’t perform that action at this time.
0 commit comments