Documentation ¶
Overview ¶
Package epoch provides SOURCE_DATE_EPOCH utilities.
Index ¶
- Constants
- func FromContext(ctx context.Context) *time.Time
- func ParseSourceDateEpoch(sourceDateEpoch string) (*time.Time, error)
- func SetSourceDateEpoch(tm time.Time)
- func SourceDateEpoch() (*time.Time, error)
- func UnsetSourceDateEpoch()
- func WithSourceDateEpoch(ctx context.Context, tm *time.Time) context.Context
Constants ¶
const SourceDateEpochEnv = "SOURCE_DATE_EPOCH"
SourceDateEpochEnv is the SOURCE_DATE_EPOCH env var. See https://reproducible-builds.org/docs/source-date-epoch/
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the epoch associated with the context. FromContext does not fall back to read the SOURCE_DATE_EPOCH env var.
func ParseSourceDateEpoch ¶
ParseSourceDateEpoch parses the given source date epoch, as *time.Time. It returns an error if sourceDateEpoch is empty or not well-formatted.
func SetSourceDateEpoch ¶
SetSourceDateEpoch sets the SOURCE_DATE_EPOCH env var.
func SourceDateEpoch ¶
SourceDateEpoch returns the SOURCE_DATE_EPOCH env var as *time.Time. If the env var is not set, SourceDateEpoch returns nil without an error.
func UnsetSourceDateEpoch ¶
func UnsetSourceDateEpoch()
UnsetSourceDateEpoch unsets the SOURCE_DATE_EPOCH env var.
Types ¶
This section is empty.