Fix errors reported by Go Vet

This commit is contained in:
bep
2015-03-06 14:56:44 +01:00
parent c4c19ad303
commit 103ea842f8
9 changed files with 21 additions and 21 deletions

View File

@@ -111,7 +111,7 @@ func BytesToHTML(b []byte) template.HTML {
return template.HTML(string(b))
}
func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Renderer {
func GetHtmlRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Renderer {
renderParameters := blackfriday.HtmlRendererParameters{
FootnoteAnchorPrefix: viper.GetString("FootnoteAnchorPrefix"),
FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
@@ -141,7 +141,7 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
return blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters)
}
func GetMarkdownExtensions(ctx RenderingContext) int {
func GetMarkdownExtensions(ctx *RenderingContext) int {
flags := 0 | blackfriday.EXTENSION_NO_INTRA_EMPHASIS |
blackfriday.EXTENSION_TABLES | blackfriday.EXTENSION_FENCED_CODE |
blackfriday.EXTENSION_AUTOLINK | blackfriday.EXTENSION_STRIKETHROUGH |
@@ -155,12 +155,12 @@ func GetMarkdownExtensions(ctx RenderingContext) int {
return flags
}
func MarkdownRender(ctx RenderingContext) []byte {
func MarkdownRender(ctx *RenderingContext) []byte {
return blackfriday.Markdown(ctx.Content, GetHtmlRenderer(0, ctx),
GetMarkdownExtensions(ctx))
}
func MarkdownRenderWithTOC(ctx RenderingContext) []byte {
func MarkdownRenderWithTOC(ctx *RenderingContext) []byte {
return blackfriday.Markdown(ctx.Content,
GetHtmlRenderer(blackfriday.HTML_TOC, ctx),
GetMarkdownExtensions(ctx))
@@ -219,7 +219,7 @@ func (c *RenderingContext) getConfig() *Blackfriday {
return c.Config
}
func RenderBytesWithTOC(ctx RenderingContext) []byte {
func RenderBytesWithTOC(ctx *RenderingContext) []byte {
switch ctx.PageFmt {
default:
return MarkdownRenderWithTOC(ctx)
@@ -230,7 +230,7 @@ func RenderBytesWithTOC(ctx RenderingContext) []byte {
}
}
func RenderBytes(ctx RenderingContext) []byte {
func RenderBytes(ctx *RenderingContext) []byte {
switch ctx.PageFmt {
default:
return MarkdownRender(ctx)

View File

@@ -204,7 +204,7 @@ func TestDoArithmetic(t *testing.T) {
result, err := DoArithmetic(this.a, this.b, this.op)
if b, ok := this.expect.(bool); ok && !b {
if err == nil {
t.Errorf("[%d] doArithmetic didn't return an expected error")
t.Errorf("[%d] doArithmetic didn't return an expected error", i)
}
} else {
if err != nil {

View File

@@ -107,7 +107,7 @@ func TestMakePathRelative(t *testing.T) {
_, error := MakePathRelative("a/b/c.ss", "/a/c", "/d/c", "/e/f")
if error == nil {
t.Errorf("Test #%d failed. Expected error")
t.Errorf("Test failed, expected error")
}
}
@@ -497,7 +497,7 @@ func TestFileAndExt(t *testing.T) {
t.Errorf("Test %d failed. Expected filename %q got %q.", i, d.expectedFile, file)
}
if d.expectedExt != ext {
t.Errorf("Test %d failed. Expected extension $q got %q.", i, d.expectedExt, ext)
t.Errorf("Test %d failed. Expected extension %q got %q.", i, d.expectedExt, ext)
}
}
@@ -564,7 +564,7 @@ func TestFindCWD(t *testing.T) {
t.Errorf("Test %d failed. Expected %q but got %q", i, d.expectedDir, dir)
}
if d.expectedErr != err {
t.Error("Test %d failed. Expected %q but got %q", i, d.expectedErr, err)
t.Errorf("Test %d failed. Expected %q but got %q", i, d.expectedErr, err)
}
}
}
@@ -639,7 +639,7 @@ func TestWriteToDisk(t *testing.T) {
}
contents, e := ioutil.ReadFile(d.filename)
if e != nil {
t.Error("Test %d failed. Could not read file %s. Reason: %s\n", i, d.filename, e)
t.Errorf("Test %d failed. Could not read file %s. Reason: %s\n", i, d.filename, e)
}
if randomString != string(contents) {
t.Errorf("Test %d failed. Expected contents %q but got %q", i, randomString, string(contents))