diff --git a/debian/deb_test.go b/debian/deb_test.go index 5b387a06..9ce1df59 100644 --- a/debian/deb_test.go +++ b/debian/deb_test.go @@ -14,18 +14,18 @@ type DebSuite struct { var _ = Suite(&DebSuite{}) func (s *DebSuite) SetUpSuite(c *C) { - _, __file__, _, _ := runtime.Caller(0) - s.debFile = filepath.Join(filepath.Dir(__file__), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb") - s.dscFile = filepath.Join(filepath.Dir(__file__), "../system/files/pyspi_0.6.1-1.3.dsc") - s.dscFileNoSign = filepath.Join(filepath.Dir(__file__), "../system/files/pyspi-0.6.1-1.3.stripped.dsc") + _, _File, _, _ := runtime.Caller(0) + s.debFile = filepath.Join(filepath.Dir(_File), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb") + s.dscFile = filepath.Join(filepath.Dir(_File), "../system/files/pyspi_0.6.1-1.3.dsc") + s.dscFileNoSign = filepath.Join(filepath.Dir(_File), "../system/files/pyspi-0.6.1-1.3.stripped.dsc") } func (s *DebSuite) TestGetControlFileFromDeb(c *C) { _, err := GetControlFileFromDeb("/no/such/file") c.Check(err, ErrorMatches, ".*no such file or directory") - _, __file__, _, _ := runtime.Caller(0) - _, err = GetControlFileFromDeb(__file__) + _, _File, _, _ := runtime.Caller(0) + _, err = GetControlFileFromDeb(_File) c.Check(err, ErrorMatches, "unable to read .deb archive: ar: missing global header") st, err := GetControlFileFromDeb(s.debFile) @@ -40,8 +40,8 @@ func (s *DebSuite) TestGetControlFileFromDsc(c *C) { _, err := GetControlFileFromDsc("/no/such/file", verifier) c.Check(err, ErrorMatches, ".*no such file or directory") - _, __file__, _, _ := runtime.Caller(0) - _, err = GetControlFileFromDsc(__file__, verifier) + _, _File, _, _ := runtime.Caller(0) + _, err = GetControlFileFromDsc(_File, verifier) c.Check(err, ErrorMatches, "malformed stanza syntax") st, err := GetControlFileFromDsc(s.dscFile, verifier) diff --git a/debian/package.go b/debian/package.go index 14bd1cb1..41742a0e 100644 --- a/debian/package.go +++ b/debian/package.go @@ -375,9 +375,8 @@ func (p *Package) Equals(p2 *Package) bool { found = true if f.Checksums != f2.Checksums { return false - } else { - break } + break } } @@ -554,9 +553,8 @@ func (collection *PackageCollection) Update(p *Package) error { found = true if f.Checksums != f2.Checksums { return fmt.Errorf("unable to save: %s, conflict with existing packge", p) - } else { - break } + break } } diff --git a/files/package_pool_test.go b/files/package_pool_test.go index 2fb1affb..9042fee3 100644 --- a/files/package_pool_test.go +++ b/files/package_pool_test.go @@ -87,8 +87,8 @@ func (s *PackagePoolSuite) TestRemove(c *C) { } func (s *PackagePoolSuite) TestImportOk(c *C) { - _, __file__, _, _ := runtime.Caller(0) - debFile := filepath.Join(filepath.Dir(__file__), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb") + _, _File, _, _ := runtime.Caller(0) + debFile := filepath.Join(filepath.Dir(_File), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb") err := s.pool.Import(debFile, "91b1a1480b90b9e269ca44d897b12575") c.Check(err, IsNil) @@ -108,8 +108,8 @@ func (s *PackagePoolSuite) TestImportNotExist(c *C) { } func (s *PackagePoolSuite) TestImportOverwrite(c *C) { - _, __file__, _, _ := runtime.Caller(0) - debFile := filepath.Join(filepath.Dir(__file__), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb") + _, _File, _, _ := runtime.Caller(0) + debFile := filepath.Join(filepath.Dir(_File), "../system/files/libboost-program-options-dev_1.49.0.1_i386.deb") os.MkdirAll(filepath.Join(s.pool.rootPath, "91", "b1"), 0755) ioutil.WriteFile(filepath.Join(s.pool.rootPath, "91", "b1", "libboost-program-options-dev_1.49.0.1_i386.deb"), []byte("1"), 0644)