Skip to content

Commit 3a9e6a1

Browse files
make golint happy
1 parent 2f8091b commit 3a9e6a1

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

dataurl.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import (
1313
)
1414

1515
const (
16+
// EncodingBase64 is base64 encoding for the data url
1617
EncodingBase64 = "base64"
17-
EncodingASCII = "ascii"
18+
// EncodingASCII is ascii encoding for the data url
19+
EncodingASCII = "ascii"
1820
)
1921

2022
func defaultMediaType() MediaType {
@@ -33,6 +35,7 @@ type MediaType struct {
3335
Params map[string]string
3436
}
3537

38+
// ContentType returns the content type of the dataurl's data, in the form type/subtype.
3639
func (mt *MediaType) ContentType() string {
3740
return fmt.Sprintf("%s/%s", mt.Type, mt.Subtype)
3841
}
@@ -180,7 +183,7 @@ func (p *parser) parse() error {
180183
case itemLeftStringQuote:
181184
p.unquoteParamVal = true
182185
case itemParamVal:
183-
var val string = item.val
186+
val := item.val
184187
if p.unquoteParamVal {
185188
p.unquoteParamVal = false
186189
us, err := strconv.Unquote("\"" + val + "\"")

dataurl_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func expectItems(expected, actual []item) bool {
228228
if len(expected) != len(actual) {
229229
return false
230230
}
231-
for i, _ := range expected {
231+
for i := range expected {
232232
if expected[i].t != actual[i].t {
233233
return false
234234
}
@@ -260,7 +260,7 @@ func equal(du1, du2 *DataURL) (bool, error) {
260260
func TestLexDataURLs(t *testing.T) {
261261
for _, test := range genTestTable() {
262262
l := lex(test.InputRawDataURL)
263-
items := make([]item, 0)
263+
var items []item
264264
for item := range l.items {
265265
items = append(items, item)
266266
}

lex.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,8 @@ func lexDataComma(l *lexer) stateFn {
480480
l.emit(itemDataComma)
481481
if l.seenBase64Item {
482482
return lexBase64Data
483-
} else {
484-
return lexData
485483
}
484+
return lexData
486485
}
487486

488487
func lexData(l *lexer) stateFn {

0 commit comments

Comments
 (0)