aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-03-24 10:11:16 +0100
committerBjørn Erik Pedersen <[email protected]>2019-03-24 16:14:51 +0100
commitb5f39d23b86f9cb83c51da9fe4abb4c19c01c3b7 (patch)
treecf23180dc07698391cf47c2fe525755417729020 /transform
parent3011f36c27ecde309325e6c75ca377f4f87fa97a (diff)
downloadhugo-b5f39d23b86f9cb83c51da9fe4abb4c19c01c3b7.tar.gz
hugo-b5f39d23b86f9cb83c51da9fe4abb4c19c01c3b7.zip
all: Apply staticcheck recommendations
Diffstat (limited to 'transform')
-rw-r--r--transform/chain_test.go4
-rw-r--r--transform/livereloadinject/livereloadinject_test.go4
-rw-r--r--transform/urlreplacers/absurlreplacer.go7
-rw-r--r--transform/urlreplacers/absurlreplacer_test.go1
4 files changed, 4 insertions, 12 deletions
diff --git a/transform/chain_test.go b/transform/chain_test.go
index e34024296..a8d59f902 100644
--- a/transform/chain_test.go
+++ b/transform/chain_test.go
@@ -58,8 +58,8 @@ func TestChaingMultipleTransformers(t *testing.T) {
expected := "Test: f4r f3r f1r f2r f1r The End."
- if string(out.Bytes()) != expected {
- t.Errorf("Expected %s got %s", expected, string(out.Bytes()))
+ if out.String() != expected {
+ t.Errorf("Expected %s got %s", expected, out.String())
}
}
diff --git a/transform/livereloadinject/livereloadinject_test.go b/transform/livereloadinject/livereloadinject_test.go
index 0e0f708d3..1058244b4 100644
--- a/transform/livereloadinject/livereloadinject_test.go
+++ b/transform/livereloadinject/livereloadinject_test.go
@@ -35,7 +35,7 @@ func doTestLiveReloadInject(t *testing.T, bodyEndTag string) {
tr.Apply(out, in)
expected := fmt.Sprintf(`<script data-no-instant>document.write('<script src="/livereload.js?port=1313&mindelay=10"></' + 'script>')</script>%s`, bodyEndTag)
- if string(out.Bytes()) != expected {
- t.Errorf("Expected %s got %s", expected, string(out.Bytes()))
+ if out.String() != expected {
+ t.Errorf("Expected %s got %s", expected, out.String())
}
}
diff --git a/transform/urlreplacers/absurlreplacer.go b/transform/urlreplacers/absurlreplacer.go
index 02083d9f5..545df914a 100644
--- a/transform/urlreplacers/absurlreplacer.go
+++ b/transform/urlreplacers/absurlreplacer.go
@@ -37,8 +37,6 @@ type absurllexer struct {
quotes [][]byte
}
-type stateFunc func(*absurllexer) stateFunc
-
type prefix struct {
disabled bool
b []byte
@@ -54,11 +52,6 @@ func newPrefixState() []*prefix {
}
}
-type absURLMatcher struct {
- match []byte
- quote []byte
-}
-
func (l *absurllexer) emit() {
l.w.Write(l.content[l.start:l.pos])
l.start = l.pos
diff --git a/transform/urlreplacers/absurlreplacer_test.go b/transform/urlreplacers/absurlreplacer_test.go
index f7a5b1656..3c2dbf777 100644
--- a/transform/urlreplacers/absurlreplacer_test.go
+++ b/transform/urlreplacers/absurlreplacer_test.go
@@ -41,7 +41,6 @@ const (
replace1 = "No replacements."
replace2 = "ᚠᛇᚻ ᛒᛦᚦ ᚠᚱᚩᚠᚢᚱ\nᚠᛁᚱᚪ ᚷᛖᚻᚹᛦᛚᚳᚢᛗ"
replace3 = `End of file: src="/`
- replace4 = `End of file: srcset="/`
replace5 = `Srcsett with no closing quote: srcset="/img/small.jpg do be do be do.`
// Issue: 816, schemaless links combined with others