Re-vendor the shared files from sneak/prompts at dd4027b (closes #52)
check / check (push) Waiting to run
check / check (push) Waiting to run
Takes .golangci.yml, .dockerignore, .gitignore, .editorconfig, the workflow and REPO_POLICIES.md from sneak/prompts dd4027b, keeping this repository's own entries after the shared content. Lint (golangci-lint v2.14.0) and test become Dockerfile phases that script/lint and script/test build alone and uncached; the image build depends on both, and script/cibuild bootstraps, runs script/check, then builds the image. The agent guidance file moves to AGENTS.md. The Go code is fixed for what the new configuration finds; reads that iterate rows now also report an iteration error. Model: opus-5-5
This commit is contained in:
@@ -60,6 +60,7 @@ func timeSince(t time.Time) string {
|
||||
if duration < time.Minute {
|
||||
return "just now"
|
||||
}
|
||||
|
||||
if duration < time.Hour {
|
||||
minutes := int(duration.Minutes())
|
||||
if minutes == 1 {
|
||||
@@ -68,6 +69,7 @@ func timeSince(t time.Time) string {
|
||||
|
||||
return duration.Truncate(time.Minute).String() + " ago"
|
||||
}
|
||||
|
||||
if duration < hoursPerDay*time.Hour {
|
||||
hours := int(duration.Hours())
|
||||
if hours == 1 {
|
||||
@@ -76,10 +78,12 @@ func timeSince(t time.Time) string {
|
||||
|
||||
return duration.Truncate(time.Hour).String() + " ago"
|
||||
}
|
||||
|
||||
days := int(duration.Hours() / hoursPerDay)
|
||||
if days == 1 {
|
||||
return "1 day ago"
|
||||
}
|
||||
|
||||
if days < daysPerMonth {
|
||||
return duration.Truncate(hoursPerDay*time.Hour).String() + " ago"
|
||||
}
|
||||
@@ -118,7 +122,7 @@ func initTemplates() {
|
||||
"appLicense": func() string { return version.License },
|
||||
"appRepoURL": func() string { return version.RepoURL },
|
||||
"appGitRevision": func() string { return version.GitRevisionShort },
|
||||
"appGitCommitURL": func() string { return version.CommitURL() },
|
||||
"appGitCommitURL": version.CommitURL,
|
||||
}
|
||||
|
||||
// Parse index template
|
||||
@@ -134,19 +138,22 @@ func initTemplates() {
|
||||
}
|
||||
|
||||
// Parse AS detail template
|
||||
defaultTemplates.ASDetail, err = template.New("asDetail").Funcs(funcs).Parse(asDetailHTML)
|
||||
defaultTemplates.ASDetail, err = template.New("asDetail").
|
||||
Funcs(funcs).Parse(asDetailHTML)
|
||||
if err != nil {
|
||||
panic("failed to parse AS detail template: " + err.Error())
|
||||
}
|
||||
|
||||
// Parse prefix detail template
|
||||
defaultTemplates.PrefixDetail, err = template.New("prefixDetail").Funcs(funcs).Parse(prefixDetailHTML)
|
||||
defaultTemplates.PrefixDetail, err = template.New("prefixDetail").
|
||||
Funcs(funcs).Parse(prefixDetailHTML)
|
||||
if err != nil {
|
||||
panic("failed to parse prefix detail template: " + err.Error())
|
||||
}
|
||||
|
||||
// Parse prefix length template
|
||||
defaultTemplates.PrefixLength, err = template.New("prefixLength").Funcs(funcs).Parse(prefixLengthHTML)
|
||||
defaultTemplates.PrefixLength, err = template.New("prefixLength").
|
||||
Funcs(funcs).Parse(prefixLengthHTML)
|
||||
if err != nil {
|
||||
panic("failed to parse prefix length template: " + err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user