├── .gitignore ├── LICENSE ├── README.md ├── android.go ├── android_test.go ├── bitrise.yml ├── config.go ├── config_test.go ├── downloadutil.go ├── downloadutil_test.go ├── go.mod ├── go.sum ├── main.go ├── main_test.go ├── platformutil.go ├── step.yml └── vendor ├── github.com ├── andybalholm │ └── brotli │ │ ├── LICENSE │ │ ├── README.md │ │ ├── backward_references.go │ │ ├── backward_references_hq.go │ │ ├── bit_cost.go │ │ ├── bit_reader.go │ │ ├── bitwriter.go │ │ ├── block_splitter.go │ │ ├── block_splitter_command.go │ │ ├── block_splitter_distance.go │ │ ├── block_splitter_literal.go │ │ ├── brotli_bit_stream.go │ │ ├── cluster.go │ │ ├── cluster_command.go │ │ ├── cluster_distance.go │ │ ├── cluster_literal.go │ │ ├── command.go │ │ ├── compress_fragment.go │ │ ├── compress_fragment_two_pass.go │ │ ├── constants.go │ │ ├── context.go │ │ ├── decode.go │ │ ├── dictionary.go │ │ ├── dictionary_hash.go │ │ ├── encode.go │ │ ├── encoder.go │ │ ├── encoder_dict.go │ │ ├── entropy_encode.go │ │ ├── entropy_encode_static.go │ │ ├── fast_log.go │ │ ├── find_match_length.go │ │ ├── h10.go │ │ ├── h5.go │ │ ├── h6.go │ │ ├── hash.go │ │ ├── hash_composite.go │ │ ├── hash_forgetful_chain.go │ │ ├── hash_longest_match_quickly.go │ │ ├── hash_rolling.go │ │ ├── histogram.go │ │ ├── http.go │ │ ├── huffman.go │ │ ├── literal_cost.go │ │ ├── matchfinder │ │ ├── emitter.go │ │ ├── m0.go │ │ ├── m4.go │ │ ├── matchfinder.go │ │ └── textencoder.go │ │ ├── memory.go │ │ ├── metablock.go │ │ ├── metablock_command.go │ │ ├── metablock_distance.go │ │ ├── metablock_literal.go │ │ ├── params.go │ │ ├── platform.go │ │ ├── prefix.go │ │ ├── prefix_dec.go │ │ ├── quality.go │ │ ├── reader.go │ │ ├── ringbuffer.go │ │ ├── state.go │ │ ├── static_dict.go │ │ ├── static_dict_lut.go │ │ ├── symbol_list.go │ │ ├── transform.go │ │ ├── utf8_util.go │ │ ├── util.go │ │ ├── write_bits.go │ │ └── writer.go ├── bitrise-io │ ├── go-steputils │ │ └── stepconf │ │ │ └── stepconf.go │ └── go-utils │ │ ├── LICENSE │ │ ├── colorstring │ │ └── colorstring.go │ │ ├── command │ │ ├── command.go │ │ ├── file.go │ │ ├── git │ │ │ ├── commands.go │ │ │ └── git.go │ │ └── zip.go │ │ ├── fileutil │ │ └── fileutil.go │ │ ├── log │ │ ├── defaultlogger.go │ │ ├── dummylogger.go │ │ ├── internal_logger.go │ │ ├── json_logger.go │ │ ├── log.go │ │ ├── logger.go │ │ ├── print.go │ │ ├── raw_logger.go │ │ └── severity.go │ │ ├── parseutil │ │ └── parseutil.go │ │ ├── pathutil │ │ ├── path_filter.go │ │ ├── pathutil.go │ │ └── sortable_path.go │ │ ├── pointers │ │ └── pointers.go │ │ └── versions │ │ └── versions.go ├── blang │ └── semver │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── json.go │ │ ├── package.json │ │ ├── range.go │ │ ├── semver.go │ │ ├── sort.go │ │ └── sql.go ├── davecgh │ └── go-spew │ │ ├── LICENSE │ │ └── spew │ │ ├── bypass.go │ │ ├── bypasssafe.go │ │ ├── common.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── dump.go │ │ ├── format.go │ │ └── spew.go ├── dsnet │ └── compress │ │ ├── .travis.yml │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── api.go │ │ ├── bzip2 │ │ ├── bwt.go │ │ ├── common.go │ │ ├── fuzz_off.go │ │ ├── fuzz_on.go │ │ ├── internal │ │ │ └── sais │ │ │ │ ├── common.go │ │ │ │ ├── sais_byte.go │ │ │ │ └── sais_int.go │ │ ├── mtf_rle2.go │ │ ├── prefix.go │ │ ├── reader.go │ │ ├── rle1.go │ │ └── writer.go │ │ ├── internal │ │ ├── common.go │ │ ├── debug.go │ │ ├── errors │ │ │ └── errors.go │ │ ├── gofuzz.go │ │ ├── prefix │ │ │ ├── debug.go │ │ │ ├── decoder.go │ │ │ ├── encoder.go │ │ │ ├── prefix.go │ │ │ ├── range.go │ │ │ ├── reader.go │ │ │ ├── wrap.go │ │ │ └── writer.go │ │ └── release.go │ │ ├── zbench.sh │ │ ├── zfuzz.sh │ │ ├── zprof.sh │ │ └── ztest.sh ├── golang │ └── snappy │ │ ├── .gitignore │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README │ │ ├── decode.go │ │ ├── decode_amd64.s │ │ ├── decode_arm64.s │ │ ├── decode_asm.go │ │ ├── decode_other.go │ │ ├── encode.go │ │ ├── encode_amd64.s │ │ ├── encode_arm64.s │ │ ├── encode_asm.go │ │ ├── encode_other.go │ │ └── snappy.go ├── klauspost │ ├── compress │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── .goreleaser.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── SECURITY.md │ │ ├── compressible.go │ │ ├── flate │ │ │ ├── deflate.go │ │ │ ├── dict_decoder.go │ │ │ ├── fast_encoder.go │ │ │ ├── huffman_bit_writer.go │ │ │ ├── huffman_code.go │ │ │ ├── huffman_sortByFreq.go │ │ │ ├── huffman_sortByLiteral.go │ │ │ ├── inflate.go │ │ │ ├── inflate_gen.go │ │ │ ├── level1.go │ │ │ ├── level2.go │ │ │ ├── level3.go │ │ │ ├── level4.go │ │ │ ├── level5.go │ │ │ ├── level6.go │ │ │ ├── matchlen_amd64.go │ │ │ ├── matchlen_amd64.s │ │ │ ├── matchlen_generic.go │ │ │ ├── regmask_amd64.go │ │ │ ├── regmask_other.go │ │ │ ├── stateless.go │ │ │ └── token.go │ │ ├── fse │ │ │ ├── README.md │ │ │ ├── bitreader.go │ │ │ ├── bitwriter.go │ │ │ ├── bytereader.go │ │ │ ├── compress.go │ │ │ ├── decompress.go │ │ │ └── fse.go │ │ ├── gen.sh │ │ ├── huff0 │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── bitreader.go │ │ │ ├── bitwriter.go │ │ │ ├── compress.go │ │ │ ├── decompress.go │ │ │ ├── decompress_amd64.go │ │ │ ├── decompress_amd64.s │ │ │ ├── decompress_generic.go │ │ │ └── huff0.go │ │ ├── internal │ │ │ ├── cpuinfo │ │ │ │ ├── cpuinfo.go │ │ │ │ ├── cpuinfo_amd64.go │ │ │ │ └── cpuinfo_amd64.s │ │ │ └── snapref │ │ │ │ ├── LICENSE │ │ │ │ ├── decode.go │ │ │ │ ├── decode_other.go │ │ │ │ ├── encode.go │ │ │ │ ├── encode_other.go │ │ │ │ └── snappy.go │ │ ├── s2sx.mod │ │ ├── s2sx.sum │ │ └── zstd │ │ │ ├── README.md │ │ │ ├── bitreader.go │ │ │ ├── bitwriter.go │ │ │ ├── blockdec.go │ │ │ ├── blockenc.go │ │ │ ├── blocktype_string.go │ │ │ ├── bytebuf.go │ │ │ ├── bytereader.go │ │ │ ├── decodeheader.go │ │ │ ├── decoder.go │ │ │ ├── decoder_options.go │ │ │ ├── dict.go │ │ │ ├── enc_base.go │ │ │ ├── enc_best.go │ │ │ ├── enc_better.go │ │ │ ├── enc_dfast.go │ │ │ ├── enc_fast.go │ │ │ ├── encoder.go │ │ │ ├── encoder_options.go │ │ │ ├── framedec.go │ │ │ ├── frameenc.go │ │ │ ├── fse_decoder.go │ │ │ ├── fse_decoder_amd64.go │ │ │ ├── fse_decoder_amd64.s │ │ │ ├── fse_decoder_generic.go │ │ │ ├── fse_encoder.go │ │ │ ├── fse_predefined.go │ │ │ ├── hash.go │ │ │ ├── history.go │ │ │ ├── internal │ │ │ └── xxhash │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── README.md │ │ │ │ ├── xxhash.go │ │ │ │ ├── xxhash_amd64.s │ │ │ │ ├── xxhash_arm64.s │ │ │ │ ├── xxhash_asm.go │ │ │ │ ├── xxhash_other.go │ │ │ │ └── xxhash_safe.go │ │ │ ├── matchlen_amd64.go │ │ │ ├── matchlen_amd64.s │ │ │ ├── matchlen_generic.go │ │ │ ├── seqdec.go │ │ │ ├── seqdec_amd64.go │ │ │ ├── seqdec_amd64.s │ │ │ ├── seqdec_generic.go │ │ │ ├── seqenc.go │ │ │ ├── snappy.go │ │ │ ├── zip.go │ │ │ └── zstd.go │ └── pgzip │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── GO_LICENSE │ │ ├── LICENSE │ │ ├── README.md │ │ ├── gunzip.go │ │ └── gzip.go ├── magiconair │ └── properties │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── decode.go │ │ ├── doc.go │ │ ├── integrate.go │ │ ├── lex.go │ │ ├── load.go │ │ ├── parser.go │ │ ├── properties.go │ │ └── rangecheck.go ├── mholt │ └── archiver │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── archiver.go │ │ ├── azure-pipelines.yml │ │ ├── brotli.go │ │ ├── build.bash │ │ ├── bz2.go │ │ ├── filecompressor.go │ │ ├── gz.go │ │ ├── lz4.go │ │ ├── rar.go │ │ ├── sz.go │ │ ├── tar.go │ │ ├── tarbrotli.go │ │ ├── tarbz2.go │ │ ├── targz.go │ │ ├── tarlz4.go │ │ ├── tarsz.go │ │ ├── tarxz.go │ │ ├── tarzst.go │ │ ├── xz.go │ │ ├── zip.go │ │ └── zstd.go ├── nwaples │ └── rardecode │ │ ├── LICENSE │ │ ├── README.md │ │ ├── archive.go │ │ ├── archive15.go │ │ ├── archive50.go │ │ ├── bit_reader.go │ │ ├── decode29.go │ │ ├── decode29_lz.go │ │ ├── decode29_ppm.go │ │ ├── decode50.go │ │ ├── decode_reader.go │ │ ├── decrypt_reader.go │ │ ├── filters.go │ │ ├── huffman.go │ │ ├── ppm_model.go │ │ ├── reader.go │ │ └── vm.go ├── pierrec │ └── lz4 │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── block.go │ │ ├── debug.go │ │ ├── debug_stub.go │ │ ├── decode_amd64.go │ │ ├── decode_amd64.s │ │ ├── decode_other.go │ │ ├── errors.go │ │ ├── internal │ │ └── xxh32 │ │ │ └── xxh32zero.go │ │ ├── lz4.go │ │ ├── lz4_go1.10.go │ │ ├── lz4_notgo1.10.go │ │ ├── reader.go │ │ ├── reader_legacy.go │ │ ├── writer.go │ │ └── writer_legacy.go ├── pmezard │ └── go-difflib │ │ ├── LICENSE │ │ └── difflib │ │ └── difflib.go ├── stretchr │ └── testify │ │ ├── LICENSE │ │ ├── assert │ │ ├── assertion_compare.go │ │ ├── assertion_compare_can_convert.go │ │ ├── assertion_compare_legacy.go │ │ ├── assertion_format.go │ │ ├── assertion_format.go.tmpl │ │ ├── assertion_forward.go │ │ ├── assertion_forward.go.tmpl │ │ ├── assertion_order.go │ │ ├── assertions.go │ │ ├── doc.go │ │ ├── errors.go │ │ ├── forward_assertions.go │ │ └── http_assertions.go │ │ └── require │ │ ├── doc.go │ │ ├── forward_requirements.go │ │ ├── require.go │ │ ├── require.go.tmpl │ │ ├── require_forward.go │ │ ├── require_forward.go.tmpl │ │ └── requirements.go ├── ulikunitz │ └── xz │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── SECURITY.md │ │ ├── TODO.md │ │ ├── bits.go │ │ ├── crc.go │ │ ├── format.go │ │ ├── fox-check-none.xz │ │ ├── fox.xz │ │ ├── internal │ │ ├── hash │ │ │ ├── cyclic_poly.go │ │ │ ├── doc.go │ │ │ ├── rabin_karp.go │ │ │ └── roller.go │ │ └── xlog │ │ │ └── xlog.go │ │ ├── lzma │ │ ├── bintree.go │ │ ├── bitops.go │ │ ├── breader.go │ │ ├── buffer.go │ │ ├── bytewriter.go │ │ ├── decoder.go │ │ ├── decoderdict.go │ │ ├── directcodec.go │ │ ├── distcodec.go │ │ ├── encoder.go │ │ ├── encoderdict.go │ │ ├── fox.lzma │ │ ├── hashtable.go │ │ ├── header.go │ │ ├── header2.go │ │ ├── lengthcodec.go │ │ ├── literalcodec.go │ │ ├── matchalgorithm.go │ │ ├── operation.go │ │ ├── prob.go │ │ ├── properties.go │ │ ├── rangecodec.go │ │ ├── reader.go │ │ ├── reader2.go │ │ ├── state.go │ │ ├── treecodecs.go │ │ ├── writer.go │ │ └── writer2.go │ │ ├── lzmafilter.go │ │ ├── make-docs │ │ ├── none-check.go │ │ ├── reader.go │ │ └── writer.go └── xi2 │ └── xz │ ├── AUTHORS │ ├── LICENSE │ ├── README.md │ ├── dec_bcj.go │ ├── dec_delta.go │ ├── dec_lzma2.go │ ├── dec_stream.go │ ├── dec_util.go │ ├── dec_xz.go │ ├── doc.go │ └── reader.go ├── gopkg.in └── yaml.v3 │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── apic.go │ ├── decode.go │ ├── emitterc.go │ ├── encode.go │ ├── parserc.go │ ├── readerc.go │ ├── resolve.go │ ├── scannerc.go │ ├── sorter.go │ ├── writerc.go │ ├── yaml.go │ ├── yamlh.go │ └── yamlprivateh.go └── modules.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .bitrise* 2 | .gows.user.yml 3 | .idea/ 4 | _tmp/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 - present Karol Wrotniak Droids On Roids LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /android_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/stretchr/testify/require" 5 | "os" 6 | "testing" 7 | ) 8 | 9 | func TestFindBuildToolsVersion(t *testing.T) { 10 | androidHome := os.Getenv("ANDROID_HOME") 11 | require.NotEmpty(t, androidHome) 12 | properties, err := findBuildToolsVersion(androidHome) 13 | 14 | require.NoError(t, err) 15 | require.NotEmpty(t, properties) 16 | } 17 | -------------------------------------------------------------------------------- /config.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // Config ... 4 | type Config struct { 5 | Version string `env:"version,required"` 6 | WorkingDir string `env:"working_dir,dir"` 7 | Commands []string `env:"commands,required"` 8 | } 9 | 10 | func (config *Config) stripEmptyCommands() { 11 | var strippedCommands []string 12 | for _, command := range config.Commands { 13 | if command != "" { 14 | strippedCommands = append(strippedCommands, command) 15 | } 16 | } 17 | config.Commands = strippedCommands 18 | } 19 | -------------------------------------------------------------------------------- /config_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/bitrise-io/go-steputils/stepconf" 5 | "github.com/stretchr/testify/require" 6 | "os" 7 | "testing" 8 | ) 9 | 10 | func TestCreateConfigsModelFromEnvs(t *testing.T) { 11 | err := os.Setenv("commands", "||doctor||test||||") 12 | require.NoError(t, err) 13 | 14 | err = os.Setenv("working_dir", os.TempDir()) 15 | require.NoError(t, err) 16 | 17 | err = os.Setenv("version", "1") 18 | require.NoError(t, err) 19 | 20 | var config Config 21 | require.NoError(t, stepconf.Parse(&config)) 22 | 23 | config.stripEmptyCommands() 24 | stepconf.Print(config) 25 | 26 | require.Len(t, config.Commands, 2) 27 | require.Equal(t, "doctor", config.Commands[0]) 28 | require.Equal(t, "test", config.Commands[1]) 29 | } 30 | -------------------------------------------------------------------------------- /downloadutil.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/bitrise-io/go-utils/log" 6 | "github.com/blang/semver" 7 | "github.com/mholt/archiver" 8 | "io" 9 | "net/http" 10 | "os" 11 | ) 12 | 13 | func downloadAndUnTarXZ(url, dirPath string) error { 14 | file, err := os.CreateTemp("", "flutter.*.tar.xz") 15 | if err != nil { 16 | return err 17 | } 18 | 19 | defer func() { 20 | if err := file.Close(); err != nil { 21 | log.Errorf("Failed to close temporary file %s, error: %s", file.Name(), err) 22 | } 23 | if err := os.Remove(file.Name()); err != nil { 24 | log.Errorf("Failed to remove temporary file %s, error: %s", file.Name(), err) 25 | } 26 | }() 27 | 28 | if err := downloadFile(url, file); err != nil { 29 | return err 30 | } 31 | 32 | return archiver.Unarchive(file.Name(), dirPath) 33 | } 34 | 35 | func downloadFile(downloadURL string, outFile *os.File) error { 36 | response, err := http.Get(downloadURL) 37 | if err != nil { 38 | return err 39 | } 40 | 41 | defer func() { 42 | if err := response.Body.Close(); err != nil { 43 | log.Warnf("Failed to close (%s) body", downloadURL) 44 | } 45 | }() 46 | 47 | if response.StatusCode != http.StatusOK { 48 | return fmt.Errorf("failed to download file from %s, error: %s", downloadURL, response.Status) 49 | } 50 | 51 | _, err = io.Copy(outFile, response.Body) 52 | if err != nil { 53 | return fmt.Errorf("failed to save file %s, error: %s", outFile.Name(), err) 54 | } 55 | 56 | return nil 57 | } 58 | 59 | func normalizeFlutterVersion(flutterVersion string) string { 60 | if version, err := semver.Parse(flutterVersion); err == nil { 61 | if version.LT(semver.MustParse("1.17.0")) { 62 | return "v" + flutterVersion 63 | } 64 | } 65 | return flutterVersion 66 | } 67 | -------------------------------------------------------------------------------- /downloadutil_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/bitrise-io/go-utils/pathutil" 5 | "github.com/mholt/archiver" 6 | "github.com/stretchr/testify/require" 7 | "net/http" 8 | "net/http/httptest" 9 | "os" 10 | "path" 11 | "testing" 12 | ) 13 | 14 | func TestDownloadFileUnreachableURL(t *testing.T) { 15 | dummyFile, err := os.Open("/dev/null") 16 | require.NoError(t, err) 17 | 18 | err = downloadFile("http://unreachable.invalid", dummyFile) 19 | require.Error(t, err) 20 | } 21 | 22 | func TestDownloadFileHTTPError(t *testing.T) { 23 | dummyFile, err := os.Open("/dev/null") 24 | require.NoError(t, err) 25 | 26 | ts := httptest.NewServer(http.NotFoundHandler()) 27 | defer ts.Close() 28 | 29 | err = downloadFile(ts.URL, dummyFile) 30 | require.Error(t, err) 31 | } 32 | 33 | func TestDownloadFileSuccessfully(t *testing.T) { 34 | dummyFile, err := os.CreateTemp("", "test.txt") 35 | require.NoError(t, err) 36 | 37 | ts := httptest.NewServer(http.FileServer(http.Dir(os.TempDir()))) 38 | defer ts.Close() 39 | 40 | err = downloadFile(ts.URL, dummyFile) 41 | require.NoError(t, err) 42 | 43 | err = dummyFile.Close() 44 | require.NoError(t, err) 45 | 46 | err = os.Remove(dummyFile.Name()) 47 | require.NoError(t, err) 48 | } 49 | 50 | func TestDownloadAnUnTarXZSuccessfully(t *testing.T) { 51 | archiveDir, err := os.MkdirTemp("", "testdir") 52 | require.NoError(t, err) 53 | 54 | dummyFile, err := os.CreateTemp("", "test") 55 | require.NoError(t, err) 56 | 57 | const archiveFileName = "test.tar.xz" 58 | archiveFile := path.Join(archiveDir, archiveFileName) 59 | 60 | err = archiver.Archive([]string{dummyFile.Name()}, archiveFile) 61 | require.NoError(t, err) 62 | 63 | ts := httptest.NewServer(http.FileServer(http.Dir(archiveDir))) 64 | defer ts.Close() 65 | 66 | destinationDir, err := os.MkdirTemp("", "destination") 67 | require.NoError(t, err) 68 | 69 | err = downloadAndUnTarXZ(ts.URL+"/"+archiveFileName, destinationDir) 70 | require.NoError(t, err) 71 | pathExists, err := pathutil.IsPathExists(dummyFile.Name()) 72 | require.NoError(t, err) 73 | require.True(t, pathExists) 74 | 75 | require.NoError(t, os.RemoveAll(archiveDir)) 76 | require.NoError(t, os.RemoveAll(destinationDir)) 77 | require.NoError(t, os.RemoveAll(dummyFile.Name())) 78 | } 79 | 80 | func TestNormalizePre117SemanticVersion(t *testing.T) { 81 | require.Equal(t, "v1.16.9", normalizeFlutterVersion("1.16.9")) 82 | } 83 | 84 | func TestNormalizePost117SemanticVersion(t *testing.T) { 85 | require.Equal(t, "1.17.0", normalizeFlutterVersion("1.17.0")) 86 | } 87 | 88 | func TestNormalizeNonSemanticVersion(t *testing.T) { 89 | require.Equal(t, "master", normalizeFlutterVersion("master")) 90 | } 91 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/DroidsOnRoids/bitrise-step-flutter 2 | 3 | go 1.21 4 | 5 | toolchain go1.23.2 6 | 7 | require ( 8 | github.com/bitrise-io/go-steputils v1.0.6 9 | github.com/bitrise-io/go-utils v1.0.13 10 | github.com/blang/semver v3.5.1+incompatible 11 | github.com/magiconair/properties v1.8.7 12 | github.com/mholt/archiver v1.1.3-0.20190917152942-233fc16b9615 13 | github.com/stretchr/testify v1.8.4 14 | ) 15 | 16 | require ( 17 | github.com/andybalholm/brotli v1.1.1 // indirect 18 | github.com/davecgh/go-spew v1.1.1 // indirect 19 | github.com/dsnet/compress v0.0.1 // indirect 20 | github.com/frankban/quicktest v1.14.6 // indirect 21 | github.com/golang/snappy v0.0.4 // indirect 22 | github.com/klauspost/compress v1.17.11 // indirect 23 | github.com/klauspost/pgzip v1.2.6 // indirect 24 | github.com/nwaples/rardecode v1.1.3 // indirect 25 | github.com/pierrec/lz4 v2.6.1+incompatible // indirect 26 | github.com/pmezard/go-difflib v1.0.0 // indirect 27 | github.com/ulikunitz/xz v0.5.12 // indirect 28 | github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect 29 | gopkg.in/yaml.v3 v3.0.1 // indirect 30 | ) 31 | -------------------------------------------------------------------------------- /main_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/stretchr/testify/require" 5 | "runtime" 6 | "testing" 7 | ) 8 | 9 | func Test_getFlutterSdkSourceURL(t *testing.T) { 10 | if runtime.GOOS == "darwin" { 11 | if runtime.GOARCH == "arm64" { 12 | require.Equal(t, getFlutterSdkSourceURL("3.0.1", "stable"), "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_arm64_3.0.1-stable.zip") 13 | require.Equal(t, getFlutterSdkSourceURL("3.1.0", "beta"), "https://storage.googleapis.com/flutter_infra_release/releases/beta/macos/flutter_macos_arm64_3.1.0-beta.zip") 14 | } else { 15 | require.Equal(t, getFlutterSdkSourceURL("3.0.1", "stable"), "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.0.1-stable.zip") 16 | require.Equal(t, getFlutterSdkSourceURL("3.1.0", "beta"), "https://storage.googleapis.com/flutter_infra_release/releases/beta/macos/flutter_macos_3.1.0-beta.zip") 17 | } 18 | } else if runtime.GOOS == "linux" { 19 | require.Equal(t, getFlutterSdkSourceURL("3.0.1", "stable"), "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.0.1-stable.tar.xz") 20 | require.Equal(t, getFlutterSdkSourceURL("3.1.0", "beta"), "https://storage.googleapis.com/flutter_infra_release/releases/beta/linux/flutter_linux_3.1.0-beta.tar.xz") 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /platformutil.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/bitrise-io/go-utils/pathutil" 6 | "path/filepath" 7 | "runtime" 8 | ) 9 | 10 | func getSdkDestinationDir() (string, error) { 11 | if runtime.GOOS == "darwin" { 12 | return filepath.Join(pathutil.UserHomeDir(), "Library/flutter"), nil 13 | } else if runtime.GOOS == "linux" { 14 | return "/opt/flutter", nil 15 | } 16 | return "", fmt.Errorf("unsupported OS: %s", runtime.GOOS) 17 | } 18 | 19 | func getFlutterPlatform() string { 20 | if runtime.GOOS == "darwin" { 21 | return "macos" 22 | } 23 | return runtime.GOOS 24 | } 25 | 26 | func getArchiveExtension() string { 27 | if runtime.GOOS == "linux" { 28 | return "tar.xz" 29 | } 30 | return "zip" 31 | } 32 | -------------------------------------------------------------------------------- /step.yml: -------------------------------------------------------------------------------- 1 | # 2 | # A couple of useful guides & docs: 3 | # 4 | # - Main Bitrise CLI docs: https://github.com/bitrise-io/bitrise/tree/master/_docs 5 | # - Step Development Guideline: https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md 6 | # - Bitrise.yml format spec: https://github.com/bitrise-io/bitrise/blob/master/_docs/bitrise-yml-format-spec.md 7 | # - Bitrise docs: http://devcenter.bitrise.io/ 8 | # - Bitrise CLI guides: http://devcenter.bitrise.io/bitrise-cli/ 9 | 10 | title: |- 11 | Flutter 12 | summary: | 13 | Executes one or more Flutter commands. E.g. build, test or install. 14 | description: | 15 | Sample `bitrise.yml` snippet for building iOS and Android apps: 16 | ```yaml 17 | primary: 18 | steps: 19 | - certificate-and-profile-installer: 20 | inputs: 21 | - install_defaults: 'no' 22 | - activate-ssh-key: 23 | run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}' 24 | - git-clone: {} 25 | - flutter: 26 | inputs: 27 | - commands: test|build ios|build apk 28 | ``` 29 | 30 | website: https://github.com/DroidsOnRoids/bitrise-step-flutter 31 | source_code_url: https://github.com/DroidsOnRoids/bitrise-step-flutter 32 | support_url: https://github.com/DroidsOnRoids/bitrise-step-flutter/issues 33 | host_os_tags: 34 | - osx-10.10 35 | - ubuntu-16.04 36 | 37 | # Type tags are used for categorizing steps, for easier step discovery in Step Libraries. 38 | # You can find more information about type tags in the Step Development Guideline: 39 | # https://github.com/bitrise-io/bitrise/blob/master/_docs/step-development-guideline.md 40 | type_tags: 41 | - build 42 | - test 43 | 44 | project_type_tags: 45 | - flutter 46 | 47 | is_requires_admin_user: false 48 | is_always_run: false 49 | is_skippable: false 50 | run_if: "" 51 | 52 | deps: 53 | brew: 54 | - name: git 55 | - name: curl 56 | - name: unzip 57 | 58 | apt_get: 59 | - name: git 60 | - name: curl 61 | - name: unzip 62 | - name: libglu1-mesa 63 | 64 | toolkit: 65 | go: 66 | package_name: github.com/DroidsOnRoids/bitrise-step-flutter 67 | 68 | inputs: 69 | - version: 1.17.4 70 | opts: 71 | title: "Flutter version" 72 | summary: Flutter release version or repository tag, without `v` prefix. E.g. `0.9.4-beta` or `0.10.0` or `master`. 73 | is_expand: true 74 | is_required: true 75 | 76 | - working_dir: $BITRISE_SOURCE_DIR 77 | opts: 78 | title: "Root directory of Flutter project" 79 | summary: The root directory of your Flutter project, where your `pubspec.yaml` file is located. 80 | is_expand: true 81 | is_required: true 82 | 83 | - commands: build 84 | opts: 85 | title: "Flutter commands to be executed" 86 | summary: | 87 | `|` separated Flutter commands to be executed in order. E.g. `build`, `test` or `install`. 88 | is_expand: true 89 | is_required: true 90 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/README.md: -------------------------------------------------------------------------------- 1 | This package is a brotli compressor and decompressor implemented in Go. 2 | It was translated from the reference implementation (https://github.com/google/brotli) 3 | with the `c2go` tool at https://github.com/andybalholm/c2go. 4 | 5 | I have been working on new compression algorithms (not translated from C) 6 | in the matchfinder package. 7 | You can use them with the NewWriterV2 function. 8 | Currently they give better results than the old implementation 9 | (at least for compressing my test file, Newton’s *Opticks*) 10 | on levels 2 to 6. 11 | 12 | I am using it in production with https://github.com/andybalholm/redwood. 13 | 14 | API documentation is found at https://pkg.go.dev/github.com/andybalholm/brotli?tab=doc. 15 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/bitwriter.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2010 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* Write bits into a byte array. */ 10 | 11 | type bitWriter struct { 12 | dst []byte 13 | 14 | // Data waiting to be written is the low nbits of bits. 15 | bits uint64 16 | nbits uint 17 | } 18 | 19 | func (w *bitWriter) writeBits(nb uint, b uint64) { 20 | w.bits |= b << w.nbits 21 | w.nbits += nb 22 | if w.nbits >= 32 { 23 | bits := w.bits 24 | w.bits >>= 32 25 | w.nbits -= 32 26 | w.dst = append(w.dst, 27 | byte(bits), 28 | byte(bits>>8), 29 | byte(bits>>16), 30 | byte(bits>>24), 31 | ) 32 | } 33 | } 34 | 35 | func (w *bitWriter) writeSingleBit(bit bool) { 36 | if bit { 37 | w.writeBits(1, 1) 38 | } else { 39 | w.writeBits(1, 0) 40 | } 41 | } 42 | 43 | func (w *bitWriter) jumpToByteBoundary() { 44 | dst := w.dst 45 | for w.nbits != 0 { 46 | dst = append(dst, byte(w.bits)) 47 | w.bits >>= 8 48 | if w.nbits > 8 { // Avoid underflow 49 | w.nbits -= 8 50 | } else { 51 | w.nbits = 0 52 | } 53 | } 54 | w.bits = 0 55 | w.dst = dst 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/cluster.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2013 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* Functions for clustering similar histograms together. */ 10 | 11 | type histogramPair struct { 12 | idx1 uint32 13 | idx2 uint32 14 | cost_combo float64 15 | cost_diff float64 16 | } 17 | 18 | func histogramPairIsLess(p1 *histogramPair, p2 *histogramPair) bool { 19 | if p1.cost_diff != p2.cost_diff { 20 | return p1.cost_diff > p2.cost_diff 21 | } 22 | 23 | return (p1.idx2 - p1.idx1) > (p2.idx2 - p2.idx1) 24 | } 25 | 26 | /* Returns entropy reduction of the context map when we combine two clusters. */ 27 | func clusterCostDiff(size_a uint, size_b uint) float64 { 28 | var size_c uint = size_a + size_b 29 | return float64(size_a)*fastLog2(size_a) + float64(size_b)*fastLog2(size_b) - float64(size_c)*fastLog2(size_c) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/constants.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2016 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* Specification: 7.3. Encoding of the context map */ 10 | const contextMapMaxRle = 16 11 | 12 | /* Specification: 2. Compressed representation overview */ 13 | const maxNumberOfBlockTypes = 256 14 | 15 | /* Specification: 3.3. Alphabet sizes: insert-and-copy length */ 16 | const numLiteralSymbols = 256 17 | 18 | const numCommandSymbols = 704 19 | 20 | const numBlockLenSymbols = 26 21 | 22 | const maxContextMapSymbols = (maxNumberOfBlockTypes + contextMapMaxRle) 23 | 24 | const maxBlockTypeSymbols = (maxNumberOfBlockTypes + 2) 25 | 26 | /* Specification: 3.5. Complex prefix codes */ 27 | const repeatPreviousCodeLength = 16 28 | 29 | const repeatZeroCodeLength = 17 30 | 31 | const codeLengthCodes = (repeatZeroCodeLength + 1) 32 | 33 | /* "code length of 8 is repeated" */ 34 | const initialRepeatedCodeLength = 8 35 | 36 | /* "Large Window Brotli" */ 37 | const largeMaxDistanceBits = 62 38 | 39 | const largeMinWbits = 10 40 | 41 | const largeMaxWbits = 30 42 | 43 | /* Specification: 4. Encoding of distances */ 44 | const numDistanceShortCodes = 16 45 | 46 | const maxNpostfix = 3 47 | 48 | const maxNdirect = 120 49 | 50 | const maxDistanceBits = 24 51 | 52 | func distanceAlphabetSize(NPOSTFIX uint, NDIRECT uint, MAXNBITS uint) uint { 53 | return numDistanceShortCodes + NDIRECT + uint(MAXNBITS<<(NPOSTFIX+1)) 54 | } 55 | 56 | /* numDistanceSymbols == 1128 */ 57 | const numDistanceSymbols = 1128 58 | 59 | const maxDistance = 0x3FFFFFC 60 | 61 | const maxAllowedDistance = 0x7FFFFFFC 62 | 63 | /* 7.1. Context modes and context ID lookup for literals */ 64 | /* "context IDs for literals are in the range of 0..63" */ 65 | const literalContextBits = 6 66 | 67 | /* 7.2. Context ID for distances */ 68 | const distanceContextBits = 2 69 | 70 | /* 9.1. Format of the Stream Header */ 71 | /* Number of slack bytes for window size. Don't confuse 72 | with BROTLI_NUM_DISTANCE_SHORT_CODES. */ 73 | const windowGap = 16 74 | 75 | func maxBackwardLimit(W uint) uint { 76 | return (uint(1) << W) - windowGap 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/encoder_dict.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Dictionary data (words and transforms) for 1 possible context */ 4 | type encoderDictionary struct { 5 | words *dictionary 6 | cutoffTransformsCount uint32 7 | cutoffTransforms uint64 8 | hash_table []uint16 9 | buckets []uint16 10 | dict_words []dictWord 11 | } 12 | 13 | func initEncoderDictionary(dict *encoderDictionary) { 14 | dict.words = getDictionary() 15 | 16 | dict.hash_table = kStaticDictionaryHash[:] 17 | dict.buckets = kStaticDictionaryBuckets[:] 18 | dict.dict_words = kStaticDictionaryWords[:] 19 | 20 | dict.cutoffTransformsCount = kCutoffTransformsCount 21 | dict.cutoffTransforms = kCutoffTransforms 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/find_match_length.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | import ( 4 | "encoding/binary" 5 | "math/bits" 6 | "runtime" 7 | ) 8 | 9 | /* Copyright 2010 Google Inc. All Rights Reserved. 10 | 11 | Distributed under MIT license. 12 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 13 | */ 14 | 15 | /* Function to find maximal matching prefixes of strings. */ 16 | func findMatchLengthWithLimit(s1 []byte, s2 []byte, limit uint) uint { 17 | var matched uint = 0 18 | _, _ = s1[limit-1], s2[limit-1] // bounds check 19 | switch runtime.GOARCH { 20 | case "amd64": 21 | // Compare 8 bytes at at time. 22 | for matched+8 <= limit { 23 | w1 := binary.LittleEndian.Uint64(s1[matched:]) 24 | w2 := binary.LittleEndian.Uint64(s2[matched:]) 25 | if w1 != w2 { 26 | return matched + uint(bits.TrailingZeros64(w1^w2)>>3) 27 | } 28 | matched += 8 29 | } 30 | case "386": 31 | // Compare 4 bytes at at time. 32 | for matched+4 <= limit { 33 | w1 := binary.LittleEndian.Uint32(s1[matched:]) 34 | w2 := binary.LittleEndian.Uint32(s2[matched:]) 35 | if w1 != w2 { 36 | return matched + uint(bits.TrailingZeros32(w1^w2)>>3) 37 | } 38 | matched += 4 39 | } 40 | } 41 | for matched < limit && s1[matched] == s2[matched] { 42 | matched++ 43 | } 44 | return matched 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/matchfinder/emitter.go: -------------------------------------------------------------------------------- 1 | package matchfinder 2 | 3 | // An absoluteMatch is like a Match, but it stores indexes into the byte 4 | // stream instead of lengths. 5 | type absoluteMatch struct { 6 | // Start is the index of the first byte. 7 | Start int 8 | 9 | // End is the index of the byte after the last byte 10 | // (so that End - Start = Length). 11 | End int 12 | 13 | // Match is the index of the previous data that matches 14 | // (Start - Match = Distance). 15 | Match int 16 | } 17 | 18 | // A matchEmitter manages the output of matches for a MatchFinder. 19 | type matchEmitter struct { 20 | // Dst is the destination slice that Matches are added to. 21 | Dst []Match 22 | 23 | // NextEmit is the index of the next byte to emit. 24 | NextEmit int 25 | } 26 | 27 | func (e *matchEmitter) emit(m absoluteMatch) { 28 | e.Dst = append(e.Dst, Match{ 29 | Unmatched: m.Start - e.NextEmit, 30 | Length: m.End - m.Start, 31 | Distance: m.Start - m.Match, 32 | }) 33 | e.NextEmit = m.End 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/matchfinder/textencoder.go: -------------------------------------------------------------------------------- 1 | package matchfinder 2 | 3 | import "fmt" 4 | 5 | // A TextEncoder is an Encoder that produces a human-readable representation of 6 | // the LZ77 compression. Matches are replaced with symbols. 7 | type TextEncoder struct{} 8 | 9 | func (t TextEncoder) Reset() {} 10 | 11 | func (t TextEncoder) Encode(dst []byte, src []byte, matches []Match, lastBlock bool) []byte { 12 | pos := 0 13 | for _, m := range matches { 14 | if m.Unmatched > 0 { 15 | dst = append(dst, src[pos:pos+m.Unmatched]...) 16 | pos += m.Unmatched 17 | } 18 | if m.Length > 0 { 19 | dst = append(dst, []byte(fmt.Sprintf("<%d,%d>", m.Length, m.Distance))...) 20 | pos += m.Length 21 | } 22 | } 23 | if pos < len(src) { 24 | dst = append(dst, src[pos:]...) 25 | } 26 | return dst 27 | } 28 | 29 | // A NoMatchFinder implements MatchFinder, but doesn't find any matches. 30 | // It can be used to implement the equivalent of the standard library flate package's 31 | // HuffmanOnly setting. 32 | type NoMatchFinder struct{} 33 | 34 | func (n NoMatchFinder) Reset() {} 35 | 36 | func (n NoMatchFinder) FindMatches(dst []Match, src []byte) []Match { 37 | return append(dst, Match{ 38 | Unmatched: len(src), 39 | }) 40 | } 41 | 42 | // AutoReset wraps a MatchFinder that can return references to data in previous 43 | // blocks, and calls Reset before each block. It is useful for (e.g.) using a 44 | // snappy Encoder with a MatchFinder designed for flate. (Snappy doesn't 45 | // support references between blocks.) 46 | type AutoReset struct { 47 | MatchFinder 48 | } 49 | 50 | func (a AutoReset) FindMatches(dst []Match, src []byte) []Match { 51 | a.Reset() 52 | return a.MatchFinder.FindMatches(dst, src) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/memory.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2016 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* 10 | Dynamically grows array capacity to at least the requested size 11 | T: data type 12 | A: array 13 | C: capacity 14 | R: requested size 15 | */ 16 | func brotli_ensure_capacity_uint8_t(a *[]byte, c *uint, r uint) { 17 | if *c < r { 18 | var new_size uint = *c 19 | if new_size == 0 { 20 | new_size = r 21 | } 22 | 23 | for new_size < r { 24 | new_size *= 2 25 | } 26 | 27 | if cap(*a) < int(new_size) { 28 | var new_array []byte = make([]byte, new_size) 29 | if *c != 0 { 30 | copy(new_array, (*a)[:*c]) 31 | } 32 | 33 | *a = new_array 34 | } else { 35 | *a = (*a)[:new_size] 36 | } 37 | 38 | *c = new_size 39 | } 40 | } 41 | 42 | func brotli_ensure_capacity_uint32_t(a *[]uint32, c *uint, r uint) { 43 | var new_array []uint32 44 | if *c < r { 45 | var new_size uint = *c 46 | if new_size == 0 { 47 | new_size = r 48 | } 49 | 50 | for new_size < r { 51 | new_size *= 2 52 | } 53 | 54 | if cap(*a) < int(new_size) { 55 | new_array = make([]uint32, new_size) 56 | if *c != 0 { 57 | copy(new_array, (*a)[:*c]) 58 | } 59 | 60 | *a = new_array 61 | } else { 62 | *a = (*a)[:new_size] 63 | } 64 | *c = new_size 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/params.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2017 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* Parameters for the Brotli encoder with chosen quality levels. */ 10 | type hasherParams struct { 11 | type_ int 12 | bucket_bits int 13 | block_bits int 14 | hash_len int 15 | num_last_distances_to_check int 16 | } 17 | 18 | type distanceParams struct { 19 | distance_postfix_bits uint32 20 | num_direct_distance_codes uint32 21 | alphabet_size uint32 22 | max_distance uint 23 | } 24 | 25 | /* Encoding parameters */ 26 | type encoderParams struct { 27 | mode int 28 | quality int 29 | lgwin uint 30 | lgblock int 31 | size_hint uint 32 | disable_literal_context_modeling bool 33 | large_window bool 34 | hasher hasherParams 35 | dist distanceParams 36 | dictionary encoderDictionary 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/platform.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2013 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | func brotli_min_double(a float64, b float64) float64 { 10 | if a < b { 11 | return a 12 | } else { 13 | return b 14 | } 15 | } 16 | 17 | func brotli_max_double(a float64, b float64) float64 { 18 | if a > b { 19 | return a 20 | } else { 21 | return b 22 | } 23 | } 24 | 25 | func brotli_min_float(a float32, b float32) float32 { 26 | if a < b { 27 | return a 28 | } else { 29 | return b 30 | } 31 | } 32 | 33 | func brotli_max_float(a float32, b float32) float32 { 34 | if a > b { 35 | return a 36 | } else { 37 | return b 38 | } 39 | } 40 | 41 | func brotli_min_int(a int, b int) int { 42 | if a < b { 43 | return a 44 | } else { 45 | return b 46 | } 47 | } 48 | 49 | func brotli_max_int(a int, b int) int { 50 | if a > b { 51 | return a 52 | } else { 53 | return b 54 | } 55 | } 56 | 57 | func brotli_min_size_t(a uint, b uint) uint { 58 | if a < b { 59 | return a 60 | } else { 61 | return b 62 | } 63 | } 64 | 65 | func brotli_max_size_t(a uint, b uint) uint { 66 | if a > b { 67 | return a 68 | } else { 69 | return b 70 | } 71 | } 72 | 73 | func brotli_min_uint32_t(a uint32, b uint32) uint32 { 74 | if a < b { 75 | return a 76 | } else { 77 | return b 78 | } 79 | } 80 | 81 | func brotli_max_uint32_t(a uint32, b uint32) uint32 { 82 | if a > b { 83 | return a 84 | } else { 85 | return b 86 | } 87 | } 88 | 89 | func brotli_min_uint8_t(a byte, b byte) byte { 90 | if a < b { 91 | return a 92 | } else { 93 | return b 94 | } 95 | } 96 | 97 | func brotli_max_uint8_t(a byte, b byte) byte { 98 | if a > b { 99 | return a 100 | } else { 101 | return b 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/prefix.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2013 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* Functions for encoding of integers into prefix codes the amount of extra 10 | bits, and the actual values of the extra bits. */ 11 | 12 | /* Here distance_code is an intermediate code, i.e. one of the special codes or 13 | the actual distance increased by BROTLI_NUM_DISTANCE_SHORT_CODES - 1. */ 14 | func prefixEncodeCopyDistance(distance_code uint, num_direct_codes uint, postfix_bits uint, code *uint16, extra_bits *uint32) { 15 | if distance_code < numDistanceShortCodes+num_direct_codes { 16 | *code = uint16(distance_code) 17 | *extra_bits = 0 18 | return 19 | } else { 20 | var dist uint = (uint(1) << (postfix_bits + 2)) + (distance_code - numDistanceShortCodes - num_direct_codes) 21 | var bucket uint = uint(log2FloorNonZero(dist) - 1) 22 | var postfix_mask uint = (1 << postfix_bits) - 1 23 | var postfix uint = dist & postfix_mask 24 | var prefix uint = (dist >> bucket) & 1 25 | var offset uint = (2 + prefix) << bucket 26 | var nbits uint = bucket - postfix_bits 27 | *code = uint16(nbits<<10 | (numDistanceShortCodes + num_direct_codes + ((2*(nbits-1) + prefix) << postfix_bits) + postfix)) 28 | *extra_bits = uint32((dist - offset) >> postfix_bits) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/symbol_list.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2013 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* Utilities for building Huffman decoding tables. */ 10 | 11 | type symbolList struct { 12 | storage []uint16 13 | offset int 14 | } 15 | 16 | func symbolListGet(sl symbolList, i int) uint16 { 17 | return sl.storage[i+sl.offset] 18 | } 19 | 20 | func symbolListPut(sl symbolList, i int, val uint16) { 21 | sl.storage[i+sl.offset] = val 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/utf8_util.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | /* Copyright 2013 Google Inc. All Rights Reserved. 4 | 5 | Distributed under MIT license. 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 7 | */ 8 | 9 | /* Heuristics for deciding about the UTF8-ness of strings. */ 10 | 11 | const kMinUTF8Ratio float64 = 0.75 12 | 13 | /* Returns 1 if at least min_fraction of the bytes between pos and 14 | pos + length in the (data, mask) ring-buffer is UTF8-encoded, otherwise 15 | returns 0. */ 16 | func parseAsUTF8(symbol *int, input []byte, size uint) uint { 17 | /* ASCII */ 18 | if input[0]&0x80 == 0 { 19 | *symbol = int(input[0]) 20 | if *symbol > 0 { 21 | return 1 22 | } 23 | } 24 | 25 | /* 2-byte UTF8 */ 26 | if size > 1 && input[0]&0xE0 == 0xC0 && input[1]&0xC0 == 0x80 { 27 | *symbol = (int(input[0])&0x1F)<<6 | int(input[1])&0x3F 28 | if *symbol > 0x7F { 29 | return 2 30 | } 31 | } 32 | 33 | /* 3-byte UFT8 */ 34 | if size > 2 && input[0]&0xF0 == 0xE0 && input[1]&0xC0 == 0x80 && input[2]&0xC0 == 0x80 { 35 | *symbol = (int(input[0])&0x0F)<<12 | (int(input[1])&0x3F)<<6 | int(input[2])&0x3F 36 | if *symbol > 0x7FF { 37 | return 3 38 | } 39 | } 40 | 41 | /* 4-byte UFT8 */ 42 | if size > 3 && input[0]&0xF8 == 0xF0 && input[1]&0xC0 == 0x80 && input[2]&0xC0 == 0x80 && input[3]&0xC0 == 0x80 { 43 | *symbol = (int(input[0])&0x07)<<18 | (int(input[1])&0x3F)<<12 | (int(input[2])&0x3F)<<6 | int(input[3])&0x3F 44 | if *symbol > 0xFFFF && *symbol <= 0x10FFFF { 45 | return 4 46 | } 47 | } 48 | 49 | /* Not UTF8, emit a special symbol above the UTF8-code space */ 50 | *symbol = 0x110000 | int(input[0]) 51 | 52 | return 1 53 | } 54 | 55 | /* Returns 1 if at least min_fraction of the data is UTF8-encoded.*/ 56 | func isMostlyUTF8(data []byte, pos uint, mask uint, length uint, min_fraction float64) bool { 57 | var size_utf8 uint = 0 58 | var i uint = 0 59 | for i < length { 60 | var symbol int 61 | current_data := data[(pos+i)&mask:] 62 | var bytes_read uint = parseAsUTF8(&symbol, current_data, length-i) 63 | i += bytes_read 64 | if symbol < 0x110000 { 65 | size_utf8 += bytes_read 66 | } 67 | } 68 | 69 | return float64(size_utf8) > min_fraction*float64(length) 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/util.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | func assert(cond bool) { 4 | if !cond { 5 | panic("assertion failure") 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/andybalholm/brotli/write_bits.go: -------------------------------------------------------------------------------- 1 | package brotli 2 | 3 | import "encoding/binary" 4 | 5 | /* Copyright 2010 Google Inc. All Rights Reserved. 6 | 7 | Distributed under MIT license. 8 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 9 | */ 10 | 11 | /* Write bits into a byte array. */ 12 | 13 | /* This function writes bits into bytes in increasing addresses, and within 14 | a byte least-significant-bit first. 15 | 16 | The function can write up to 56 bits in one go with WriteBits 17 | Example: let's assume that 3 bits (Rs below) have been written already: 18 | 19 | BYTE-0 BYTE+1 BYTE+2 20 | 21 | 0000 0RRR 0000 0000 0000 0000 22 | 23 | Now, we could write 5 or less bits in MSB by just sifting by 3 24 | and OR'ing to BYTE-0. 25 | 26 | For n bits, we take the last 5 bits, OR that with high bits in BYTE-0, 27 | and locate the rest in BYTE+1, BYTE+2, etc. */ 28 | func writeBits(n_bits uint, bits uint64, pos *uint, array []byte) { 29 | /* This branch of the code can write up to 56 bits at a time, 30 | 7 bits are lost by being perhaps already in *p and at least 31 | 1 bit is needed to initialize the bit-stream ahead (i.e. if 7 32 | bits are in *p and we write 57 bits, then the next write will 33 | access a byte that was never initialized). */ 34 | p := array[*pos>>3:] 35 | v := uint64(p[0]) 36 | v |= bits << (*pos & 7) 37 | binary.LittleEndian.PutUint64(p, v) 38 | *pos += n_bits 39 | } 40 | 41 | func writeSingleBit(bit bool, pos *uint, array []byte) { 42 | if bit { 43 | writeBits(1, 1, pos, array) 44 | } else { 45 | writeBits(1, 0, pos, array) 46 | } 47 | } 48 | 49 | func writeBitsPrepareStorage(pos uint, array []byte) { 50 | assert(pos&7 == 0) 51 | array[pos>>3] = 0 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Bitrise 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/command/file.go: -------------------------------------------------------------------------------- 1 | package command 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "os" 7 | "os/exec" 8 | "strings" 9 | 10 | "github.com/bitrise-io/go-utils/pathutil" 11 | ) 12 | 13 | func runCommand(name string, args ...string) error { 14 | cmd := exec.Command(name, args...) 15 | if out, err := cmd.CombinedOutput(); err != nil { 16 | printableCmd := PrintableCommandArgs(false, append([]string{name}, args...)) 17 | 18 | var exitErr *exec.ExitError 19 | if errors.As(err, &exitErr) { 20 | return fmt.Errorf("command failed with exit status %d (%s): %w", exitErr.ExitCode(), printableCmd, errors.New(string(out))) 21 | } 22 | return fmt.Errorf("executing command failed (%s): %w", printableCmd, err) 23 | } 24 | return nil 25 | } 26 | 27 | // CopyFile ... 28 | func CopyFile(src, dst string) error { 29 | // replace with a pure Go implementation? 30 | // Golang proposal was: https://go-review.googlesource.com/#/c/1591/5/src/io/ioutil/ioutil.go 31 | isDir, err := pathutil.IsDirExists(src) 32 | if err != nil { 33 | return err 34 | } 35 | if isDir { 36 | return errors.New("source is a directory: " + src) 37 | } 38 | args := []string{src, dst} 39 | return runCommand("rsync", args...) 40 | } 41 | 42 | // CopyDir ... 43 | func CopyDir(src, dst string, isOnlyContent bool) error { 44 | if isOnlyContent && !strings.HasSuffix(src, "/") { 45 | src = src + "/" 46 | } 47 | args := []string{"-ar", src, dst} 48 | return runCommand("rsync", args...) 49 | } 50 | 51 | // RemoveDir ... 52 | // Deprecated: use RemoveAll instead. 53 | func RemoveDir(dirPth string) error { 54 | if exist, err := pathutil.IsPathExists(dirPth); err != nil { 55 | return err 56 | } else if exist { 57 | if err := os.RemoveAll(dirPth); err != nil { 58 | return err 59 | } 60 | } 61 | return nil 62 | } 63 | 64 | // RemoveFile ... 65 | // Deprecated: use RemoveAll instead. 66 | func RemoveFile(pth string) error { 67 | if exist, err := pathutil.IsPathExists(pth); err != nil { 68 | return err 69 | } else if exist { 70 | if err := os.Remove(pth); err != nil { 71 | return err 72 | } 73 | } 74 | return nil 75 | } 76 | 77 | // RemoveAll removes recursively every file on the given paths. 78 | func RemoveAll(pths ...string) error { 79 | for _, pth := range pths { 80 | if err := os.RemoveAll(pth); err != nil { 81 | return err 82 | } 83 | } 84 | return nil 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/command/git/git.go: -------------------------------------------------------------------------------- 1 | package git 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/bitrise-io/go-utils/command" 7 | ) 8 | 9 | // Git represents a Git project. 10 | type Git struct { 11 | dir string 12 | } 13 | 14 | // New creates a new git project. 15 | func New(dir string) (Git, error) { 16 | if err := os.MkdirAll(dir, 0755); err != nil { 17 | return Git{}, err 18 | } 19 | return Git{dir: dir}, nil 20 | } 21 | 22 | func (g *Git) command(args ...string) *command.Model { 23 | cmd := command.New("git", args...) 24 | cmd.SetDir(g.dir) 25 | cmd.SetEnvs(append(os.Environ(), "GIT_ASKPASS=echo")...) 26 | return cmd 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/command/zip.go: -------------------------------------------------------------------------------- 1 | package command 2 | 3 | import ( 4 | "archive/zip" 5 | "errors" 6 | "io" 7 | "log" 8 | "net/http" 9 | "os" 10 | "path/filepath" 11 | 12 | "github.com/bitrise-io/go-utils/pathutil" 13 | ) 14 | 15 | // UnZIP ... 16 | func UnZIP(src, dest string) error { 17 | r, err := zip.OpenReader(src) 18 | if err != nil { 19 | return err 20 | } 21 | defer func() { 22 | if err := r.Close(); err != nil { 23 | log.Fatal(err) 24 | } 25 | }() 26 | 27 | if err := os.MkdirAll(dest, 0755); err != nil { 28 | return err 29 | } 30 | 31 | // Closure to address file descriptors issue with all the deferred .Close() methods 32 | extractAndWriteFile := func(f *zip.File) error { 33 | rc, err := f.Open() 34 | if err != nil { 35 | return err 36 | } 37 | defer func() { 38 | if err := rc.Close(); err != nil { 39 | log.Fatal(err) 40 | } 41 | }() 42 | 43 | path := filepath.Join(dest, f.Name) 44 | 45 | if f.FileInfo().IsDir() { 46 | if err := os.MkdirAll(path, f.Mode()); err != nil { 47 | return err 48 | } 49 | } else { 50 | f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) 51 | if err != nil { 52 | return err 53 | } 54 | defer func() { 55 | if err := f.Close(); err != nil { 56 | log.Fatal(err) 57 | } 58 | }() 59 | 60 | if _, err = io.Copy(f, rc); err != nil { 61 | return err 62 | } 63 | } 64 | return nil 65 | } 66 | 67 | for _, f := range r.File { 68 | if err := extractAndWriteFile(f); err != nil { 69 | return err 70 | } 71 | } 72 | return nil 73 | } 74 | 75 | // DownloadAndUnZIP ... 76 | func DownloadAndUnZIP(url, pth string) error { 77 | tmpDir, err := pathutil.NormalizedOSTempDirPath("") 78 | if err != nil { 79 | return err 80 | } 81 | srcFilePath := tmpDir + "/target.zip" 82 | srcFile, err := os.Create(srcFilePath) 83 | if err != nil { 84 | return err 85 | } 86 | defer func() { 87 | if err := srcFile.Close(); err != nil { 88 | log.Fatal("Failed to close srcFile:", err) 89 | } 90 | if err := os.Remove(srcFilePath); err != nil { 91 | log.Fatal("Failed to remove srcFile:", err) 92 | } 93 | }() 94 | 95 | response, err := http.Get(url) 96 | if err != nil { 97 | return err 98 | } 99 | defer func() { 100 | if err := response.Body.Close(); err != nil { 101 | log.Fatal("Failed to close response body:", err) 102 | } 103 | }() 104 | 105 | if response.StatusCode != http.StatusOK { 106 | errorMsg := "Failed to download target from: " + url 107 | return errors.New(errorMsg) 108 | } 109 | 110 | if _, err := io.Copy(srcFile, response.Body); err != nil { 111 | return err 112 | } 113 | 114 | return UnZIP(srcFilePath, pth) 115 | } 116 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/defaultlogger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | // DefaultLogger ... 4 | type DefaultLogger struct { 5 | ts bool 6 | } 7 | 8 | // NewDefaultLogger ... 9 | func NewDefaultLogger(withTimestamp bool) DefaultLogger { 10 | return DefaultLogger{withTimestamp} 11 | } 12 | 13 | // Donef ... 14 | func (dl DefaultLogger) Donef(format string, v ...interface{}) { 15 | fSelect(dl.ts, TDonef, Donef)(format, v...) 16 | } 17 | 18 | // Successf ... 19 | func (dl DefaultLogger) Successf(format string, v ...interface{}) { 20 | fSelect(dl.ts, TSuccessf, Successf)(format, v...) 21 | } 22 | 23 | // Infof ... 24 | func (dl DefaultLogger) Infof(format string, v ...interface{}) { 25 | fSelect(dl.ts, TInfof, Infof)(format, v...) 26 | } 27 | 28 | // Printf ... 29 | func (dl DefaultLogger) Printf(format string, v ...interface{}) { 30 | fSelect(dl.ts, TPrintf, Printf)(format, v...) 31 | } 32 | 33 | // Warnf ... 34 | func (dl DefaultLogger) Warnf(format string, v ...interface{}) { 35 | fSelect(dl.ts, TWarnf, Warnf)(format, v...) 36 | } 37 | 38 | // Errorf ... 39 | func (dl DefaultLogger) Errorf(format string, v ...interface{}) { 40 | fSelect(dl.ts, TErrorf, Errorf)(format, v...) 41 | } 42 | 43 | // Debugf ... 44 | func (dl DefaultLogger) Debugf(format string, v ...interface{}) { 45 | if enableDebugLog { 46 | fSelect(dl.ts, TDebugf, Debugf)(format, v...) 47 | } 48 | } 49 | 50 | type logfunc func(string, ...interface{}) 51 | 52 | func fSelect(t bool, tf logfunc, f logfunc) logfunc { 53 | if t { 54 | return tf 55 | } 56 | return f 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/dummylogger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | // DummyLogger ... 4 | type DummyLogger struct{} 5 | 6 | // NewDummyLogger ... 7 | func NewDummyLogger() DummyLogger { 8 | return DummyLogger{} 9 | } 10 | 11 | // Donef ... 12 | func (dl DummyLogger) Donef(format string, v ...interface{}) {} 13 | 14 | // Successf ... 15 | func (dl DummyLogger) Successf(format string, v ...interface{}) {} 16 | 17 | // Infof ... 18 | func (dl DummyLogger) Infof(format string, v ...interface{}) {} 19 | 20 | // Printf ... 21 | func (dl DummyLogger) Printf(format string, v ...interface{}) {} 22 | 23 | // Debugf ... 24 | func (dl DummyLogger) Debugf(format string, v ...interface{}) {} 25 | 26 | // Warnf ... 27 | func (dl DummyLogger) Warnf(format string, v ...interface{}) {} 28 | 29 | // Errorf ... 30 | func (dl DummyLogger) Errorf(format string, v ...interface{}) {} 31 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/internal_logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "encoding/json" 7 | "fmt" 8 | "net/http" 9 | "time" 10 | ) 11 | 12 | var ( 13 | analyticsServerURL = "https://step-analytics.bitrise.io" 14 | httpClient = http.Client{ 15 | Timeout: time.Second * 5, 16 | } 17 | ) 18 | 19 | // Entry represents a line in a log 20 | type Entry struct { 21 | LogLevel string `json:"log_level"` 22 | Message string `json:"message"` 23 | Data map[string]interface{} `json:"data"` 24 | } 25 | 26 | // SetAnalyticsServerURL updates the the analytics server collecting the 27 | // logs. It is intended for use during tests. Warning: current implementation 28 | // is not thread safe, do not call the function during runtime. 29 | func SetAnalyticsServerURL(url string) { 30 | analyticsServerURL = url 31 | } 32 | 33 | // Internal sends the log message to the configured analytics server 34 | func rprintf(logLevel string, stepID string, tag string, data map[string]interface{}, format string, v ...interface{}) { 35 | e := Entry{ 36 | Message: fmt.Sprintf(format, v...), 37 | LogLevel: logLevel, 38 | } 39 | 40 | e.Data = make(map[string]interface{}) 41 | for k, v := range data { 42 | e.Data[k] = v 43 | } 44 | 45 | if v, ok := e.Data["step_id"]; ok { 46 | fmt.Printf("internal logger: data.step_id (%s) will be overriden with (%s) ", v, stepID) 47 | } 48 | if v, ok := e.Data["tag"]; ok { 49 | fmt.Printf("internal logger: data.tag (%s) will be overriden with (%s) ", v, tag) 50 | } 51 | 52 | e.Data["step_id"] = stepID 53 | e.Data["tag"] = tag 54 | 55 | var b bytes.Buffer 56 | if err := json.NewEncoder(&b).Encode(e); err != nil { 57 | return 58 | } 59 | 60 | ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) 61 | defer cancel() 62 | 63 | req, err := http.NewRequest(http.MethodPost, analyticsServerURL+"/logs", &b) 64 | if err != nil { 65 | // deliberately not writing into users log 66 | return 67 | } 68 | req = req.WithContext(ctx) 69 | req.Header.Add("Content-Type", "application/json") 70 | 71 | if _, err := httpClient.Do(req); err != nil { 72 | // deliberately not writing into users log 73 | return 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/json_logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | ) 8 | 9 | // JSONLoger ... 10 | type JSONLoger struct { 11 | writer io.Writer 12 | } 13 | 14 | // NewJSONLoger ... 15 | func NewJSONLoger(writer io.Writer) *JSONLoger { 16 | return &JSONLoger{ 17 | writer: writer, 18 | } 19 | } 20 | 21 | // NewDefaultJSONLoger ... 22 | func NewDefaultJSONLoger() JSONLoger { 23 | return JSONLoger{ 24 | writer: os.Stdout, 25 | } 26 | } 27 | 28 | // Print ... 29 | func (l JSONLoger) Print(f Formatable) { 30 | if _, err := fmt.Fprint(l.writer, f.JSON()); err != nil { 31 | fmt.Printf("failed to print message: %s, error: %s\n", f.JSON(), err) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/log.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | "time" 8 | ) 9 | 10 | var outWriter io.Writer = os.Stdout 11 | 12 | // SetOutWriter ... 13 | func SetOutWriter(writer io.Writer) { 14 | outWriter = writer 15 | } 16 | 17 | var enableDebugLog = false 18 | 19 | // SetEnableDebugLog ... 20 | func SetEnableDebugLog(enable bool) { 21 | enableDebugLog = enable 22 | } 23 | 24 | var timestampLayout = "15:04:05" 25 | 26 | // SetTimestampLayout ... 27 | func SetTimestampLayout(layout string) { 28 | timestampLayout = layout 29 | } 30 | 31 | func timestampField() string { 32 | currentTime := time.Now() 33 | return fmt.Sprintf("[%s]", currentTime.Format(timestampLayout)) 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | // Logger ... 4 | type Logger interface { 5 | Print(f Formatable) 6 | } 7 | 8 | // Formatable ... 9 | type Formatable interface { 10 | String() string 11 | JSON() string 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/raw_logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "os" 7 | ) 8 | 9 | // RawLogger ... 10 | type RawLogger struct { 11 | writer io.Writer 12 | } 13 | 14 | // NewRawLogger ... 15 | func NewRawLogger(writer io.Writer) *RawLogger { 16 | return &RawLogger{ 17 | writer: writer, 18 | } 19 | } 20 | 21 | // NewDefaultRawLogger ... 22 | func NewDefaultRawLogger() RawLogger { 23 | return RawLogger{ 24 | writer: os.Stdout, 25 | } 26 | } 27 | 28 | // Print ... 29 | func (l RawLogger) Print(f Formatable) { 30 | if _, err := fmt.Fprintln(l.writer, f.String()); err != nil { 31 | fmt.Printf("failed to print message: %s, error: %s\n", f.String(), err) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/log/severity.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import "github.com/bitrise-io/go-utils/colorstring" 4 | 5 | // Severity ... 6 | type Severity uint8 7 | 8 | const ( 9 | errorSeverity Severity = iota 10 | warnSeverity 11 | normalSeverity 12 | infoSeverity 13 | successSeverity 14 | debugSeverity 15 | ) 16 | 17 | type severityColorFunc colorstring.ColorfFunc 18 | 19 | var ( 20 | successSeverityColorFunc severityColorFunc = colorstring.Greenf 21 | infoSeverityColorFunc severityColorFunc = colorstring.Bluef 22 | normalSeverityColorFunc severityColorFunc = colorstring.NoColorf 23 | debugSeverityColorFunc severityColorFunc = colorstring.Magentaf 24 | warnSeverityColorFunc severityColorFunc = colorstring.Yellowf 25 | errorSeverityColorFunc severityColorFunc = colorstring.Redf 26 | ) 27 | 28 | var severityColorFuncMap = map[Severity]severityColorFunc{ 29 | successSeverity: successSeverityColorFunc, 30 | infoSeverity: infoSeverityColorFunc, 31 | normalSeverity: normalSeverityColorFunc, 32 | debugSeverity: debugSeverityColorFunc, 33 | warnSeverity: warnSeverityColorFunc, 34 | errorSeverity: errorSeverityColorFunc, 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/parseutil/parseutil.go: -------------------------------------------------------------------------------- 1 | package parseutil 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "strconv" 7 | "strings" 8 | 9 | "github.com/bitrise-io/go-utils/pointers" 10 | ) 11 | 12 | // ParseBool ... 13 | func ParseBool(userInputStr string) (bool, error) { 14 | if userInputStr == "" { 15 | return false, errors.New("No string to parse") 16 | } 17 | userInputStr = strings.TrimSpace(userInputStr) 18 | 19 | lowercased := strings.ToLower(userInputStr) 20 | if lowercased == "yes" || lowercased == "y" { 21 | return true, nil 22 | } 23 | if lowercased == "no" || lowercased == "n" { 24 | return false, nil 25 | } 26 | return strconv.ParseBool(lowercased) 27 | } 28 | 29 | // CastToString ... 30 | func CastToString(value interface{}) string { 31 | casted, ok := value.(string) 32 | 33 | if !ok { 34 | castedStr := fmt.Sprintf("%v", value) 35 | casted = castedStr 36 | } 37 | 38 | return casted 39 | } 40 | 41 | // CastToStringPtr ... 42 | func CastToStringPtr(value interface{}) *string { 43 | castedValue := CastToString(value) 44 | return pointers.NewStringPtr(castedValue) 45 | } 46 | 47 | // CastToBool ... 48 | func CastToBool(value interface{}) (bool, bool) { 49 | casted, ok := value.(bool) 50 | 51 | if !ok { 52 | castedStr := CastToString(value) 53 | 54 | castedBool, err := ParseBool(castedStr) 55 | if err != nil { 56 | return false, false 57 | } 58 | 59 | casted = castedBool 60 | } 61 | 62 | return casted, true 63 | } 64 | 65 | // CastToBoolPtr ... 66 | func CastToBoolPtr(value interface{}) (*bool, bool) { 67 | castedValue, ok := CastToBool(value) 68 | if !ok { 69 | return nil, false 70 | } 71 | return pointers.NewBoolPtr(castedValue), true 72 | } 73 | 74 | // CastToMapStringInterface ... 75 | func CastToMapStringInterface(value interface{}) (map[string]interface{}, bool) { 76 | castedValue, ok := value.(map[interface{}]interface{}) 77 | desiredMap := map[string]interface{}{} 78 | for key, value := range castedValue { 79 | keyStr, ok := key.(string) 80 | if !ok { 81 | return map[string]interface{}{}, false 82 | } 83 | desiredMap[keyStr] = value 84 | } 85 | return desiredMap, ok 86 | } 87 | 88 | // CastToMapStringInterfacePtr ... 89 | func CastToMapStringInterfacePtr(value interface{}) (*map[string]interface{}, bool) { 90 | casted, ok := CastToMapStringInterface(value) 91 | if !ok { 92 | return nil, false 93 | } 94 | return pointers.NewMapStringInterfacePtr(casted), true 95 | } 96 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/pointers/pointers.go: -------------------------------------------------------------------------------- 1 | package pointers 2 | 3 | import "time" 4 | 5 | // NewBoolPtr ... 6 | func NewBoolPtr(val bool) *bool { 7 | ptrValue := new(bool) 8 | *ptrValue = val 9 | return ptrValue 10 | } 11 | 12 | // NewStringPtr ... 13 | func NewStringPtr(val string) *string { 14 | ptrValue := new(string) 15 | *ptrValue = val 16 | return ptrValue 17 | } 18 | 19 | // NewTimePtr ... 20 | func NewTimePtr(val time.Time) *time.Time { 21 | ptrValue := new(time.Time) 22 | *ptrValue = val 23 | return ptrValue 24 | } 25 | 26 | // NewIntPtr ... 27 | func NewIntPtr(val int) *int { 28 | ptrValue := new(int) 29 | *ptrValue = val 30 | return ptrValue 31 | } 32 | 33 | // NewInt64Ptr ... 34 | func NewInt64Ptr(val int64) *int64 { 35 | ptrValue := new(int64) 36 | *ptrValue = val 37 | return ptrValue 38 | } 39 | 40 | // NewMapStringInterfacePtr ... 41 | func NewMapStringInterfacePtr(val map[string]interface{}) *map[string]interface{} { 42 | ptrValue := new(map[string]interface{}) 43 | *ptrValue = map[string]interface{}{} 44 | for key, value := range val { 45 | (*ptrValue)[key] = value 46 | } 47 | return ptrValue 48 | } 49 | 50 | // ------------------------------------------------------ 51 | // --- Safe Getters 52 | 53 | // Bool ... 54 | func Bool(val *bool) bool { 55 | return BoolWithDefault(val, false) 56 | } 57 | 58 | // BoolWithDefault ... 59 | func BoolWithDefault(val *bool, defaultValue bool) bool { 60 | if val == nil { 61 | return defaultValue 62 | } 63 | return *val 64 | } 65 | 66 | // String ... 67 | func String(val *string) string { 68 | return StringWithDefault(val, "") 69 | } 70 | 71 | // StringWithDefault ... 72 | func StringWithDefault(val *string, defaultValue string) string { 73 | if val == nil { 74 | return defaultValue 75 | } 76 | return *val 77 | } 78 | 79 | // TimeWithDefault ... 80 | func TimeWithDefault(val *time.Time, defaultValue time.Time) time.Time { 81 | if val == nil { 82 | return defaultValue 83 | } 84 | return *val 85 | } 86 | 87 | // Int ... 88 | func Int(val *int) int { 89 | return IntWithDefault(val, 0) 90 | } 91 | 92 | // IntWithDefault ... 93 | func IntWithDefault(val *int, defaultValue int) int { 94 | if val == nil { 95 | return defaultValue 96 | } 97 | return *val 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/bitrise-io/go-utils/versions/versions.go: -------------------------------------------------------------------------------- 1 | package versions 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "strings" 7 | ) 8 | 9 | // CompareVersions ... 10 | // semantic version (X.Y.Z) 11 | // 1 if version 2 is greater then version 1, -1 if not 12 | // -2 & error if can't compare (if not supported component found) 13 | func CompareVersions(version1, version2 string) (int, error) { 14 | version1Slice := strings.Split(version1, ".") 15 | version2Slice := strings.Split(version2, ".") 16 | 17 | lenDiff := len(version1Slice) - len(version2Slice) 18 | if lenDiff != 0 { 19 | makeDefVerComps := func(compLen int) []string { 20 | comps := make([]string, compLen, compLen) 21 | for idx := len(comps) - 1; idx >= 0; idx-- { 22 | comps[idx] = "0" 23 | } 24 | return comps 25 | } 26 | if lenDiff > 0 { 27 | // v1 slice is longer 28 | version2Slice = append(version2Slice, makeDefVerComps(lenDiff)...) 29 | } else { 30 | // v2 slice is longer 31 | version1Slice = append(version1Slice, makeDefVerComps(-lenDiff)...) 32 | } 33 | } 34 | 35 | cnt := len(version1Slice) 36 | for i, num := range version1Slice { 37 | num1, err := strconv.ParseInt(num, 0, 64) 38 | if err != nil { 39 | return -2, fmt.Errorf("failed to parse int (%s): %s", num, err) 40 | } 41 | 42 | num2, err2 := strconv.ParseInt(version2Slice[i], 0, 64) 43 | if err2 != nil { 44 | return -2, fmt.Errorf("failed to parse int (%s): %s", version2Slice[i], err2) 45 | } 46 | 47 | if num2 > num1 { 48 | return 1, nil 49 | } else if num2 < num1 { 50 | return -1, nil 51 | } 52 | 53 | if i == cnt-1 { 54 | // last one 55 | if num2 == num1 { 56 | return 0, nil 57 | } 58 | } 59 | } 60 | return -1, nil 61 | } 62 | 63 | // IsVersionBetween ... 64 | // returns true if it's between the lower and upper limit 65 | // or in case it matches the lower or the upper limit 66 | func IsVersionBetween(verBase, verLower, verUpper string) (bool, error) { 67 | r1, err := CompareVersions(verBase, verLower) 68 | if err != nil { 69 | return false, err 70 | } 71 | if r1 == 1 { 72 | return false, nil 73 | } 74 | 75 | r2, err := CompareVersions(verBase, verUpper) 76 | if err != nil { 77 | return false, err 78 | } 79 | if r2 == -1 { 80 | return false, nil 81 | } 82 | 83 | return true, nil 84 | } 85 | 86 | // IsVersionGreaterOrEqual ... 87 | // returns true if verBase is greater or equal to verLower 88 | func IsVersionGreaterOrEqual(verBase, verLower string) (bool, error) { 89 | r1, err := CompareVersions(verBase, verLower) 90 | if err != nil { 91 | return false, err 92 | } 93 | if r1 == 1 { 94 | return false, nil 95 | } 96 | 97 | return true, nil 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/blang/semver/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | matrix: 3 | include: 4 | - go: 1.4.3 5 | - go: 1.5.4 6 | - go: 1.6.3 7 | - go: 1.7 8 | - go: tip 9 | allow_failures: 10 | - go: tip 11 | install: 12 | - go get golang.org/x/tools/cmd/cover 13 | - go get github.com/mattn/goveralls 14 | script: 15 | - echo "Test and track coverage" ; $HOME/gopath/bin/goveralls -package "." -service=travis-ci 16 | -repotoken $COVERALLS_TOKEN 17 | - echo "Build examples" ; cd examples && go build 18 | - echo "Check if gofmt'd" ; diff -u <(echo -n) <(gofmt -d -s .) 19 | env: 20 | global: 21 | secure: HroGEAUQpVq9zX1b1VIkraLiywhGbzvNnTZq2TMxgK7JHP8xqNplAeF1izrR2i4QLL9nsY+9WtYss4QuPvEtZcVHUobw6XnL6radF7jS1LgfYZ9Y7oF+zogZ2I5QUMRLGA7rcxQ05s7mKq3XZQfeqaNts4bms/eZRefWuaFZbkw= 22 | -------------------------------------------------------------------------------- /vendor/github.com/blang/semver/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 Benedikt Lang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/blang/semver/json.go: -------------------------------------------------------------------------------- 1 | package semver 2 | 3 | import ( 4 | "encoding/json" 5 | ) 6 | 7 | // MarshalJSON implements the encoding/json.Marshaler interface. 8 | func (v Version) MarshalJSON() ([]byte, error) { 9 | return json.Marshal(v.String()) 10 | } 11 | 12 | // UnmarshalJSON implements the encoding/json.Unmarshaler interface. 13 | func (v *Version) UnmarshalJSON(data []byte) (err error) { 14 | var versionString string 15 | 16 | if err = json.Unmarshal(data, &versionString); err != nil { 17 | return 18 | } 19 | 20 | *v, err = Parse(versionString) 21 | 22 | return 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/blang/semver/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "blang", 3 | "bugs": { 4 | "URL": "https://github.com/blang/semver/issues", 5 | "url": "https://github.com/blang/semver/issues" 6 | }, 7 | "gx": { 8 | "dvcsimport": "github.com/blang/semver" 9 | }, 10 | "gxVersion": "0.10.0", 11 | "language": "go", 12 | "license": "MIT", 13 | "name": "semver", 14 | "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", 15 | "version": "3.5.1" 16 | } 17 | 18 | -------------------------------------------------------------------------------- /vendor/github.com/blang/semver/sort.go: -------------------------------------------------------------------------------- 1 | package semver 2 | 3 | import ( 4 | "sort" 5 | ) 6 | 7 | // Versions represents multiple versions. 8 | type Versions []Version 9 | 10 | // Len returns length of version collection 11 | func (s Versions) Len() int { 12 | return len(s) 13 | } 14 | 15 | // Swap swaps two versions inside the collection by its indices 16 | func (s Versions) Swap(i, j int) { 17 | s[i], s[j] = s[j], s[i] 18 | } 19 | 20 | // Less checks if version at index i is less than version at index j 21 | func (s Versions) Less(i, j int) bool { 22 | return s[i].LT(s[j]) 23 | } 24 | 25 | // Sort sorts a slice of versions 26 | func Sort(versions []Version) { 27 | sort.Sort(Versions(versions)) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/blang/semver/sql.go: -------------------------------------------------------------------------------- 1 | package semver 2 | 3 | import ( 4 | "database/sql/driver" 5 | "fmt" 6 | ) 7 | 8 | // Scan implements the database/sql.Scanner interface. 9 | func (v *Version) Scan(src interface{}) (err error) { 10 | var str string 11 | switch src := src.(type) { 12 | case string: 13 | str = src 14 | case []byte: 15 | str = string(src) 16 | default: 17 | return fmt.Errorf("Version.Scan: cannot convert %T to string.", src) 18 | } 19 | 20 | if t, err := Parse(str); err == nil { 21 | *v = t 22 | } 23 | 24 | return 25 | } 26 | 27 | // Value implements the database/sql/driver.Valuer interface. 28 | func (v Version) Value() (driver.Value, error) { 29 | return v.String(), nil 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /vendor/github.com/davecgh/go-spew/spew/bypasssafe.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2016 Dave Collins 2 | // 3 | // Permission to use, copy, modify, and distribute this software for any 4 | // purpose with or without fee is hereby granted, provided that the above 5 | // copyright notice and this permission notice appear in all copies. 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | 15 | // NOTE: Due to the following build constraints, this file will only be compiled 16 | // when the code is running on Google App Engine, compiled by GopherJS, or 17 | // "-tags safe" is added to the go build command line. The "disableunsafe" 18 | // tag is deprecated and thus should not be used. 19 | // +build js appengine safe disableunsafe !go1.4 20 | 21 | package spew 22 | 23 | import "reflect" 24 | 25 | const ( 26 | // UnsafeDisabled is a build-time constant which specifies whether or 27 | // not access to the unsafe package is available. 28 | UnsafeDisabled = true 29 | ) 30 | 31 | // unsafeReflectValue typically converts the passed reflect.Value into a one 32 | // that bypasses the typical safety restrictions preventing access to 33 | // unaddressable and unexported data. However, doing this relies on access to 34 | // the unsafe package. This is a stub version which simply returns the passed 35 | // reflect.Value when the unsafe package is not available. 36 | func unsafeReflectValue(v reflect.Value) reflect.Value { 37 | return v 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | before_install: 4 | - curl -L https://github.com/google/brotli/archive/v1.0.2.tar.gz | tar -zxv 5 | - (cd brotli-1.0.2 && mkdir out && cd out && ../configure-cmake && make && sudo make install) 6 | - rm -rf brotli-1.0.2 7 | - curl -L https://github.com/facebook/zstd/archive/v1.3.2.tar.gz | tar -zxv 8 | - (cd zstd-1.3.2 && sudo make install) 9 | - rm -rf zstd-1.3.2 10 | - sudo ldconfig 11 | - mkdir /tmp/go1.12 12 | - curl -L -s https://dl.google.com/go/go1.12.linux-amd64.tar.gz | tar -zxf - -C /tmp/go1.12 --strip-components 1 13 | - unset GOROOT 14 | - (GO111MODULE=on /tmp/go1.12/bin/go mod vendor) 15 | - (cd /tmp && GO111MODULE=on /tmp/go1.12/bin/go get golang.org/x/lint/golint@8f45f776aaf18cebc8d65861cc70c33c60471952) 16 | - (cd /tmp && GO111MODULE=on /tmp/go1.12/bin/go get honnef.co/go/tools/cmd/staticcheck@2019.1) 17 | matrix: 18 | include: 19 | - go: 1.9.x 20 | script: 21 | - go test -v -race ./... 22 | - go: 1.10.x 23 | script: 24 | - go test -v -race ./... 25 | - go: 1.11.x 26 | script: 27 | - go test -v -race ./... 28 | - go: 1.12.x 29 | script: 30 | - ./ztest.sh 31 | - go: master 32 | script: 33 | - go test -v -race ./... 34 | allow_failures: 35 | - go: master 36 | fast_finish: true 37 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright © 2015, Joe Tsai and The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright notice, 9 | this list of conditions and the following disclaimer in the documentation and/or 10 | other materials provided with the distribution. 11 | * Neither the copyright holder nor the names of its contributors may be used to 12 | endorse or promote products derived from this software without specific prior 13 | written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/api.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Joe Tsai. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // Package compress is a collection of compression libraries. 6 | package compress 7 | 8 | import ( 9 | "bufio" 10 | "io" 11 | 12 | "github.com/dsnet/compress/internal/errors" 13 | ) 14 | 15 | // The Error interface identifies all compression related errors. 16 | type Error interface { 17 | error 18 | CompressError() 19 | 20 | // IsDeprecated reports the use of a deprecated and unsupported feature. 21 | IsDeprecated() bool 22 | 23 | // IsCorrupted reports whether the input stream was corrupted. 24 | IsCorrupted() bool 25 | } 26 | 27 | var _ Error = errors.Error{} 28 | 29 | // ByteReader is an interface accepted by all decompression Readers. 30 | // It guarantees that the decompressor never reads more data than is necessary 31 | // from the underlying io.Reader. 32 | type ByteReader interface { 33 | io.Reader 34 | io.ByteReader 35 | } 36 | 37 | var _ ByteReader = (*bufio.Reader)(nil) 38 | 39 | // BufferedReader is an interface accepted by all decompression Readers. 40 | // It guarantees that the decompressor never reads more data than is necessary 41 | // from the underlying io.Reader. Since BufferedReader allows a decompressor 42 | // to peek at bytes further along in the stream without advancing the read 43 | // pointer, decompression can experience a significant performance gain when 44 | // provided a reader that satisfies this interface. Thus, a decompressor will 45 | // prefer this interface over ByteReader for performance reasons. 46 | // 47 | // The bufio.Reader satisfies this interface. 48 | type BufferedReader interface { 49 | io.Reader 50 | 51 | // Buffered returns the number of bytes currently buffered. 52 | // 53 | // This value becomes invalid following the next Read/Discard operation. 54 | Buffered() int 55 | 56 | // Peek returns the next n bytes without advancing the reader. 57 | // 58 | // If Peek returns fewer than n bytes, it also returns an error explaining 59 | // why the peek is short. Peek must support peeking of at least 8 bytes. 60 | // If 0 <= n <= Buffered(), Peek is guaranteed to succeed without reading 61 | // from the underlying io.Reader. 62 | // 63 | // This result becomes invalid following the next Read/Discard operation. 64 | Peek(n int) ([]byte, error) 65 | 66 | // Discard skips the next n bytes, returning the number of bytes discarded. 67 | // 68 | // If Discard skips fewer than n bytes, it also returns an error. 69 | // If 0 <= n <= Buffered(), Discard is guaranteed to succeed without reading 70 | // from the underlying io.Reader. 71 | Discard(n int) (int, error) 72 | } 73 | 74 | var _ BufferedReader = (*bufio.Reader)(nil) 75 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/bzip2/fuzz_off.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016, Joe Tsai. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build !gofuzz 6 | 7 | // This file exists to suppress fuzzing details from release builds. 8 | 9 | package bzip2 10 | 11 | type fuzzReader struct{} 12 | 13 | func (*fuzzReader) updateChecksum(int64, uint32) {} 14 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/bzip2/fuzz_on.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016, Joe Tsai. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build gofuzz 6 | 7 | // This file exists to export internal implementation details for fuzz testing. 8 | 9 | package bzip2 10 | 11 | func ForwardBWT(buf []byte) (ptr int) { 12 | var bwt burrowsWheelerTransform 13 | return bwt.Encode(buf) 14 | } 15 | 16 | func ReverseBWT(buf []byte, ptr int) { 17 | var bwt burrowsWheelerTransform 18 | bwt.Decode(buf, ptr) 19 | } 20 | 21 | type fuzzReader struct { 22 | Checksums Checksums 23 | } 24 | 25 | // updateChecksum updates Checksums. 26 | // 27 | // If a valid pos is provided, it appends the (pos, val) pair to the slice. 28 | // Otherwise, it will update the last record with the new value. 29 | func (fr *fuzzReader) updateChecksum(pos int64, val uint32) { 30 | if pos >= 0 { 31 | fr.Checksums = append(fr.Checksums, Checksum{pos, val}) 32 | } else { 33 | fr.Checksums[len(fr.Checksums)-1].Value = val 34 | } 35 | } 36 | 37 | type Checksum struct { 38 | Offset int64 // Bit offset of the checksum 39 | Value uint32 // Checksum value 40 | } 41 | 42 | type Checksums []Checksum 43 | 44 | // Apply overwrites all checksum fields in d with the ones in cs. 45 | func (cs Checksums) Apply(d []byte) []byte { 46 | d = append([]byte(nil), d...) 47 | for _, c := range cs { 48 | setU32(d, c.Offset, c.Value) 49 | } 50 | return d 51 | } 52 | 53 | func setU32(d []byte, pos int64, val uint32) { 54 | for i := uint(0); i < 32; i++ { 55 | bpos := uint64(pos) + uint64(i) 56 | d[bpos/8] &= ^byte(1 << (7 - bpos%8)) 57 | d[bpos/8] |= byte(val>>(31-i)) << (7 - bpos%8) 58 | } 59 | } 60 | 61 | // Verify checks that all checksum fields in d matches those in cs. 62 | func (cs Checksums) Verify(d []byte) bool { 63 | for _, c := range cs { 64 | if getU32(d, c.Offset) != c.Value { 65 | return false 66 | } 67 | } 68 | return true 69 | } 70 | 71 | func getU32(d []byte, pos int64) (val uint32) { 72 | for i := uint(0); i < 32; i++ { 73 | bpos := uint64(pos) + uint64(i) 74 | val |= (uint32(d[bpos/8] >> (7 - bpos%8))) << (31 - i) 75 | } 76 | return val 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/bzip2/internal/sais/common.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Joe Tsai. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // Package sais implements a linear time suffix array algorithm. 6 | package sais 7 | 8 | //go:generate go run sais_gen.go byte sais_byte.go 9 | //go:generate go run sais_gen.go int sais_int.go 10 | 11 | // This package ports the C sais implementation by Yuta Mori. The ports are 12 | // located in sais_byte.go and sais_int.go, which are identical to each other 13 | // except for the types. Since Go does not support generics, we use generators to 14 | // create the two files. 15 | // 16 | // References: 17 | // https://sites.google.com/site/yuta256/sais 18 | // https://www.researchgate.net/publication/221313676_Linear_Time_Suffix_Array_Construction_Using_D-Critical_Substrings 19 | // https://www.researchgate.net/publication/224176324_Two_Efficient_Algorithms_for_Linear_Time_Suffix_Array_Construction 20 | 21 | // ComputeSA computes the suffix array of t and places the result in sa. 22 | // Both t and sa must be the same length. 23 | func ComputeSA(t []byte, sa []int) { 24 | if len(sa) != len(t) { 25 | panic("mismatching sizes") 26 | } 27 | computeSA_byte(t, sa, 0, len(t), 256) 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/internal/debug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Joe Tsai. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build debug,!gofuzz 6 | 7 | package internal 8 | 9 | const ( 10 | Debug = true 11 | GoFuzz = false 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/internal/gofuzz.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016, Joe Tsai. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | // +build gofuzz 6 | 7 | package internal 8 | 9 | const ( 10 | Debug = true 11 | GoFuzz = true 12 | ) 13 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/internal/prefix/encoder.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Joe Tsai. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE.md file. 4 | 5 | package prefix 6 | 7 | import ( 8 | "sort" 9 | 10 | "github.com/dsnet/compress/internal" 11 | ) 12 | 13 | type Encoder struct { 14 | chunks []uint32 // First-level lookup map 15 | chunkMask uint32 // Mask the length of the chunks table 16 | 17 | NumSyms uint32 // Number of symbols 18 | } 19 | 20 | // Init initializes Encoder according to the codes provided. 21 | func (pe *Encoder) Init(codes PrefixCodes) { 22 | // Handle special case trees. 23 | if len(codes) <= 1 { 24 | switch { 25 | case len(codes) == 0: // Empty tree (should error if used later) 26 | *pe = Encoder{chunks: pe.chunks[:0], NumSyms: 0} 27 | case len(codes) == 1 && codes[0].Len == 0: // Single code tree (bit-length of zero) 28 | pe.chunks = append(pe.chunks[:0], codes[0].Val< 0; n >>= 1 { 45 | numChunks <<= 1 46 | } 47 | pe.NumSyms = uint32(len(codes)) 48 | 49 | retry: 50 | // Allocate and reset chunks. 51 | pe.chunks = allocUint32s(pe.chunks, numChunks) 52 | pe.chunkMask = uint32(numChunks - 1) 53 | for i := range pe.chunks { 54 | pe.chunks[i] = 0 // Logic below relies on zero value as uninitialized 55 | } 56 | 57 | // Insert each symbol, checking that there are no conflicts. 58 | for _, c := range codes { 59 | if pe.chunks[c.Sym&pe.chunkMask] > 0 { 60 | // Collision found our "hash" table, so grow and try again. 61 | numChunks <<= 1 62 | goto retry 63 | } 64 | pe.chunks[c.Sym&pe.chunkMask] = c.Val< /dev/null 44 | $PPROF -output=cpu.html -weblist=. $PKG_NAME.test $TMPDIR/cpu.profile 2> /dev/null 45 | $PPROF -output=mem_objects.svg -alloc_objects -web $PKG_NAME.test $TMPDIR/mem.profile 2> /dev/null 46 | $PPROF -output=mem_objects.html -alloc_objects -weblist=. $PKG_NAME.test $TMPDIR/mem.profile 2> /dev/null 47 | $PPROF -output=mem_space.svg -alloc_space -web $PKG_NAME.test $TMPDIR/mem.profile 2> /dev/null 48 | $PPROF -output=mem_space.html -alloc_space -weblist=. $PKG_NAME.test $TMPDIR/mem.profile 2> /dev/null 49 | fi 50 | 51 | rm -rf $DIR/_zprof_/$PKG_NAME 52 | mkdir -p $DIR/_zprof_/$PKG_NAME 53 | mv *.html *.svg $DIR/_zprof_/$PKG_NAME 2> /dev/null 54 | ) 55 | -------------------------------------------------------------------------------- /vendor/github.com/dsnet/compress/ztest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2017, Joe Tsai. All rights reserved. 4 | # Use of this source code is governed by a BSD-style 5 | # license that can be found in the LICENSE.md file. 6 | 7 | cd $(go list -f '{{ .Dir }}' github.com/dsnet/compress) 8 | 9 | BOLD="\x1b[1mRunning: " 10 | PASS="\x1b[32mPASS" 11 | FAIL="\x1b[31mFAIL" 12 | RESET="\x1b[0m" 13 | 14 | echo -e "${BOLD}fmt${RESET}" 15 | RET_FMT=$(find . -name "*.go" | egrep -v "/(_.*_|\..*|testdata)/" | xargs gofmt -d) 16 | if [[ ! -z "$RET_FMT" ]]; then echo "$RET_FMT"; echo; fi 17 | 18 | echo -e "${BOLD}test${RESET}" 19 | RET_TEST=$(go test -race ./... | egrep -v "^(ok|[?])\s+") 20 | if [[ ! -z "$RET_TEST" ]]; then echo "$RET_TEST"; echo; fi 21 | 22 | echo -e "${BOLD}staticcheck${RESET}" 23 | RET_SCHK=$(staticcheck \ 24 | -ignore " 25 | github.com/dsnet/compress/brotli/*.go:SA4016 26 | github.com/dsnet/compress/brotli/*.go:S1023 27 | github.com/dsnet/compress/brotli/*.go:U1000 28 | github.com/dsnet/compress/bzip2/*.go:S1023 29 | github.com/dsnet/compress/flate/*.go:U1000 30 | github.com/dsnet/compress/internal/cgo/lzma/*.go:SA4000 31 | github.com/dsnet/compress/internal/prefix/*.go:S1004 32 | github.com/dsnet/compress/internal/prefix/*.go:S1023 33 | github.com/dsnet/compress/internal/prefix/*.go:SA4016 34 | github.com/dsnet/compress/internal/tool/bench/*.go:S1007 35 | github.com/dsnet/compress/xflate/internal/meta/*.go:S1023 36 | " ./... 2>&1) 37 | if [[ ! -z "$RET_SCHK" ]]; then echo "$RET_SCHK"; echo; fi 38 | 39 | echo -e "${BOLD}lint${RESET}" 40 | RET_LINT=$(golint ./... 2>&1 | 41 | egrep -v "^vendor/" | 42 | egrep -v "should have comment(.*)or be unexported" | 43 | egrep -v "^(.*)type name will be used as(.*)by other packages" | 44 | egrep -v "^brotli/transform.go:(.*)replace i [+]= 1 with i[+]{2}" | 45 | egrep -v "^internal/prefix/prefix.go:(.*)replace symBits(.*) [-]= 1 with symBits(.*)[-]{2}" | 46 | egrep -v "^xflate/common.go:(.*)NoCompression should be of the form" | 47 | egrep -v "^exit status") 48 | if [[ ! -z "$RET_LINT" ]]; then echo "$RET_LINT"; echo; fi 49 | 50 | if [[ ! -z "$RET_FMT" ]] || [ ! -z "$RET_TEST" ] || [[ ! -z "$RET_SCHK" ]] || [[ ! -z "$RET_LINT" ]]; then 51 | echo -e "${FAIL}${RESET}"; exit 1 52 | else 53 | echo -e "${PASS}${RESET}"; exit 0 54 | fi 55 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/.gitignore: -------------------------------------------------------------------------------- 1 | cmd/snappytool/snappytool 2 | testdata/bench 3 | 4 | # These explicitly listed benchmark data files are for an obsolete version of 5 | # snappy_test.go. 6 | testdata/alice29.txt 7 | testdata/asyoulik.txt 8 | testdata/fireworks.jpeg 9 | testdata/geo.protodata 10 | testdata/html 11 | testdata/html_x_4 12 | testdata/kppkn.gtb 13 | testdata/lcet10.txt 14 | testdata/paper-100k.pdf 15 | testdata/plrabn12.txt 16 | testdata/urls.10K 17 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of Snappy-Go authors for copyright purposes. 2 | # This file is distinct from the CONTRIBUTORS files. 3 | # See the latter for an explanation. 4 | 5 | # Names should be added to this file as 6 | # Name or Organization 7 | # The email address is not required for organizations. 8 | 9 | # Please keep the list sorted. 10 | 11 | Amazon.com, Inc 12 | Damian Gryski 13 | Eric Buth 14 | Google Inc. 15 | Jan Mercl <0xjnml@gmail.com> 16 | Klaus Post 17 | Rodolfo Carvalho 18 | Sebastien Binet 19 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This is the official list of people who can contribute 2 | # (and typically have contributed) code to the Snappy-Go repository. 3 | # The AUTHORS file lists the copyright holders; this file 4 | # lists people. For example, Google employees are listed here 5 | # but not in AUTHORS, because Google holds the copyright. 6 | # 7 | # The submission process automatically checks to make sure 8 | # that people submitting code are listed in this file (by email address). 9 | # 10 | # Names should be added to this file only after verifying that 11 | # the individual or the individual's organization has agreed to 12 | # the appropriate Contributor License Agreement, found here: 13 | # 14 | # http://code.google.com/legal/individual-cla-v1.0.html 15 | # http://code.google.com/legal/corporate-cla-v1.0.html 16 | # 17 | # The agreement for individuals can be filled out on the web. 18 | # 19 | # When adding J Random Contributor's name to this file, 20 | # either J's name or J's organization's name should be 21 | # added to the AUTHORS file, depending on whether the 22 | # individual or corporate CLA was used. 23 | 24 | # Names should be added to this file like so: 25 | # Name 26 | 27 | # Please keep the list sorted. 28 | 29 | Alex Legg 30 | Damian Gryski 31 | Eric Buth 32 | Jan Mercl <0xjnml@gmail.com> 33 | Jonathan Swinney 34 | Kai Backman 35 | Klaus Post 36 | Marc-Antoine Ruel 37 | Nigel Tao 38 | Rob Pike 39 | Rodolfo Carvalho 40 | Russ Cox 41 | Sebastien Binet 42 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/decode_asm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | // +build gc 7 | // +build !noasm 8 | // +build amd64 arm64 9 | 10 | package snappy 11 | 12 | // decode has the same semantics as in decode_other.go. 13 | // 14 | //go:noescape 15 | func decode(dst, src []byte) int 16 | -------------------------------------------------------------------------------- /vendor/github.com/golang/snappy/encode_asm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Snappy-Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !appengine 6 | // +build gc 7 | // +build !noasm 8 | // +build amd64 arm64 9 | 10 | package snappy 11 | 12 | // emitLiteral has the same semantics as in encode_other.go. 13 | // 14 | //go:noescape 15 | func emitLiteral(dst, lit []byte) int 16 | 17 | // emitCopy has the same semantics as in encode_other.go. 18 | // 19 | //go:noescape 20 | func emitCopy(dst []byte, offset, length int) int 21 | 22 | // extendMatch has the same semantics as in encode_other.go. 23 | // 24 | //go:noescape 25 | func extendMatch(src []byte, i, j int) int 26 | 27 | // encodeBlock has the same semantics as in encode_other.go. 28 | // 29 | //go:noescape 30 | func encodeBlock(dst, src []byte) (d int) 31 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/.gitattributes: -------------------------------------------------------------------------------- 1 | * -text 2 | *.bin -text -diff 3 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | /s2/cmd/_s2sx/sfx-exe 26 | 27 | # Linux perf files 28 | perf.data 29 | perf.data.old 30 | 31 | # gdb history 32 | .gdb_history 33 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/.goreleaser.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | before: 4 | hooks: 5 | - ./gen.sh 6 | 7 | builds: 8 | - 9 | id: "s2c" 10 | binary: s2c 11 | main: ./s2/cmd/s2c/main.go 12 | flags: 13 | - -trimpath 14 | env: 15 | - CGO_ENABLED=0 16 | goos: 17 | - aix 18 | - linux 19 | - freebsd 20 | - netbsd 21 | - windows 22 | - darwin 23 | goarch: 24 | - 386 25 | - amd64 26 | - arm 27 | - arm64 28 | - ppc64 29 | - ppc64le 30 | - mips64 31 | - mips64le 32 | goarm: 33 | - 7 34 | - 35 | id: "s2d" 36 | binary: s2d 37 | main: ./s2/cmd/s2d/main.go 38 | flags: 39 | - -trimpath 40 | env: 41 | - CGO_ENABLED=0 42 | goos: 43 | - aix 44 | - linux 45 | - freebsd 46 | - netbsd 47 | - windows 48 | - darwin 49 | goarch: 50 | - 386 51 | - amd64 52 | - arm 53 | - arm64 54 | - ppc64 55 | - ppc64le 56 | - mips64 57 | - mips64le 58 | goarm: 59 | - 7 60 | - 61 | id: "s2sx" 62 | binary: s2sx 63 | main: ./s2/cmd/_s2sx/main.go 64 | flags: 65 | - -modfile=s2sx.mod 66 | - -trimpath 67 | env: 68 | - CGO_ENABLED=0 69 | goos: 70 | - aix 71 | - linux 72 | - freebsd 73 | - netbsd 74 | - windows 75 | - darwin 76 | goarch: 77 | - 386 78 | - amd64 79 | - arm 80 | - arm64 81 | - ppc64 82 | - ppc64le 83 | - mips64 84 | - mips64le 85 | goarm: 86 | - 7 87 | 88 | archives: 89 | - 90 | id: s2-binaries 91 | name_template: "s2-{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" 92 | format_overrides: 93 | - goos: windows 94 | format: zip 95 | files: 96 | - unpack/* 97 | - s2/LICENSE 98 | - s2/README.md 99 | checksum: 100 | name_template: 'checksums.txt' 101 | snapshot: 102 | version_template: "{{ .Tag }}-next" 103 | changelog: 104 | sort: asc 105 | filters: 106 | exclude: 107 | - '^doc:' 108 | - '^docs:' 109 | - '^test:' 110 | - '^tests:' 111 | - '^Update\sREADME.md' 112 | 113 | nfpms: 114 | - 115 | file_name_template: "s2_package__{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" 116 | vendor: Klaus Post 117 | homepage: https://github.com/klauspost/compress 118 | maintainer: Klaus Post 119 | description: S2 Compression Tool 120 | license: BSD 3-Clause 121 | formats: 122 | - deb 123 | - rpm 124 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Security updates are applied only to the latest release. 6 | 7 | ## Vulnerability Definition 8 | 9 | A security vulnerability is a bug that with certain input triggers a crash or an infinite loop. Most calls will have varying execution time and only in rare cases will slow operation be considered a security vulnerability. 10 | 11 | Corrupted output generally is not considered a security vulnerability, unless independent operations are able to affect each other. Note that not all functionality is re-entrant and safe to use concurrently. 12 | 13 | Out-of-memory crashes only applies if the en/decoder uses an abnormal amount of memory, with appropriate options applied, to limit maximum window size, concurrency, etc. However, if you are in doubt you are welcome to file a security issue. 14 | 15 | It is assumed that all callers are trusted, meaning internal data exposed through reflection or inspection of returned data structures is not considered a vulnerability. 16 | 17 | Vulnerabilities resulting from compiler/assembler errors should be reported upstream. Depending on the severity this package may or may not implement a workaround. 18 | 19 | ## Reporting a Vulnerability 20 | 21 | If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released. 22 | 23 | Please disclose it at [security advisory](https://github.com/klauspost/compress/security/advisories/new). If possible please provide a minimal reproducer. If the issue only applies to a single platform, it would be helpful to provide access to that. 24 | 25 | This project is maintained by a team of volunteers on a reasonable-effort basis. As such, vulnerabilities will be disclosed in a best effort base. 26 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/compressible.go: -------------------------------------------------------------------------------- 1 | package compress 2 | 3 | import "math" 4 | 5 | // Estimate returns a normalized compressibility estimate of block b. 6 | // Values close to zero are likely uncompressible. 7 | // Values above 0.1 are likely to be compressible. 8 | // Values above 0.5 are very compressible. 9 | // Very small lengths will return 0. 10 | func Estimate(b []byte) float64 { 11 | if len(b) < 16 { 12 | return 0 13 | } 14 | 15 | // Correctly predicted order 1 16 | hits := 0 17 | lastMatch := false 18 | var o1 [256]byte 19 | var hist [256]int 20 | c1 := byte(0) 21 | for _, c := range b { 22 | if c == o1[c1] { 23 | // We only count a hit if there was two correct predictions in a row. 24 | if lastMatch { 25 | hits++ 26 | } 27 | lastMatch = true 28 | } else { 29 | lastMatch = false 30 | } 31 | o1[c1] = c 32 | c1 = c 33 | hist[c]++ 34 | } 35 | 36 | // Use x^0.6 to give better spread 37 | prediction := math.Pow(float64(hits)/float64(len(b)), 0.6) 38 | 39 | // Calculate histogram distribution 40 | variance := float64(0) 41 | avg := float64(len(b)) / 256 42 | 43 | for _, v := range hist { 44 | Δ := float64(v) - avg 45 | variance += Δ * Δ 46 | } 47 | 48 | stddev := math.Sqrt(float64(variance)) / float64(len(b)) 49 | exp := math.Sqrt(1 / float64(len(b))) 50 | 51 | // Subtract expected stddev 52 | stddev -= exp 53 | if stddev < 0 { 54 | stddev = 0 55 | } 56 | stddev *= 1 + exp 57 | 58 | // Use x^0.4 to give better spread 59 | entropy := math.Pow(stddev, 0.4) 60 | 61 | // 50/50 weight between prediction and histogram distribution 62 | return math.Pow((prediction+entropy)/2, 0.9) 63 | } 64 | 65 | // ShannonEntropyBits returns the number of bits minimum required to represent 66 | // an entropy encoding of the input bytes. 67 | // https://en.wiktionary.org/wiki/Shannon_entropy 68 | func ShannonEntropyBits(b []byte) int { 69 | if len(b) == 0 { 70 | return 0 71 | } 72 | var hist [256]int 73 | for _, c := range b { 74 | hist[c]++ 75 | } 76 | shannon := float64(0) 77 | invTotal := 1.0 / float64(len(b)) 78 | for _, v := range hist[:] { 79 | if v > 0 { 80 | n := float64(v) 81 | shannon += math.Ceil(-math.Log2(n*invTotal) * n) 82 | } 83 | } 84 | return int(math.Ceil(shannon)) 85 | } 86 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/flate/matchlen_amd64.go: -------------------------------------------------------------------------------- 1 | //go:build amd64 && !appengine && !noasm && gc 2 | // +build amd64,!appengine,!noasm,gc 3 | 4 | // Copyright 2019+ Klaus Post. All rights reserved. 5 | // License information can be found in the LICENSE file. 6 | 7 | package flate 8 | 9 | // matchLen returns how many bytes match in a and b 10 | // 11 | // It assumes that: 12 | // 13 | // len(a) <= len(b) and len(a) > 0 14 | // 15 | //go:noescape 16 | func matchLen(a []byte, b []byte) int 17 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/flate/matchlen_amd64.s: -------------------------------------------------------------------------------- 1 | // Copied from S2 implementation. 2 | 3 | //go:build !appengine && !noasm && gc && !noasm 4 | 5 | #include "textflag.h" 6 | 7 | // func matchLen(a []byte, b []byte) int 8 | TEXT ·matchLen(SB), NOSPLIT, $0-56 9 | MOVQ a_base+0(FP), AX 10 | MOVQ b_base+24(FP), CX 11 | MOVQ a_len+8(FP), DX 12 | 13 | // matchLen 14 | XORL SI, SI 15 | CMPL DX, $0x08 16 | JB matchlen_match4_standalone 17 | 18 | matchlen_loopback_standalone: 19 | MOVQ (AX)(SI*1), BX 20 | XORQ (CX)(SI*1), BX 21 | JZ matchlen_loop_standalone 22 | 23 | #ifdef GOAMD64_v3 24 | TZCNTQ BX, BX 25 | #else 26 | BSFQ BX, BX 27 | #endif 28 | SHRL $0x03, BX 29 | LEAL (SI)(BX*1), SI 30 | JMP gen_match_len_end 31 | 32 | matchlen_loop_standalone: 33 | LEAL -8(DX), DX 34 | LEAL 8(SI), SI 35 | CMPL DX, $0x08 36 | JAE matchlen_loopback_standalone 37 | 38 | matchlen_match4_standalone: 39 | CMPL DX, $0x04 40 | JB matchlen_match2_standalone 41 | MOVL (AX)(SI*1), BX 42 | CMPL (CX)(SI*1), BX 43 | JNE matchlen_match2_standalone 44 | LEAL -4(DX), DX 45 | LEAL 4(SI), SI 46 | 47 | matchlen_match2_standalone: 48 | CMPL DX, $0x02 49 | JB matchlen_match1_standalone 50 | MOVW (AX)(SI*1), BX 51 | CMPW (CX)(SI*1), BX 52 | JNE matchlen_match1_standalone 53 | LEAL -2(DX), DX 54 | LEAL 2(SI), SI 55 | 56 | matchlen_match1_standalone: 57 | CMPL DX, $0x01 58 | JB gen_match_len_end 59 | MOVB (AX)(SI*1), BL 60 | CMPB (CX)(SI*1), BL 61 | JNE gen_match_len_end 62 | INCL SI 63 | 64 | gen_match_len_end: 65 | MOVQ SI, ret+48(FP) 66 | RET 67 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/flate/matchlen_generic.go: -------------------------------------------------------------------------------- 1 | //go:build !amd64 || appengine || !gc || noasm 2 | // +build !amd64 appengine !gc noasm 3 | 4 | // Copyright 2019+ Klaus Post. All rights reserved. 5 | // License information can be found in the LICENSE file. 6 | 7 | package flate 8 | 9 | import ( 10 | "encoding/binary" 11 | "math/bits" 12 | ) 13 | 14 | // matchLen returns the maximum common prefix length of a and b. 15 | // a must be the shortest of the two. 16 | func matchLen(a, b []byte) (n int) { 17 | for ; len(a) >= 8 && len(b) >= 8; a, b = a[8:], b[8:] { 18 | diff := binary.LittleEndian.Uint64(a) ^ binary.LittleEndian.Uint64(b) 19 | if diff != 0 { 20 | return n + bits.TrailingZeros64(diff)>>3 21 | } 22 | n += 8 23 | } 24 | 25 | for i := range a { 26 | if a[i] != b[i] { 27 | break 28 | } 29 | n++ 30 | } 31 | return n 32 | 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/flate/regmask_amd64.go: -------------------------------------------------------------------------------- 1 | package flate 2 | 3 | const ( 4 | // Masks for shifts with register sizes of the shift value. 5 | // This can be used to work around the x86 design of shifting by mod register size. 6 | // It can be used when a variable shift is always smaller than the register size. 7 | 8 | // reg8SizeMaskX - shift value is 8 bits, shifted is X 9 | reg8SizeMask8 = 7 10 | reg8SizeMask16 = 15 11 | reg8SizeMask32 = 31 12 | reg8SizeMask64 = 63 13 | 14 | // reg16SizeMaskX - shift value is 16 bits, shifted is X 15 | reg16SizeMask8 = reg8SizeMask8 16 | reg16SizeMask16 = reg8SizeMask16 17 | reg16SizeMask32 = reg8SizeMask32 18 | reg16SizeMask64 = reg8SizeMask64 19 | 20 | // reg32SizeMaskX - shift value is 32 bits, shifted is X 21 | reg32SizeMask8 = reg8SizeMask8 22 | reg32SizeMask16 = reg8SizeMask16 23 | reg32SizeMask32 = reg8SizeMask32 24 | reg32SizeMask64 = reg8SizeMask64 25 | 26 | // reg64SizeMaskX - shift value is 64 bits, shifted is X 27 | reg64SizeMask8 = reg8SizeMask8 28 | reg64SizeMask16 = reg8SizeMask16 29 | reg64SizeMask32 = reg8SizeMask32 30 | reg64SizeMask64 = reg8SizeMask64 31 | 32 | // regSizeMaskUintX - shift value is uint, shifted is X 33 | regSizeMaskUint8 = reg8SizeMask8 34 | regSizeMaskUint16 = reg8SizeMask16 35 | regSizeMaskUint32 = reg8SizeMask32 36 | regSizeMaskUint64 = reg8SizeMask64 37 | ) 38 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/flate/regmask_other.go: -------------------------------------------------------------------------------- 1 | //go:build !amd64 2 | // +build !amd64 3 | 4 | package flate 5 | 6 | const ( 7 | // Masks for shifts with register sizes of the shift value. 8 | // This can be used to work around the x86 design of shifting by mod register size. 9 | // It can be used when a variable shift is always smaller than the register size. 10 | 11 | // reg8SizeMaskX - shift value is 8 bits, shifted is X 12 | reg8SizeMask8 = 0xff 13 | reg8SizeMask16 = 0xff 14 | reg8SizeMask32 = 0xff 15 | reg8SizeMask64 = 0xff 16 | 17 | // reg16SizeMaskX - shift value is 16 bits, shifted is X 18 | reg16SizeMask8 = 0xffff 19 | reg16SizeMask16 = 0xffff 20 | reg16SizeMask32 = 0xffff 21 | reg16SizeMask64 = 0xffff 22 | 23 | // reg32SizeMaskX - shift value is 32 bits, shifted is X 24 | reg32SizeMask8 = 0xffffffff 25 | reg32SizeMask16 = 0xffffffff 26 | reg32SizeMask32 = 0xffffffff 27 | reg32SizeMask64 = 0xffffffff 28 | 29 | // reg64SizeMaskX - shift value is 64 bits, shifted is X 30 | reg64SizeMask8 = 0xffffffffffffffff 31 | reg64SizeMask16 = 0xffffffffffffffff 32 | reg64SizeMask32 = 0xffffffffffffffff 33 | reg64SizeMask64 = 0xffffffffffffffff 34 | 35 | // regSizeMaskUintX - shift value is uint, shifted is X 36 | regSizeMaskUint8 = ^uint(0) 37 | regSizeMaskUint16 = ^uint(0) 38 | regSizeMaskUint32 = ^uint(0) 39 | regSizeMaskUint64 = ^uint(0) 40 | ) 41 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/fse/bytereader.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Klaus Post. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // Based on work Copyright (c) 2013, Yann Collet, released under BSD License. 5 | 6 | package fse 7 | 8 | // byteReader provides a byte reader that reads 9 | // little endian values from a byte stream. 10 | // The input stream is manually advanced. 11 | // The reader performs no bounds checks. 12 | type byteReader struct { 13 | b []byte 14 | off int 15 | } 16 | 17 | // init will initialize the reader and set the input. 18 | func (b *byteReader) init(in []byte) { 19 | b.b = in 20 | b.off = 0 21 | } 22 | 23 | // advance the stream b n bytes. 24 | func (b *byteReader) advance(n uint) { 25 | b.off += int(n) 26 | } 27 | 28 | // Uint32 returns a little endian uint32 starting at current offset. 29 | func (b byteReader) Uint32() uint32 { 30 | b2 := b.b[b.off:] 31 | b2 = b2[:4] 32 | v3 := uint32(b2[3]) 33 | v2 := uint32(b2[2]) 34 | v1 := uint32(b2[1]) 35 | v0 := uint32(b2[0]) 36 | return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) 37 | } 38 | 39 | // unread returns the unread portion of the input. 40 | func (b byteReader) unread() []byte { 41 | return b.b[b.off:] 42 | } 43 | 44 | // remain will return the number of bytes remaining. 45 | func (b byteReader) remain() int { 46 | return len(b.b) - b.off 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd s2/cmd/_s2sx/ || exit 1 4 | go generate . 5 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/huff0/.gitignore: -------------------------------------------------------------------------------- 1 | /huff0-fuzz.zip 2 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo.go: -------------------------------------------------------------------------------- 1 | // Package cpuinfo gives runtime info about the current CPU. 2 | // 3 | // This is a very limited module meant for use internally 4 | // in this project. For more versatile solution check 5 | // https://github.com/klauspost/cpuid. 6 | package cpuinfo 7 | 8 | // HasBMI1 checks whether an x86 CPU supports the BMI1 extension. 9 | func HasBMI1() bool { 10 | return hasBMI1 11 | } 12 | 13 | // HasBMI2 checks whether an x86 CPU supports the BMI2 extension. 14 | func HasBMI2() bool { 15 | return hasBMI2 16 | } 17 | 18 | // DisableBMI2 will disable BMI2, for testing purposes. 19 | // Call returned function to restore previous state. 20 | func DisableBMI2() func() { 21 | old := hasBMI2 22 | hasBMI2 = false 23 | return func() { 24 | hasBMI2 = old 25 | } 26 | } 27 | 28 | // HasBMI checks whether an x86 CPU supports both BMI1 and BMI2 extensions. 29 | func HasBMI() bool { 30 | return HasBMI1() && HasBMI2() 31 | } 32 | 33 | var hasBMI1 bool 34 | var hasBMI2 bool 35 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo_amd64.go: -------------------------------------------------------------------------------- 1 | //go:build amd64 && !appengine && !noasm && gc 2 | // +build amd64,!appengine,!noasm,gc 3 | 4 | package cpuinfo 5 | 6 | // go:noescape 7 | func x86extensions() (bmi1, bmi2 bool) 8 | 9 | func init() { 10 | hasBMI1, hasBMI2 = x86extensions() 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/internal/cpuinfo/cpuinfo_amd64.s: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | // +build gc 3 | // +build !noasm 4 | 5 | #include "textflag.h" 6 | #include "funcdata.h" 7 | #include "go_asm.h" 8 | 9 | TEXT ·x86extensions(SB), NOSPLIT, $0 10 | // 1. determine max EAX value 11 | XORQ AX, AX 12 | CPUID 13 | 14 | CMPQ AX, $7 15 | JB unsupported 16 | 17 | // 2. EAX = 7, ECX = 0 --- see Table 3-8 "Information Returned by CPUID Instruction" 18 | MOVQ $7, AX 19 | MOVQ $0, CX 20 | CPUID 21 | 22 | BTQ $3, BX // bit 3 = BMI1 23 | SETCS AL 24 | 25 | BTQ $8, BX // bit 8 = BMI2 26 | SETCS AH 27 | 28 | MOVB AL, bmi1+0(FP) 29 | MOVB AH, bmi2+1(FP) 30 | RET 31 | 32 | unsupported: 33 | XORQ AX, AX 34 | MOVB AL, bmi1+0(FP) 35 | MOVB AL, bmi2+1(FP) 36 | RET 37 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/internal/snapref/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/s2sx.mod: -------------------------------------------------------------------------------- 1 | module github.com/klauspost/compress 2 | 3 | go 1.19 4 | 5 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/s2sx.sum: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DroidsOnRoids/bitrise-step-flutter/add8cc531d26dcb7726cb2dfa5ba61bd97888fad/vendor/github.com/klauspost/compress/s2sx.sum -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/bytereader.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019+ Klaus Post. All rights reserved. 2 | // License information can be found in the LICENSE file. 3 | // Based on work by Yann Collet, released under BSD License. 4 | 5 | package zstd 6 | 7 | // byteReader provides a byte reader that reads 8 | // little endian values from a byte stream. 9 | // The input stream is manually advanced. 10 | // The reader performs no bounds checks. 11 | type byteReader struct { 12 | b []byte 13 | off int 14 | } 15 | 16 | // advance the stream b n bytes. 17 | func (b *byteReader) advance(n uint) { 18 | b.off += int(n) 19 | } 20 | 21 | // overread returns whether we have advanced too far. 22 | func (b *byteReader) overread() bool { 23 | return b.off > len(b.b) 24 | } 25 | 26 | // Int32 returns a little endian int32 starting at current offset. 27 | func (b byteReader) Int32() int32 { 28 | b2 := b.b[b.off:] 29 | b2 = b2[:4] 30 | v3 := int32(b2[3]) 31 | v2 := int32(b2[2]) 32 | v1 := int32(b2[1]) 33 | v0 := int32(b2[0]) 34 | return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) 35 | } 36 | 37 | // Uint8 returns the next byte 38 | func (b *byteReader) Uint8() uint8 { 39 | v := b.b[b.off] 40 | return v 41 | } 42 | 43 | // Uint32 returns a little endian uint32 starting at current offset. 44 | func (b byteReader) Uint32() uint32 { 45 | if r := b.remain(); r < 4 { 46 | // Very rare 47 | v := uint32(0) 48 | for i := 1; i <= r; i++ { 49 | v = (v << 8) | uint32(b.b[len(b.b)-i]) 50 | } 51 | return v 52 | } 53 | b2 := b.b[b.off:] 54 | b2 = b2[:4] 55 | v3 := uint32(b2[3]) 56 | v2 := uint32(b2[2]) 57 | v1 := uint32(b2[1]) 58 | v0 := uint32(b2[0]) 59 | return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) 60 | } 61 | 62 | // Uint32NC returns a little endian uint32 starting at current offset. 63 | // The caller must be sure if there are at least 4 bytes left. 64 | func (b byteReader) Uint32NC() uint32 { 65 | b2 := b.b[b.off:] 66 | b2 = b2[:4] 67 | v3 := uint32(b2[3]) 68 | v2 := uint32(b2[2]) 69 | v1 := uint32(b2[1]) 70 | v0 := uint32(b2[0]) 71 | return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) 72 | } 73 | 74 | // unread returns the unread portion of the input. 75 | func (b byteReader) unread() []byte { 76 | return b.b[b.off:] 77 | } 78 | 79 | // remain will return the number of bytes remaining. 80 | func (b byteReader) remain() int { 81 | return len(b.b) - b.off 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/fse_decoder_amd64.go: -------------------------------------------------------------------------------- 1 | //go:build amd64 && !appengine && !noasm && gc 2 | // +build amd64,!appengine,!noasm,gc 3 | 4 | package zstd 5 | 6 | import ( 7 | "fmt" 8 | ) 9 | 10 | type buildDtableAsmContext struct { 11 | // inputs 12 | stateTable *uint16 13 | norm *int16 14 | dt *uint64 15 | 16 | // outputs --- set by the procedure in the case of error; 17 | // for interpretation please see the error handling part below 18 | errParam1 uint64 19 | errParam2 uint64 20 | } 21 | 22 | // buildDtable_asm is an x86 assembly implementation of fseDecoder.buildDtable. 23 | // Function returns non-zero exit code on error. 24 | // 25 | //go:noescape 26 | func buildDtable_asm(s *fseDecoder, ctx *buildDtableAsmContext) int 27 | 28 | // please keep in sync with _generate/gen_fse.go 29 | const ( 30 | errorCorruptedNormalizedCounter = 1 31 | errorNewStateTooBig = 2 32 | errorNewStateNoBits = 3 33 | ) 34 | 35 | // buildDtable will build the decoding table. 36 | func (s *fseDecoder) buildDtable() error { 37 | ctx := buildDtableAsmContext{ 38 | stateTable: &s.stateTable[0], 39 | norm: &s.norm[0], 40 | dt: (*uint64)(&s.dt[0]), 41 | } 42 | code := buildDtable_asm(s, &ctx) 43 | 44 | if code != 0 { 45 | switch code { 46 | case errorCorruptedNormalizedCounter: 47 | position := ctx.errParam1 48 | return fmt.Errorf("corrupted input (position=%d, expected 0)", position) 49 | 50 | case errorNewStateTooBig: 51 | newState := decSymbol(ctx.errParam1) 52 | size := ctx.errParam2 53 | return fmt.Errorf("newState (%d) outside table size (%d)", newState, size) 54 | 55 | case errorNewStateNoBits: 56 | newState := decSymbol(ctx.errParam1) 57 | oldState := decSymbol(ctx.errParam2) 58 | return fmt.Errorf("newState (%d) == oldState (%d) and no bits", newState, oldState) 59 | 60 | default: 61 | return fmt.Errorf("buildDtable_asm returned unhandled nonzero code = %d", code) 62 | } 63 | } 64 | return nil 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/fse_decoder_generic.go: -------------------------------------------------------------------------------- 1 | //go:build !amd64 || appengine || !gc || noasm 2 | // +build !amd64 appengine !gc noasm 3 | 4 | package zstd 5 | 6 | import ( 7 | "errors" 8 | "fmt" 9 | ) 10 | 11 | // buildDtable will build the decoding table. 12 | func (s *fseDecoder) buildDtable() error { 13 | tableSize := uint32(1 << s.actualTableLog) 14 | highThreshold := tableSize - 1 15 | symbolNext := s.stateTable[:256] 16 | 17 | // Init, lay down lowprob symbols 18 | { 19 | for i, v := range s.norm[:s.symbolLen] { 20 | if v == -1 { 21 | s.dt[highThreshold].setAddBits(uint8(i)) 22 | highThreshold-- 23 | v = 1 24 | } 25 | symbolNext[i] = uint16(v) 26 | } 27 | } 28 | 29 | // Spread symbols 30 | { 31 | tableMask := tableSize - 1 32 | step := tableStep(tableSize) 33 | position := uint32(0) 34 | for ss, v := range s.norm[:s.symbolLen] { 35 | for i := 0; i < int(v); i++ { 36 | s.dt[position].setAddBits(uint8(ss)) 37 | for { 38 | // lowprob area 39 | position = (position + step) & tableMask 40 | if position <= highThreshold { 41 | break 42 | } 43 | } 44 | } 45 | } 46 | if position != 0 { 47 | // position must reach all cells once, otherwise normalizedCounter is incorrect 48 | return errors.New("corrupted input (position != 0)") 49 | } 50 | } 51 | 52 | // Build Decoding table 53 | { 54 | tableSize := uint16(1 << s.actualTableLog) 55 | for u, v := range s.dt[:tableSize] { 56 | symbol := v.addBits() 57 | nextState := symbolNext[symbol] 58 | symbolNext[symbol] = nextState + 1 59 | nBits := s.actualTableLog - byte(highBits(uint32(nextState))) 60 | s.dt[u&maxTableMask].setNBits(nBits) 61 | newState := (nextState << nBits) - tableSize 62 | if newState > tableSize { 63 | return fmt.Errorf("newState (%d) outside table size (%d)", newState, tableSize) 64 | } 65 | if newState == uint16(u) && nBits == 0 { 66 | // Seems weird that this is possible with nbits > 0. 67 | return fmt.Errorf("newState (%d) == oldState (%d) and no bits", newState, u) 68 | } 69 | s.dt[u&maxTableMask].setNewState(newState) 70 | } 71 | } 72 | return nil 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/hash.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019+ Klaus Post. All rights reserved. 2 | // License information can be found in the LICENSE file. 3 | // Based on work by Yann Collet, released under BSD License. 4 | 5 | package zstd 6 | 7 | const ( 8 | prime3bytes = 506832829 9 | prime4bytes = 2654435761 10 | prime5bytes = 889523592379 11 | prime6bytes = 227718039650203 12 | prime7bytes = 58295818150454627 13 | prime8bytes = 0xcf1bbcdcb7a56463 14 | ) 15 | 16 | // hashLen returns a hash of the lowest mls bytes of with length output bits. 17 | // mls must be >=3 and <=8. Any other value will return hash for 4 bytes. 18 | // length should always be < 32. 19 | // Preferably length and mls should be a constant for inlining. 20 | func hashLen(u uint64, length, mls uint8) uint32 { 21 | switch mls { 22 | case 3: 23 | return (uint32(u<<8) * prime3bytes) >> (32 - length) 24 | case 5: 25 | return uint32(((u << (64 - 40)) * prime5bytes) >> (64 - length)) 26 | case 6: 27 | return uint32(((u << (64 - 48)) * prime6bytes) >> (64 - length)) 28 | case 7: 29 | return uint32(((u << (64 - 56)) * prime7bytes) >> (64 - length)) 30 | case 8: 31 | return uint32((u * prime8bytes) >> (64 - length)) 32 | default: 33 | return (uint32(u) * prime4bytes) >> (32 - length) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Caleb Spare 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md: -------------------------------------------------------------------------------- 1 | # xxhash 2 | 3 | VENDORED: Go to [github.com/cespare/xxhash](https://github.com/cespare/xxhash) for original package. 4 | 5 | xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a 6 | high-quality hashing algorithm that is much faster than anything in the Go 7 | standard library. 8 | 9 | This package provides a straightforward API: 10 | 11 | ``` 12 | func Sum64(b []byte) uint64 13 | func Sum64String(s string) uint64 14 | type Digest struct{ ... } 15 | func New() *Digest 16 | ``` 17 | 18 | The `Digest` type implements hash.Hash64. Its key methods are: 19 | 20 | ``` 21 | func (*Digest) Write([]byte) (int, error) 22 | func (*Digest) WriteString(string) (int, error) 23 | func (*Digest) Sum64() uint64 24 | ``` 25 | 26 | The package is written with optimized pure Go and also contains even faster 27 | assembly implementations for amd64 and arm64. If desired, the `purego` build tag 28 | opts into using the Go code even on those architectures. 29 | 30 | [xxHash]: http://cyan4973.github.io/xxHash/ 31 | 32 | ## Compatibility 33 | 34 | This package is in a module and the latest code is in version 2 of the module. 35 | You need a version of Go with at least "minimal module compatibility" to use 36 | github.com/cespare/xxhash/v2: 37 | 38 | * 1.9.7+ for Go 1.9 39 | * 1.10.3+ for Go 1.10 40 | * Go 1.11 or later 41 | 42 | I recommend using the latest release of Go. 43 | 44 | ## Benchmarks 45 | 46 | Here are some quick benchmarks comparing the pure-Go and assembly 47 | implementations of Sum64. 48 | 49 | | input size | purego | asm | 50 | | ---------- | --------- | --------- | 51 | | 4 B | 1.3 GB/s | 1.2 GB/s | 52 | | 16 B | 2.9 GB/s | 3.5 GB/s | 53 | | 100 B | 6.9 GB/s | 8.1 GB/s | 54 | | 4 KB | 11.7 GB/s | 16.7 GB/s | 55 | | 10 MB | 12.0 GB/s | 17.3 GB/s | 56 | 57 | These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C 58 | CPU using the following commands under Go 1.19.2: 59 | 60 | ``` 61 | benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$') 62 | benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$') 63 | ``` 64 | 65 | ## Projects using this package 66 | 67 | - [InfluxDB](https://github.com/influxdata/influxdb) 68 | - [Prometheus](https://github.com/prometheus/prometheus) 69 | - [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) 70 | - [FreeCache](https://github.com/coocood/freecache) 71 | - [FastCache](https://github.com/VictoriaMetrics/fastcache) 72 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_asm.go: -------------------------------------------------------------------------------- 1 | //go:build (amd64 || arm64) && !appengine && gc && !purego && !noasm 2 | // +build amd64 arm64 3 | // +build !appengine 4 | // +build gc 5 | // +build !purego 6 | // +build !noasm 7 | 8 | package xxhash 9 | 10 | // Sum64 computes the 64-bit xxHash digest of b. 11 | // 12 | //go:noescape 13 | func Sum64(b []byte) uint64 14 | 15 | //go:noescape 16 | func writeBlocks(s *Digest, b []byte) int 17 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go: -------------------------------------------------------------------------------- 1 | //go:build (!amd64 && !arm64) || appengine || !gc || purego || noasm 2 | // +build !amd64,!arm64 appengine !gc purego noasm 3 | 4 | package xxhash 5 | 6 | // Sum64 computes the 64-bit xxHash digest of b. 7 | func Sum64(b []byte) uint64 { 8 | // A simpler version would be 9 | // d := New() 10 | // d.Write(b) 11 | // return d.Sum64() 12 | // but this is faster, particularly for small inputs. 13 | 14 | n := len(b) 15 | var h uint64 16 | 17 | if n >= 32 { 18 | v1 := primes[0] + prime2 19 | v2 := prime2 20 | v3 := uint64(0) 21 | v4 := -primes[0] 22 | for len(b) >= 32 { 23 | v1 = round(v1, u64(b[0:8:len(b)])) 24 | v2 = round(v2, u64(b[8:16:len(b)])) 25 | v3 = round(v3, u64(b[16:24:len(b)])) 26 | v4 = round(v4, u64(b[24:32:len(b)])) 27 | b = b[32:len(b):len(b)] 28 | } 29 | h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) 30 | h = mergeRound(h, v1) 31 | h = mergeRound(h, v2) 32 | h = mergeRound(h, v3) 33 | h = mergeRound(h, v4) 34 | } else { 35 | h = prime5 36 | } 37 | 38 | h += uint64(n) 39 | 40 | for ; len(b) >= 8; b = b[8:] { 41 | k1 := round(0, u64(b[:8])) 42 | h ^= k1 43 | h = rol27(h)*prime1 + prime4 44 | } 45 | if len(b) >= 4 { 46 | h ^= uint64(u32(b[:4])) * prime1 47 | h = rol23(h)*prime2 + prime3 48 | b = b[4:] 49 | } 50 | for ; len(b) > 0; b = b[1:] { 51 | h ^= uint64(b[0]) * prime5 52 | h = rol11(h) * prime1 53 | } 54 | 55 | h ^= h >> 33 56 | h *= prime2 57 | h ^= h >> 29 58 | h *= prime3 59 | h ^= h >> 32 60 | 61 | return h 62 | } 63 | 64 | func writeBlocks(d *Digest, b []byte) int { 65 | v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 66 | n := len(b) 67 | for len(b) >= 32 { 68 | v1 = round(v1, u64(b[0:8:len(b)])) 69 | v2 = round(v2, u64(b[8:16:len(b)])) 70 | v3 = round(v3, u64(b[16:24:len(b)])) 71 | v4 = round(v4, u64(b[24:32:len(b)])) 72 | b = b[32:len(b):len(b)] 73 | } 74 | d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 75 | return n - len(b) 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go: -------------------------------------------------------------------------------- 1 | package xxhash 2 | 3 | // Sum64String computes the 64-bit xxHash digest of s. 4 | func Sum64String(s string) uint64 { 5 | return Sum64([]byte(s)) 6 | } 7 | 8 | // WriteString adds more data to d. It always returns len(s), nil. 9 | func (d *Digest) WriteString(s string) (n int, err error) { 10 | return d.Write([]byte(s)) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/matchlen_amd64.go: -------------------------------------------------------------------------------- 1 | //go:build amd64 && !appengine && !noasm && gc 2 | // +build amd64,!appengine,!noasm,gc 3 | 4 | // Copyright 2019+ Klaus Post. All rights reserved. 5 | // License information can be found in the LICENSE file. 6 | 7 | package zstd 8 | 9 | // matchLen returns how many bytes match in a and b 10 | // 11 | // It assumes that: 12 | // 13 | // len(a) <= len(b) and len(a) > 0 14 | // 15 | //go:noescape 16 | func matchLen(a []byte, b []byte) int 17 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/matchlen_amd64.s: -------------------------------------------------------------------------------- 1 | // Copied from S2 implementation. 2 | 3 | //go:build !appengine && !noasm && gc && !noasm 4 | 5 | #include "textflag.h" 6 | 7 | // func matchLen(a []byte, b []byte) int 8 | TEXT ·matchLen(SB), NOSPLIT, $0-56 9 | MOVQ a_base+0(FP), AX 10 | MOVQ b_base+24(FP), CX 11 | MOVQ a_len+8(FP), DX 12 | 13 | // matchLen 14 | XORL SI, SI 15 | CMPL DX, $0x08 16 | JB matchlen_match4_standalone 17 | 18 | matchlen_loopback_standalone: 19 | MOVQ (AX)(SI*1), BX 20 | XORQ (CX)(SI*1), BX 21 | JZ matchlen_loop_standalone 22 | 23 | #ifdef GOAMD64_v3 24 | TZCNTQ BX, BX 25 | #else 26 | BSFQ BX, BX 27 | #endif 28 | SHRL $0x03, BX 29 | LEAL (SI)(BX*1), SI 30 | JMP gen_match_len_end 31 | 32 | matchlen_loop_standalone: 33 | LEAL -8(DX), DX 34 | LEAL 8(SI), SI 35 | CMPL DX, $0x08 36 | JAE matchlen_loopback_standalone 37 | 38 | matchlen_match4_standalone: 39 | CMPL DX, $0x04 40 | JB matchlen_match2_standalone 41 | MOVL (AX)(SI*1), BX 42 | CMPL (CX)(SI*1), BX 43 | JNE matchlen_match2_standalone 44 | LEAL -4(DX), DX 45 | LEAL 4(SI), SI 46 | 47 | matchlen_match2_standalone: 48 | CMPL DX, $0x02 49 | JB matchlen_match1_standalone 50 | MOVW (AX)(SI*1), BX 51 | CMPW (CX)(SI*1), BX 52 | JNE matchlen_match1_standalone 53 | LEAL -2(DX), DX 54 | LEAL 2(SI), SI 55 | 56 | matchlen_match1_standalone: 57 | CMPL DX, $0x01 58 | JB gen_match_len_end 59 | MOVB (AX)(SI*1), BL 60 | CMPB (CX)(SI*1), BL 61 | JNE gen_match_len_end 62 | INCL SI 63 | 64 | gen_match_len_end: 65 | MOVQ SI, ret+48(FP) 66 | RET 67 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/compress/zstd/matchlen_generic.go: -------------------------------------------------------------------------------- 1 | //go:build !amd64 || appengine || !gc || noasm 2 | // +build !amd64 appengine !gc noasm 3 | 4 | // Copyright 2019+ Klaus Post. All rights reserved. 5 | // License information can be found in the LICENSE file. 6 | 7 | package zstd 8 | 9 | import ( 10 | "encoding/binary" 11 | "math/bits" 12 | ) 13 | 14 | // matchLen returns the maximum common prefix length of a and b. 15 | // a must be the shortest of the two. 16 | func matchLen(a, b []byte) (n int) { 17 | for ; len(a) >= 8 && len(b) >= 8; a, b = a[8:], b[8:] { 18 | diff := binary.LittleEndian.Uint64(a) ^ binary.LittleEndian.Uint64(b) 19 | if diff != 0 { 20 | return n + bits.TrailingZeros64(diff)>>3 21 | } 22 | n += 8 23 | } 24 | 25 | for i := range a { 26 | if a[i] != b[i] { 27 | break 28 | } 29 | n++ 30 | } 31 | return n 32 | 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/pgzip/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/pgzip/.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | arch: 3 | - amd64 4 | - ppc64le 5 | language: go 6 | 7 | os: 8 | - linux 9 | - osx 10 | 11 | go: 12 | - 1.13.x 13 | - 1.14.x 14 | - 1.15.x 15 | - master 16 | 17 | env: 18 | - GO111MODULE=off 19 | 20 | script: 21 | - diff <(gofmt -d .) <(printf "") 22 | - go test -v -cpu=1,2,4 . 23 | - go test -v -cpu=2 -race -short . 24 | 25 | matrix: 26 | allow_failures: 27 | - go: 'master' 28 | fast_finish: true 29 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/pgzip/GO_LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/klauspost/pgzip/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Klaus Post 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/.gitignore: -------------------------------------------------------------------------------- 1 | *.sublime-project 2 | *.sublime-workspace 3 | *.un~ 4 | *.swp 5 | .idea/ 6 | *.iml 7 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2020, Frank Schroeder 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/integrate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2022 Frank Schroeder. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package properties 6 | 7 | import "flag" 8 | 9 | // MustFlag sets flags that are skipped by dst.Parse when p contains 10 | // the respective key for flag.Flag.Name. 11 | // 12 | // It's use is recommended with command line arguments as in: 13 | // 14 | // flag.Parse() 15 | // p.MustFlag(flag.CommandLine) 16 | func (p *Properties) MustFlag(dst *flag.FlagSet) { 17 | m := make(map[string]*flag.Flag) 18 | dst.VisitAll(func(f *flag.Flag) { 19 | m[f.Name] = f 20 | }) 21 | dst.Visit(func(f *flag.Flag) { 22 | delete(m, f.Name) // overridden 23 | }) 24 | 25 | for name, f := range m { 26 | v, ok := p.Get(name) 27 | if !ok { 28 | continue 29 | } 30 | 31 | if err := f.Value.Set(v); err != nil { 32 | ErrorHandler(err) 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/parser.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2022 Frank Schroeder. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package properties 6 | 7 | import ( 8 | "fmt" 9 | "runtime" 10 | ) 11 | 12 | type parser struct { 13 | lex *lexer 14 | } 15 | 16 | func parse(input string) (properties *Properties, err error) { 17 | p := &parser{lex: lex(input)} 18 | defer p.recover(&err) 19 | 20 | properties = NewProperties() 21 | key := "" 22 | comments := []string{} 23 | 24 | for { 25 | token := p.expectOneOf(itemComment, itemKey, itemEOF) 26 | switch token.typ { 27 | case itemEOF: 28 | goto done 29 | case itemComment: 30 | comments = append(comments, token.val) 31 | continue 32 | case itemKey: 33 | key = token.val 34 | if _, ok := properties.m[key]; !ok { 35 | properties.k = append(properties.k, key) 36 | } 37 | } 38 | 39 | token = p.expectOneOf(itemValue, itemEOF) 40 | if len(comments) > 0 { 41 | properties.c[key] = comments 42 | comments = []string{} 43 | } 44 | switch token.typ { 45 | case itemEOF: 46 | properties.m[key] = "" 47 | goto done 48 | case itemValue: 49 | properties.m[key] = token.val 50 | } 51 | } 52 | 53 | done: 54 | return properties, nil 55 | } 56 | 57 | func (p *parser) errorf(format string, args ...interface{}) { 58 | format = fmt.Sprintf("properties: Line %d: %s", p.lex.lineNumber(), format) 59 | panic(fmt.Errorf(format, args...)) 60 | } 61 | 62 | func (p *parser) expectOneOf(expected ...itemType) (token item) { 63 | token = p.lex.nextItem() 64 | for _, v := range expected { 65 | if token.typ == v { 66 | return token 67 | } 68 | } 69 | p.unexpected(token) 70 | panic("unexpected token") 71 | } 72 | 73 | func (p *parser) unexpected(token item) { 74 | p.errorf(token.String()) 75 | } 76 | 77 | // recover is the handler that turns panics into returns from the top level of Parse. 78 | func (p *parser) recover(errp *error) { 79 | e := recover() 80 | if e != nil { 81 | if _, ok := e.(runtime.Error); ok { 82 | panic(e) 83 | } 84 | *errp = e.(error) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /vendor/github.com/magiconair/properties/rangecheck.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013-2022 Frank Schroeder. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package properties 6 | 7 | import ( 8 | "fmt" 9 | "math" 10 | ) 11 | 12 | // make this a var to overwrite it in a test 13 | var is32Bit = ^uint(0) == math.MaxUint32 14 | 15 | // intRangeCheck checks if the value fits into the int type and 16 | // panics if it does not. 17 | func intRangeCheck(key string, v int64) int { 18 | if is32Bit && (v < math.MinInt32 || v > math.MaxInt32) { 19 | panic(fmt.Sprintf("Value %d for key %s out of range", v, key)) 20 | } 21 | return int(v) 22 | } 23 | 24 | // uintRangeCheck checks if the value fits into the uint type and 25 | // panics if it does not. 26 | func uintRangeCheck(key string, v uint64) uint { 27 | if is32Bit && v > math.MaxUint32 { 28 | panic(fmt.Sprintf("Value %d for key %s out of range", v, key)) 29 | } 30 | return uint(v) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | _gitignore 3 | builds/ 4 | *.test 5 | cmd/archiver/archiver 6 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Matthew Holt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/brotli.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "path/filepath" 7 | 8 | "github.com/andybalholm/brotli" 9 | ) 10 | 11 | // Brotli facilitates brotli compression. 12 | type Brotli struct { 13 | Quality int 14 | } 15 | 16 | // Compress reads in, compresses it, and writes it to out. 17 | func (br *Brotli) Compress(in io.Reader, out io.Writer) error { 18 | w := brotli.NewWriterLevel(out, br.Quality) 19 | defer w.Close() 20 | _, err := io.Copy(w, in) 21 | return err 22 | } 23 | 24 | // Decompress reads in, decompresses it, and writes it to out. 25 | func (br *Brotli) Decompress(in io.Reader, out io.Writer) error { 26 | r := brotli.NewReader(in) 27 | _, err := io.Copy(out, r) 28 | return err 29 | } 30 | 31 | // CheckExt ensures the file extension matches the format. 32 | func (br *Brotli) CheckExt(filename string) error { 33 | if filepath.Ext(filename) != ".br" { 34 | return fmt.Errorf("filename must have a .br extension") 35 | } 36 | return nil 37 | } 38 | 39 | func (br *Brotli) String() string { return "brotli" } 40 | 41 | // NewBrotli returns a new, default instance ready to be customized and used. 42 | func NewBrotli() *Brotli { 43 | return &Brotli{ 44 | Quality: brotli.DefaultCompression, 45 | } 46 | } 47 | 48 | // Compile-time checks to ensure type implements desired interfaces. 49 | var ( 50 | _ = Compressor(new(Brotli)) 51 | _ = Decompressor(new(Brotli)) 52 | ) 53 | 54 | // DefaultBrotli is a default instance that is conveniently ready to use. 55 | var DefaultBrotli = NewBrotli() 56 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/build.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | # This script builds archiver for most common platforms. 5 | 6 | export CGO_ENABLED=0 7 | 8 | cd cmd/arc 9 | GOOS=linux GOARCH=amd64 go build -o ../../builds/arc_linux_amd64 10 | GOOS=linux GOARCH=arm go build -o ../../builds/arc_linux_arm7 11 | GOOS=darwin GOARCH=amd64 go build -o ../../builds/arc_mac_amd64 12 | GOOS=windows GOARCH=amd64 go build -o ../../builds/arc_windows_amd64.exe 13 | cd ../.. 14 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/bz2.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "path/filepath" 7 | 8 | "github.com/dsnet/compress/bzip2" 9 | ) 10 | 11 | // Bz2 facilitates bzip2 compression. 12 | type Bz2 struct { 13 | CompressionLevel int 14 | } 15 | 16 | // Compress reads in, compresses it, and writes it to out. 17 | func (bz *Bz2) Compress(in io.Reader, out io.Writer) error { 18 | w, err := bzip2.NewWriter(out, &bzip2.WriterConfig{ 19 | Level: bz.CompressionLevel, 20 | }) 21 | if err != nil { 22 | return err 23 | } 24 | defer w.Close() 25 | _, err = io.Copy(w, in) 26 | return err 27 | } 28 | 29 | // Decompress reads in, decompresses it, and writes it to out. 30 | func (bz *Bz2) Decompress(in io.Reader, out io.Writer) error { 31 | r, err := bzip2.NewReader(in, nil) 32 | if err != nil { 33 | return err 34 | } 35 | defer r.Close() 36 | _, err = io.Copy(out, r) 37 | return err 38 | } 39 | 40 | // CheckExt ensures the file extension matches the format. 41 | func (bz *Bz2) CheckExt(filename string) error { 42 | if filepath.Ext(filename) != ".bz2" { 43 | return fmt.Errorf("filename must have a .bz2 extension") 44 | } 45 | return nil 46 | } 47 | 48 | func (bz *Bz2) String() string { return "bz2" } 49 | 50 | // NewBz2 returns a new, default instance ready to be customized and used. 51 | func NewBz2() *Bz2 { 52 | return &Bz2{ 53 | CompressionLevel: bzip2.DefaultCompression, 54 | } 55 | } 56 | 57 | // Compile-time checks to ensure type implements desired interfaces. 58 | var ( 59 | _ = Compressor(new(Bz2)) 60 | _ = Decompressor(new(Bz2)) 61 | ) 62 | 63 | // DefaultBz2 is a default instance that is conveniently ready to use. 64 | var DefaultBz2 = NewBz2() 65 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/filecompressor.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | // FileCompressor can compress and decompress single files. 9 | type FileCompressor struct { 10 | Compressor 11 | Decompressor 12 | 13 | // Whether to overwrite existing files when creating files. 14 | OverwriteExisting bool 15 | } 16 | 17 | // CompressFile reads the source file and compresses it to destination. 18 | // The destination must have a matching extension. 19 | func (fc FileCompressor) CompressFile(source, destination string) error { 20 | if err := fc.CheckExt(destination); err != nil { 21 | return err 22 | } 23 | if fc.Compressor == nil { 24 | return fmt.Errorf("no compressor specified") 25 | } 26 | if !fc.OverwriteExisting && fileExists(destination) { 27 | return fmt.Errorf("file exists: %s", destination) 28 | } 29 | 30 | in, err := os.Open(source) 31 | if err != nil { 32 | return err 33 | } 34 | defer in.Close() 35 | 36 | out, err := os.Create(destination) 37 | if err != nil { 38 | return err 39 | } 40 | defer out.Close() 41 | 42 | return fc.Compress(in, out) 43 | } 44 | 45 | // DecompressFile reads the source file and decompresses it to destination. 46 | func (fc FileCompressor) DecompressFile(source, destination string) error { 47 | if fc.Decompressor == nil { 48 | return fmt.Errorf("no decompressor specified") 49 | } 50 | if !fc.OverwriteExisting && fileExists(destination) { 51 | return fmt.Errorf("file exists: %s", destination) 52 | } 53 | 54 | in, err := os.Open(source) 55 | if err != nil { 56 | return err 57 | } 58 | defer in.Close() 59 | 60 | out, err := os.Create(destination) 61 | if err != nil { 62 | return err 63 | } 64 | defer out.Close() 65 | 66 | return fc.Decompress(in, out) 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/gz.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "compress/gzip" 5 | "fmt" 6 | "io" 7 | "path/filepath" 8 | 9 | pgzip "github.com/klauspost/pgzip" 10 | ) 11 | 12 | // Gz facilitates gzip compression. 13 | type Gz struct { 14 | CompressionLevel int 15 | SingleThreaded bool 16 | } 17 | 18 | // Compress reads in, compresses it, and writes it to out. 19 | func (gz *Gz) Compress(in io.Reader, out io.Writer) error { 20 | var w io.WriteCloser 21 | var err error 22 | if gz.SingleThreaded { 23 | w, err = gzip.NewWriterLevel(out, gz.CompressionLevel) 24 | } else { 25 | w, err = pgzip.NewWriterLevel(out, gz.CompressionLevel) 26 | } 27 | if err != nil { 28 | return err 29 | } 30 | defer w.Close() 31 | _, err = io.Copy(w, in) 32 | return err 33 | } 34 | 35 | // Decompress reads in, decompresses it, and writes it to out. 36 | func (gz *Gz) Decompress(in io.Reader, out io.Writer) error { 37 | var r io.ReadCloser 38 | var err error 39 | if gz.SingleThreaded { 40 | r, err = gzip.NewReader(in) 41 | } else { 42 | r, err = pgzip.NewReader(in) 43 | } 44 | if err != nil { 45 | return err 46 | } 47 | defer r.Close() 48 | _, err = io.Copy(out, r) 49 | return err 50 | } 51 | 52 | // CheckExt ensures the file extension matches the format. 53 | func (gz *Gz) CheckExt(filename string) error { 54 | if filepath.Ext(filename) != ".gz" { 55 | return fmt.Errorf("filename must have a .gz extension") 56 | } 57 | return nil 58 | } 59 | 60 | func (gz *Gz) String() string { return "gz" } 61 | 62 | // NewGz returns a new, default instance ready to be customized and used. 63 | func NewGz() *Gz { 64 | return &Gz{ 65 | CompressionLevel: gzip.DefaultCompression, 66 | } 67 | } 68 | 69 | // Compile-time checks to ensure type implements desired interfaces. 70 | var ( 71 | _ = Compressor(new(Gz)) 72 | _ = Decompressor(new(Gz)) 73 | ) 74 | 75 | // DefaultGz is a default instance that is conveniently ready to use. 76 | var DefaultGz = NewGz() 77 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/lz4.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "path/filepath" 7 | 8 | "github.com/pierrec/lz4" 9 | ) 10 | 11 | // Lz4 facilitates LZ4 compression. 12 | type Lz4 struct { 13 | CompressionLevel int 14 | } 15 | 16 | // Compress reads in, compresses it, and writes it to out. 17 | func (lz *Lz4) Compress(in io.Reader, out io.Writer) error { 18 | w := lz4.NewWriter(out) 19 | w.Header.CompressionLevel = lz.CompressionLevel 20 | defer w.Close() 21 | _, err := io.Copy(w, in) 22 | return err 23 | } 24 | 25 | // Decompress reads in, decompresses it, and writes it to out. 26 | func (lz *Lz4) Decompress(in io.Reader, out io.Writer) error { 27 | r := lz4.NewReader(in) 28 | _, err := io.Copy(out, r) 29 | return err 30 | } 31 | 32 | // CheckExt ensures the file extension matches the format. 33 | func (lz *Lz4) CheckExt(filename string) error { 34 | if filepath.Ext(filename) != ".lz4" { 35 | return fmt.Errorf("filename must have a .lz4 extension") 36 | } 37 | return nil 38 | } 39 | 40 | func (lz *Lz4) String() string { return "lz4" } 41 | 42 | // NewLz4 returns a new, default instance ready to be customized and used. 43 | func NewLz4() *Lz4 { 44 | return &Lz4{ 45 | CompressionLevel: 9, // https://github.com/lz4/lz4/blob/1b819bfd633ae285df2dfe1b0589e1ec064f2873/lib/lz4hc.h#L48 46 | } 47 | } 48 | 49 | // Compile-time checks to ensure type implements desired interfaces. 50 | var ( 51 | _ = Compressor(new(Lz4)) 52 | _ = Decompressor(new(Lz4)) 53 | ) 54 | 55 | // DefaultLz4 is a default instance that is conveniently ready to use. 56 | var DefaultLz4 = NewLz4() 57 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/sz.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "path/filepath" 7 | 8 | "github.com/golang/snappy" 9 | ) 10 | 11 | // Snappy facilitates Snappy compression. 12 | type Snappy struct{} 13 | 14 | // Compress reads in, compresses it, and writes it to out. 15 | func (s *Snappy) Compress(in io.Reader, out io.Writer) error { 16 | w := snappy.NewWriter(out) 17 | defer w.Close() 18 | _, err := io.Copy(w, in) 19 | return err 20 | } 21 | 22 | // Decompress reads in, decompresses it, and writes it to out. 23 | func (s *Snappy) Decompress(in io.Reader, out io.Writer) error { 24 | r := snappy.NewReader(in) 25 | _, err := io.Copy(out, r) 26 | return err 27 | } 28 | 29 | // CheckExt ensures the file extension matches the format. 30 | func (s *Snappy) CheckExt(filename string) error { 31 | if filepath.Ext(filename) != ".sz" { 32 | return fmt.Errorf("filename must have a .sz extension") 33 | } 34 | return nil 35 | } 36 | 37 | func (s *Snappy) String() string { return "sz" } 38 | 39 | // NewSnappy returns a new, default instance ready to be customized and used. 40 | func NewSnappy() *Snappy { 41 | return new(Snappy) 42 | } 43 | 44 | // Compile-time checks to ensure type implements desired interfaces. 45 | var ( 46 | _ = Compressor(new(Snappy)) 47 | _ = Decompressor(new(Snappy)) 48 | ) 49 | 50 | // DefaultSnappy is a default instance that is conveniently ready to use. 51 | var DefaultSnappy = NewSnappy() 52 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/xz.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "path/filepath" 7 | 8 | "github.com/ulikunitz/xz" 9 | fastxz "github.com/xi2/xz" 10 | ) 11 | 12 | // Xz facilitates XZ compression. 13 | type Xz struct{} 14 | 15 | // Compress reads in, compresses it, and writes it to out. 16 | func (x *Xz) Compress(in io.Reader, out io.Writer) error { 17 | w, err := xz.NewWriter(out) 18 | if err != nil { 19 | return err 20 | } 21 | defer w.Close() 22 | _, err = io.Copy(w, in) 23 | return err 24 | } 25 | 26 | // Decompress reads in, decompresses it, and writes it to out. 27 | func (x *Xz) Decompress(in io.Reader, out io.Writer) error { 28 | r, err := fastxz.NewReader(in, 0) 29 | if err != nil { 30 | return err 31 | } 32 | _, err = io.Copy(out, r) 33 | return err 34 | } 35 | 36 | // CheckExt ensures the file extension matches the format. 37 | func (x *Xz) CheckExt(filename string) error { 38 | if filepath.Ext(filename) != ".xz" { 39 | return fmt.Errorf("filename must have a .xz extension") 40 | } 41 | return nil 42 | } 43 | 44 | func (x *Xz) String() string { return "xz" } 45 | 46 | // NewXz returns a new, default instance ready to be customized and used. 47 | func NewXz() *Xz { 48 | return new(Xz) 49 | } 50 | 51 | // Compile-time checks to ensure type implements desired interfaces. 52 | var ( 53 | _ = Compressor(new(Xz)) 54 | _ = Decompressor(new(Xz)) 55 | ) 56 | 57 | // DefaultXz is a default instance that is conveniently ready to use. 58 | var DefaultXz = NewXz() 59 | -------------------------------------------------------------------------------- /vendor/github.com/mholt/archiver/zstd.go: -------------------------------------------------------------------------------- 1 | package archiver 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "path/filepath" 7 | 8 | "github.com/klauspost/compress/zstd" 9 | ) 10 | 11 | // Zstd facilitates Zstandard compression. 12 | type Zstd struct { 13 | } 14 | 15 | // Compress reads in, compresses it, and writes it to out. 16 | func (zs *Zstd) Compress(in io.Reader, out io.Writer) error { 17 | w, err := zstd.NewWriter(out) 18 | if err != nil { 19 | return err 20 | } 21 | defer w.Close() 22 | _, err = io.Copy(w, in) 23 | return err 24 | } 25 | 26 | // Decompress reads in, decompresses it, and writes it to out. 27 | func (zs *Zstd) Decompress(in io.Reader, out io.Writer) error { 28 | r, err := zstd.NewReader(in) 29 | if err != nil { 30 | return err 31 | } 32 | defer r.Close() 33 | _, err = io.Copy(out, r) 34 | return err 35 | } 36 | 37 | // CheckExt ensures the file extension matches the format. 38 | func (zs *Zstd) CheckExt(filename string) error { 39 | if filepath.Ext(filename) != ".zst" { 40 | return fmt.Errorf("filename must have a .zst extension") 41 | } 42 | return nil 43 | } 44 | 45 | func (zs *Zstd) String() string { return "zstd" } 46 | 47 | // NewZstd returns a new, default instance ready to be customized and used. 48 | func NewZstd() *Zstd { 49 | return new(Zstd) 50 | } 51 | 52 | // Compile-time checks to ensure type implements desired interfaces. 53 | var ( 54 | _ = Compressor(new(Zstd)) 55 | _ = Decompressor(new(Zstd)) 56 | ) 57 | 58 | // DefaultZstd is a default instance that is conveniently ready to use. 59 | var DefaultZstd = NewZstd() 60 | -------------------------------------------------------------------------------- /vendor/github.com/nwaples/rardecode/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Nicholas Waples 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /vendor/github.com/nwaples/rardecode/README.md: -------------------------------------------------------------------------------- 1 | # rardecode 2 | [![GoDoc](https://godoc.org/github.com/nwaples/rardecode?status.svg)](https://godoc.org/github.com/nwaples/rardecode) 3 | 4 | A go package for reading RAR archives. 5 | -------------------------------------------------------------------------------- /vendor/github.com/nwaples/rardecode/decode29_ppm.go: -------------------------------------------------------------------------------- 1 | package rardecode 2 | 3 | import "io" 4 | 5 | type ppm29Decoder struct { 6 | m model // ppm model 7 | esc byte // escape character 8 | br io.ByteReader 9 | } 10 | 11 | func (d *ppm29Decoder) init(br *rarBitReader) error { 12 | maxOrder, err := br.readBits(7) 13 | if err != nil { 14 | return err 15 | } 16 | reset := maxOrder&0x20 > 0 17 | 18 | // Should have flushed all unread bits from bitReader by now, 19 | // use underlying ByteReader 20 | d.br = br.r 21 | 22 | var maxMB int 23 | if reset { 24 | c, err := d.br.ReadByte() 25 | if err != nil { 26 | return err 27 | } 28 | maxMB = int(c) + 1 29 | } 30 | 31 | if maxOrder&0x40 > 0 { 32 | d.esc, err = d.br.ReadByte() 33 | if err != nil { 34 | return err 35 | } 36 | } 37 | 38 | maxOrder = (maxOrder & 0x1f) + 1 39 | if maxOrder > 16 { 40 | maxOrder = 16 + (maxOrder-16)*3 41 | } 42 | 43 | return d.m.init(d.br, reset, maxOrder, maxMB) 44 | } 45 | 46 | func (d *ppm29Decoder) reset() { 47 | d.esc = 2 48 | } 49 | 50 | func (d *ppm29Decoder) readFilterData() ([]byte, error) { 51 | c, err := d.m.ReadByte() 52 | if err != nil { 53 | return nil, err 54 | } 55 | n := int(c&7) + 1 56 | if n == 7 { 57 | b, err := d.m.ReadByte() 58 | if err != nil { 59 | return nil, err 60 | } 61 | n += int(b) 62 | } else if n == 8 { 63 | b, err := d.m.ReadByte() 64 | if err != nil { 65 | return nil, err 66 | } 67 | n = int(b) << 8 68 | b, err = d.m.ReadByte() 69 | if err != nil { 70 | return nil, err 71 | } 72 | n |= int(b) 73 | } 74 | 75 | n++ 76 | buf := make([]byte, n) 77 | buf[0] = byte(c) 78 | for i := 1; i < n; i++ { 79 | buf[i], err = d.m.ReadByte() 80 | if err != nil { 81 | return nil, err 82 | } 83 | } 84 | return buf, nil 85 | } 86 | 87 | func (d *ppm29Decoder) decode(w *window) ([]byte, error) { 88 | c, err := d.m.ReadByte() 89 | if err != nil { 90 | return nil, err 91 | } 92 | if c != d.esc { 93 | w.writeByte(c) 94 | return nil, nil 95 | } 96 | c, err = d.m.ReadByte() 97 | if err != nil { 98 | return nil, err 99 | } 100 | 101 | switch c { 102 | case 0: 103 | return nil, endOfBlock 104 | case 2: 105 | return nil, endOfBlockAndFile 106 | case 3: 107 | return d.readFilterData() 108 | case 4: 109 | offset := 0 110 | for i := 0; i < 3; i++ { 111 | c, err = d.m.ReadByte() 112 | if err != nil { 113 | return nil, err 114 | } 115 | offset = offset<<8 | int(c) 116 | } 117 | len, err := d.m.ReadByte() 118 | if err != nil { 119 | return nil, err 120 | } 121 | w.copyBytes(int(len)+32, offset+2) 122 | case 5: 123 | len, err := d.m.ReadByte() 124 | if err != nil { 125 | return nil, err 126 | } 127 | w.copyBytes(int(len)+4, 1) 128 | default: 129 | w.writeByte(d.esc) 130 | } 131 | return nil, nil 132 | } 133 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/macos 2 | 3 | ### macOS ### 4 | *.DS_Store 5 | .AppleDouble 6 | .LSOverride 7 | 8 | # Icon must end with two \r 9 | Icon 10 | 11 | 12 | # Thumbnails 13 | ._* 14 | 15 | # Files that might appear in the root of a volume 16 | .DocumentRevisions-V100 17 | .fseventsd 18 | .Spotlight-V100 19 | .TemporaryItems 20 | .Trashes 21 | .VolumeIcon.icns 22 | .com.apple.timemachine.donotpresent 23 | 24 | # Directories potentially created on remote AFP share 25 | .AppleDB 26 | .AppleDesktop 27 | Network Trash Folder 28 | Temporary Items 29 | .apdisk 30 | 31 | # End of https://www.gitignore.io/api/macos 32 | 33 | cmd/*/*exe 34 | .idea -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | env: 4 | - GO111MODULE=off 5 | 6 | go: 7 | - 1.9.x 8 | - 1.10.x 9 | - 1.11.x 10 | - 1.12.x 11 | - master 12 | 13 | matrix: 14 | fast_finish: true 15 | allow_failures: 16 | - go: master 17 | 18 | sudo: false 19 | 20 | script: 21 | - go test -v -cpu=2 22 | - go test -v -cpu=2 -race 23 | - go test -v -cpu=2 -tags noasm 24 | - go test -v -cpu=2 -race -tags noasm 25 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Pierre Curto 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of xxHash nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/README.md: -------------------------------------------------------------------------------- 1 | # lz4 : LZ4 compression in pure Go 2 | 3 | [![GoDoc](https://godoc.org/github.com/pierrec/lz4?status.svg)](https://godoc.org/github.com/pierrec/lz4) 4 | [![Build Status](https://travis-ci.org/pierrec/lz4.svg?branch=master)](https://travis-ci.org/pierrec/lz4) 5 | [![Go Report Card](https://goreportcard.com/badge/github.com/pierrec/lz4)](https://goreportcard.com/report/github.com/pierrec/lz4) 6 | [![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/pierrec/lz4.svg?style=social)](https://github.com/pierrec/lz4/tags) 7 | 8 | ## Overview 9 | 10 | This package provides a streaming interface to [LZ4 data streams](http://fastcompression.blogspot.fr/2013/04/lz4-streaming-format-final.html) as well as low level compress and uncompress functions for LZ4 data blocks. 11 | The implementation is based on the reference C [one](https://github.com/lz4/lz4). 12 | 13 | ## Install 14 | 15 | Assuming you have the go toolchain installed: 16 | 17 | ``` 18 | go get github.com/pierrec/lz4 19 | ``` 20 | 21 | There is a command line interface tool to compress and decompress LZ4 files. 22 | 23 | ``` 24 | go install github.com/pierrec/lz4/cmd/lz4c 25 | ``` 26 | 27 | Usage 28 | 29 | ``` 30 | Usage of lz4c: 31 | -version 32 | print the program version 33 | 34 | Subcommands: 35 | Compress the given files or from stdin to stdout. 36 | compress [arguments] [ ...] 37 | -bc 38 | enable block checksum 39 | -l int 40 | compression level (0=fastest) 41 | -sc 42 | disable stream checksum 43 | -size string 44 | block max size [64K,256K,1M,4M] (default "4M") 45 | 46 | Uncompress the given files or from stdin to stdout. 47 | uncompress [arguments] [ ...] 48 | 49 | ``` 50 | 51 | 52 | ## Example 53 | 54 | ``` 55 | // Compress and uncompress an input string. 56 | s := "hello world" 57 | r := strings.NewReader(s) 58 | 59 | // The pipe will uncompress the data from the writer. 60 | pr, pw := io.Pipe() 61 | zw := lz4.NewWriter(pw) 62 | zr := lz4.NewReader(pr) 63 | 64 | go func() { 65 | // Compress the input string. 66 | _, _ = io.Copy(zw, r) 67 | _ = zw.Close() // Make sure the writer is closed 68 | _ = pw.Close() // Terminate the pipe 69 | }() 70 | 71 | _, _ = io.Copy(os.Stdout, zr) 72 | 73 | // Output: 74 | // hello world 75 | ``` 76 | 77 | ## Contributing 78 | 79 | Contributions are very welcome for bug fixing, performance improvements...! 80 | 81 | - Open an issue with a proper description 82 | - Send a pull request with appropriate test case(s) 83 | 84 | ## Contributors 85 | 86 | Thanks to all [contributors](https://github.com/pierrec/lz4/graphs/contributors) so far! 87 | 88 | Special thanks to [@Zariel](https://github.com/Zariel) for his asm implementation of the decoder. 89 | 90 | Special thanks to [@klauspost](https://github.com/klauspost) for his work on optimizing the code. 91 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/debug.go: -------------------------------------------------------------------------------- 1 | // +build lz4debug 2 | 3 | package lz4 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "path/filepath" 9 | "runtime" 10 | ) 11 | 12 | const debugFlag = true 13 | 14 | func debug(args ...interface{}) { 15 | _, file, line, _ := runtime.Caller(1) 16 | file = filepath.Base(file) 17 | 18 | f := fmt.Sprintf("LZ4: %s:%d %s", file, line, args[0]) 19 | if f[len(f)-1] != '\n' { 20 | f += "\n" 21 | } 22 | fmt.Fprintf(os.Stderr, f, args[1:]...) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/debug_stub.go: -------------------------------------------------------------------------------- 1 | // +build !lz4debug 2 | 3 | package lz4 4 | 5 | const debugFlag = false 6 | 7 | func debug(args ...interface{}) {} 8 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/decode_amd64.go: -------------------------------------------------------------------------------- 1 | // +build !appengine 2 | // +build gc 3 | // +build !noasm 4 | 5 | package lz4 6 | 7 | //go:noescape 8 | func decodeBlock(dst, src []byte) int 9 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/decode_other.go: -------------------------------------------------------------------------------- 1 | // +build !amd64 appengine !gc noasm 2 | 3 | package lz4 4 | 5 | func decodeBlock(dst, src []byte) (ret int) { 6 | const hasError = -2 7 | defer func() { 8 | if recover() != nil { 9 | ret = hasError 10 | } 11 | }() 12 | 13 | var si, di int 14 | for { 15 | // Literals and match lengths (token). 16 | b := int(src[si]) 17 | si++ 18 | 19 | // Literals. 20 | if lLen := b >> 4; lLen > 0 { 21 | switch { 22 | case lLen < 0xF && si+16 < len(src): 23 | // Shortcut 1 24 | // if we have enough room in src and dst, and the literals length 25 | // is small enough (0..14) then copy all 16 bytes, even if not all 26 | // are part of the literals. 27 | copy(dst[di:], src[si:si+16]) 28 | si += lLen 29 | di += lLen 30 | if mLen := b & 0xF; mLen < 0xF { 31 | // Shortcut 2 32 | // if the match length (4..18) fits within the literals, then copy 33 | // all 18 bytes, even if not all are part of the literals. 34 | mLen += 4 35 | if offset := int(src[si]) | int(src[si+1])<<8; mLen <= offset { 36 | i := di - offset 37 | end := i + 18 38 | if end > len(dst) { 39 | // The remaining buffer may not hold 18 bytes. 40 | // See https://github.com/pierrec/lz4/issues/51. 41 | end = len(dst) 42 | } 43 | copy(dst[di:], dst[i:end]) 44 | si += 2 45 | di += mLen 46 | continue 47 | } 48 | } 49 | case lLen == 0xF: 50 | for src[si] == 0xFF { 51 | lLen += 0xFF 52 | si++ 53 | } 54 | lLen += int(src[si]) 55 | si++ 56 | fallthrough 57 | default: 58 | copy(dst[di:di+lLen], src[si:si+lLen]) 59 | si += lLen 60 | di += lLen 61 | } 62 | } 63 | if si >= len(src) { 64 | return di 65 | } 66 | 67 | offset := int(src[si]) | int(src[si+1])<<8 68 | if offset == 0 { 69 | return hasError 70 | } 71 | si += 2 72 | 73 | // Match. 74 | mLen := b & 0xF 75 | if mLen == 0xF { 76 | for src[si] == 0xFF { 77 | mLen += 0xFF 78 | si++ 79 | } 80 | mLen += int(src[si]) 81 | si++ 82 | } 83 | mLen += minMatch 84 | 85 | // Copy the match. 86 | expanded := dst[di-offset:] 87 | if mLen > offset { 88 | // Efficiently copy the match dst[di-offset:di] into the dst slice. 89 | bytesToCopy := offset * (mLen / offset) 90 | for n := offset; n <= bytesToCopy+offset; n *= 2 { 91 | copy(expanded[n:], expanded[:n]) 92 | } 93 | di += bytesToCopy 94 | mLen -= bytesToCopy 95 | } 96 | di += copy(dst[di:di+mLen], expanded[:mLen]) 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/errors.go: -------------------------------------------------------------------------------- 1 | package lz4 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "os" 7 | rdebug "runtime/debug" 8 | ) 9 | 10 | var ( 11 | // ErrInvalidSourceShortBuffer is returned by UncompressBlock or CompressBLock when a compressed 12 | // block is corrupted or the destination buffer is not large enough for the uncompressed data. 13 | ErrInvalidSourceShortBuffer = errors.New("lz4: invalid source or destination buffer too short") 14 | // ErrInvalid is returned when reading an invalid LZ4 archive. 15 | ErrInvalid = errors.New("lz4: bad magic number") 16 | // ErrBlockDependency is returned when attempting to decompress an archive created with block dependency. 17 | ErrBlockDependency = errors.New("lz4: block dependency not supported") 18 | // ErrUnsupportedSeek is returned when attempting to Seek any way but forward from the current position. 19 | ErrUnsupportedSeek = errors.New("lz4: can only seek forward from io.SeekCurrent") 20 | ) 21 | 22 | func recoverBlock(e *error) { 23 | if r := recover(); r != nil && *e == nil { 24 | if debugFlag { 25 | fmt.Fprintln(os.Stderr, r) 26 | rdebug.PrintStack() 27 | } 28 | *e = ErrInvalidSourceShortBuffer 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/lz4_go1.10.go: -------------------------------------------------------------------------------- 1 | //+build go1.10 2 | 3 | package lz4 4 | 5 | import ( 6 | "fmt" 7 | "strings" 8 | ) 9 | 10 | func (h Header) String() string { 11 | var s strings.Builder 12 | 13 | s.WriteString(fmt.Sprintf("%T{", h)) 14 | if h.BlockChecksum { 15 | s.WriteString("BlockChecksum: true ") 16 | } 17 | if h.NoChecksum { 18 | s.WriteString("NoChecksum: true ") 19 | } 20 | if bs := h.BlockMaxSize; bs != 0 && bs != 4<<20 { 21 | s.WriteString(fmt.Sprintf("BlockMaxSize: %d ", bs)) 22 | } 23 | if l := h.CompressionLevel; l != 0 { 24 | s.WriteString(fmt.Sprintf("CompressionLevel: %d ", l)) 25 | } 26 | s.WriteByte('}') 27 | 28 | return s.String() 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/pierrec/lz4/lz4_notgo1.10.go: -------------------------------------------------------------------------------- 1 | //+build !go1.10 2 | 3 | package lz4 4 | 5 | import ( 6 | "bytes" 7 | "fmt" 8 | ) 9 | 10 | func (h Header) String() string { 11 | var s bytes.Buffer 12 | 13 | s.WriteString(fmt.Sprintf("%T{", h)) 14 | if h.BlockChecksum { 15 | s.WriteString("BlockChecksum: true ") 16 | } 17 | if h.NoChecksum { 18 | s.WriteString("NoChecksum: true ") 19 | } 20 | if bs := h.BlockMaxSize; bs != 0 && bs != 4<<20 { 21 | s.WriteString(fmt.Sprintf("BlockMaxSize: %d ", bs)) 22 | } 23 | if l := h.CompressionLevel; l != 0 { 24 | s.WriteString(fmt.Sprintf("CompressionLevel: %d ", l)) 25 | } 26 | s.WriteByte('}') 27 | 28 | return s.String() 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/pmezard/go-difflib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go: -------------------------------------------------------------------------------- 1 | //go:build go1.17 2 | // +build go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_legacy.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Wrapper around reflect.Value.CanConvert, for compatibility 13 | // reasons. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return value.CanConvert(to) 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go: -------------------------------------------------------------------------------- 1 | //go:build !go1.17 2 | // +build !go1.17 3 | 4 | // TODO: once support for Go 1.16 is dropped, this file can be 5 | // merged/removed with assertion_compare_go1.17_test.go and 6 | // assertion_compare_can_convert.go 7 | 8 | package assert 9 | 10 | import "reflect" 11 | 12 | // Older versions of Go does not have the reflect.Value.CanConvert 13 | // method. 14 | func canConvert(value reflect.Value, to reflect.Type) bool { 15 | return false 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentFormat}} 2 | func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/doc.go: -------------------------------------------------------------------------------- 1 | // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. 2 | // 3 | // # Example Usage 4 | // 5 | // The following is a complete example using assert in a standard test function: 6 | // 7 | // import ( 8 | // "testing" 9 | // "github.com/stretchr/testify/assert" 10 | // ) 11 | // 12 | // func TestSomething(t *testing.T) { 13 | // 14 | // var a string = "Hello" 15 | // var b string = "Hello" 16 | // 17 | // assert.Equal(t, a, b, "The two words should be the same.") 18 | // 19 | // } 20 | // 21 | // if you assert many times, use the format below: 22 | // 23 | // import ( 24 | // "testing" 25 | // "github.com/stretchr/testify/assert" 26 | // ) 27 | // 28 | // func TestSomething(t *testing.T) { 29 | // assert := assert.New(t) 30 | // 31 | // var a string = "Hello" 32 | // var b string = "Hello" 33 | // 34 | // assert.Equal(a, b, "The two words should be the same.") 35 | // } 36 | // 37 | // # Assertions 38 | // 39 | // Assertions allow you to easily write test code, and are global funcs in the `assert` package. 40 | // All assertion functions take, as the first argument, the `*testing.T` object provided by the 41 | // testing framework. This allows the assertion funcs to write the failings and other details to 42 | // the correct place. 43 | // 44 | // Every assertion function also takes an optional string message as the final argument, 45 | // allowing custom error messages to be appended to the message the assertion method outputs. 46 | package assert 47 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/errors.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | import ( 4 | "errors" 5 | ) 6 | 7 | // AnError is an error instance useful for testing. If the code does not care 8 | // about error specifics, and only needs to return the error for example, this 9 | // error should be used to make the test code more readable. 10 | var AnError = errors.New("assert.AnError general error for testing") 11 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/assert/forward_assertions.go: -------------------------------------------------------------------------------- 1 | package assert 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/require/doc.go: -------------------------------------------------------------------------------- 1 | // Package require implements the same assertions as the `assert` package but 2 | // stops test execution when a test fails. 3 | // 4 | // # Example Usage 5 | // 6 | // The following is a complete example using require in a standard test function: 7 | // 8 | // import ( 9 | // "testing" 10 | // "github.com/stretchr/testify/require" 11 | // ) 12 | // 13 | // func TestSomething(t *testing.T) { 14 | // 15 | // var a string = "Hello" 16 | // var b string = "Hello" 17 | // 18 | // require.Equal(t, a, b, "The two words should be the same.") 19 | // 20 | // } 21 | // 22 | // # Assertions 23 | // 24 | // The `require` package have same global functions as in the `assert` package, 25 | // but instead of returning a boolean result they call `t.FailNow()`. 26 | // 27 | // Every assertion function also takes an optional string message as the final argument, 28 | // allowing custom error messages to be appended to the message the assertion method outputs. 29 | package require 30 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/require/forward_requirements.go: -------------------------------------------------------------------------------- 1 | package require 2 | 3 | // Assertions provides assertion methods around the 4 | // TestingT interface. 5 | type Assertions struct { 6 | t TestingT 7 | } 8 | 9 | // New makes a new Assertions object for the specified TestingT. 10 | func New(t TestingT) *Assertions { 11 | return &Assertions{ 12 | t: t, 13 | } 14 | } 15 | 16 | //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require_forward.go.tmpl -include-format-funcs" 17 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/require/require.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.Comment}} 2 | func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { 3 | if h, ok := t.(tHelper); ok { h.Helper() } 4 | if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return } 5 | t.FailNow() 6 | } 7 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/require/require_forward.go.tmpl: -------------------------------------------------------------------------------- 1 | {{.CommentWithoutT "a"}} 2 | func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) { 3 | if h, ok := a.t.(tHelper); ok { h.Helper() } 4 | {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/stretchr/testify/require/requirements.go: -------------------------------------------------------------------------------- 1 | package require 2 | 3 | // TestingT is an interface wrapper around *testing.T 4 | type TestingT interface { 5 | Errorf(format string, args ...interface{}) 6 | FailNow() 7 | } 8 | 9 | type tHelper interface { 10 | Helper() 11 | } 12 | 13 | // ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful 14 | // for table driven tests. 15 | type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) 16 | 17 | // ValueAssertionFunc is a common function prototype when validating a single value. Can be useful 18 | // for table driven tests. 19 | type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) 20 | 21 | // BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful 22 | // for table driven tests. 23 | type BoolAssertionFunc func(TestingT, bool, ...interface{}) 24 | 25 | // ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful 26 | // for table driven tests. 27 | type ErrorAssertionFunc func(TestingT, error, ...interface{}) 28 | 29 | //go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require.go.tmpl -include-format-funcs" 30 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/.gitignore: -------------------------------------------------------------------------------- 1 | # .gitignore 2 | 3 | TODO.html 4 | README.html 5 | 6 | lzma/writer.txt 7 | lzma/reader.txt 8 | 9 | cmd/gxz/gxz 10 | cmd/xb/xb 11 | 12 | # test executables 13 | *.test 14 | 15 | # profile files 16 | *.out 17 | 18 | # vim swap file 19 | .*.swp 20 | 21 | # executables on windows 22 | *.exe 23 | 24 | # default compression test file 25 | enwik8* 26 | 27 | # file generated by example 28 | example.xz -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2022 Ulrich Kunitz 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * My name, Ulrich Kunitz, may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Currently the last minor version v0.5.x is supported. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | You can privately report a vulnerability following this 10 | [procedure](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability#privately-reporting-a-security-vulnerability). 11 | Alternatively you can create a Github issue at 12 | . 13 | 14 | In both cases expect a response in at least 7 days. 15 | 16 | ## Security Advisories 17 | 18 | All security advisories for this project are published under 19 | [github.com/ulikunitz/xz/security/advisories](https://github.com/ulikunitz/xz/security/advisories?state=published). 20 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/bits.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package xz 6 | 7 | import ( 8 | "errors" 9 | "io" 10 | ) 11 | 12 | // putUint32LE puts the little-endian representation of x into the first 13 | // four bytes of p. 14 | func putUint32LE(p []byte, x uint32) { 15 | p[0] = byte(x) 16 | p[1] = byte(x >> 8) 17 | p[2] = byte(x >> 16) 18 | p[3] = byte(x >> 24) 19 | } 20 | 21 | // putUint64LE puts the little-endian representation of x into the first 22 | // eight bytes of p. 23 | func putUint64LE(p []byte, x uint64) { 24 | p[0] = byte(x) 25 | p[1] = byte(x >> 8) 26 | p[2] = byte(x >> 16) 27 | p[3] = byte(x >> 24) 28 | p[4] = byte(x >> 32) 29 | p[5] = byte(x >> 40) 30 | p[6] = byte(x >> 48) 31 | p[7] = byte(x >> 56) 32 | } 33 | 34 | // uint32LE converts a little endian representation to an uint32 value. 35 | func uint32LE(p []byte) uint32 { 36 | return uint32(p[0]) | uint32(p[1])<<8 | uint32(p[2])<<16 | 37 | uint32(p[3])<<24 38 | } 39 | 40 | // putUvarint puts a uvarint representation of x into the byte slice. 41 | func putUvarint(p []byte, x uint64) int { 42 | i := 0 43 | for x >= 0x80 { 44 | p[i] = byte(x) | 0x80 45 | x >>= 7 46 | i++ 47 | } 48 | p[i] = byte(x) 49 | return i + 1 50 | } 51 | 52 | // errOverflow indicates an overflow of the 64-bit unsigned integer. 53 | var errOverflowU64 = errors.New("xz: uvarint overflows 64-bit unsigned integer") 54 | 55 | // readUvarint reads a uvarint from the given byte reader. 56 | func readUvarint(r io.ByteReader) (x uint64, n int, err error) { 57 | const maxUvarintLen = 10 58 | 59 | var s uint 60 | i := 0 61 | for { 62 | b, err := r.ReadByte() 63 | if err != nil { 64 | return x, i, err 65 | } 66 | i++ 67 | if i > maxUvarintLen { 68 | return x, i, errOverflowU64 69 | } 70 | if b < 0x80 { 71 | if i == maxUvarintLen && b > 1 { 72 | return x, i, errOverflowU64 73 | } 74 | return x | uint64(b)<>27]) 29 | } 30 | */ 31 | 32 | // nlz32 computes the number of leading zeros for an unsigned 32-bit integer. 33 | func nlz32(x uint32) int { 34 | // Smear left most bit to the right 35 | x |= x >> 1 36 | x |= x >> 2 37 | x |= x >> 4 38 | x |= x >> 8 39 | x |= x >> 16 40 | // Use ntz mechanism to calculate nlz. 41 | x++ 42 | if x == 0 { 43 | return 0 44 | } 45 | x *= ntz32Const 46 | return 32 - int(ntz32Table[x>>27]) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/breader.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lzma 6 | 7 | import ( 8 | "errors" 9 | "io" 10 | ) 11 | 12 | // breader provides the ReadByte function for a Reader. It doesn't read 13 | // more data from the reader than absolutely necessary. 14 | type breader struct { 15 | io.Reader 16 | // helper slice to save allocations 17 | p []byte 18 | } 19 | 20 | // ByteReader converts an io.Reader into an io.ByteReader. 21 | func ByteReader(r io.Reader) io.ByteReader { 22 | br, ok := r.(io.ByteReader) 23 | if !ok { 24 | return &breader{r, make([]byte, 1)} 25 | } 26 | return br 27 | } 28 | 29 | // ReadByte read byte function. 30 | func (r *breader) ReadByte() (c byte, err error) { 31 | n, err := r.Reader.Read(r.p) 32 | if n < 1 { 33 | if err == nil { 34 | err = errors.New("breader.ReadByte: no data") 35 | } 36 | return 0, err 37 | } 38 | return r.p[0], nil 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/bytewriter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lzma 6 | 7 | import ( 8 | "errors" 9 | "io" 10 | ) 11 | 12 | // ErrLimit indicates that the limit of the LimitedByteWriter has been 13 | // reached. 14 | var ErrLimit = errors.New("limit reached") 15 | 16 | // LimitedByteWriter provides a byte writer that can be written until a 17 | // limit is reached. The field N provides the number of remaining 18 | // bytes. 19 | type LimitedByteWriter struct { 20 | BW io.ByteWriter 21 | N int64 22 | } 23 | 24 | // WriteByte writes a single byte to the limited byte writer. It returns 25 | // ErrLimit if the limit has been reached. If the byte is successfully 26 | // written the field N of the LimitedByteWriter will be decremented by 27 | // one. 28 | func (l *LimitedByteWriter) WriteByte(c byte) error { 29 | if l.N <= 0 { 30 | return ErrLimit 31 | } 32 | if err := l.BW.WriteByte(c); err != nil { 33 | return err 34 | } 35 | l.N-- 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/directcodec.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lzma 6 | 7 | // directCodec allows the encoding and decoding of values with a fixed number 8 | // of bits. The number of bits must be in the range [1,32]. 9 | type directCodec byte 10 | 11 | // Bits returns the number of bits supported by this codec. 12 | func (dc directCodec) Bits() int { 13 | return int(dc) 14 | } 15 | 16 | // Encode uses the range encoder to encode a value with the fixed number of 17 | // bits. The most-significant bit is encoded first. 18 | func (dc directCodec) Encode(e *rangeEncoder, v uint32) error { 19 | for i := int(dc) - 1; i >= 0; i-- { 20 | if err := e.DirectEncodeBit(v >> uint(i)); err != nil { 21 | return err 22 | } 23 | } 24 | return nil 25 | } 26 | 27 | // Decode uses the range decoder to decode a value with the given number of 28 | // given bits. The most-significant bit is decoded first. 29 | func (dc directCodec) Decode(d *rangeDecoder) (v uint32, err error) { 30 | for i := int(dc) - 1; i >= 0; i-- { 31 | x, err := d.DirectDecodeBit() 32 | if err != nil { 33 | return 0, err 34 | } 35 | v = (v << 1) | x 36 | } 37 | return v, nil 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/fox.lzma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DroidsOnRoids/bitrise-step-flutter/add8cc531d26dcb7726cb2dfa5ba61bd97888fad/vendor/github.com/ulikunitz/xz/lzma/fox.lzma -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/matchalgorithm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lzma 6 | 7 | import "errors" 8 | 9 | // MatchAlgorithm identifies an algorithm to find matches in the 10 | // dictionary. 11 | type MatchAlgorithm byte 12 | 13 | // Supported matcher algorithms. 14 | const ( 15 | HashTable4 MatchAlgorithm = iota 16 | BinaryTree 17 | ) 18 | 19 | // maStrings are used by the String method. 20 | var maStrings = map[MatchAlgorithm]string{ 21 | HashTable4: "HashTable4", 22 | BinaryTree: "BinaryTree", 23 | } 24 | 25 | // String returns a string representation of the Matcher. 26 | func (a MatchAlgorithm) String() string { 27 | if s, ok := maStrings[a]; ok { 28 | return s 29 | } 30 | return "unknown" 31 | } 32 | 33 | var errUnsupportedMatchAlgorithm = errors.New( 34 | "lzma: unsupported match algorithm value") 35 | 36 | // verify checks whether the matcher value is supported. 37 | func (a MatchAlgorithm) verify() error { 38 | if _, ok := maStrings[a]; !ok { 39 | return errUnsupportedMatchAlgorithm 40 | } 41 | return nil 42 | } 43 | 44 | func (a MatchAlgorithm) new(dictCap int) (m matcher, err error) { 45 | switch a { 46 | case HashTable4: 47 | return newHashTable(dictCap, 4) 48 | case BinaryTree: 49 | return newBinTree(dictCap) 50 | } 51 | return nil, errUnsupportedMatchAlgorithm 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/operation.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lzma 6 | 7 | import ( 8 | "fmt" 9 | "unicode" 10 | ) 11 | 12 | // operation represents an operation on the dictionary during encoding or 13 | // decoding. 14 | type operation interface { 15 | Len() int 16 | } 17 | 18 | // rep represents a repetition at the given distance and the given length 19 | type match struct { 20 | // supports all possible distance values, including the eos marker 21 | distance int64 22 | // length 23 | n int 24 | } 25 | 26 | // Len returns the number of bytes matched. 27 | func (m match) Len() int { 28 | return m.n 29 | } 30 | 31 | // String returns a string representation for the repetition. 32 | func (m match) String() string { 33 | return fmt.Sprintf("M{%d,%d}", m.distance, m.n) 34 | } 35 | 36 | // lit represents a single byte literal. 37 | type lit struct { 38 | b byte 39 | } 40 | 41 | // Len returns 1 for the single byte literal. 42 | func (l lit) Len() int { 43 | return 1 44 | } 45 | 46 | // String returns a string representation for the literal. 47 | func (l lit) String() string { 48 | var c byte 49 | if unicode.IsPrint(rune(l.b)) { 50 | c = l.b 51 | } else { 52 | c = '.' 53 | } 54 | return fmt.Sprintf("L{%c/%02x}", c, l.b) 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/prob.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lzma 6 | 7 | // movebits defines the number of bits used for the updates of probability 8 | // values. 9 | const movebits = 5 10 | 11 | // probbits defines the number of bits of a probability value. 12 | const probbits = 11 13 | 14 | // probInit defines 0.5 as initial value for prob values. 15 | const probInit prob = 1 << (probbits - 1) 16 | 17 | // Type prob represents probabilities. The type can also be used to encode and 18 | // decode single bits. 19 | type prob uint16 20 | 21 | // Dec decreases the probability. The decrease is proportional to the 22 | // probability value. 23 | func (p *prob) dec() { 24 | *p -= *p >> movebits 25 | } 26 | 27 | // Inc increases the probability. The Increase is proportional to the 28 | // difference of 1 and the probability value. 29 | func (p *prob) inc() { 30 | *p += ((1 << probbits) - *p) >> movebits 31 | } 32 | 33 | // Computes the new bound for a given range using the probability value. 34 | func (p prob) bound(r uint32) uint32 { 35 | return (r >> probbits) * uint32(p) 36 | } 37 | 38 | // Bits returns 1. One is the number of bits that can be encoded or decoded 39 | // with a single prob value. 40 | func (p prob) Bits() int { 41 | return 1 42 | } 43 | 44 | // Encode encodes the least-significant bit of v. Note that the p value will be 45 | // changed. 46 | func (p *prob) Encode(e *rangeEncoder, v uint32) error { 47 | return e.EncodeBit(v, p) 48 | } 49 | 50 | // Decode decodes a single bit. Note that the p value will change. 51 | func (p *prob) Decode(d *rangeDecoder) (v uint32, err error) { 52 | return d.DecodeBit(p) 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/lzma/properties.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package lzma 6 | 7 | import ( 8 | "errors" 9 | "fmt" 10 | ) 11 | 12 | // maximum and minimum values for the LZMA properties. 13 | const ( 14 | minPB = 0 15 | maxPB = 4 16 | ) 17 | 18 | // maxPropertyCode is the possible maximum of a properties code byte. 19 | const maxPropertyCode = (maxPB+1)*(maxLP+1)*(maxLC+1) - 1 20 | 21 | // Properties contains the parameters LC, LP and PB. The parameter LC 22 | // defines the number of literal context bits; parameter LP the number 23 | // of literal position bits and PB the number of position bits. 24 | type Properties struct { 25 | LC int 26 | LP int 27 | PB int 28 | } 29 | 30 | // String returns the properties in a string representation. 31 | func (p *Properties) String() string { 32 | return fmt.Sprintf("LC %d LP %d PB %d", p.LC, p.LP, p.PB) 33 | } 34 | 35 | // PropertiesForCode converts a properties code byte into a Properties value. 36 | func PropertiesForCode(code byte) (p Properties, err error) { 37 | if code > maxPropertyCode { 38 | return p, errors.New("lzma: invalid properties code") 39 | } 40 | p.LC = int(code % 9) 41 | code /= 9 42 | p.LP = int(code % 5) 43 | code /= 5 44 | p.PB = int(code % 5) 45 | return p, err 46 | } 47 | 48 | // verify checks the properties for correctness. 49 | func (p *Properties) verify() error { 50 | if p == nil { 51 | return errors.New("lzma: properties are nil") 52 | } 53 | if !(minLC <= p.LC && p.LC <= maxLC) { 54 | return errors.New("lzma: lc out of range") 55 | } 56 | if !(minLP <= p.LP && p.LP <= maxLP) { 57 | return errors.New("lzma: lp out of range") 58 | } 59 | if !(minPB <= p.PB && p.PB <= maxPB) { 60 | return errors.New("lzma: pb out of range") 61 | } 62 | return nil 63 | } 64 | 65 | // Code converts the properties to a byte. The function assumes that 66 | // the properties components are all in range. 67 | func (p Properties) Code() byte { 68 | return byte((p.PB*5+p.LP)*9 + p.LC) 69 | } 70 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/make-docs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | pandoc -t html5 -f markdown -s --css=doc/md.css -o README.html README.md 5 | pandoc -t html5 -f markdown -s --css=doc/md.css -o TODO.html TODO.md 6 | -------------------------------------------------------------------------------- /vendor/github.com/ulikunitz/xz/none-check.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014-2022 Ulrich Kunitz. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package xz 6 | 7 | import "hash" 8 | 9 | type noneHash struct{} 10 | 11 | func (h noneHash) Write(p []byte) (n int, err error) { return len(p), nil } 12 | 13 | func (h noneHash) Sum(b []byte) []byte { return b } 14 | 15 | func (h noneHash) Reset() {} 16 | 17 | func (h noneHash) Size() int { return 0 } 18 | 19 | func (h noneHash) BlockSize() int { return 0 } 20 | 21 | func newNoneHash() hash.Hash { 22 | return &noneHash{} 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/xi2/xz/AUTHORS: -------------------------------------------------------------------------------- 1 | # Package xz authors 2 | 3 | Michael Cross 4 | 5 | # XZ Embedded authors 6 | 7 | Lasse Collin 8 | Igor Pavlov 9 | -------------------------------------------------------------------------------- /vendor/github.com/xi2/xz/LICENSE: -------------------------------------------------------------------------------- 1 | Licensing of github.com/xi2/xz 2 | ============================== 3 | 4 | This Go package is a modified version of 5 | 6 | XZ Embedded 7 | 8 | The contents of the testdata directory are modified versions of 9 | the test files from 10 | 11 | XZ Utils 12 | 13 | All the files in this package have been written by Michael Cross, 14 | Lasse Collin and/or Igor PavLov. All these files have been put 15 | into the public domain. You can do whatever you want with these 16 | files. 17 | 18 | This software is provided "as is", without any warranty. 19 | -------------------------------------------------------------------------------- /vendor/github.com/xi2/xz/README.md: -------------------------------------------------------------------------------- 1 | # Xz 2 | 3 | Package xz implements XZ decompression natively in Go. 4 | 5 | Documentation at . 6 | 7 | Download and install with `go get github.com/xi2/xz`. 8 | 9 | If you need compression as well as decompression, you might want to 10 | look at . 11 | -------------------------------------------------------------------------------- /vendor/github.com/xi2/xz/dec_delta.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Delta decoder 3 | * 4 | * Author: Lasse Collin 5 | * 6 | * Translation to Go: Michael Cross 7 | * 8 | * This file has been put into the public domain. 9 | * You can do whatever you want with this file. 10 | */ 11 | 12 | package xz 13 | 14 | type xzDecDelta struct { 15 | delta [256]byte 16 | pos byte 17 | distance int // in range [1, 256] 18 | } 19 | 20 | /* 21 | * Decode raw stream which has a delta filter as the first filter. 22 | */ 23 | func xzDecDeltaRun(s *xzDecDelta, b *xzBuf, chain func(*xzBuf) xzRet) xzRet { 24 | outStart := b.outPos 25 | ret := chain(b) 26 | for i := outStart; i < b.outPos; i++ { 27 | tmp := b.out[i] + s.delta[byte(s.distance+int(s.pos))] 28 | s.delta[s.pos] = tmp 29 | b.out[i] = tmp 30 | s.pos-- 31 | } 32 | return ret 33 | } 34 | 35 | /* 36 | * Allocate memory for a delta decoder. xzDecDeltaReset must be used 37 | * before calling xzDecDeltaRun. 38 | */ 39 | func xzDecDeltaCreate() *xzDecDelta { 40 | return new(xzDecDelta) 41 | } 42 | 43 | /* 44 | * Returns xzOK if the given distance is valid. Otherwise 45 | * xzOptionsError is returned. 46 | */ 47 | func xzDecDeltaReset(s *xzDecDelta, distance int) xzRet { 48 | if distance < 1 || distance > 256 { 49 | return xzOptionsError 50 | } 51 | s.delta = [256]byte{} 52 | s.pos = 0 53 | s.distance = distance 54 | return xzOK 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/xi2/xz/dec_util.go: -------------------------------------------------------------------------------- 1 | /* 2 | * XZ decompressor utility functions 3 | * 4 | * Author: Michael Cross 5 | * 6 | * This file has been put into the public domain. 7 | * You can do whatever you want with this file. 8 | */ 9 | 10 | package xz 11 | 12 | func getLE32(buf []byte) uint32 { 13 | return uint32(buf[0]) | 14 | uint32(buf[1])<<8 | 15 | uint32(buf[2])<<16 | 16 | uint32(buf[3])<<24 17 | } 18 | 19 | func getBE32(buf []byte) uint32 { 20 | return uint32(buf[0])<<24 | 21 | uint32(buf[1])<<16 | 22 | uint32(buf[2])<<8 | 23 | uint32(buf[3]) 24 | } 25 | 26 | func putLE32(val uint32, buf []byte) { 27 | buf[0] = byte(val) 28 | buf[1] = byte(val >> 8) 29 | buf[2] = byte(val >> 16) 30 | buf[3] = byte(val >> 24) 31 | return 32 | } 33 | 34 | func putBE32(val uint32, buf []byte) { 35 | buf[0] = byte(val >> 24) 36 | buf[1] = byte(val >> 16) 37 | buf[2] = byte(val >> 8) 38 | buf[3] = byte(val) 39 | return 40 | } 41 | 42 | func putLE64(val uint64, buf []byte) { 43 | buf[0] = byte(val) 44 | buf[1] = byte(val >> 8) 45 | buf[2] = byte(val >> 16) 46 | buf[3] = byte(val >> 24) 47 | buf[4] = byte(val >> 32) 48 | buf[5] = byte(val >> 40) 49 | buf[6] = byte(val >> 48) 50 | buf[7] = byte(val >> 56) 51 | return 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/xi2/xz/doc.go: -------------------------------------------------------------------------------- 1 | // Package xz implements XZ decompression natively in Go. 2 | // 3 | // Usage 4 | // 5 | // For ease of use, this package is designed to have a similar API to 6 | // compress/gzip. See the examples for further details. 7 | // 8 | // Implementation 9 | // 10 | // This package is a translation from C to Go of XZ Embedded 11 | // (http://tukaani.org/xz/embedded.html) with enhancements made so as 12 | // to implement all mandatory and optional parts of the XZ file format 13 | // specification v1.0.4. It supports all filters and block check 14 | // types, supports multiple streams, and performs index verification 15 | // using SHA-256 as recommended by the specification. 16 | // 17 | // Speed 18 | // 19 | // On the author's Intel Ivybridge i5, decompression speed is about 20 | // half that of the standard XZ Utils (tested with a recent linux 21 | // kernel tarball). 22 | // 23 | // Thanks 24 | // 25 | // Thanks are due to Lasse Collin and Igor Pavlov, the authors of XZ 26 | // Embedded, on whose code package xz is based. It would not exist 27 | // without their decision to allow others to modify and reuse their 28 | // code. 29 | // 30 | // Bug reports 31 | // 32 | // For bug reports relating to this package please contact the author 33 | // through https://github.com/xi2/xz/issues, and not the authors of XZ 34 | // Embedded. 35 | package xz 36 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | This project is covered by two different licenses: MIT and Apache. 3 | 4 | #### MIT License #### 5 | 6 | The following files were ported to Go from C files of libyaml, and thus 7 | are still covered by their original MIT license, with the additional 8 | copyright staring in 2011 when the project was ported over: 9 | 10 | apic.go emitterc.go parserc.go readerc.go scannerc.go 11 | writerc.go yamlh.go yamlprivateh.go 12 | 13 | Copyright (c) 2006-2010 Kirill Simonov 14 | Copyright (c) 2006-2011 Kirill Simonov 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy of 17 | this software and associated documentation files (the "Software"), to deal in 18 | the Software without restriction, including without limitation the rights to 19 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 20 | of the Software, and to permit persons to whom the Software is furnished to do 21 | so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in all 24 | copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | SOFTWARE. 33 | 34 | ### Apache License ### 35 | 36 | All the remaining project files are covered by the Apache license: 37 | 38 | Copyright (c) 2011-2019 Canonical Ltd 39 | 40 | Licensed under the Apache License, Version 2.0 (the "License"); 41 | you may not use this file except in compliance with the License. 42 | You may obtain a copy of the License at 43 | 44 | http://www.apache.org/licenses/LICENSE-2.0 45 | 46 | Unless required by applicable law or agreed to in writing, software 47 | distributed under the License is distributed on an "AS IS" BASIS, 48 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 49 | See the License for the specific language governing permissions and 50 | limitations under the License. 51 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/gopkg.in/yaml.v3/writerc.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2011-2019 Canonical Ltd 3 | // Copyright (c) 2006-2010 Kirill Simonov 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | // of the Software, and to permit persons to whom the Software is furnished to do 10 | // so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | package yaml 24 | 25 | // Set the writer error and return false. 26 | func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { 27 | emitter.error = yaml_WRITER_ERROR 28 | emitter.problem = problem 29 | return false 30 | } 31 | 32 | // Flush the output buffer. 33 | func yaml_emitter_flush(emitter *yaml_emitter_t) bool { 34 | if emitter.write_handler == nil { 35 | panic("write handler not set") 36 | } 37 | 38 | // Check if the buffer is empty. 39 | if emitter.buffer_pos == 0 { 40 | return true 41 | } 42 | 43 | if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { 44 | return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) 45 | } 46 | emitter.buffer_pos = 0 47 | return true 48 | } 49 | --------------------------------------------------------------------------------