aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2016-03-14 20:31:31 +0100
committerBjørn Erik Pedersen <[email protected]>2016-03-14 20:35:50 +0100
commit70739c972e910aed9321f1bc0efb97adeb741fd6 (patch)
tree6499f9610b9865dee157cad9131cc3d4edd56481
parent3a82ae7114b72704a4711844787e4f119939b8e2 (diff)
downloadhugo-70739c972e910aed9321f1bc0efb97adeb741fd6.tar.gz
hugo-70739c972e910aed9321f1bc0efb97adeb741fd6.zip
Remove unnecessary type conversions
-rw-r--r--helpers/general.go2
-rw-r--r--hugolib/page.go6
-rw-r--r--hugolib/permalinks.go2
-rw-r--r--hugolib/shortcode.go2
-rw-r--r--hugolib/site.go4
-rw-r--r--transform/absurlreplacer.go2
6 files changed, 9 insertions, 9 deletions
diff --git a/helpers/general.go b/helpers/general.go
index 6ed95f8f4..be30bc75e 100644
--- a/helpers/general.go
+++ b/helpers/general.go
@@ -328,7 +328,7 @@ func Seq(args ...interface{}) ([]int, error) {
if last < -100000 {
return nil, errors.New("size of result exeeds limit")
}
- size := int(((last - first) / inc) + 1)
+ size := ((last - first) / inc) + 1
// sanity check
if size <= 0 || size > 2000 {
diff --git a/hugolib/page.go b/hugolib/page.go
index 975f64a68..8884bda5d 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -411,12 +411,12 @@ func (p *Page) analyzePage() {
p.WordCount = len(p.PlainWords())
}
- p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
+ p.FuzzyWordCount = (p.WordCount + 100) / 100 * 100
if p.isCJKLanguage {
- p.ReadingTime = int((p.WordCount + 500) / 501)
+ p.ReadingTime = (p.WordCount + 500) / 501
} else {
- p.ReadingTime = int((p.WordCount + 212) / 213)
+ p.ReadingTime = (p.WordCount + 212) / 213
}
}
diff --git a/hugolib/permalinks.go b/hugolib/permalinks.go
index f6f2bd80d..9a194bd73 100644
--- a/hugolib/permalinks.go
+++ b/hugolib/permalinks.go
@@ -135,7 +135,7 @@ func pageToPermalinkDate(p *Page, dateField string) (string, error) {
case "monthname":
return p.Date.Month().String(), nil
case "day":
- return fmt.Sprintf("%02d", int(p.Date.Day())), nil
+ return fmt.Sprintf("%02d", p.Date.Day()), nil
case "weekday":
return strconv.Itoa(int(p.Date.Weekday())), nil
case "weekdayname":
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
index b221ff8a7..3c0afd2e7 100644
--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -155,7 +155,7 @@ func HandleShortcodes(stringToParse string, page *Page, t tpl.Template) (string,
}
}
- return string(tmpContent), nil
+ return tmpContent, nil
}
var isInnerShortcodeCache = struct {
diff --git a/hugolib/site.go b/hugolib/site.go
index ba8096d12..a0324e230 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -358,7 +358,7 @@ func (s *SiteInfo) githubFileLink(ref string, currentPage *Page, relative bool)
}
}
- for _, file := range []*source.File(*s.Files) {
+ for _, file := range *s.Files {
if file.Path() == refPath {
target = file
break
@@ -1899,7 +1899,7 @@ func (s *Site) permalink(plink string) string {
}
func (s *Site) permalinkStr(plink string) string {
- return helpers.MakePermalink(string(viper.GetString("BaseURL")), helpers.URLizeAndPrep(plink)).String()
+ return helpers.MakePermalink(viper.GetString("BaseURL"), helpers.URLizeAndPrep(plink)).String()
}
func (s *Site) NewNode() *Node {
diff --git a/transform/absurlreplacer.go b/transform/absurlreplacer.go
index 74cd76d49..c659a94e8 100644
--- a/transform/absurlreplacer.go
+++ b/transform/absurlreplacer.go
@@ -197,7 +197,7 @@ func checkCandidateSrcset(l *absurllexer) {
section := l.content[l.pos+len(m.quote) : l.pos+posLastQuote+1]
fields := bytes.Fields(section)
- l.w.Write([]byte(m.quote))
+ l.w.Write(m.quote)
for i, f := range fields {
if f[0] == '/' {
l.w.Write(l.path)