Remove unnecessary type conversions

This commit is contained in:
Bjørn Erik Pedersen 2016-03-14 20:31:31 +01:00
parent 3a82ae7114
commit 70739c972e
6 changed files with 9 additions and 9 deletions

View file

@ -328,7 +328,7 @@ func Seq(args ...interface{}) ([]int, error) {
if last < -100000 { if last < -100000 {
return nil, errors.New("size of result exeeds limit") return nil, errors.New("size of result exeeds limit")
} }
size := int(((last - first) / inc) + 1) size := ((last - first) / inc) + 1
// sanity check // sanity check
if size <= 0 || size > 2000 { if size <= 0 || size > 2000 {

View file

@ -411,12 +411,12 @@ func (p *Page) analyzePage() {
p.WordCount = len(p.PlainWords()) p.WordCount = len(p.PlainWords())
} }
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100 p.FuzzyWordCount = (p.WordCount + 100) / 100 * 100
if p.isCJKLanguage { if p.isCJKLanguage {
p.ReadingTime = int((p.WordCount + 500) / 501) p.ReadingTime = (p.WordCount + 500) / 501
} else { } else {
p.ReadingTime = int((p.WordCount + 212) / 213) p.ReadingTime = (p.WordCount + 212) / 213
} }
} }

View file

@ -135,7 +135,7 @@ func pageToPermalinkDate(p *Page, dateField string) (string, error) {
case "monthname": case "monthname":
return p.Date.Month().String(), nil return p.Date.Month().String(), nil
case "day": case "day":
return fmt.Sprintf("%02d", int(p.Date.Day())), nil return fmt.Sprintf("%02d", p.Date.Day()), nil
case "weekday": case "weekday":
return strconv.Itoa(int(p.Date.Weekday())), nil return strconv.Itoa(int(p.Date.Weekday())), nil
case "weekdayname": case "weekdayname":

View file

@ -155,7 +155,7 @@ func HandleShortcodes(stringToParse string, page *Page, t tpl.Template) (string,
} }
} }
return string(tmpContent), nil return tmpContent, nil
} }
var isInnerShortcodeCache = struct { var isInnerShortcodeCache = struct {

View file

@ -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 { if file.Path() == refPath {
target = file target = file
break break
@ -1899,7 +1899,7 @@ func (s *Site) permalink(plink string) string {
} }
func (s *Site) permalinkStr(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 { func (s *Site) NewNode() *Node {

View file

@ -197,7 +197,7 @@ func checkCandidateSrcset(l *absurllexer) {
section := l.content[l.pos+len(m.quote) : l.pos+posLastQuote+1] section := l.content[l.pos+len(m.quote) : l.pos+posLastQuote+1]
fields := bytes.Fields(section) fields := bytes.Fields(section)
l.w.Write([]byte(m.quote)) l.w.Write(m.quote)
for i, f := range fields { for i, f := range fields {
if f[0] == '/' { if f[0] == '/' {
l.w.Write(l.path) l.w.Write(l.path)