Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix date cron issue #914

Merged
merged 5 commits into from
Aug 25, 2021
Merged

Conversation

laurentsimon
Copy link
Contributor

  • Please check if the PR fulfills these requirements
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    bug fix

  • What is the current behavior? (You can also link to an open issue here)
    date format is broken

  • What is the new behavior (if this is a feature change)?
    fixed

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    no

  • Other information:
    close BUG: Cron date format broken #911

sce "github.com/ossf/scorecard/v2/errors"
)

//nolint
type jsonCheckResult struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do this instead:

func (u *ScorecardResult) MarshalJSON() ([]byte, error) {
	type Alias ScorecardResult
	return json.Marshal(&struct {
		Date string `json:"date"`
		*Alias
	}{
		Date: u.Date.Format("..."),
		Alias:    (*Alias)(u),
	})
}

See: http://choly.ca/post/go-json-marshalling/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to skip this.

@laurentsimon laurentsimon enabled auto-merge (squash) August 25, 2021 22:26
@laurentsimon laurentsimon merged commit e083f04 into ossf:main Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Cron date format broken
2 participants