Skip to content

Commit

Permalink
don't fail if LDFLAGS env isn't set (ko-build#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh authored Jul 8, 2022
1 parent 9139f45 commit 59c4264
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
baseImageOverrides:
github.com/google/ko: golang:1.17

builds:
- id: ko
ldflags:
- "{{ .Env.LDFLAGS }}"
4 changes: 3 additions & 1 deletion pkg/build/gobuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,9 @@ func (g *gobuild) tarKoData(ref reference, platform *v1.Platform) (*bytes.Buffer
}

func createTemplateData() map[string]interface{} {
envVars := map[string]string{}
envVars := map[string]string{
"LDFLAGS": "",
}
for _, entry := range os.Environ() {
kv := strings.SplitN(entry, "=", 2)
envVars[kv[0]] = kv[1]
Expand Down

0 comments on commit 59c4264

Please sign in to comment.