Remove unnecessary type conversions - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 70739c972e910aed9321f1bc0efb97adeb741fd6
DIR parent 3a82ae7114b72704a4711844787e4f119939b8e2
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Mon, 14 Mar 2016 20:31:31 +0100
Remove unnecessary type conversions
Diffstat:
M helpers/general.go | 2 +-
M hugolib/page.go | 6 +++---
M hugolib/permalinks.go | 2 +-
M hugolib/shortcode.go | 2 +-
M hugolib/site.go | 4 ++--
M transform/absurlreplacer.go | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
---
DIR diff --git 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 {
DIR diff --git 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
}
}
DIR diff --git 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":
DIR diff --git 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 {
DIR diff --git 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 {
DIR diff --git 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)