From 4d3b19eae16983881f4f754c03675e3d13b7affb Mon Sep 17 00:00:00 2001 From: Ciprian Dorin Craciun Date: Wed, 17 Nov 2021 21:07:28 +0200 Subject: [PATCH] [archiver] Switch Brotli implementations with a pure Go one. --- sources/go.mod | 1 + sources/go.sum | 2 ++ sources/lib/archiver/compress.go | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources/go.mod b/sources/go.mod index 0d7b5b9..bab55e4 100644 --- a/sources/go.mod +++ b/sources/go.mod @@ -4,6 +4,7 @@ go 1.12 require ( github.com/Pallinder/go-randomdata v1.2.0 // indirect + github.com/andybalholm/brotli v1.0.4 // indirect github.com/colinmarc/cdb v0.0.0-00000000000000-000000000000 github.com/davecgh/go-spew v1.1.1 // indirect github.com/foobaz/go-zopfli v0.0.0-20140122214029-7432051485e2 // indirect diff --git a/sources/go.sum b/sources/go.sum index 50af4e0..3814f64 100644 --- a/sources/go.sum +++ b/sources/go.sum @@ -1,5 +1,7 @@ github.com/Pallinder/go-randomdata v1.2.0 h1:DZ41wBchNRb/0GfsePLiSwb0PHZmT67XY00lCDlaYPg= github.com/Pallinder/go-randomdata v1.2.0/go.mod h1:yHmJgulpD2Nfrm0cR9tI/+oAgRqCQQixsA8HyRZfV9Y= +github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= +github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/cipriancraciun/go-cdb-lib v0.0.0-20190809203657-d959ce9cc674 h1:UyoEJxLS9OPdjyinKfCA2aKgIf1NhXyIxneRSMrqZls= github.com/cipriancraciun/go-cdb-lib v0.0.0-20190809203657-d959ce9cc674/go.mod h1:/M2lSbkwYzIP5OqU4u+aygk4LCVpB7wi60O0Myhs05g= github.com/cipriancraciun/go-fasthttp v0.0.0-20190817151805-34223126fc19 h1:a+yE808Mqxm5W+Fxono2AKDPBpfNyDo/wKt6Rnsqb9E= diff --git a/sources/lib/archiver/compress.go b/sources/lib/archiver/compress.go index a445c2c..dd88923 100644 --- a/sources/lib/archiver/compress.go +++ b/sources/lib/archiver/compress.go @@ -9,7 +9,7 @@ import "fmt" import "github.com/foobaz/go-zopfli/zopfli" -import brotli "github.com/itchio/go-brotli/enc" +import "github.com/andybalholm/brotli" @@ -83,9 +83,9 @@ func CompressBrotli (_data []byte) ([]byte, string, error) { _buffer := & bytes.Buffer {} - _options := brotli.BrotliWriterOptions { Quality : 11, LGWin : 24} + _options := brotli.WriterOptions { Quality : 11, LGWin : 24} - _encoder := brotli.NewBrotliWriter (_buffer, &_options) + _encoder := brotli.NewWriterOptions (_buffer, _options) if _, _error := _encoder.Write (_data); _error != nil { return nil, "", _error