From 7031ffd262a49276de187589e5b29b974c801c2b Mon Sep 17 00:00:00 2001 From: Hein Date: Thu, 3 Sep 2026 21:17:03 +0200 Subject: [PATCH] chore(ci): add govulncheck, staticcheck, go vet, gofumpt gates * Add lint/format checks to the Gitea release workflow and Makefile (targets: vet, fmt, fmt-check, staticcheck, govulncheck, check) * Switch .golangci.json formatter from gofmt to gofumpt (extra.group-params) * Bump golang.org/x/text 0.37.0 -> 0.39.0 for GO-2026-5970; re-vendor * Fix staticcheck S1011 in pkg/diff; drop unused pgsql writer helpers * Fix gocritic unnamedResult (pkg/diff) and rangeValCopy (pkg/pgsql) * Apply gofumpt + goimports formatting across the tree --- sql_types.go | 9 +++++---- sql_types_test.go | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql_types.go b/sql_types.go index 0b3146c..8c6b83e 100644 --- a/sql_types.go +++ b/sql_types.go @@ -111,6 +111,7 @@ func (n *SqlNull[T]) Scan(value any) error { return n.FromString(fmt.Sprintf("%v", value)) } } + func (n *SqlNull[T]) FromString(s string) error { s = strings.TrimSpace(s) n.Valid = false @@ -448,7 +449,7 @@ type ( type SqlTimeStamp struct{ SqlNull[time.Time] } func (t SqlTimeStamp) MarshalJSON() ([]byte, error) { - if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0002, 1, 1, 0, 0, 0, 0, time.UTC)) { + if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0o002, 1, 1, 0, 0, 0, 0, time.UTC)) { return []byte("null"), nil } return fmt.Appendf(nil, `"%s"`, t.Val.Format("2006-01-02T15:04:05")), nil @@ -465,14 +466,14 @@ func (t *SqlTimeStamp) UnmarshalJSON(b []byte) error { } func (t SqlTimeStamp) Value() (driver.Value, error) { - if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0002, 1, 1, 0, 0, 0, 0, time.UTC)) { + if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0o002, 1, 1, 0, 0, 0, 0, time.UTC)) { return nil, nil } return t.Val.Format("2006-01-02T15:04:05"), nil } func (t SqlTimeStamp) MarshalYAML() (any, error) { - if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0002, 1, 1, 0, 0, 0, 0, time.UTC)) { + if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0o002, 1, 1, 0, 0, 0, 0, time.UTC)) { return nil, nil } return t.Val.Format("2006-01-02T15:04:05"), nil @@ -489,7 +490,7 @@ func (t *SqlTimeStamp) UnmarshalYAML(value *yaml.Node) error { } func (t SqlTimeStamp) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0002, 1, 1, 0, 0, 0, 0, time.UTC)) { + if !t.Valid || t.Val.IsZero() || t.Val.Before(time.Date(0o002, 1, 1, 0, 0, 0, 0, time.UTC)) { return e.EncodeElement("", start) } return e.EncodeElement(t.Val.Format("2006-01-02T15:04:05"), start) diff --git a/sql_types_test.go b/sql_types_test.go index 8f9bca2..bad8dd3 100644 --- a/sql_types_test.go +++ b/sql_types_test.go @@ -955,4 +955,3 @@ func TestSqlByteArray_Base64_RoundTrip(t *testing.T) { t.Errorf("Round-trip failed: expected %v, got %v", original, b3.Val) } } -