all: Format code with gofumpt

See https://github.com/mvdan/gofumpt
This commit is contained in:
Bjørn Erik Pedersen
2020-12-02 13:23:25 +01:00
parent 32471b57bd
commit d90e37e0c6
442 changed files with 1426 additions and 2254 deletions

View File

@@ -125,7 +125,6 @@ func (ids *idFactory) Generate(value []byte, kind ast.NodeKind) []byte {
}
ids.vals[buf.String()] = struct{}{}
})
}

View File

@@ -91,7 +91,6 @@ func TestSanitizeAnchorNameAsciiOnly(t *testing.T) {
c.Assert(sanitizeAnchorNameString("god is神真美好 good", goldmark_config.AutoHeadingIDTypeGitHubAscii), qt.Equals, "god-is-good")
c.Assert(sanitizeAnchorNameString("Resumé", goldmark_config.AutoHeadingIDTypeGitHubAscii), qt.Equals, "resume")
}
func TestSanitizeAnchorNameBlackfriday(t *testing.T) {
@@ -106,7 +105,6 @@ func BenchmarkSanitizeAnchorName(b *testing.B) {
result := sanitizeAnchorName(input, goldmark_config.AutoHeadingIDTypeGitHub)
if len(result) != 24 {
b.Fatalf("got %d", len(result))
}
}
}
@@ -118,7 +116,6 @@ func BenchmarkSanitizeAnchorNameAsciiOnly(b *testing.B) {
result := sanitizeAnchorName(input, goldmark_config.AutoHeadingIDTypeGitHubAscii)
if len(result) != 12 {
b.Fatalf("got %d", len(result))
}
}
}
@@ -130,7 +127,6 @@ func BenchmarkSanitizeAnchorNameBlackfriday(b *testing.B) {
result := sanitizeAnchorName(input, goldmark_config.AutoHeadingIDTypeBlackfriday)
if len(result) != 24 {
b.Fatalf("got %d", len(result))
}
}
}

View File

@@ -62,9 +62,7 @@ func (p provide) New(cfg converter.ProviderConfig) (converter.Provider, error) {
}), nil
}
var (
_ converter.AnchorNameSanitizer = (*goldmarkConverter)(nil)
)
var _ converter.AnchorNameSanitizer = (*goldmarkConverter)(nil)
type goldmarkConverter struct {
md goldmark.Markdown
@@ -156,7 +154,6 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown {
)
return md
}
var _ identity.IdentitiesProvider = (*converterResult)(nil)
@@ -267,7 +264,6 @@ func (c *goldmarkConverter) Convert(ctx converter.RenderContext) (result convert
ids: rcx.ids.GetIdentities(),
toc: pctx.TableOfContents(),
}, nil
}
var featureSet = map[identity.Identity]bool{
@@ -329,7 +325,6 @@ func newHighlighting(cfg highlight.Config) goldmark.Extender {
}
w.WriteString("</div>")
}),
)
}

View File

@@ -31,7 +31,6 @@ import (
)
func convert(c *qt.C, mconf markup_config.Config, content string) converter.Result {
p, err := Provider.New(
converter.ProviderConfig{
MarkupConfig: mconf,
@@ -163,7 +162,6 @@ description
c.Assert(ok, qt.Equals, true)
tocHTML := toc.TableOfContents().ToHTML(1, 2, false)
c.Assert(tocHTML, qt.Contains, "TableOfContents")
}
func TestConvertAutoIDAsciiOnly(t *testing.T) {
@@ -212,7 +210,6 @@ func TestConvertIssues(t *testing.T) {
c.Assert(got, qt.Contains, "<custom-element>\n <div>This will be \"slotted\" into the custom element.</div>\n</custom-element>\n")
})
}
func TestCodeFence(t *testing.T) {
@@ -257,7 +254,6 @@ LINE5
</code></pre></div>`)
result = convertForConfig(c, cfg, `echo "Hugo Rocks!"`, "unknown")
c.Assert(result, qt.Equals, "<pre><code class=\"language-unknown\" data-lang=\"unknown\">echo &quot;Hugo Rocks!&quot;\n</code></pre>")
})
c.Run("Highlight lines, default config", func(c *qt.C) {

View File

@@ -115,7 +115,6 @@ func (r *hookedRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
// https://github.com/yuin/goldmark/blob/b611cd333a492416b56aa8d94b04a67bf0096ab2/renderer/html/html.go#L404
func (r *hookedRenderer) RenderAttributes(w util.BufWriter, node ast.Node) {
for _, attr := range node.Attributes() {
_, _ = w.WriteString(" ")
_, _ = w.Write(attr.Name)
@@ -189,7 +188,6 @@ func (r *hookedRenderer) renderImage(w util.BufWriter, source []byte, node ast.N
ctx.AddIdentity(h.ImageRenderer)
return ast.WalkContinue, err
}
// Fall back to the default Goldmark render funcs. Method below borrowed from:

View File

@@ -53,7 +53,8 @@ And then some.
p, err := Provider.New(
converter.ProviderConfig{
MarkupConfig: markup_config.Default,
Logger: loggers.NewErrorLogger()})
Logger: loggers.NewErrorLogger(),
})
c.Assert(err, qt.IsNil)
conv, err := p.New(converter.DocumentContext{})
c.Assert(err, qt.IsNil)