pkg/epoch: replace some fmt.Sprintfs with strconv
Teeny-tiny optimizations:
BenchmarkSprintf-10 37735996 32.31 ns/op 0 B/op 0 allocs/op
BenchmarkItoa-10 591945836 2.031 ns/op 0 B/op 0 allocs/op
BenchmarkFormatUint-10 593701444 2.014 ns/op 0 B/op 0 allocs/op
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -60,10 +60,10 @@ func SourceDateEpochOrNow() time.Time {
|
||||
|
||||
// SetSourceDateEpoch sets the SOURCE_DATE_EPOCH env var.
|
||||
func SetSourceDateEpoch(tm time.Time) {
|
||||
os.Setenv(SourceDateEpochEnv, fmt.Sprintf("%d", tm.Unix()))
|
||||
_ = os.Setenv(SourceDateEpochEnv, strconv.Itoa(int(tm.Unix())))
|
||||
}
|
||||
|
||||
// UnsetSourceDateEpoch unsets the SOURCE_DATE_EPOCH env var.
|
||||
func UnsetSourceDateEpoch() {
|
||||
os.Unsetenv(SourceDateEpochEnv)
|
||||
_ = os.Unsetenv(SourceDateEpochEnv)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user