Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Herman Slatman <hslatman@users.noreply.github.com>
  • Loading branch information
maraino and hslatman committed Jul 1, 2024
1 parent 60f27c4 commit 4864e67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions internal/templates/funcmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import (
)

// GetFuncMap returns the list of functions provided by sprig. It adds the
// function "toTime" and changes the function "fail" to set the given string,
// this way we can report template errors directly to the template without
// having the wrapper that text/template adds.
// function "toTime" and changes the function "fail".
//
// "toTime" receives a time or a Unix epoch and formats it to RFC3339 in UTC.
// The "toTime" function receives a time or a Unix epoch and formats it to
// RFC3339 in UTC. The "fail" function sets the provided message, so that
// template errors are reported directly to the template without having the
// wrapper that text/template adds.
//
//
// sprig "env" and "expandenv" functions are removed to avoid the leak of
// information.
Expand Down
2 changes: 1 addition & 1 deletion internal/templates/funcmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ func TestGetFuncMap_toTime(t *testing.T) {
got, err := time.Parse(time.RFC3339, fn(nil))
require.NoError(t, err)
assert.WithinDuration(t, want, got, time.Second)
assert.Equal(t, got.Location(), time.UTC)
assert.Equal(t, time.UTC, got.Location())
})
}
2 changes: 1 addition & 1 deletion x509util/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (c *Certificate) GetCertificate() *x509.Certificate {
e.Set(cert)
}

// Validity bpunds.
// Validity bounds.
cert.NotBefore = c.NotBefore
cert.NotAfter = c.NotAfter

Expand Down

0 comments on commit 4864e67

Please sign in to comment.