From ca82220dc5bfaa3561c8de24ae89bd2eb806310e Mon Sep 17 00:00:00 2001 From: Ananth Bhaskararaman Date: Fri, 12 Apr 2024 23:30:45 +0530 Subject: [PATCH] chore: Housekeeping GitHub Actions Workflow CI. Cleaned up code by fixing lint errors. --- .github/workflows/ci.yml | 35 +++++++ LICENSE | 2 + README.md | 83 +++------------- cmd/dataurl/main.go | 13 +-- dataurl.go | 12 +-- dataurl_test.go | 210 ++++++++++++++++++++------------------- doc.go | 50 +++++----- go.mod | 3 + go.sum | 0 lex.go | 4 - wercker.yml | 1 - 11 files changed, 194 insertions(+), 219 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 go.mod create mode 100644 go.sum delete mode 100644 wercker.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..04d1740 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI 🏗 + +on: + push: + branches: + - main + + pull_request: + branches: + - main + + workflow_dispatch: + +jobs: + test: + name: Lint & test code. + strategy: + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + go: ['stable', 'oldstable'] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - uses: golangci/golangci-lint-action@v3 + with: + version: "v1.55.2" + + - run: go vet ./... + + - run: go test -race -cover ./... diff --git a/LICENSE b/LICENSE index ae6cb62..8291c02 100644 --- a/LICENSE +++ b/LICENSE @@ -2,6 +2,8 @@ The MIT License (MIT) Copyright (c) 2014 Vincent Petithory +Copyright (c) 2024 Ananth Bhaskararaman + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to diff --git a/README.md b/README.md index 1ac59ad..7f7275a 100644 --- a/README.md +++ b/README.md @@ -1,81 +1,26 @@ -# Data URL Schemes for Go [![wercker status](https://app.wercker.com/status/6f9a2e144dfcc59e862c52459b452928/s "wercker status")](https://app.wercker.com/project/bykey/6f9a2e144dfcc59e862c52459b452928) [![GoDoc](https://godoc.org/github.com/vincent-petithory/dataurl?status.png)](https://godoc.org/github.com/vincent-petithory/dataurl) +# Dataurl -This package parses and generates Data URL Schemes for the Go language, according to [RFC 2397](http://tools.ietf.org/html/rfc2397). +[![Go Reference](https://pkg.go.dev/badge/github.com/ananthb/dataurl.svg)](https://pkg.go.dev/github.com/ananthb/dataurl) -Data URLs are small chunks of data commonly used in browsers to display inline data, -typically like small images, or when you use the FileReader API of the browser. - -Common use-cases: - - * generate a data URL out of a `string`, `[]byte`, `io.Reader` for inclusion in HTML templates, - * parse a data URL sent by a browser in a http.Handler, and do something with the data (save to disk, etc.) - * ... - -Install the package with: -~~~ -go get github.com/vincent-petithory/dataurl -~~~ - -## Usage +Data URL Schemes for Go -~~~ go -package main +[![CI 🏗](https://github.com/ananthb/dataurl/actions/workflows/ci.yml/badge.svg)](https://github.com/ananthb/dataurl/actions/workflows/ci.yml) -import ( - "github.com/vincent-petithory/dataurl" - "fmt" -) +This package parses and generates Data URL Schemes for the Go language, +according to [RFC 2397](http://tools.ietf.org/html/rfc2397). -func main() { - dataURL, err := dataurl.DecodeString(`data:text/plain;charset=utf-8;base64,aGV5YQ==`) - if err != nil { - fmt.Println(err) - return - } - fmt.Printf("content type: %s, data: %s\n", dataURL.MediaType.ContentType(), string(dataURL.Data)) - // Output: content type: text/plain, data: heya -} -~~~ - -From a `http.Handler`: - -~~~ go -func handleDataURLUpload(w http.ResponseWriter, r *http.Request) { - dataURL, err := dataurl.Decode(r.Body) - defer r.Body.Close() - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - if dataURL.ContentType() == "image/png" { - ioutil.WriteFile("image.png", dataURL.Data, 0644) - } else { - http.Error(w, "not a png", http.StatusBadRequest) - } -} -~~~ +Data URLs are small chunks of data commonly used in browsers to display inline data, +typically like small images, or when you use the FileReader API of the browser. ## Command -For convenience, a `dataurl` command is provided to encode/decode dataurl streams. - -~~~ -dataurl - Encode or decode dataurl data and print to standard output - -Usage: dataurl [OPTION]... [FILE] +Use the [`dataurl`](./cmd/dataurl) command to encode/decode dataurl streams. - dataurl encodes or decodes FILE or standard input if FILE is - or omitted, and prints to standard output. - Unless -mimetype is used, when FILE is specified, dataurl will attempt to detect its mimetype using Go's mime.TypeByExtension (http://golang.org/pkg/mime/#TypeByExtension). If this fails or data is read from STDIN, the mimetype will default to application/octet-stream. +Install it with `go install github.com/ananthb/dataurl/cmd/dataurl@latest`. -Options: - -a=false: encode data using ascii instead of base64 - -ascii=false: encode data using ascii instead of base64 - -d=false: decode data instead of encoding - -decode=false: decode data instead of encoding - -m="": force the mimetype of the data to encode to this value - -mimetype="": force the mimetype of the data to encode to this value -~~~ +## [LICENSE](LICENSE) -## Contributing +Forked from [vincent-petithory/dataurl](https://github.com/vincent-petithory/dataurl) +with contributions from [MagicalTux/dataurl)[https://github.com/MagicalTux/dataurl/tree/fix-issue-5). -Feel free to file an issue/make a pull request if you find any bug, or want to suggest enhancements. +Dataurl is available under the terms of the MIT license. diff --git a/cmd/dataurl/main.go b/cmd/dataurl/main.go index cf764c9..eb84eeb 100644 --- a/cmd/dataurl/main.go +++ b/cmd/dataurl/main.go @@ -4,13 +4,12 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "mime" "os" "path" - "github.com/vincent-petithory/dataurl" + "github.com/ananthb/dataurl" ) var ( @@ -63,7 +62,7 @@ func main() { case 1: if flag.Arg(0) == "-" { in = os.Stdin - return + break } if f, err := os.Open(flag.Arg(0)); err != nil { log.Fatal(err) @@ -109,9 +108,6 @@ func decode(in io.Reader, out io.Writer) (err error) { } _, err = out.Write(du.Data) - if err != nil { - return - } return } @@ -126,7 +122,7 @@ func encode(in io.Reader, out io.Writer, encoding string, mediatype string) (err return } }() - b, err := ioutil.ReadAll(in) + b, err := io.ReadAll(in) if err != nil { return } @@ -135,8 +131,5 @@ func encode(in io.Reader, out io.Writer, encoding string, mediatype string) (err du.Encoding = encoding _, err = du.WriteTo(out) - if err != nil { - return - } return } diff --git a/dataurl.go b/dataurl.go index 7a9fe67..2d68f94 100644 --- a/dataurl.go +++ b/dataurl.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "sort" "strconv" @@ -107,11 +106,11 @@ func New(data []byte, mediatype string, paramPairs ...string) *DataURL { // Note: it doesn't guarantee the returned string is equal to // the initial source string that was used to create this DataURL. // The reasons for that are: -// * Insertion of default values for MediaType that were maybe not in the initial string, -// * Various ways to encode the MediaType parameters (quoted string or url encoded string, the latter is used), +// - Insertion of default values for MediaType that were maybe not in the initial string, +// - Various ways to encode the MediaType parameters (quoted string or url encoded string, the latter is used), func (du *DataURL) String() string { var buf bytes.Buffer - du.WriteTo(&buf) + _, _ = du.WriteTo(&buf) return (&buf).String() } @@ -135,8 +134,7 @@ func (du *DataURL) WriteTo(w io.Writer) (n int64, err error) { if du.Encoding == EncodingBase64 { encoder := base64.NewEncoder(base64.StdEncoding, w) - ni, err = encoder.Write(du.Data) - if err != nil { + if _, err = encoder.Write(du.Data); err != nil { return } encoder.Close() @@ -271,7 +269,7 @@ func DecodeString(s string) (*DataURL, error) { // Decode decodes a Data URL scheme from a io.Reader. func Decode(r io.Reader) (*DataURL, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/dataurl_test.go b/dataurl_test.go index 2140d2a..a2e35e6 100644 --- a/dataurl_test.go +++ b/dataurl_test.go @@ -20,15 +20,15 @@ type dataURLTest struct { func genTestTable() []dataURLTest { return []dataURLTest{ - dataURLTest{ + { `data:;base64,aGV5YQ==`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemParamSemicolon, ";"}, - item{itemBase64Enc, "base64"}, - item{itemDataComma, ","}, - item{itemData, "aGV5YQ=="}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemParamSemicolon, ";"}, + {itemBase64Enc, "base64"}, + {itemDataComma, ","}, + {itemData, "aGV5YQ=="}, + {itemEOF, ""}, }, DataURL{ defaultMediaType(), @@ -36,18 +36,18 @@ func genTestTable() []dataURLTest { []byte("heya"), }, }, - dataURLTest{ + { `data:text/plain;base64,aGV5YQ==`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemMediaType, "text"}, - item{itemMediaSep, "/"}, - item{itemMediaSubType, "plain"}, - item{itemParamSemicolon, ";"}, - item{itemBase64Enc, "base64"}, - item{itemDataComma, ","}, - item{itemData, "aGV5YQ=="}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemMediaType, "text"}, + {itemMediaSep, "/"}, + {itemMediaSubType, "plain"}, + {itemParamSemicolon, ";"}, + {itemBase64Enc, "base64"}, + {itemDataComma, ","}, + {itemData, "aGV5YQ=="}, + {itemEOF, ""}, }, DataURL{ MediaType{ @@ -59,22 +59,22 @@ func genTestTable() []dataURLTest { []byte("heya"), }, }, - dataURLTest{ + { `data:text/plain;charset=utf-8;base64,aGV5YQ==`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemMediaType, "text"}, - item{itemMediaSep, "/"}, - item{itemMediaSubType, "plain"}, - item{itemParamSemicolon, ";"}, - item{itemParamAttr, "charset"}, - item{itemParamEqual, "="}, - item{itemParamVal, "utf-8"}, - item{itemParamSemicolon, ";"}, - item{itemBase64Enc, "base64"}, - item{itemDataComma, ","}, - item{itemData, "aGV5YQ=="}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemMediaType, "text"}, + {itemMediaSep, "/"}, + {itemMediaSubType, "plain"}, + {itemParamSemicolon, ";"}, + {itemParamAttr, "charset"}, + {itemParamEqual, "="}, + {itemParamVal, "utf-8"}, + {itemParamSemicolon, ";"}, + {itemBase64Enc, "base64"}, + {itemDataComma, ","}, + {itemData, "aGV5YQ=="}, + {itemEOF, ""}, }, DataURL{ MediaType{ @@ -88,26 +88,26 @@ func genTestTable() []dataURLTest { []byte("heya"), }, }, - dataURLTest{ + { `data:text/plain;charset=utf-8;foo=bar;base64,aGV5YQ==`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemMediaType, "text"}, - item{itemMediaSep, "/"}, - item{itemMediaSubType, "plain"}, - item{itemParamSemicolon, ";"}, - item{itemParamAttr, "charset"}, - item{itemParamEqual, "="}, - item{itemParamVal, "utf-8"}, - item{itemParamSemicolon, ";"}, - item{itemParamAttr, "foo"}, - item{itemParamEqual, "="}, - item{itemParamVal, "bar"}, - item{itemParamSemicolon, ";"}, - item{itemBase64Enc, "base64"}, - item{itemDataComma, ","}, - item{itemData, "aGV5YQ=="}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemMediaType, "text"}, + {itemMediaSep, "/"}, + {itemMediaSubType, "plain"}, + {itemParamSemicolon, ";"}, + {itemParamAttr, "charset"}, + {itemParamEqual, "="}, + {itemParamVal, "utf-8"}, + {itemParamSemicolon, ";"}, + {itemParamAttr, "foo"}, + {itemParamEqual, "="}, + {itemParamVal, "bar"}, + {itemParamSemicolon, ";"}, + {itemBase64Enc, "base64"}, + {itemDataComma, ","}, + {itemData, "aGV5YQ=="}, + {itemEOF, ""}, }, DataURL{ MediaType{ @@ -122,32 +122,32 @@ func genTestTable() []dataURLTest { []byte("heya"), }, }, - dataURLTest{ + { `data:application/json;charset=utf-8;foo="b\"<@>\"r";style=unformatted%20json;base64,eyJtc2ciOiAiaGV5YSJ9`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemMediaType, "application"}, - item{itemMediaSep, "/"}, - item{itemMediaSubType, "json"}, - item{itemParamSemicolon, ";"}, - item{itemParamAttr, "charset"}, - item{itemParamEqual, "="}, - item{itemParamVal, "utf-8"}, - item{itemParamSemicolon, ";"}, - item{itemParamAttr, "foo"}, - item{itemParamEqual, "="}, - item{itemLeftStringQuote, "\""}, - item{itemParamVal, `b\"<@>\"r`}, - item{itemRightStringQuote, "\""}, - item{itemParamSemicolon, ";"}, - item{itemParamAttr, "style"}, - item{itemParamEqual, "="}, - item{itemParamVal, "unformatted%20json"}, - item{itemParamSemicolon, ";"}, - item{itemBase64Enc, "base64"}, - item{itemDataComma, ","}, - item{itemData, "eyJtc2ciOiAiaGV5YSJ9"}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemMediaType, "application"}, + {itemMediaSep, "/"}, + {itemMediaSubType, "json"}, + {itemParamSemicolon, ";"}, + {itemParamAttr, "charset"}, + {itemParamEqual, "="}, + {itemParamVal, "utf-8"}, + {itemParamSemicolon, ";"}, + {itemParamAttr, "foo"}, + {itemParamEqual, "="}, + {itemLeftStringQuote, "\""}, + {itemParamVal, `b\"<@>\"r`}, + {itemRightStringQuote, "\""}, + {itemParamSemicolon, ";"}, + {itemParamAttr, "style"}, + {itemParamEqual, "="}, + {itemParamVal, "unformatted%20json"}, + {itemParamSemicolon, ";"}, + {itemBase64Enc, "base64"}, + {itemDataComma, ","}, + {itemData, "eyJtc2ciOiAiaGV5YSJ9"}, + {itemEOF, ""}, }, DataURL{ MediaType{ @@ -163,20 +163,20 @@ func genTestTable() []dataURLTest { []byte(`{"msg": "heya"}`), }, }, - dataURLTest{ + { `data:xxx;base64,aGV5YQ==`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemError, "invalid character for media type"}, + {itemDataPrefix, dataPrefix}, + {itemError, "invalid character for media type"}, }, DataURL{}, }, - dataURLTest{ + { `data:,`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemDataComma, ","}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemDataComma, ","}, + {itemEOF, ""}, }, DataURL{ defaultMediaType(), @@ -184,13 +184,13 @@ func genTestTable() []dataURLTest { []byte(""), }, }, - dataURLTest{ + { `data:,A%20brief%20note`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemDataComma, ","}, - item{itemData, "A%20brief%20note"}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemDataComma, ","}, + {itemData, "A%20brief%20note"}, + {itemEOF, ""}, }, DataURL{ defaultMediaType(), @@ -198,18 +198,18 @@ func genTestTable() []dataURLTest { []byte("A brief note"), }, }, - dataURLTest{ + { `data:image/svg+xml-im.a.fake;base64,cGllLXN0b2NrX1RoaXJ0eQ==`, []item{ - item{itemDataPrefix, dataPrefix}, - item{itemMediaType, "image"}, - item{itemMediaSep, "/"}, - item{itemMediaSubType, "svg+xml-im.a.fake"}, - item{itemParamSemicolon, ";"}, - item{itemBase64Enc, "base64"}, - item{itemDataComma, ","}, - item{itemData, "cGllLXN0b2NrX1RoaXJ0eQ=="}, - item{itemEOF, ""}, + {itemDataPrefix, dataPrefix}, + {itemMediaType, "image"}, + {itemMediaSep, "/"}, + {itemMediaSubType, "svg+xml-im.a.fake"}, + {itemParamSemicolon, ";"}, + {itemBase64Enc, "base64"}, + {itemDataComma, ","}, + {itemData, "cGllLXN0b2NrX1RoaXJ0eQ=="}, + {itemEOF, ""}, }, DataURL{ MediaType{ @@ -450,7 +450,8 @@ func TestNew(t *testing.T) { } } -var golangFavicon = strings.Replace(`AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAA +var golangFavicon = strings.Replace( + `AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAD///8AVE44//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb/ /uF2/1ROOP////8A////AFROOP/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+ 4Xb//uF2//7hdv9UTjj/////AP///wBUTjj//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7h @@ -470,7 +471,11 @@ Tv/Ip07//uF2//7hdv/+4Xb//uF2/8zBlv/Kv4//pZJU/3tzTv9UTjj/19nd/////wD///8A4eLl /6CcjP97c07/e3NO/1dOMf9BOiX/TkUn/2VXLf97c07/e3NO/6CcjP/h4uX/////AP///wD///8A ////AP///wD///8A////AP///wDq6/H/3N/j/9fZ3f/q6/H/////AP///wD///8A////AP///wD/ //8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAA==`, "\n", "", -1) +AAAAAAAAAAAAAA==`, + "\n", + "", + -1, +) func TestEncodeBytes(t *testing.T) { mustDecode := func(s string) []byte { @@ -509,7 +514,7 @@ func BenchmarkLex(b *testing.B) { for i := 0; i < b.N; i++ { for _, test := range genTestTable() { l := lex(test.InputRawDataURL) - for _ = range l.items { + for range l.items { } } } @@ -563,8 +568,11 @@ func ExampleDecodeString() { func ExampleDecode() { r, err := http.NewRequest( - "POST", "/", - strings.NewReader(`data:image/vnd.microsoft.icon;name=golang%20favicon;base64,`+golangFavicon), + "POST", + "/", + strings.NewReader( + `data:image/vnd.microsoft.icon;name=golang%20favicon;base64,`+golangFavicon, + ), ) if err != nil { fmt.Println(err) @@ -572,7 +580,7 @@ func ExampleDecode() { } var dataURL *DataURL - h := func(w http.ResponseWriter, r *http.Request) { + h := func(_ http.ResponseWriter, r *http.Request) { var err error dataURL, err = Decode(r.Body) defer r.Body.Close() diff --git a/doc.go b/doc.go index 56461d0..c489651 100644 --- a/doc.go +++ b/doc.go @@ -1,28 +1,24 @@ -/* -Package dataurl parses Data URL Schemes -according to RFC 2397 -(http://tools.ietf.org/html/rfc2397). - -Data URLs are small chunks of data commonly used in browsers to display inline data, -typically like small images, or when you use the FileReader API of the browser. - -A dataurl looks like: - - data:text/plain;charset=utf-8,A%20brief%20note - -Or, with base64 encoding: - - data:image/vnd.microsoft.icon;name=golang%20favicon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAD///8AVE44//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb/ - /uF2/1ROOP////8A////AFROOP/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+ - ... - /6CcjP97c07/e3NO/1dOMf9BOiX/TkUn/2VXLf97c07/e3NO/6CcjP/h4uX/////AP///wD///8A - ////AP///wD///8A////AP///wDq6/H/3N/j/9fZ3f/q6/H/////AP///wD///8A////AP///wD/ - //8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAA== - -Common functions are Decode and DecodeString to obtain a DataURL, -and DataURL.String() and DataURL.WriteTo to generate a Data URL string. - -*/ +// Package dataurl parses Data URL Schemes +// according to RFC 2397 (http://tools.ietf.org/html/rfc2397). +// +// Data URLs are small chunks of data commonly used in browsers to display inline data, +// typically like small images, or when you use the FileReader API of the browser. +// +// A dataurl looks like: +// +// data:text/plain;charset=utf-8,A%20brief%20note +// +// Or, with base64 encoding: +// +// data:image/vnd.microsoft.icon;name=golang%20favicon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAA +// AAAAAAD///8AVE44//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb/ +// /uF2/1ROOP////8A////AFROOP/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+ +// ... +// /6CcjP97c07/e3NO/1dOMf9BOiX/TkUn/2VXLf97c07/e3NO/6CcjP/h4uX/////AP///wD///8A +// ////AP///wD///8A////AP///wDq6/H/3N/j/9fZ3f/q6/H/////AP///wD///8A////AP///wD/ +// //8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +// AAAAAAAAAAAAAA== +// +// Common functions are Decode and DecodeString to obtain a DataURL, +// and DataURL.String() and DataURL.WriteTo to generate a Data URL string. package dataurl diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4424a7f --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/ananthb/dataurl + +go 1.22.2 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/lex.go b/lex.go index 1a8717f..cc13b64 100644 --- a/lex.go +++ b/lex.go @@ -174,10 +174,6 @@ func (l *lexer) backup() { l.pos -= l.width } -func (l *lexer) ignore() { - l.start = l.pos -} - func (l *lexer) errorf(format string, args ...interface{}) stateFn { l.items <- item{itemError, fmt.Sprintf(format, args...)} return nil diff --git a/wercker.yml b/wercker.yml deleted file mode 100644 index 3ab8084..0000000 --- a/wercker.yml +++ /dev/null @@ -1 +0,0 @@ -box: wercker/default \ No newline at end of file