From 909c5bb1167951f8c8a75a7605a5f2662faf76c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Sun, 14 Jun 2026 23:57:52 +0200 Subject: [PATCH] fix tests --- deb/publish.go | 4 ++-- deb/publish_test.go | 8 ++++---- system/files/corruptdb.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deb/publish.go b/deb/publish.go index 79c086f6..ac02508a 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -1136,7 +1136,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP release["Label"] = p.GetLabel() release["Suite"] = p.GetSuite() release["Codename"] = p.GetCodename() - datetime_format := "Mon, 2 Jan 2006 15:04:05 MST" + datetimeFormat := "Mon, 2 Jan 2006 15:04:05 MST" publishDate := time.Now().UTC() if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" { @@ -1144,7 +1144,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP publishDate = time.Unix(sec, 0).UTC() } } - release["Date"] = publishDate.Format(datetime_format) + release["Date"] = publishDate.Format(datetimeFormat) release["Architectures"] = strings.Join(utils.StrSlicesSubstract(p.Architectures, []string{ArchitectureSource}), " ") if p.AcquireByHash { release["Acquire-By-Hash"] = "yes" diff --git a/deb/publish_test.go b/deb/publish_test.go index 052640bc..5d4cb752 100644 --- a/deb/publish_test.go +++ b/deb/publish_test.go @@ -436,14 +436,14 @@ func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) { func (s *PublishedRepoSuite) TestPublishSourceDateEpoch(c *C) { // Test with SOURCE_DATE_EPOCH set _ = os.Setenv("SOURCE_DATE_EPOCH", "1234567890") - defer os.Unsetenv("SOURCE_DATE_EPOCH") + defer func() { _ = os.Unsetenv("SOURCE_DATE_EPOCH") }() err := s.repo.Publish(s.packagePool, s.provider, s.factory, &NullSigner{}, nil, false, "") c.Assert(err, IsNil) rf, err := os.Open(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze/Release")) c.Assert(err, IsNil) - defer rf.Close() + defer func() { _ = rf.Close() }() cfr := NewControlFileReader(rf, true, false) st, err := cfr.ReadStanza() @@ -456,14 +456,14 @@ func (s *PublishedRepoSuite) TestPublishSourceDateEpoch(c *C) { func (s *PublishedRepoSuite) TestPublishSourceDateEpochInvalid(c *C) { // Test with invalid SOURCE_DATE_EPOCH (should fallback to current time) _ = os.Setenv("SOURCE_DATE_EPOCH", "invalid") - defer os.Unsetenv("SOURCE_DATE_EPOCH") + defer func() { _ = os.Unsetenv("SOURCE_DATE_EPOCH") }() err := s.repo2.Publish(s.packagePool, s.provider, s.factory, nil, nil, false, "") c.Assert(err, IsNil) rf, err := os.Open(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/Release")) c.Assert(err, IsNil) - defer rf.Close() + defer func() { _ = rf.Close() }() cfr := NewControlFileReader(rf, true, false) st, err := cfr.ReadStanza() diff --git a/system/files/corruptdb.go b/system/files/corruptdb.go index 4febcbc9..15b4e094 100644 --- a/system/files/corruptdb.go +++ b/system/files/corruptdb.go @@ -20,7 +20,7 @@ func main() { if err != nil { log.Fatalf("Error opening DB %q: %s", dbPath, err) } - defer db.Close() + defer func() { _ = db.Close() }() keys := db.KeysByPrefix([]byte(prefix)) if len(keys) == 0 {