Skip to content

Commit 909c5bb

Browse files
committed
fix tests
1 parent 06bcce2 commit 909c5bb

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

deb/publish.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,15 +1136,15 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
11361136
release["Label"] = p.GetLabel()
11371137
release["Suite"] = p.GetSuite()
11381138
release["Codename"] = p.GetCodename()
1139-
datetime_format := "Mon, 2 Jan 2006 15:04:05 MST"
1139+
datetimeFormat := "Mon, 2 Jan 2006 15:04:05 MST"
11401140

11411141
publishDate := time.Now().UTC()
11421142
if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" {
11431143
if sec, err := strconv.ParseInt(epoch, 10, 64); err == nil {
11441144
publishDate = time.Unix(sec, 0).UTC()
11451145
}
11461146
}
1147-
release["Date"] = publishDate.Format(datetime_format)
1147+
release["Date"] = publishDate.Format(datetimeFormat)
11481148
release["Architectures"] = strings.Join(utils.StrSlicesSubstract(p.Architectures, []string{ArchitectureSource}), " ")
11491149
if p.AcquireByHash {
11501150
release["Acquire-By-Hash"] = "yes"

deb/publish_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,14 @@ func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) {
436436
func (s *PublishedRepoSuite) TestPublishSourceDateEpoch(c *C) {
437437
// Test with SOURCE_DATE_EPOCH set
438438
_ = os.Setenv("SOURCE_DATE_EPOCH", "1234567890")
439-
defer os.Unsetenv("SOURCE_DATE_EPOCH")
439+
defer func() { _ = os.Unsetenv("SOURCE_DATE_EPOCH") }()
440440

441441
err := s.repo.Publish(s.packagePool, s.provider, s.factory, &NullSigner{}, nil, false, "")
442442
c.Assert(err, IsNil)
443443

444444
rf, err := os.Open(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze/Release"))
445445
c.Assert(err, IsNil)
446-
defer rf.Close()
446+
defer func() { _ = rf.Close() }()
447447

448448
cfr := NewControlFileReader(rf, true, false)
449449
st, err := cfr.ReadStanza()
@@ -456,14 +456,14 @@ func (s *PublishedRepoSuite) TestPublishSourceDateEpoch(c *C) {
456456
func (s *PublishedRepoSuite) TestPublishSourceDateEpochInvalid(c *C) {
457457
// Test with invalid SOURCE_DATE_EPOCH (should fallback to current time)
458458
_ = os.Setenv("SOURCE_DATE_EPOCH", "invalid")
459-
defer os.Unsetenv("SOURCE_DATE_EPOCH")
459+
defer func() { _ = os.Unsetenv("SOURCE_DATE_EPOCH") }()
460460

461461
err := s.repo2.Publish(s.packagePool, s.provider, s.factory, nil, nil, false, "")
462462
c.Assert(err, IsNil)
463463

464464
rf, err := os.Open(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/Release"))
465465
c.Assert(err, IsNil)
466-
defer rf.Close()
466+
defer func() { _ = rf.Close() }()
467467

468468
cfr := NewControlFileReader(rf, true, false)
469469
st, err := cfr.ReadStanza()

system/files/corruptdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func main() {
2020
if err != nil {
2121
log.Fatalf("Error opening DB %q: %s", dbPath, err)
2222
}
23-
defer db.Close()
23+
defer func() { _ = db.Close() }()
2424

2525
keys := db.KeysByPrefix([]byte(prefix))
2626
if len(keys) == 0 {

0 commit comments

Comments
 (0)