A time layout is written with placeholders such as YYYY that Go's time package takes literally

tx0/go:foreign-time-layoutdefaultwarningbug

What it finds

t.Format("YYYY-MM-DD"): Go writes layouts with a reference time, Mon Jan 2 15:04:05 MST 2006, so 2006-01-02 is a date. Placeholders from other languages, such as YYYY, dd, HH or mm, are not special: Format prints them as they are and Parse expects to find them in the input. Within a layout, 01 after an hour is a month, not the minutes, which are 04.

The layout must be a constant string of the file, passed to time.Parse, time.ParseInLocation, or to a method Format or AppendFormat in a file that imports time. It is reported when it contains a run of letters YYYY, yyyy, YY, yy, DD, dd, HH, hh, mm, ss or SS, or 01 right after 15: or 03:.

From the rule's source, foreign_time_layout.rs.

Example from the rule's tests
package p import "time" const stamp = "yyyy-MM-dd" func f(t time.Time, s string) (string, error) {	a := t.Format("YYYY-MM-DD")tx0 reports: YYYY in the layout YYYY-MM-DD is not a placeholder of time	b := t.Format("2006-01-02 15:01")tx0 reports: 01 after the hour in the layout 2006-01-02 15:01 is the month	_, err := time.Parse(stamp, s)tx0 reports: yyyy in the layout yyyy-MM-dd is not a placeholder of time	c := t.Format("2006-01-02T15:04:05Z07:00")	d := t.Format(time.RFC3339)	e := t.Format("Mon Jan _2 03:04PM")	return a + b + c + d + e, err}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/go:foreign-time-layout" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/go:foreign-time-layout] reason="..."

tx0 explain tx0/go:foreign-time-layout shows the same in the terminal. Found a false positive? Report it.