Dan Anglin
71d62ecaf6
Add golangci-lint for linting and refactor the code based on the feedback from running it. Changes: - Add configuration for golangci-lint. - Break the large function in create.go into smaller ones. - Rename internal/templateFuncs to internal/templatefuncs to remove upper case letters in the package name. - Add a mage target for lint tests.
24 lines
428 B
Go
24 lines
428 B
Go
package templatefuncs
|
|
|
|
import (
|
|
"time"
|
|
|
|
"codeflow.dananglin.me.uk/apollo/spruce/internal/cv"
|
|
)
|
|
|
|
// WithinTimePeriod returns true if the employment's end date is within
|
|
// the specified time period.
|
|
func WithinTimePeriod(date time.Time) func(d cv.Duration) bool {
|
|
return func(d cv.Duration) bool {
|
|
if d.Present {
|
|
return true
|
|
}
|
|
|
|
result, err := d.After(date)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
|
|
return result
|
|
}
|
|
}
|