Skip to content

Commit 8ec437d

Browse files
committed
build: toControllerOptions: micro-optimization
Swapping the order of these checks, which I guess is the most minimal optimization possible BenchmarkGetEnv-10 68764720 16.82 ns/op 0 B/op 0 allocs/op BenchmarkMap-10 454135184 2.635 ns/op 0 B/op 0 allocs/op Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent bd672ea commit 8ec437d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

commands/build.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ func (o *buildOptions) toControllerOptions() (*controllerapi.BuildOptions, error
121121
}
122122

123123
// TODO: extract env var parsing to a method easily usable by library consumers
124-
if v := os.Getenv("SOURCE_DATE_EPOCH"); v != "" {
125-
if _, ok := opts.BuildArgs["SOURCE_DATE_EPOCH"]; !ok {
124+
if _, ok := opts.BuildArgs["SOURCE_DATE_EPOCH"]; !ok {
125+
if v := os.Getenv("SOURCE_DATE_EPOCH"); v != "" {
126126
opts.BuildArgs["SOURCE_DATE_EPOCH"] = v
127127
}
128128
}

0 commit comments

Comments
 (0)