summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-03-07 12:58:39 +0100
committerbep <bjorn.erik.pedersen@gmail.com>2015-03-07 12:58:39 +0100
commita91bcd85e2d2b11e7bc8463d05e019de54abe3cf (patch)
tree4d06937f91e528af6b1226c0863862711515e3f9 /source
parente007c9b25d076f5705afb63fda4f3abd3d05b7b8 (diff)
source: apply some Golint rules
Diffstat (limited to 'source')
-rw-r--r--source/file.go20
-rw-r--r--source/filesystem.go18
2 files changed, 17 insertions, 21 deletions
diff --git a/source/file.go b/source/file.go
index a4a5b27c3..393c231b9 100644
--- a/source/file.go
+++ b/source/file.go
@@ -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 {
diff --git a/source/filesystem.go b/source/filesystem.go
index 597d8c7a9..d30eea8da 100644
--- a/source/filesystem.go
+++ b/source/filesystem.go
@@ -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)