source: apply some Golint rules
authorbep <bjorn.erik.pedersen@gmail.com>
Sat, 7 Mar 2015 11:58:39 +0000 (12:58 +0100)
committerbep <bjorn.erik.pedersen@gmail.com>
Sat, 7 Mar 2015 11:58:39 +0000 (12:58 +0100)
source/file.go
source/filesystem.go

index a4a5b27c3dfbfa7843b63c32c6dc097eb2706201..393c231b923410e76d871c450c90803b85d14a8d 100644 (file)
@@ -53,19 +53,17 @@ func (f *File) BaseFileName() string {
 func (f *File) Section() string {
        if f.section != "" {
                return f.section
-       } else {
-               f.section = helpers.GuessSection(f.Dir())
-               return f.section
        }
+       f.section = helpers.GuessSection(f.Dir())
+       return f.section
 }
 
 func (f *File) LogicalName() string {
        if f.logicalName != "" {
                return f.logicalName
-       } else {
-               _, f.logicalName = filepath.Split(f.relpath)
-               return f.logicalName
        }
+       _, f.logicalName = filepath.Split(f.relpath)
+       return f.logicalName
 }
 
 func (f *File) SetDir(dir string) {
@@ -75,19 +73,17 @@ func (f *File) SetDir(dir string) {
 func (f *File) Dir() string {
        if f.dir != "" {
                return f.dir
-       } else {
-               f.dir, _ = filepath.Split(f.relpath)
-               return f.dir
        }
+       f.dir, _ = filepath.Split(f.relpath)
+       return f.dir
 }
 
 func (f *File) Extension() string {
        if f.ext != "" {
                return f.ext
-       } else {
-               f.ext = strings.TrimPrefix(filepath.Ext(f.LogicalName()), ".")
-               return f.ext
        }
+       f.ext = strings.TrimPrefix(filepath.Ext(f.LogicalName()), ".")
+       return f.ext
 }
 
 func (f *File) Ext() string {
index 597d8c7a989b75b3962b86c0a4aa14655b225cea..d30eea8da4ac8cbebaacc21ee2ebab725fdf7023 100644 (file)
@@ -107,17 +107,17 @@ func (f *Filesystem) captureFiles() {
                                return filepath.SkipDir
                        }
                        return nil
-               } else {
-                       if isNonProcessablePath(filePath) {
-                               return nil
-                       }
-                       data, err := ioutil.ReadFile(filePath)
-                       if err != nil {
-                               return err
-                       }
-                       f.add(filePath, bytes.NewBuffer(data))
+               }
+
+               if isNonProcessablePath(filePath) {
                        return nil
                }
+               data, err := ioutil.ReadFile(filePath)
+               if err != nil {
+                       return err
+               }
+               f.add(filePath, bytes.NewBuffer(data))
+               return nil
        }
 
        filepath.Walk(f.Base, walker)