Remove unnecessary type alias for strings.Builder

TIL embedded types can be acessed by their non-namespaced name - so there
actually is no need for a type alias to access .strings.Builder, one can just
use .Builder.
This commit is contained in:
Niklas Fasching 2019-01-05 13:02:29 +01:00
parent faea88d48e
commit 3e14771ebf
2 changed files with 4 additions and 6 deletions

View file

@ -14,7 +14,7 @@ import (
// HTMLWriter exports an org document into a html document. // HTMLWriter exports an org document into a html document.
type HTMLWriter struct { type HTMLWriter struct {
stringBuilder strings.Builder
document *Document document *Document
HighlightCodeBlock func(source, lang string) string HighlightCodeBlock func(source, lang string) string
htmlEscape bool htmlEscape bool
@ -57,7 +57,7 @@ func NewHTMLWriter() *HTMLWriter {
func (w *HTMLWriter) emptyClone() *HTMLWriter { func (w *HTMLWriter) emptyClone() *HTMLWriter {
wcopy := *w wcopy := *w
wcopy.stringBuilder = stringBuilder{} wcopy.Builder = strings.Builder{}
return &wcopy return &wcopy
} }

View file

@ -7,12 +7,10 @@ import (
"unicode/utf8" "unicode/utf8"
) )
type stringBuilder = strings.Builder
// OrgWriter export an org document into pretty printed org document. // OrgWriter export an org document into pretty printed org document.
type OrgWriter struct { type OrgWriter struct {
TagsColumn int TagsColumn int
stringBuilder strings.Builder
indent string indent string
} }
@ -38,7 +36,7 @@ func (w *OrgWriter) After(d *Document) {}
func (w *OrgWriter) emptyClone() *OrgWriter { func (w *OrgWriter) emptyClone() *OrgWriter {
wcopy := *w wcopy := *w
wcopy.stringBuilder = strings.Builder{} wcopy.Builder = strings.Builder{}
return &wcopy return &wcopy
} }