diff --git a/.gitignore b/.gitignore index 731c9e7e..2e9d0b38 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ rice-box.go /filebrowser.exe /frontend/dist /backend/vendor - +/backend/*.cov .DS_Store node_modules diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c578e9..760ce7eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +# v0.1.4 + - various UI fixes + - Added download button back to toolbar + - Added upload button to side menu + - breadcrumb spacing fix + - Added "compact" view option + - various backend fixes + - search no longer searches by word with spaces, includes space in searches + - prepared for full json configuration + - ## v0.1.3 - improved styling, colors, transparency, blur diff --git a/Dockerfile b/Dockerfile index 2b9ebea5..a0f628a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN npm i COPY ./frontend/ ./ RUN npm run build -FROM golang:alpine as base +FROM golang:1.21-alpine as base WORKDIR /app COPY ./backend ./ RUN go build -ldflags="-w -s" -o filebrowser . @@ -15,7 +15,7 @@ RUN apk --no-cache add \ ca-certificates \ mailcap VOLUME /srv -EXPOSE 80 +EXPOSE 8080 WORKDIR / COPY --from=base /app/.filebrowser.json /.filebrowser.json COPY --from=base /app/filebrowser /filebrowser diff --git a/backend/http/search.go b/backend/http/search.go index cff54a5b..38887e00 100644 --- a/backend/http/search.go +++ b/backend/http/search.go @@ -1,25 +1,25 @@ package http import ( - "net/http" "github.com/gtsteffaniak/filebrowser/search" + "net/http" ) var searchHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) { response := []map[string]interface{}{} query := r.URL.Query().Get("query") indexInfo, fileTypes := search.SearchAllIndexes(query, r.URL.Path) - for _,path := range(indexInfo){ + for _, path := range indexInfo { f := fileTypes[path] responseObj := map[string]interface{}{ - "path" : path, + "path": path, } - for filterType,_ := range(f) { + for filterType, _ := range f { if f[filterType] { responseObj[filterType] = f[filterType] } } - response = append(response,responseObj) + response = append(response, responseObj) } return renderJSON(w, r, response) -}) \ No newline at end of file +}) diff --git a/backend/render.yml b/backend/render.yml new file mode 100644 index 00000000..e69de29b diff --git a/backend/run_benchmark.sh b/backend/run_benchmark.sh new file mode 100755 index 00000000..fda0f117 --- /dev/null +++ b/backend/run_benchmark.sh @@ -0,0 +1,18 @@ +#!/bin/sh +## TEST file used by docker testing containers +touch render.yml +checkExit() { + if [ "$?" -ne 0 ];then + exit 1 + fi +} + +if command -v go &> /dev/null +then + printf "\n == Running benchmark (sends to results.txt) == \n" + go test -bench=. -benchmem ./... + checkExit +else + echo "ERROR: unable to perform tests" + exit 1 +fi diff --git a/backend/run_check_coverage.sh b/backend/run_check_coverage.sh new file mode 100755 index 00000000..9c2e74f4 --- /dev/null +++ b/backend/run_check_coverage.sh @@ -0,0 +1,3 @@ +#!/bin/bash +go test -race -v -coverpkg=./... -coverprofile=coverage.cov ./... +go tool cover -html=coverage.cov diff --git a/backend/run_fmt.sh b/backend/run_fmt.sh new file mode 100755 index 00000000..97439b6f --- /dev/null +++ b/backend/run_fmt.sh @@ -0,0 +1,2 @@ +#!/bin/bash +for i in $(find $(pwd) -name '*.go');do gofmt -w $i;done diff --git a/backend/run_tests.sh b/backend/run_tests.sh new file mode 100755 index 00000000..f7a6732a --- /dev/null +++ b/backend/run_tests.sh @@ -0,0 +1,21 @@ +#!/bin/sh +## TEST file used by docker testing containers +touch render.yml +checkExit() { + if [ "$?" -ne 0 ];then + exit 1 + fi +} + +if command -v go &> /dev/null +then + printf "\n == Running tests == \n" + go test -race -v ./... + checkExit + printf "\n == Running benchmark (sends to results.txt) == \n" + go test -bench=. -benchtime=100x -benchmem ./... + checkExit +else + echo "ERROR: unable to perform tests" + exit 1 +fi diff --git a/backend/search/conditions.go b/backend/search/conditions.go index e44edf6a..57f5a511 100644 --- a/backend/search/conditions.go +++ b/backend/search/conditions.go @@ -25,14 +25,14 @@ var compressedFile = []string{ ".tar.xz", } -type searchOptions struct { +type SearchOptions struct { Conditions map[string]bool Size int Terms []string } -func ParseSearch(value string) *searchOptions { - opts := &searchOptions{ +func ParseSearch(value string) *SearchOptions { + opts := &SearchOptions{ Conditions: map[string]bool{ "exact": strings.Contains(value, "case:exact"), }, @@ -79,8 +79,8 @@ func ParseSearch(value string) *searchOptions { } if len(types) > 0 { - // Remove the fields from the search value, including added space - value = typeRegexp.ReplaceAllString(value+" ", "") + // Remove the fields from the search value + value = typeRegexp.ReplaceAllString(value, "") } if value == "" { diff --git a/backend/search/indexing.go b/backend/search/indexing.go index 4b9f0b43..b58da03d 100644 --- a/backend/search/indexing.go +++ b/backend/search/indexing.go @@ -2,29 +2,27 @@ package search import ( "log" + "math/rand" + "mime" "os" "path/filepath" "sort" "strings" "sync" "time" - "mime" - "math/rand" ) var ( - sessionInProgress sync.Map // Track IPs with requests in progress - rootPath string = "/srv" - indexes map[string][]string - mutex sync.RWMutex - lastIndexed time.Time + sessionInProgress sync.Map // Track IPs with requests in progress + rootPath string = "/srv" + indexes map[string][]string + mutex sync.RWMutex + lastIndexed time.Time ) func InitializeIndex(intervalMinutes uint32) { // Initialize the indexes map indexes = make(map[string][]string) - indexes["dirs"] = []string{} - indexes["files"] = []string{} var numFiles, numDirs int log.Println("Indexing files...") lastIndexedStart := time.Now() @@ -97,15 +95,14 @@ func addToIndex(path string, fileName string, isDir bool) { mutex.Lock() defer mutex.Unlock() path = strings.TrimPrefix(path, rootPath+"/") - path = strings.TrimSuffix(path, "/") - adjustedPath := path + "/" + fileName - if path == rootPath { - adjustedPath = fileName + path = strings.TrimSuffix(path, "/") + "/" + if path == "" { + path = "/" } if isDir { - indexes["dirs"] = append(indexes["dirs"], adjustedPath) - }else{ - indexes["files"] = append(indexes["files"], adjustedPath) + indexes[path] = []string{} + } else { + indexes[path] = append(indexes[path], fileName) } } @@ -119,37 +116,52 @@ func SearchAllIndexes(search string, scope string) ([]string, map[string]map[str defer mutex.RUnlock() fileListTypes := make(map[string]map[string]bool) var matching []string - maximum := 100 - + // 250 items total seems like a reasonable limit + maximum := 250 for _, searchTerm := range searchOptions.Terms { if searchTerm == "" { continue } + // Create a reused fileType map + reusedFileType := map[string]bool{} // Iterate over the indexes - for _,i := range([]string{"dirs","files"}) { - isdir := i == "dirs" - count := 0 - for _, path := range indexes[i] { - value, found := sessionInProgress.Load(sourceSession) - if !found || value != runningHash { - return []string{}, map[string]map[string]bool{} - } - if count > maximum { - break - } - pathName := scopedPathNameFilter(path, scope) - if pathName == "" { - continue - } - matches, fileType := containsSearchTerm(path, searchTerm, *searchOptions, isdir) + count := 0 + for pathName, files := range indexes { + if count > maximum { + break + } + // this is here to terminate a search if a new one has started + // currently limited to one search per container, should be session based + value, found := sessionInProgress.Load(sourceSession) + if !found || value != runningHash { + return []string{}, map[string]map[string]bool{} + } + pathName = scopedPathNameFilter(pathName, scope) + if pathName == "" { + continue + } + // check if dir matches + matches, fileType := containsSearchTerm(pathName, searchTerm, *searchOptions, false) + if matches { + matching = append(matching, pathName) + fileListTypes[pathName] = fileType + count++ + } + for _, fileName := range files { + // check if file matches + matches, fileType := containsSearchTerm(pathName+fileName, searchTerm, *searchOptions, false) if !matches { continue } - if isdir { - pathName = pathName+"/" + matching = append(matching, pathName+fileName) + // Clear and reuse the fileType map + for key := range reusedFileType { + delete(reusedFileType, key) } - matching = append(matching, pathName) - fileListTypes[pathName] = fileType + for key, value := range fileType { + reusedFileType[key] = value + } + fileListTypes[pathName] = copyFileTypeMap(reusedFileType) count++ } } @@ -163,51 +175,79 @@ func SearchAllIndexes(search string, scope string) ([]string, map[string]map[str return matching, fileListTypes } -func scopedPathNameFilter(pathName string, scope string) string { - scope = strings.TrimPrefix(scope, "/") - if strings.HasPrefix(pathName, scope) { - pathName = strings.TrimPrefix(pathName, scope) - } else { - pathName = "" +func copyFileTypeMap(src map[string]bool) map[string]bool { + dest := make(map[string]bool, len(src)) + for key, value := range src { + dest[key] = value } - return pathName + return dest } -func containsSearchTerm(pathName string, searchTerm string, options searchOptions, isDir bool) (bool, map[string]bool) { - conditions := options.Conditions - path := getLastPathComponent(pathName) - if !conditions["exact"] { - path = strings.ToLower(path) - searchTerm = strings.ToLower(searchTerm) - } - if strings.Contains(path, searchTerm) { - fileTypes := map[string]bool{} - fileSize := getFileSize(pathName) - matchesCondition := false - matchesAllConditions := true - extension := filepath.Ext(strings.ToLower(path)) - mimetype := mime.TypeByExtension(extension) - fileTypes["audio"] = strings.HasPrefix(mimetype, "audio") - fileTypes["image"] = strings.HasPrefix(mimetype, "image") - fileTypes["video"] = strings.HasPrefix(mimetype, "video") - fileTypes["doc"] = isDoc(extension) - fileTypes["archive"] = isArchive(extension) - fileTypes["dir"] = isDir +func scopedPathNameFilter(pathName string, scope string) string { + if strings.HasPrefix(pathName, scope) { + return strings.TrimPrefix(pathName, scope) + } + return "" +} - for t,v := range conditions { - switch t { - case "exact" : continue - case "larger" : matchesCondition = fileSize > int64(options.Size) * 1000000 - case "smaller" : matchesCondition = fileSize < int64(options.Size) * 1000000 - default : matchesCondition = v == fileTypes[t] +func containsSearchTerm(pathName string, searchTerm string, options SearchOptions, isDir bool) (bool, map[string]bool) { + conditions := options.Conditions + path := getLastPathComponent(pathName) + // Convert to lowercase once + lowerPath := path + lowerSearchTerm := searchTerm + if !conditions["exact"] { + lowerPath = strings.ToLower(path) + lowerSearchTerm = strings.ToLower(searchTerm) + } + if strings.Contains(lowerPath, lowerSearchTerm) { + // Reuse the fileTypes map and clear its values + fileTypes := map[string]bool{ + "audio": false, + "image": false, + "video": false, + "doc": false, + "archive": false, + "dir": false, + } + + // Calculate fileSize only if needed + var fileSize int64 + if conditions["larger"] || conditions["smaller"] { + fileSize = getFileSize(pathName) + } + + matchesAllConditions := true + extension := filepath.Ext(lowerPath) + mimetype := mime.TypeByExtension(extension) + fileTypes["audio"] = strings.HasPrefix(mimetype, "audio") + fileTypes["image"] = strings.HasPrefix(mimetype, "image") + fileTypes["video"] = strings.HasPrefix(mimetype, "video") + fileTypes["doc"] = isDoc(extension) + fileTypes["archive"] = isArchive(extension) + fileTypes["dir"] = isDir + + for t, v := range conditions { + if t == "exact" { + continue } - if (!matchesCondition) { + var matchesCondition bool + switch t { + case "larger": + matchesCondition = fileSize > int64(options.Size)*1000000 + case "smaller": + matchesCondition = fileSize < int64(options.Size)*1000000 + default: + matchesCondition = v == fileTypes[t] + } + if !matchesCondition { matchesAllConditions = false } } return matchesAllConditions, fileTypes } + // Clear variables and return return false, map[string]bool{} } @@ -221,7 +261,7 @@ func isDoc(extension string) bool { } func getFileSize(filepath string) int64 { - fileInfo, err := os.Stat(rootPath+"/"+filepath) + fileInfo, err := os.Stat(rootPath + "/" + filepath) if err != nil { return 0 } @@ -259,4 +299,4 @@ func stringExistsInArray(target string, strings []string) bool { } } return false -} \ No newline at end of file +} diff --git a/backend/search/search_test.go b/backend/search/search_test.go new file mode 100644 index 00000000..6399d2fe --- /dev/null +++ b/backend/search/search_test.go @@ -0,0 +1,150 @@ +package search + +import ( + "encoding/json" + "fmt" + "math/rand" + "reflect" + "testing" + "time" +) + +// loop over test files and compare output +func TestParseSearch(t *testing.T) { + value := ParseSearch("my test search") + want := &SearchOptions{ + Conditions: map[string]bool{ + "exact": false, + }, + Terms: []string{"my test search"}, + } + if !reflect.DeepEqual(value, want) { + t.Fatalf("\n got: %+v\n want: %+v", value, want) + } + value = ParseSearch("case:exact my|test|search") + want = &SearchOptions{ + Conditions: map[string]bool{ + "exact": true, + }, + Terms: []string{"my", "test", "search"}, + } + if !reflect.DeepEqual(value, want) { + t.Fatalf("\n got: %+v\n want: %+v", value, want) + } +} + +func BenchmarkSearchAllIndexes(b *testing.B) { + indexes = make(map[string][]string) + + // Create mock data + createMockData(500, 3) // 1000 dirs, 3 files per dir + + // Generate 100 random search terms + searchTerms := generateRandomSearchTerms(100) + + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + // Execute the SearchAllIndexes function + for _, term := range searchTerms { + SearchAllIndexes(term, "/") + } + } + printBenchmarkResults(b) +} + +func BenchmarkFillIndex(b *testing.B) { + indexes = make(map[string][]string) + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + createMockData(10000, 10) // 1000 dirs, 3 files per dir + } + for a, _ := range indexes { + b.Logf(a) + } + printBenchmarkResults(b) +} + +func createMockData(numDirs, numFilesPerDir int) { + for i := 0; i < numDirs; i++ { + dirName := getRandomTerm() + addToIndex("/", dirName, true) + for j := 0; j < numFilesPerDir; j++ { + fileName := "file-" + getRandomTerm() + getRandomExtension() + addToIndex("/"+dirName, fileName, false) + } + } +} + +func getRandomTerm() string { + wordbank := []string{ + "hi", "test", "other", "name", + "cool", "things", "more", "items", + } + rand.Seed(time.Now().UnixNano()) + index := rand.Intn(len(wordbank)) + return wordbank[index] +} + +func getRandomExtension() string { + wordbank := []string{ + ".txt", ".mp3", ".mov", ".doc", + ".mp4", ".bak", ".zip", ".jpg", + } + rand.Seed(time.Now().UnixNano()) + index := rand.Intn(len(wordbank)) + return wordbank[index] +} + +func generateRandomSearchTerms(numTerms int) []string { + // Generate random search terms + searchTerms := make([]string, numTerms) + for i := 0; i < numTerms; i++ { + searchTerms[i] = getRandomTerm() + } + return searchTerms +} + +// JSONBytesEqual compares the JSON in two byte slices. +func JSONBytesEqual(a, b []byte) (bool, error) { + var j, j2 interface{} + if err := json.Unmarshal(a, &j); err != nil { + return false, err + } + if err := json.Unmarshal(b, &j2); err != nil { + return false, err + } + return reflect.DeepEqual(j2, j), nil +} + +func passedFunc(t *testing.T) { + t.Logf("%s passed!", t.Name()) +} + +func formatDuration(duration time.Duration) string { + if duration >= time.Second { + return fmt.Sprintf("%.2f seconds", duration.Seconds()) + } else if duration >= time.Millisecond { + return fmt.Sprintf("%.2f ms", float64(duration.Milliseconds())) + } + return fmt.Sprintf("%.2f ns", float64(duration.Nanoseconds())) +} + +func formatMemory(bytes int64) string { + sizes := []string{"B", "KB", "MB", "GB", "TB"} + i := 0 + for bytes >= 1024 && i < len(sizes)-1 { + bytes /= 1024 + i++ + } + return fmt.Sprintf("%d %s", bytes, sizes[i]) +} + +// Output the benchmark results with human-readable units +func printBenchmarkResults(b *testing.B) { + averageTimePerIteration := b.Elapsed() / time.Duration(b.N) + fmt.Printf("\nIterations : %d\n", b.N) + fmt.Printf("Total time : %s\n", formatDuration(b.Elapsed())) + fmt.Printf("Avg time per op : %s\n", formatDuration(averageTimePerIteration)) +} diff --git a/backend/vendor/github.com/andybalholm/brotli/backward_references_hq.go b/backend/vendor/github.com/andybalholm/brotli/backward_references_hq.go index 21629c1c..86c980a3 100644 --- a/backend/vendor/github.com/andybalholm/brotli/backward_references_hq.go +++ b/backend/vendor/github.com/andybalholm/brotli/backward_references_hq.go @@ -305,8 +305,11 @@ func computeMinimumCopyLength(start_cost float32, nodes []zopfliNode, num_bytes return uint(len) } -/* REQUIRES: nodes[pos].cost < kInfinity - REQUIRES: nodes[0..pos] satisfies that "ZopfliNode array invariant". */ +/* +REQUIRES: nodes[pos].cost < kInfinity + + REQUIRES: nodes[0..pos] satisfies that "ZopfliNode array invariant". +*/ func computeDistanceShortcut(block_start uint, pos uint, max_backward_limit uint, gap uint, nodes []zopfliNode) uint32 { var clen uint = uint(zopfliNodeCopyLength(&nodes[pos])) var ilen uint = uint(nodes[pos].dcode_insert_length & 0x7FFFFFF) @@ -326,13 +329,16 @@ func computeDistanceShortcut(block_start uint, pos uint, max_backward_limit uint } } -/* Fills in dist_cache[0..3] with the last four distances (as defined by - Section 4. of the Spec) that would be used at (block_start + pos) if we - used the shortest path of commands from block_start, computed from - nodes[0..pos]. The last four distances at block_start are in - starting_dist_cache[0..3]. - REQUIRES: nodes[pos].cost < kInfinity - REQUIRES: nodes[0..pos] satisfies that "ZopfliNode array invariant". */ +/* +Fills in dist_cache[0..3] with the last four distances (as defined by + + Section 4. of the Spec) that would be used at (block_start + pos) if we + used the shortest path of commands from block_start, computed from + nodes[0..pos]. The last four distances at block_start are in + starting_dist_cache[0..3]. + REQUIRES: nodes[pos].cost < kInfinity + REQUIRES: nodes[0..pos] satisfies that "ZopfliNode array invariant". +*/ func computeDistanceCache(pos uint, starting_dist_cache []int, nodes []zopfliNode, dist_cache []int) { var idx int = 0 var p uint = uint(nodes[pos].u.shortcut) @@ -353,8 +359,11 @@ func computeDistanceCache(pos uint, starting_dist_cache []int, nodes []zopfliNod } } -/* Maintains "ZopfliNode array invariant" and pushes node to the queue, if it - is eligible. */ +/* +Maintains "ZopfliNode array invariant" and pushes node to the queue, if it + + is eligible. +*/ func evaluateNode(block_start uint, pos uint, max_backward_limit uint, gap uint, starting_dist_cache []int, model *zopfliCostModel, queue *startPosQueue, nodes []zopfliNode) { /* Save cost, because ComputeDistanceCache invalidates it. */ var node_cost float32 = nodes[pos].u.cost @@ -606,21 +615,24 @@ func zopfliIterate(num_bytes uint, position uint, ringbuffer []byte, ringbuffer_ return computeShortestPathFromNodes(num_bytes, nodes) } -/* Computes the shortest path of commands from position to at most - position + num_bytes. +/* +Computes the shortest path of commands from position to at most - On return, path->size() is the number of commands found and path[i] is the - length of the i-th command (copy length plus insert length). - Note that the sum of the lengths of all commands can be less than num_bytes. + position + num_bytes. - On return, the nodes[0..num_bytes] array will have the following - "ZopfliNode array invariant": - For each i in [1..num_bytes], if nodes[i].cost < kInfinity, then - (1) nodes[i].copy_length() >= 2 - (2) nodes[i].command_length() <= i and - (3) nodes[i - nodes[i].command_length()].cost < kInfinity + On return, path->size() is the number of commands found and path[i] is the + length of the i-th command (copy length plus insert length). + Note that the sum of the lengths of all commands can be less than num_bytes. - REQUIRES: nodes != nil and len(nodes) >= num_bytes + 1 */ + On return, the nodes[0..num_bytes] array will have the following + "ZopfliNode array invariant": + For each i in [1..num_bytes], if nodes[i].cost < kInfinity, then + (1) nodes[i].copy_length() >= 2 + (2) nodes[i].command_length() <= i and + (3) nodes[i - nodes[i].command_length()].cost < kInfinity + +REQUIRES: nodes != nil and len(nodes) >= num_bytes + 1 +*/ func zopfliComputeShortestPath(num_bytes uint, position uint, ringbuffer []byte, ringbuffer_mask uint, params *encoderParams, dist_cache []int, hasher *h10, nodes []zopfliNode) uint { var max_backward_limit uint = maxBackwardLimit(params.lgwin) var max_zopfli_len uint = maxZopfliLen(params) diff --git a/backend/vendor/github.com/andybalholm/brotli/bit_reader.go b/backend/vendor/github.com/andybalholm/brotli/bit_reader.go index fba8687c..65848b41 100644 --- a/backend/vendor/github.com/andybalholm/brotli/bit_reader.go +++ b/backend/vendor/github.com/andybalholm/brotli/bit_reader.go @@ -70,11 +70,14 @@ type bitReaderState struct { /* Initializes the BrotliBitReader fields. */ -/* Ensures that accumulator is not empty. - May consume up to sizeof(brotli_reg_t) - 1 bytes of input. - Returns false if data is required but there is no input available. - For BROTLI_ALIGNED_READ this function also prepares bit reader for aligned - reading. */ +/* +Ensures that accumulator is not empty. + + May consume up to sizeof(brotli_reg_t) - 1 bytes of input. + Returns false if data is required but there is no input available. + For BROTLI_ALIGNED_READ this function also prepares bit reader for aligned + reading. +*/ func bitReaderSaveState(from *bitReader, to *bitReaderState) { to.val_ = from.val_ to.bit_pos_ = from.bit_pos_ @@ -95,22 +98,31 @@ func getAvailableBits(br *bitReader) uint32 { return 64 - br.bit_pos_ } -/* Returns amount of unread bytes the bit reader still has buffered from the - BrotliInput, including whole bytes in br->val_. */ +/* +Returns amount of unread bytes the bit reader still has buffered from the + + BrotliInput, including whole bytes in br->val_. +*/ func getRemainingBytes(br *bitReader) uint { return uint(uint32(br.input_len-br.byte_pos) + (getAvailableBits(br) >> 3)) } -/* Checks if there is at least |num| bytes left in the input ring-buffer - (excluding the bits remaining in br->val_). */ +/* +Checks if there is at least |num| bytes left in the input ring-buffer + + (excluding the bits remaining in br->val_). +*/ func checkInputAmount(br *bitReader, num uint) bool { return br.input_len-br.byte_pos >= num } -/* Guarantees that there are at least |n_bits| + 1 bits in accumulator. - Precondition: accumulator contains at least 1 bit. - |n_bits| should be in the range [1..24] for regular build. For portable - non-64-bit little-endian build only 16 bits are safe to request. */ +/* +Guarantees that there are at least |n_bits| + 1 bits in accumulator. + + Precondition: accumulator contains at least 1 bit. + |n_bits| should be in the range [1..24] for regular build. For portable + non-64-bit little-endian build only 16 bits are safe to request. +*/ func fillBitWindow(br *bitReader, n_bits uint32) { if br.bit_pos_ >= 32 { br.val_ >>= 32 @@ -120,14 +132,20 @@ func fillBitWindow(br *bitReader, n_bits uint32) { } } -/* Mostly like BrotliFillBitWindow, but guarantees only 16 bits and reads no - more than BROTLI_SHORT_FILL_BIT_WINDOW_READ bytes of input. */ +/* +Mostly like BrotliFillBitWindow, but guarantees only 16 bits and reads no + + more than BROTLI_SHORT_FILL_BIT_WINDOW_READ bytes of input. +*/ func fillBitWindow16(br *bitReader) { fillBitWindow(br, 17) } -/* Tries to pull one byte of input to accumulator. - Returns false if there is no input available. */ +/* +Tries to pull one byte of input to accumulator. + + Returns false if there is no input available. +*/ func pullByte(br *bitReader) bool { if br.byte_pos == br.input_len { return false @@ -140,28 +158,40 @@ func pullByte(br *bitReader) bool { return true } -/* Returns currently available bits. - The number of valid bits could be calculated by BrotliGetAvailableBits. */ +/* +Returns currently available bits. + + The number of valid bits could be calculated by BrotliGetAvailableBits. +*/ func getBitsUnmasked(br *bitReader) uint64 { return br.val_ >> br.bit_pos_ } -/* Like BrotliGetBits, but does not mask the result. - The result contains at least 16 valid bits. */ +/* +Like BrotliGetBits, but does not mask the result. + + The result contains at least 16 valid bits. +*/ func get16BitsUnmasked(br *bitReader) uint32 { fillBitWindow(br, 16) return uint32(getBitsUnmasked(br)) } -/* Returns the specified number of bits from |br| without advancing bit - position. */ +/* +Returns the specified number of bits from |br| without advancing bit + + position. +*/ func getBits(br *bitReader, n_bits uint32) uint32 { fillBitWindow(br, n_bits) return uint32(getBitsUnmasked(br)) & bitMask(n_bits) } -/* Tries to peek the specified amount of bits. Returns false, if there - is not enough input. */ +/* +Tries to peek the specified amount of bits. Returns false, if there + + is not enough input. +*/ func safeGetBits(br *bitReader, n_bits uint32, val *uint32) bool { for getAvailableBits(br) < n_bits { if !pullByte(br) { @@ -191,15 +221,21 @@ func bitReaderUnload(br *bitReader) { br.bit_pos_ += unused_bits } -/* Reads the specified number of bits from |br| and advances the bit pos. - Precondition: accumulator MUST contain at least |n_bits|. */ +/* +Reads the specified number of bits from |br| and advances the bit pos. + + Precondition: accumulator MUST contain at least |n_bits|. +*/ func takeBits(br *bitReader, n_bits uint32, val *uint32) { *val = uint32(getBitsUnmasked(br)) & bitMask(n_bits) dropBits(br, n_bits) } -/* Reads the specified number of bits from |br| and advances the bit pos. - Assumes that there is enough input to perform BrotliFillBitWindow. */ +/* +Reads the specified number of bits from |br| and advances the bit pos. + + Assumes that there is enough input to perform BrotliFillBitWindow. +*/ func readBits(br *bitReader, n_bits uint32) uint32 { var val uint32 fillBitWindow(br, n_bits) @@ -207,8 +243,11 @@ func readBits(br *bitReader, n_bits uint32) uint32 { return val } -/* Tries to read the specified amount of bits. Returns false, if there - is not enough input. |n_bits| MUST be positive. */ +/* +Tries to read the specified amount of bits. Returns false, if there + + is not enough input. |n_bits| MUST be positive. +*/ func safeReadBits(br *bitReader, n_bits uint32, val *uint32) bool { for getAvailableBits(br) < n_bits { if !pullByte(br) { @@ -220,8 +259,11 @@ func safeReadBits(br *bitReader, n_bits uint32, val *uint32) bool { return true } -/* Advances the bit reader position to the next byte boundary and verifies - that any skipped bits are set to zero. */ +/* +Advances the bit reader position to the next byte boundary and verifies + + that any skipped bits are set to zero. +*/ func bitReaderJumpToByteBoundary(br *bitReader) bool { var pad_bits_count uint32 = getAvailableBits(br) & 0x7 var pad_bits uint32 = 0 @@ -232,9 +274,12 @@ func bitReaderJumpToByteBoundary(br *bitReader) bool { return pad_bits == 0 } -/* Copies remaining input bytes stored in the bit reader to the output. Value - |num| may not be larger than BrotliGetRemainingBytes. The bit reader must be - warmed up again after this. */ +/* +Copies remaining input bytes stored in the bit reader to the output. Value + + |num| may not be larger than BrotliGetRemainingBytes. The bit reader must be + warmed up again after this. +*/ func copyBytes(dest []byte, br *bitReader, num uint) { for getAvailableBits(br) >= 8 && num > 0 { dest[0] = byte(getBitsUnmasked(br)) diff --git a/backend/vendor/github.com/andybalholm/brotli/block_splitter_command.go b/backend/vendor/github.com/andybalholm/brotli/block_splitter_command.go index 9dec13e4..0a7a458a 100644 --- a/backend/vendor/github.com/andybalholm/brotli/block_splitter_command.go +++ b/backend/vendor/github.com/andybalholm/brotli/block_splitter_command.go @@ -51,9 +51,12 @@ func refineEntropyCodesCommand(data []uint16, length uint, stride uint, num_hist } } -/* Assigns a block id from the range [0, num_histograms) to each data element - in data[0..length) and fills in block_id[0..length) with the assigned values. - Returns the number of blocks, i.e. one plus the number of block switches. */ +/* +Assigns a block id from the range [0, num_histograms) to each data element + + in data[0..length) and fills in block_id[0..length) with the assigned values. + Returns the number of blocks, i.e. one plus the number of block switches. +*/ func findBlocksCommand(data []uint16, length uint, block_switch_bitcost float64, num_histograms uint, histograms []histogramCommand, insert_cost []float64, cost []float64, switch_signal []byte, block_id []byte) uint { var data_size uint = histogramDataSizeCommand() var bitmaplen uint = (num_histograms + 7) >> 3 diff --git a/backend/vendor/github.com/andybalholm/brotli/block_splitter_distance.go b/backend/vendor/github.com/andybalholm/brotli/block_splitter_distance.go index 953530d5..bb04fa8a 100644 --- a/backend/vendor/github.com/andybalholm/brotli/block_splitter_distance.go +++ b/backend/vendor/github.com/andybalholm/brotli/block_splitter_distance.go @@ -51,9 +51,12 @@ func refineEntropyCodesDistance(data []uint16, length uint, stride uint, num_his } } -/* Assigns a block id from the range [0, num_histograms) to each data element - in data[0..length) and fills in block_id[0..length) with the assigned values. - Returns the number of blocks, i.e. one plus the number of block switches. */ +/* +Assigns a block id from the range [0, num_histograms) to each data element + + in data[0..length) and fills in block_id[0..length) with the assigned values. + Returns the number of blocks, i.e. one plus the number of block switches. +*/ func findBlocksDistance(data []uint16, length uint, block_switch_bitcost float64, num_histograms uint, histograms []histogramDistance, insert_cost []float64, cost []float64, switch_signal []byte, block_id []byte) uint { var data_size uint = histogramDataSizeDistance() var bitmaplen uint = (num_histograms + 7) >> 3 diff --git a/backend/vendor/github.com/andybalholm/brotli/block_splitter_literal.go b/backend/vendor/github.com/andybalholm/brotli/block_splitter_literal.go index 1c895cf3..652b041e 100644 --- a/backend/vendor/github.com/andybalholm/brotli/block_splitter_literal.go +++ b/backend/vendor/github.com/andybalholm/brotli/block_splitter_literal.go @@ -51,9 +51,12 @@ func refineEntropyCodesLiteral(data []byte, length uint, stride uint, num_histog } } -/* Assigns a block id from the range [0, num_histograms) to each data element - in data[0..length) and fills in block_id[0..length) with the assigned values. - Returns the number of blocks, i.e. one plus the number of block switches. */ +/* +Assigns a block id from the range [0, num_histograms) to each data element + + in data[0..length) and fills in block_id[0..length) with the assigned values. + Returns the number of blocks, i.e. one plus the number of block switches. +*/ func findBlocksLiteral(data []byte, length uint, block_switch_bitcost float64, num_histograms uint, histograms []histogramLiteral, insert_cost []float64, cost []float64, switch_signal []byte, block_id []byte) uint { var data_size uint = histogramDataSizeLiteral() var bitmaplen uint = (num_histograms + 7) >> 3 diff --git a/backend/vendor/github.com/andybalholm/brotli/brotli_bit_stream.go b/backend/vendor/github.com/andybalholm/brotli/brotli_bit_stream.go index 2470f84e..1d9d91d2 100644 --- a/backend/vendor/github.com/andybalholm/brotli/brotli_bit_stream.go +++ b/backend/vendor/github.com/andybalholm/brotli/brotli_bit_stream.go @@ -7,12 +7,18 @@ import ( const maxHuffmanTreeSize = (2*numCommandSymbols + 1) -/* The maximum size of Huffman dictionary for distances assuming that - NPOSTFIX = 0 and NDIRECT = 0. */ +/* +The maximum size of Huffman dictionary for distances assuming that + + NPOSTFIX = 0 and NDIRECT = 0. +*/ const maxSimpleDistanceAlphabetSize = 140 -/* Represents the range of values belonging to a prefix code: - [offset, offset + 2^nbits) */ +/* +Represents the range of values belonging to a prefix code: + + [offset, offset + 2^nbits) +*/ type prefixCodeRange struct { offset uint32 nbits uint32 @@ -96,9 +102,12 @@ func nextBlockTypeCode(calculator *blockTypeCodeCalculator, type_ byte) uint { return type_code } -/* |nibblesbits| represents the 2 bits to encode MNIBBLES (0-3) - REQUIRES: length > 0 - REQUIRES: length <= (1 << 24) */ +/* +|nibblesbits| represents the 2 bits to encode MNIBBLES (0-3) + + REQUIRES: length > 0 + REQUIRES: length <= (1 << 24) +*/ func encodeMlen(length uint, bits *uint64, numbits *uint, nibblesbits *uint64) { var lg uint if length == 1 { @@ -132,8 +141,11 @@ func storeCommandExtra(cmd *command, bw *bitWriter) { bw.writeBits(uint(insnumextra+getCopyExtra(copycode)), bits) } -/* Data structure that stores almost everything that is needed to encode each - block switch command. */ +/* +Data structure that stores almost everything that is needed to encode each + + block switch command. +*/ type blockSplitCode struct { type_code_calculator blockTypeCodeCalculator type_depths [maxBlockTypeSymbols]byte @@ -154,9 +166,12 @@ func storeVarLenUint8(n uint, bw *bitWriter) { } } -/* Stores the compressed meta-block header. - REQUIRES: length > 0 - REQUIRES: length <= (1 << 24) */ +/* +Stores the compressed meta-block header. + + REQUIRES: length > 0 + REQUIRES: length <= (1 << 24) +*/ func storeCompressedMetaBlockHeader(is_final_block bool, length uint, bw *bitWriter) { var lenbits uint64 var nlenbits uint @@ -186,9 +201,12 @@ func storeCompressedMetaBlockHeader(is_final_block bool, length uint, bw *bitWri } } -/* Stores the uncompressed meta-block header. - REQUIRES: length > 0 - REQUIRES: length <= (1 << 24) */ +/* +Stores the uncompressed meta-block header. + + REQUIRES: length > 0 + REQUIRES: length <= (1 << 24) +*/ func storeUncompressedMetaBlockHeader(length uint, bw *bitWriter) { var lenbits uint64 var nlenbits uint @@ -312,8 +330,11 @@ func storeSimpleHuffmanTree(depths []byte, symbols []uint, num_symbols uint, max } } -/* num = alphabet size - depths = symbol depths */ +/* +num = alphabet size + + depths = symbol depths +*/ func storeHuffmanTree(depths []byte, num uint, tree []huffmanTree, bw *bitWriter) { var huffman_tree [numCommandSymbols]byte var huffman_tree_extra_bits [numCommandSymbols]byte @@ -367,8 +388,11 @@ func storeHuffmanTree(depths []byte, num uint, tree []huffmanTree, bw *bitWriter storeHuffmanTreeToBitMask(huffman_tree_size, huffman_tree[:], huffman_tree_extra_bits[:], code_length_bitdepth[:], code_length_bitdepth_symbols[:], bw) } -/* Builds a Huffman tree from histogram[0:length] into depth[0:length] and - bits[0:length] and stores the encoded tree to the bit stream. */ +/* +Builds a Huffman tree from histogram[0:length] into depth[0:length] and + + bits[0:length] and stores the encoded tree to the bit stream. +*/ func buildAndStoreHuffmanTree(histogram []uint32, histogram_length uint, alphabet_size uint, tree []huffmanTree, depth []byte, bits []uint16, bw *bitWriter) { var count uint = 0 var s4 = [4]uint{0} @@ -668,12 +692,15 @@ func moveToFrontTransform(v_in []uint32, v_size uint, v_out []uint32) { } } -/* Finds runs of zeros in v[0..in_size) and replaces them with a prefix code of - the run length plus extra bits (lower 9 bits is the prefix code and the rest - are the extra bits). Non-zero values in v[] are shifted by - *max_length_prefix. Will not create prefix codes bigger than the initial - value of *max_run_length_prefix. The prefix code of run length L is simply - Log2Floor(L) and the number of extra bits is the same as the prefix code. */ +/* +Finds runs of zeros in v[0..in_size) and replaces them with a prefix code of + + the run length plus extra bits (lower 9 bits is the prefix code and the rest + are the extra bits). Non-zero values in v[] are shifted by + *max_length_prefix. Will not create prefix codes bigger than the initial + value of *max_run_length_prefix. The prefix code of run length L is simply + Log2Floor(L) and the number of extra bits is the same as the prefix code. +*/ func runLengthCodeZeros(in_size uint, v []uint32, out_size *uint, max_run_length_prefix *uint32) { var max_reps uint32 = 0 var i uint @@ -793,8 +820,11 @@ func storeBlockSwitch(code *blockSplitCode, block_len uint32, block_type byte, i bw.writeBits(uint(len_nextra), uint64(len_extra)) } -/* Builds a BlockSplitCode data structure from the block split given by the - vector of block types and block lengths and stores it to the bit stream. */ +/* +Builds a BlockSplitCode data structure from the block split given by the + + vector of block types and block lengths and stores it to the bit stream. +*/ func buildAndStoreBlockSplitCode(types []byte, lengths []uint32, num_blocks uint, num_types uint, tree []huffmanTree, code *blockSplitCode, bw *bitWriter) { var type_histo [maxBlockTypeSymbols]uint32 var length_histo [numBlockLenSymbols]uint32 @@ -913,14 +943,20 @@ func cleanupBlockEncoder(self *blockEncoder) { blockEncoderPool.Put(self) } -/* Creates entropy codes of block lengths and block types and stores them - to the bit stream. */ +/* +Creates entropy codes of block lengths and block types and stores them + + to the bit stream. +*/ func buildAndStoreBlockSwitchEntropyCodes(self *blockEncoder, tree []huffmanTree, bw *bitWriter) { buildAndStoreBlockSplitCode(self.block_types_, self.block_lengths_, self.num_blocks_, self.num_block_types_, tree, &self.block_split_code_, bw) } -/* Stores the next symbol with the entropy code of the current block type. - Updates the block type and block length at block boundaries. */ +/* +Stores the next symbol with the entropy code of the current block type. + + Updates the block type and block length at block boundaries. +*/ func storeSymbol(self *blockEncoder, symbol uint, bw *bitWriter) { if self.block_len_ == 0 { self.block_ix_++ @@ -939,9 +975,12 @@ func storeSymbol(self *blockEncoder, symbol uint, bw *bitWriter) { } } -/* Stores the next symbol with the entropy code of the current block type and - context value. - Updates the block type and block length at block boundaries. */ +/* +Stores the next symbol with the entropy code of the current block type and + + context value. + Updates the block type and block length at block boundaries. +*/ func storeSymbolWithContext(self *blockEncoder, symbol uint, context uint, context_map []uint32, bw *bitWriter, context_bits uint) { if self.block_len_ == 0 { self.block_ix_++ @@ -1257,8 +1296,11 @@ func storeMetaBlockFast(input []byte, start_pos uint, length uint, mask uint, is } } -/* This is for storing uncompressed blocks (simple raw storage of - bytes-as-bytes). */ +/* +This is for storing uncompressed blocks (simple raw storage of + + bytes-as-bytes). +*/ func storeUncompressedMetaBlock(is_final_block bool, input []byte, position uint, mask uint, len uint, bw *bitWriter) { var masked_pos uint = position & mask storeUncompressedMetaBlockHeader(uint(len), bw) diff --git a/backend/vendor/github.com/andybalholm/brotli/cluster_command.go b/backend/vendor/github.com/andybalholm/brotli/cluster_command.go index 7449751b..5aee1c08 100644 --- a/backend/vendor/github.com/andybalholm/brotli/cluster_command.go +++ b/backend/vendor/github.com/andybalholm/brotli/cluster_command.go @@ -8,8 +8,11 @@ import "math" See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -/* Computes the bit cost reduction by combining out[idx1] and out[idx2] and if - it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. */ +/* +Computes the bit cost reduction by combining out[idx1] and out[idx2] and if + + it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. +*/ func compareAndPushToQueueCommand(out []histogramCommand, cluster_size []uint32, idx1 uint32, idx2 uint32, max_num_pairs uint, pairs []histogramPair, num_pairs *uint) { var is_good_pair bool = false var p histogramPair @@ -165,10 +168,13 @@ func histogramBitCostDistanceCommand(histogram *histogramCommand, candidate *his } } -/* Find the best 'out' histogram for each of the 'in' histograms. - When called, clusters[0..num_clusters) contains the unique values from - symbols[0..in_size), but this property is not preserved in this function. - Note: we assume that out[]->bit_cost_ is already up-to-date. */ +/* +Find the best 'out' histogram for each of the 'in' histograms. + + When called, clusters[0..num_clusters) contains the unique values from + symbols[0..in_size), but this property is not preserved in this function. + Note: we assume that out[]->bit_cost_ is already up-to-date. +*/ func histogramRemapCommand(in []histogramCommand, in_size uint, clusters []uint32, num_clusters uint, out []histogramCommand, symbols []uint32) { var i uint for i = 0; i < in_size; i++ { diff --git a/backend/vendor/github.com/andybalholm/brotli/cluster_distance.go b/backend/vendor/github.com/andybalholm/brotli/cluster_distance.go index 1aaa86e6..6b4c6516 100644 --- a/backend/vendor/github.com/andybalholm/brotli/cluster_distance.go +++ b/backend/vendor/github.com/andybalholm/brotli/cluster_distance.go @@ -8,8 +8,11 @@ import "math" See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -/* Computes the bit cost reduction by combining out[idx1] and out[idx2] and if - it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. */ +/* +Computes the bit cost reduction by combining out[idx1] and out[idx2] and if + + it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. +*/ func compareAndPushToQueueDistance(out []histogramDistance, cluster_size []uint32, idx1 uint32, idx2 uint32, max_num_pairs uint, pairs []histogramPair, num_pairs *uint) { var is_good_pair bool = false var p histogramPair @@ -165,10 +168,13 @@ func histogramBitCostDistanceDistance(histogram *histogramDistance, candidate *h } } -/* Find the best 'out' histogram for each of the 'in' histograms. - When called, clusters[0..num_clusters) contains the unique values from - symbols[0..in_size), but this property is not preserved in this function. - Note: we assume that out[]->bit_cost_ is already up-to-date. */ +/* +Find the best 'out' histogram for each of the 'in' histograms. + + When called, clusters[0..num_clusters) contains the unique values from + symbols[0..in_size), but this property is not preserved in this function. + Note: we assume that out[]->bit_cost_ is already up-to-date. +*/ func histogramRemapDistance(in []histogramDistance, in_size uint, clusters []uint32, num_clusters uint, out []histogramDistance, symbols []uint32) { var i uint for i = 0; i < in_size; i++ { diff --git a/backend/vendor/github.com/andybalholm/brotli/cluster_literal.go b/backend/vendor/github.com/andybalholm/brotli/cluster_literal.go index 6ba66f31..e00c90bc 100644 --- a/backend/vendor/github.com/andybalholm/brotli/cluster_literal.go +++ b/backend/vendor/github.com/andybalholm/brotli/cluster_literal.go @@ -8,8 +8,11 @@ import "math" See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -/* Computes the bit cost reduction by combining out[idx1] and out[idx2] and if - it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. */ +/* +Computes the bit cost reduction by combining out[idx1] and out[idx2] and if + + it is below a threshold, stores the pair (idx1, idx2) in the *pairs queue. +*/ func compareAndPushToQueueLiteral(out []histogramLiteral, cluster_size []uint32, idx1 uint32, idx2 uint32, max_num_pairs uint, pairs []histogramPair, num_pairs *uint) { var is_good_pair bool = false var p histogramPair @@ -165,10 +168,13 @@ func histogramBitCostDistanceLiteral(histogram *histogramLiteral, candidate *his } } -/* Find the best 'out' histogram for each of the 'in' histograms. - When called, clusters[0..num_clusters) contains the unique values from - symbols[0..in_size), but this property is not preserved in this function. - Note: we assume that out[]->bit_cost_ is already up-to-date. */ +/* +Find the best 'out' histogram for each of the 'in' histograms. + + When called, clusters[0..num_clusters) contains the unique values from + symbols[0..in_size), but this property is not preserved in this function. + Note: we assume that out[]->bit_cost_ is already up-to-date. +*/ func histogramRemapLiteral(in []histogramLiteral, in_size uint, clusters []uint32, num_clusters uint, out []histogramLiteral, symbols []uint32) { var i uint for i = 0; i < in_size; i++ { diff --git a/backend/vendor/github.com/andybalholm/brotli/compress_fragment.go b/backend/vendor/github.com/andybalholm/brotli/compress_fragment.go index dbf0c43b..5f2cb9cb 100644 --- a/backend/vendor/github.com/andybalholm/brotli/compress_fragment.go +++ b/backend/vendor/github.com/andybalholm/brotli/compress_fragment.go @@ -37,14 +37,17 @@ func isMatch5(p1 []byte, p2 []byte) bool { p1[4] == p2[4] } -/* Builds a literal prefix code into "depths" and "bits" based on the statistics - of the "input" string and stores it into the bit stream. - Note that the prefix code here is built from the pre-LZ77 input, therefore - we can only approximate the statistics of the actual literal stream. - Moreover, for long inputs we build a histogram from a sample of the input - and thus have to assign a non-zero depth for each literal. - Returns estimated compression ratio millibytes/char for encoding given input - with generated code. */ +/* +Builds a literal prefix code into "depths" and "bits" based on the statistics + + of the "input" string and stores it into the bit stream. + Note that the prefix code here is built from the pre-LZ77 input, therefore + we can only approximate the statistics of the actual literal stream. + Moreover, for long inputs we build a histogram from a sample of the input + and thus have to assign a non-zero depth for each literal. + Returns estimated compression ratio millibytes/char for encoding given input + with generated code. +*/ func buildAndStoreLiteralPrefixCode(input []byte, input_size uint, depths []byte, bits []uint16, bw *bitWriter) uint { var histogram = [256]uint32{0} var histogram_total uint @@ -96,8 +99,11 @@ func buildAndStoreLiteralPrefixCode(input []byte, input_size uint, depths []byte } } -/* Builds a command and distance prefix code (each 64 symbols) into "depth" and - "bits" based on "histogram" and stores it into the bit stream. */ +/* +Builds a command and distance prefix code (each 64 symbols) into "depth" and + + "bits" based on "histogram" and stores it into the bit stream. +*/ func buildAndStoreCommandPrefixCode1(histogram []uint32, depth []byte, bits []uint16, bw *bitWriter) { var tree [129]huffmanTree var cmd_depth = [numCommandSymbols]byte{0} @@ -637,27 +643,29 @@ next_block: } } -/* Compresses "input" string to bw as one or more complete meta-blocks. +/* +Compresses "input" string to bw as one or more complete meta-blocks. - If "is_last" is 1, emits an additional empty last meta-block. + If "is_last" is 1, emits an additional empty last meta-block. - "cmd_depth" and "cmd_bits" contain the command and distance prefix codes - (see comment in encode.h) used for the encoding of this input fragment. - If "is_last" is 0, they are updated to reflect the statistics - of this input fragment, to be used for the encoding of the next fragment. + "cmd_depth" and "cmd_bits" contain the command and distance prefix codes + (see comment in encode.h) used for the encoding of this input fragment. + If "is_last" is 0, they are updated to reflect the statistics + of this input fragment, to be used for the encoding of the next fragment. - "*cmd_code_numbits" is the number of bits of the compressed representation - of the command and distance prefix codes, and "cmd_code" is an array of - at least "(*cmd_code_numbits + 7) >> 3" size that contains the compressed - command and distance prefix codes. If "is_last" is 0, these are also - updated to represent the updated "cmd_depth" and "cmd_bits". + "*cmd_code_numbits" is the number of bits of the compressed representation + of the command and distance prefix codes, and "cmd_code" is an array of + at least "(*cmd_code_numbits + 7) >> 3" size that contains the compressed + command and distance prefix codes. If "is_last" is 0, these are also + updated to represent the updated "cmd_depth" and "cmd_bits". - REQUIRES: "input_size" is greater than zero, or "is_last" is 1. - REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24). - REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero. - REQUIRES: "table_size" is an odd (9, 11, 13, 15) power of two - OUTPUT: maximal copy distance <= |input_size| - OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */ + REQUIRES: "input_size" is greater than zero, or "is_last" is 1. + REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24). + REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero. + REQUIRES: "table_size" is an odd (9, 11, 13, 15) power of two + OUTPUT: maximal copy distance <= |input_size| + OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) +*/ func compressFragmentFast(input []byte, input_size uint, is_last bool, table []int, table_size uint, cmd_depth []byte, cmd_bits []uint16, cmd_code_numbits *uint, cmd_code []byte, bw *bitWriter) { var initial_storage_ix uint = bw.getPos() var table_bits uint = uint(log2FloorNonZero(table_size)) diff --git a/backend/vendor/github.com/andybalholm/brotli/compress_fragment_two_pass.go b/backend/vendor/github.com/andybalholm/brotli/compress_fragment_two_pass.go index 2473aca3..2aa315b5 100644 --- a/backend/vendor/github.com/andybalholm/brotli/compress_fragment_two_pass.go +++ b/backend/vendor/github.com/andybalholm/brotli/compress_fragment_two_pass.go @@ -39,8 +39,11 @@ func isMatch1(p1 []byte, p2 []byte, length uint) bool { return p1[4] == p2[4] && p1[5] == p2[5] } -/* Builds a command and distance prefix code (each 64 symbols) into "depth" and - "bits" based on "histogram" and stores it into the bit stream. */ +/* +Builds a command and distance prefix code (each 64 symbols) into "depth" and + + "bits" based on "histogram" and stores it into the bit stream. +*/ func buildAndStoreCommandPrefixCode(histogram []uint32, depth []byte, bits []uint16, bw *bitWriter) { var tree [129]huffmanTree var cmd_depth = [numCommandSymbols]byte{0} @@ -558,18 +561,20 @@ func compressFragmentTwoPassImpl(input []byte, input_size uint, is_last bool, co } } -/* Compresses "input" string to bw as one or more complete meta-blocks. +/* +Compresses "input" string to bw as one or more complete meta-blocks. - If "is_last" is 1, emits an additional empty last meta-block. + If "is_last" is 1, emits an additional empty last meta-block. - REQUIRES: "input_size" is greater than zero, or "is_last" is 1. - REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24). - REQUIRES: "command_buf" and "literal_buf" point to at least - kCompressFragmentTwoPassBlockSize long arrays. - REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero. - REQUIRES: "table_size" is a power of two - OUTPUT: maximal copy distance <= |input_size| - OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) */ + REQUIRES: "input_size" is greater than zero, or "is_last" is 1. + REQUIRES: "input_size" is less or equal to maximal metablock size (1 << 24). + REQUIRES: "command_buf" and "literal_buf" point to at least + kCompressFragmentTwoPassBlockSize long arrays. + REQUIRES: All elements in "table[0..table_size-1]" are initialized to zero. + REQUIRES: "table_size" is a power of two + OUTPUT: maximal copy distance <= |input_size| + OUTPUT: maximal copy distance <= BROTLI_MAX_BACKWARD_LIMIT(18) +*/ func compressFragmentTwoPass(input []byte, input_size uint, is_last bool, command_buf []uint32, literal_buf []byte, table []int, table_size uint, bw *bitWriter) { var initial_storage_ix uint = bw.getPos() var table_bits uint = uint(log2FloorNonZero(table_size)) diff --git a/backend/vendor/github.com/andybalholm/brotli/decode.go b/backend/vendor/github.com/andybalholm/brotli/decode.go index d2f39a05..9e5dec05 100644 --- a/backend/vendor/github.com/andybalholm/brotli/decode.go +++ b/backend/vendor/github.com/andybalholm/brotli/decode.go @@ -69,9 +69,11 @@ const huffmanTableBits = 8 const huffmanTableMask = 0xFF -/* We need the slack region for the following reasons: - - doing up to two 16-byte copies for fast backward copying - - inserting transformed dictionary word (5 prefix + 24 base + 8 suffix) */ +/* +We need the slack region for the following reasons: + - doing up to two 16-byte copies for fast backward copying + - inserting transformed dictionary word (5 prefix + 24 base + 8 suffix) +*/ const kRingBufferWriteAheadSlack uint32 = 42 var kCodeLengthCodeOrder = [codeLengthCodes]byte{1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15} @@ -121,8 +123,11 @@ func saveErrorCode(s *Reader, e int) int { } } -/* Decodes WBITS by reading 1 - 7 bits, or 0x11 for "Large Window Brotli". - Precondition: bit-reader accumulator has at least 8 bits. */ +/* +Decodes WBITS by reading 1 - 7 bits, or 0x11 for "Large Window Brotli". + + Precondition: bit-reader accumulator has at least 8 bits. +*/ func decodeWindowBits(s *Reader, br *bitReader) int { var n uint32 var large_window bool = s.large_window @@ -361,10 +366,13 @@ func decodeMetaBlockLength(s *Reader, br *bitReader) int { } } -/* Decodes the Huffman code. - This method doesn't read data from the bit reader, BUT drops the amount of - bits that correspond to the decoded symbol. - bits MUST contain at least 15 (BROTLI_HUFFMAN_MAX_CODE_LENGTH) valid bits. */ +/* +Decodes the Huffman code. + + This method doesn't read data from the bit reader, BUT drops the amount of + bits that correspond to the decoded symbol. + bits MUST contain at least 15 (BROTLI_HUFFMAN_MAX_CODE_LENGTH) valid bits. +*/ func decodeSymbol(bits uint32, table []huffmanCode, br *bitReader) uint32 { table = table[bits&huffmanTableMask:] if table[0].bits > huffmanTableBits { @@ -377,14 +385,20 @@ func decodeSymbol(bits uint32, table []huffmanCode, br *bitReader) uint32 { return uint32(table[0].value) } -/* Reads and decodes the next Huffman code from bit-stream. - This method peeks 16 bits of input and drops 0 - 15 of them. */ +/* +Reads and decodes the next Huffman code from bit-stream. + + This method peeks 16 bits of input and drops 0 - 15 of them. +*/ func readSymbol(table []huffmanCode, br *bitReader) uint32 { return decodeSymbol(get16BitsUnmasked(br), table, br) } -/* Same as DecodeSymbol, but it is known that there is less than 15 bits of - input are currently available. */ +/* +Same as DecodeSymbol, but it is known that there is less than 15 bits of + + input are currently available. +*/ func safeDecodeSymbol(table []huffmanCode, br *bitReader, result *uint32) bool { var val uint32 var available_bits uint32 = getAvailableBits(br) @@ -448,8 +462,11 @@ func preloadSymbol(safe int, table []huffmanCode, br *bitReader, bits *uint32, v *value = uint32(table[0].value) } -/* Decodes the next Huffman code using data prepared by PreloadSymbol. - Reads 0 - 15 bits. Also peeks 8 following bits. */ +/* +Decodes the next Huffman code using data prepared by PreloadSymbol. + + Reads 0 - 15 bits. Also peeks 8 following bits. +*/ func readPreloadedSymbol(table []huffmanCode, br *bitReader, bits *uint32, value *uint32) uint32 { var result uint32 = *value var ext []huffmanCode @@ -479,9 +496,12 @@ func log2Floor(x uint32) uint32 { return result } -/* Reads (s->symbol + 1) symbols. - Totally 1..4 symbols are read, 1..11 bits each. - The list of symbols MUST NOT contain duplicates. */ +/* +Reads (s->symbol + 1) symbols. + + Totally 1..4 symbols are read, 1..11 bits each. + The list of symbols MUST NOT contain duplicates. +*/ func readSimpleHuffmanSymbols(alphabet_size uint32, max_symbol uint32, s *Reader) int { var br *bitReader = &s.br var max_bits uint32 = log2Floor(alphabet_size - 1) @@ -517,12 +537,15 @@ func readSimpleHuffmanSymbols(alphabet_size uint32, max_symbol uint32, s *Reader return decoderSuccess } -/* Process single decoded symbol code length: - A) reset the repeat variable - B) remember code length (if it is not 0) - C) extend corresponding index-chain - D) reduce the Huffman space - E) update the histogram */ +/* +Process single decoded symbol code length: + + A) reset the repeat variable + B) remember code length (if it is not 0) + C) extend corresponding index-chain + D) reduce the Huffman space + E) update the histogram +*/ func processSingleCodeLength(code_len uint32, symbol *uint32, repeat *uint32, space *uint32, prev_code_len *uint32, symbol_lists symbolList, code_length_histo []uint16, next_symbol []int) { *repeat = 0 if code_len != 0 { /* code_len == 1..15 */ @@ -536,16 +559,19 @@ func processSingleCodeLength(code_len uint32, symbol *uint32, repeat *uint32, sp (*symbol)++ } -/* Process repeated symbol code length. - A) Check if it is the extension of previous repeat sequence; if the decoded - value is not BROTLI_REPEAT_PREVIOUS_CODE_LENGTH, then it is a new - symbol-skip - B) Update repeat variable - C) Check if operation is feasible (fits alphabet) - D) For each symbol do the same operations as in ProcessSingleCodeLength +/* +Process repeated symbol code length. - PRECONDITION: code_len == BROTLI_REPEAT_PREVIOUS_CODE_LENGTH or - code_len == BROTLI_REPEAT_ZERO_CODE_LENGTH */ + A) Check if it is the extension of previous repeat sequence; if the decoded + value is not BROTLI_REPEAT_PREVIOUS_CODE_LENGTH, then it is a new + symbol-skip + B) Update repeat variable + C) Check if operation is feasible (fits alphabet) + D) For each symbol do the same operations as in ProcessSingleCodeLength + + PRECONDITION: code_len == BROTLI_REPEAT_PREVIOUS_CODE_LENGTH or + code_len == BROTLI_REPEAT_ZERO_CODE_LENGTH +*/ func processRepeatedCodeLength(code_len uint32, repeat_delta uint32, alphabet_size uint32, symbol *uint32, repeat *uint32, space *uint32, prev_code_len *uint32, repeat_code_len *uint32, symbol_lists symbolList, code_length_histo []uint16, next_symbol []int) { var old_repeat uint32 /* for BROTLI_REPEAT_ZERO_CODE_LENGTH */ /* for BROTLI_REPEAT_ZERO_CODE_LENGTH */ var extra_bits uint32 = 3 @@ -688,8 +714,11 @@ func safeReadSymbolCodeLengths(alphabet_size uint32, s *Reader) int { return decoderSuccess } -/* Reads and decodes 15..18 codes using static prefix code. - Each code is 2..4 bits long. In total 30..72 bits are used. */ +/* +Reads and decodes 15..18 codes using static prefix code. + + Each code is 2..4 bits long. In total 30..72 bits are used. +*/ func readCodeLengthCodeLengths(s *Reader) int { var br *bitReader = &s.br var num_codes uint32 = s.repeat @@ -737,17 +766,20 @@ func readCodeLengthCodeLengths(s *Reader) int { return decoderSuccess } -/* Decodes the Huffman tables. - There are 2 scenarios: - A) Huffman code contains only few symbols (1..4). Those symbols are read - directly; their code lengths are defined by the number of symbols. - For this scenario 4 - 49 bits will be read. +/* +Decodes the Huffman tables. - B) 2-phase decoding: - B.1) Small Huffman table is decoded; it is specified with code lengths - encoded with predefined entropy code. 32 - 74 bits are used. - B.2) Decoded table is used to decode code lengths of symbols in resulting - Huffman table. In worst case 3520 bits are read. */ + There are 2 scenarios: + A) Huffman code contains only few symbols (1..4). Those symbols are read + directly; their code lengths are defined by the number of symbols. + For this scenario 4 - 49 bits will be read. + + B) 2-phase decoding: + B.1) Small Huffman table is decoded; it is specified with code lengths + encoded with predefined entropy code. 32 - 74 bits are used. + B.2) Decoded table is used to decode code lengths of symbols in resulting + Huffman table. In worst case 3520 bits are read. +*/ func readHuffmanCode(alphabet_size uint32, max_symbol uint32, table []huffmanCode, opt_table_size *uint32, s *Reader) int { var br *bitReader = &s.br @@ -887,8 +919,11 @@ func readBlockLength(table []huffmanCode, br *bitReader) uint32 { return kBlockLengthPrefixCode[code].offset + readBits(br, nbits) } -/* WARNING: if state is not BROTLI_STATE_READ_BLOCK_LENGTH_NONE, then - reading can't be continued with ReadBlockLength. */ +/* +WARNING: if state is not BROTLI_STATE_READ_BLOCK_LENGTH_NONE, then + + reading can't be continued with ReadBlockLength. +*/ func safeReadBlockLength(s *Reader, result *uint32, table []huffmanCode, br *bitReader) bool { var index uint32 if s.substate_read_block_length == stateReadBlockLengthNone { @@ -913,20 +948,24 @@ func safeReadBlockLength(s *Reader, result *uint32, table []huffmanCode, br *bit } } -/* Transform: - 1) initialize list L with values 0, 1,... 255 - 2) For each input element X: +/* +Transform: + + 1. initialize list L with values 0, 1,... 255 + + 2. For each input element X: 2.1) let Y = L[X] 2.2) remove X-th element from L 2.3) prepend Y to L 2.4) append Y to output - In most cases max(Y) <= 7, so most of L remains intact. - To reduce the cost of initialization, we reuse L, remember the upper bound - of Y values, and reinitialize only first elements in L. + In most cases max(Y) <= 7, so most of L remains intact. + To reduce the cost of initialization, we reuse L, remember the upper bound + of Y values, and reinitialize only first elements in L. - Most of input values are 0 and 1. To reduce number of branches, we replace - inner for loop with do-while. */ + Most of input values are 0 and 1. To reduce number of branches, we replace + inner for loop with do-while. +*/ func inverseMoveToFrontTransform(v []byte, v_len uint32, state *Reader) { var mtf [256]byte var i int @@ -973,14 +1012,17 @@ func huffmanTreeGroupDecode(group *huffmanTreeGroup, s *Reader) int { return decoderSuccess } -/* Decodes a context map. - Decoding is done in 4 phases: - 1) Read auxiliary information (6..16 bits) and allocate memory. - In case of trivial context map, decoding is finished at this phase. - 2) Decode Huffman table using ReadHuffmanCode function. - This table will be used for reading context map items. - 3) Read context map items; "0" values could be run-length encoded. - 4) Optionally, apply InverseMoveToFront transform to the resulting map. */ +/* +Decodes a context map. + + Decoding is done in 4 phases: + 1) Read auxiliary information (6..16 bits) and allocate memory. + In case of trivial context map, decoding is finished at this phase. + 2) Decode Huffman table using ReadHuffmanCode function. + This table will be used for reading context map items. + 3) Read context map items; "0" values could be run-length encoded. + 4) Optionally, apply InverseMoveToFront transform to the resulting map. +*/ func decodeContextMap(context_map_size uint32, num_htrees *uint32, context_map_arg *[]byte, s *Reader) int { var br *bitReader = &s.br var result int = decoderSuccess @@ -1121,8 +1163,11 @@ func decodeContextMap(context_map_size uint32, num_htrees *uint32, context_map_a } } -/* Decodes a command or literal and updates block type ring-buffer. - Reads 3..54 bits. */ +/* +Decodes a command or literal and updates block type ring-buffer. + + Reads 3..54 bits. +*/ func decodeBlockTypeAndLength(safe int, s *Reader, tree_type int) bool { var max_block_type uint32 = s.num_block_types[tree_type] var type_tree []huffmanCode @@ -1207,8 +1252,11 @@ func prepareLiteralDecoding(s *Reader) { s.context_lookup = getContextLUT(int(context_mode)) } -/* Decodes the block type and updates the state for literal context. - Reads 3..54 bits. */ +/* +Decodes the block type and updates the state for literal context. + + Reads 3..54 bits. +*/ func decodeLiteralBlockSwitchInternal(safe int, s *Reader) bool { if !decodeBlockTypeAndLength(safe, s, 0) { return false @@ -1226,8 +1274,11 @@ func safeDecodeLiteralBlockSwitch(s *Reader) bool { return decodeLiteralBlockSwitchInternal(1, s) } -/* Block switch for insert/copy length. - Reads 3..54 bits. */ +/* +Block switch for insert/copy length. + + Reads 3..54 bits. +*/ func decodeCommandBlockSwitchInternal(safe int, s *Reader) bool { if !decodeBlockTypeAndLength(safe, s, 1) { return false @@ -1245,8 +1296,11 @@ func safeDecodeCommandBlockSwitch(s *Reader) bool { return decodeCommandBlockSwitchInternal(1, s) } -/* Block switch for distance codes. - Reads 3..54 bits. */ +/* +Block switch for distance codes. + + Reads 3..54 bits. +*/ func decodeDistanceBlockSwitchInternal(safe int, s *Reader) bool { if !decodeBlockTypeAndLength(safe, s, 2) { return false @@ -1276,9 +1330,12 @@ func unwrittenBytes(s *Reader, wrap bool) uint { return partial_pos_rb - s.partial_pos_out } -/* Dumps output. - Returns BROTLI_DECODER_NEEDS_MORE_OUTPUT only if there is more output to push - and either ring-buffer is as big as window size, or |force| is true. */ +/* +Dumps output. + + Returns BROTLI_DECODER_NEEDS_MORE_OUTPUT only if there is more output to push + and either ring-buffer is as big as window size, or |force| is true. +*/ func writeRingBuffer(s *Reader, available_out *uint, next_out *[]byte, total_out *uint, force bool) int { var start []byte start = s.ringbuffer[s.partial_pos_out&uint(s.ringbuffer_mask):] @@ -1336,13 +1393,15 @@ func wrapRingBuffer(s *Reader) { } } -/* Allocates ring-buffer. +/* +Allocates ring-buffer. - s->ringbuffer_size MUST be updated by BrotliCalculateRingBufferSize before - this function is called. + s->ringbuffer_size MUST be updated by BrotliCalculateRingBufferSize before + this function is called. - Last two bytes of ring-buffer are initialized to 0, so context calculation - could be done uniformly for the first two and all other positions. */ + Last two bytes of ring-buffer are initialized to 0, so context calculation + could be done uniformly for the first two and all other positions. +*/ func ensureRingBuffer(s *Reader) bool { var old_ringbuffer []byte = s.ringbuffer if s.ringbuffer_size == s.new_ringbuffer_size { @@ -1429,12 +1488,14 @@ func copyUncompressedBlockToOutput(available_out *uint, next_out *[]byte, total_ } } -/* Calculates the smallest feasible ring buffer. +/* +Calculates the smallest feasible ring buffer. - If we know the data size is small, do not allocate more ring buffer - size than needed to reduce memory usage. + If we know the data size is small, do not allocate more ring buffer + size than needed to reduce memory usage. - When this method is called, metablock size and flags MUST be decoded. */ + When this method is called, metablock size and flags MUST be decoded. +*/ func calculateRingBufferSize(s *Reader) { var window_size int = 1 << s.window_bits var new_ringbuffer_size int = window_size @@ -2060,17 +2121,19 @@ func maxDistanceSymbol(ndirect uint32, npostfix uint32) uint32 { } } -/* Invariant: input stream is never overconsumed: - - invalid input implies that the whole stream is invalid -> any amount of - input could be read and discarded - - when result is "needs more input", then at least one more byte is REQUIRED - to complete decoding; all input data MUST be consumed by decoder, so - client could swap the input buffer - - when result is "needs more output" decoder MUST ensure that it doesn't - hold more than 7 bits in bit reader; this saves client from swapping input - buffer ahead of time - - when result is "success" decoder MUST return all unused data back to input - buffer; this is possible because the invariant is held on enter */ +/* +Invariant: input stream is never overconsumed: + - invalid input implies that the whole stream is invalid -> any amount of + input could be read and discarded + - when result is "needs more input", then at least one more byte is REQUIRED + to complete decoding; all input data MUST be consumed by decoder, so + client could swap the input buffer + - when result is "needs more output" decoder MUST ensure that it doesn't + hold more than 7 bits in bit reader; this saves client from swapping input + buffer ahead of time + - when result is "success" decoder MUST return all unused data back to input + buffer; this is possible because the invariant is held on enter +*/ func decoderDecompressStream(s *Reader, available_in *uint, next_in *[]byte, available_out *uint, next_out *[]byte) int { var result int = decoderSuccess var br *bitReader = &s.br diff --git a/backend/vendor/github.com/andybalholm/brotli/encode.go b/backend/vendor/github.com/andybalholm/brotli/encode.go index 3abaf571..7826ed49 100644 --- a/backend/vendor/github.com/andybalholm/brotli/encode.go +++ b/backend/vendor/github.com/andybalholm/brotli/encode.go @@ -126,8 +126,11 @@ func remainingInputBlockSize(s *Writer) uint { return block_size - uint(delta) } -/* Wraps 64-bit input position to 32-bit ring-buffer position preserving - "not-a-first-lap" feature. */ +/* +Wraps 64-bit input position to 32-bit ring-buffer position preserving + + "not-a-first-lap" feature. +*/ func wrapPosition(position uint64) uint32 { var result uint32 = uint32(position) var gb uint64 = position >> 30 @@ -619,11 +622,11 @@ func encoderInitState(s *Writer) { } /* - Copies the given input data to the internal ring buffer of the compressor. - No processing of the data occurs at this time and this function can be - called multiple times before calling WriteBrotliData() to process the - accumulated input. At most input_block_size() bytes of input data can be - copied to the ring buffer, otherwise the next WriteBrotliData() will fail. +Copies the given input data to the internal ring buffer of the compressor. +No processing of the data occurs at this time and this function can be +called multiple times before calling WriteBrotliData() to process the +accumulated input. At most input_block_size() bytes of input data can be +copied to the ring buffer, otherwise the next WriteBrotliData() will fail. */ func copyInputToRingBuffer(s *Writer, input_size uint, input_buffer []byte) { var ringbuffer_ *ringBuffer = &s.ringbuffer_ @@ -678,8 +681,11 @@ func copyInputToRingBuffer(s *Writer, input_size uint, input_buffer []byte) { } } -/* Marks all input as processed. - Returns true if position wrapping occurs. */ +/* +Marks all input as processed. + + Returns true if position wrapping occurs. +*/ func updateLastProcessedPos(s *Writer) bool { var wrapped_last_processed_pos uint32 = wrapPosition(s.last_processed_pos_) var wrapped_input_pos uint32 = wrapPosition(s.input_pos_) @@ -717,15 +723,15 @@ func extendLastCommand(s *Writer, bytes *uint32, wrapped_last_processed_pos *uin } /* - Processes the accumulated input data and writes - the new output meta-block to s.dest, if one has been - created (otherwise the processed input data is buffered internally). - If |is_last| or |force_flush| is true, an output meta-block is - always created. However, until |is_last| is true encoder may retain up - to 7 bits of the last byte of output. To force encoder to dump the remaining - bits use WriteMetadata() to append an empty meta-data block. - Returns false if the size of the input data is larger than - input_block_size(). +Processes the accumulated input data and writes +the new output meta-block to s.dest, if one has been +created (otherwise the processed input data is buffered internally). +If |is_last| or |force_flush| is true, an output meta-block is +always created. However, until |is_last| is true encoder may retain up +to 7 bits of the last byte of output. To force encoder to dump the remaining +bits use WriteMetadata() to append an empty meta-data block. +Returns false if the size of the input data is larger than +input_block_size(). */ func encodeData(s *Writer, is_last bool, force_flush bool) bool { var delta uint64 = unprocessedInputSize(s) @@ -883,8 +889,11 @@ func encodeData(s *Writer, is_last bool, force_flush bool) bool { } } -/* Dumps remaining output bits and metadata header to s.bw. - REQUIRED: |block_size| <= (1 << 24). */ +/* +Dumps remaining output bits and metadata header to s.bw. + + REQUIRED: |block_size| <= (1 << 24). +*/ func writeMetadataHeader(s *Writer, block_size uint) { bw := &s.bw diff --git a/backend/vendor/github.com/andybalholm/brotli/entropy_encode.go b/backend/vendor/github.com/andybalholm/brotli/entropy_encode.go index 3f469a3d..8ba6e380 100644 --- a/backend/vendor/github.com/andybalholm/brotli/entropy_encode.go +++ b/backend/vendor/github.com/andybalholm/brotli/entropy_encode.go @@ -112,21 +112,23 @@ func sortHuffmanTree(v0 huffmanTree, v1 huffmanTree) bool { return v0.index_right_or_value_ > v1.index_right_or_value_ } -/* This function will create a Huffman tree. +/* +This function will create a Huffman tree. - The catch here is that the tree cannot be arbitrarily deep. - Brotli specifies a maximum depth of 15 bits for "code trees" - and 7 bits for "code length code trees." + The catch here is that the tree cannot be arbitrarily deep. + Brotli specifies a maximum depth of 15 bits for "code trees" + and 7 bits for "code length code trees." - count_limit is the value that is to be faked as the minimum value - and this minimum value is raised until the tree matches the - maximum length requirement. + count_limit is the value that is to be faked as the minimum value + and this minimum value is raised until the tree matches the + maximum length requirement. - This algorithm is not of excellent performance for very long data blocks, - especially when population counts are longer than 2**tree_limit, but - we are not planning to use this with extremely long blocks. + This algorithm is not of excellent performance for very long data blocks, + especially when population counts are longer than 2**tree_limit, but + we are not planning to use this with extremely long blocks. - See http://en.wikipedia.org/wiki/Huffman_coding */ + See http://en.wikipedia.org/wiki/Huffman_coding +*/ func createHuffmanTree(data []uint32, length uint, tree_limit int, tree []huffmanTree, depth []byte) { var count_limit uint32 var sentinel huffmanTree @@ -297,13 +299,16 @@ func writeHuffmanTreeRepetitionsZeros(repetitions uint, tree_size *uint, tree [] } } -/* Change the population counts in a way that the consequent - Huffman tree compression, especially its RLE-part will be more - likely to compress this data more efficiently. +/* +Change the population counts in a way that the consequent - length contains the size of the histogram. - counts contains the population counts. - good_for_rle is a buffer of at least length size */ + Huffman tree compression, especially its RLE-part will be more + likely to compress this data more efficiently. + + length contains the size of the histogram. + counts contains the population counts. + good_for_rle is a buffer of at least length size +*/ func optimizeHuffmanCountsForRLE(length uint, counts []uint32, good_for_rle []byte) { var nonzero_count uint = 0 var stride uint @@ -481,9 +486,12 @@ func decideOverRLEUse(depth []byte, length uint, use_rle_for_non_zero *bool, use *use_rle_for_zero = total_reps_zero > count_reps_zero*2 } -/* Write a Huffman tree from bit depths into the bit-stream representation - of a Huffman tree. The generated Huffman tree is to be compressed once - more using a Huffman tree */ +/* +Write a Huffman tree from bit depths into the bit-stream representation + + of a Huffman tree. The generated Huffman tree is to be compressed once + more using a Huffman tree +*/ func writeHuffmanTree(depth []byte, length uint, tree_size *uint, tree []byte, extra_bits_data []byte) { var previous_value byte = initialRepeatedCodeLength var i uint diff --git a/backend/vendor/github.com/andybalholm/brotli/fast_log.go b/backend/vendor/github.com/andybalholm/brotli/fast_log.go index bbae3009..600337a2 100644 --- a/backend/vendor/github.com/andybalholm/brotli/fast_log.go +++ b/backend/vendor/github.com/andybalholm/brotli/fast_log.go @@ -23,10 +23,13 @@ func log2FloorNonZero(n uint) uint32 { return result } -/* A lookup table for small values of log2(int) to be used in entropy - computation. +/* +A lookup table for small values of log2(int) to be used in entropy - ", ".join(["%.16ff" % x for x in [0.0]+[log2(x) for x in range(1, 256)]]) */ + computation. + + ", ".join(["%.16ff" % x for x in [0.0]+[log2(x) for x in range(1, 256)]]) +*/ var kLog2Table = []float32{ 0.0000000000000000, 0.0000000000000000, diff --git a/backend/vendor/github.com/andybalholm/brotli/h10.go b/backend/vendor/github.com/andybalholm/brotli/h10.go index 5662fbbb..5933ea2a 100644 --- a/backend/vendor/github.com/andybalholm/brotli/h10.go +++ b/backend/vendor/github.com/andybalholm/brotli/h10.go @@ -24,12 +24,15 @@ func hashBytesH10(data []byte) uint32 { return h >> (32 - 17) } -/* A (forgetful) hash table where each hash bucket contains a binary tree of - sequences whose first 4 bytes share the same hash code. - Each sequence is 128 long and is identified by its starting - position in the input data. The binary tree is sorted by the lexicographic - order of the sequences, and it is also a max-heap with respect to the - starting positions. */ +/* +A (forgetful) hash table where each hash bucket contains a binary tree of + + sequences whose first 4 bytes share the same hash code. + Each sequence is 128 long and is identified by its starting + position in the input data. The binary tree is sorted by the lexicographic + order of the sequences, and it is also a max-heap with respect to the + starting positions. +*/ type h10 struct { hasherCommon window_mask_ uint @@ -61,16 +64,19 @@ func rightChildIndexH10(self *h10, pos uint) uint { return 2*(pos&self.window_mask_) + 1 } -/* Stores the hash of the next 4 bytes and in a single tree-traversal, the - hash bucket's binary tree is searched for matches and is re-rooted at the - current position. +/* +Stores the hash of the next 4 bytes and in a single tree-traversal, the - If less than 128 data is available, the hash bucket of the - current position is searched for matches, but the state of the hash table - is not changed, since we can not know the final sorting order of the - current (incomplete) sequence. + hash bucket's binary tree is searched for matches and is re-rooted at the + current position. - This function must be called with increasing cur_ix positions. */ + If less than 128 data is available, the hash bucket of the + current position is searched for matches, but the state of the hash table + is not changed, since we can not know the final sorting order of the + current (incomplete) sequence. + + This function must be called with increasing cur_ix positions. +*/ func storeAndFindMatchesH10(self *h10, data []byte, cur_ix uint, ring_buffer_mask uint, max_length uint, max_backward uint, best_len *uint, matches []backwardMatch) []backwardMatch { var cur_ix_masked uint = cur_ix & ring_buffer_mask var max_comp_len uint = brotli_min_size_t(max_length, 128) @@ -152,13 +158,16 @@ func storeAndFindMatchesH10(self *h10, data []byte, cur_ix uint, ring_buffer_mas return matches } -/* Finds all backward matches of &data[cur_ix & ring_buffer_mask] up to the - length of max_length and stores the position cur_ix in the hash table. +/* +Finds all backward matches of &data[cur_ix & ring_buffer_mask] up to the - Sets *num_matches to the number of matches found, and stores the found - matches in matches[0] to matches[*num_matches - 1]. The matches will be - sorted by strictly increasing length and (non-strictly) increasing - distance. */ + length of max_length and stores the position cur_ix in the hash table. + + Sets *num_matches to the number of matches found, and stores the found + matches in matches[0] to matches[*num_matches - 1]. The matches will be + sorted by strictly increasing length and (non-strictly) increasing + distance. +*/ func findAllMatchesH10(handle *h10, dictionary *encoderDictionary, data []byte, ring_buffer_mask uint, cur_ix uint, max_length uint, max_backward uint, gap uint, params *encoderParams, matches []backwardMatch) uint { var orig_matches []backwardMatch = matches var cur_ix_masked uint = cur_ix & ring_buffer_mask @@ -224,9 +233,12 @@ func findAllMatchesH10(handle *h10, dictionary *encoderDictionary, data []byte, return uint(-cap(matches) + cap(orig_matches)) } -/* Stores the hash of the next 4 bytes and re-roots the binary tree at the - current sequence, without returning any matches. - REQUIRES: ix + 128 <= end-of-current-block */ +/* +Stores the hash of the next 4 bytes and re-roots the binary tree at the + + current sequence, without returning any matches. + REQUIRES: ix + 128 <= end-of-current-block +*/ func (h *h10) Store(data []byte, mask uint, ix uint) { var max_backward uint = h.window_mask_ - windowGap + 1 /* Maximum distance is window size - 16, see section 9.1. of the spec. */ diff --git a/backend/vendor/github.com/andybalholm/brotli/h5.go b/backend/vendor/github.com/andybalholm/brotli/h5.go index f391b73f..58b51b4b 100644 --- a/backend/vendor/github.com/andybalholm/brotli/h5.go +++ b/backend/vendor/github.com/andybalholm/brotli/h5.go @@ -8,12 +8,15 @@ import "encoding/binary" See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -/* A (forgetful) hash table to the data seen by the compressor, to - help create backward references to previous data. +/* +A (forgetful) hash table to the data seen by the compressor, to - This is a hash map of fixed size (bucket_size_) to a ring buffer of - fixed size (block_size_). The ring buffer contains the last block_size_ - index positions of the given hash key in the compressed data. */ + help create backward references to previous data. + + This is a hash map of fixed size (bucket_size_) to a ring buffer of + fixed size (block_size_). The ring buffer contains the last block_size_ + index positions of the given hash key in the compressed data. +*/ func (*h5) HashTypeLength() uint { return 4 } @@ -67,8 +70,11 @@ func (h *h5) Prepare(one_shot bool, input_size uint, data []byte) { } } -/* Look at 4 bytes at &data[ix & mask]. - Compute a hash from these, and store the value of ix at that position. */ +/* +Look at 4 bytes at &data[ix & mask]. + + Compute a hash from these, and store the value of ix at that position. +*/ func (h *h5) Store(data []byte, mask uint, ix uint) { var num []uint16 = h.num var key uint32 = hashBytesH5(data[ix&mask:], h.hash_shift_) @@ -100,17 +106,20 @@ func (h *h5) PrepareDistanceCache(distance_cache []int) { prepareDistanceCache(distance_cache, h.params.num_last_distances_to_check) } -/* Find a longest backward match of &data[cur_ix] up to the length of - max_length and stores the position cur_ix in the hash table. +/* +Find a longest backward match of &data[cur_ix] up to the length of - REQUIRES: PrepareDistanceCacheH5 must be invoked for current distance cache - values; if this method is invoked repeatedly with the same distance - cache values, it is enough to invoke PrepareDistanceCacheH5 once. + max_length and stores the position cur_ix in the hash table. - Does not look for matches longer than max_length. - Does not look for matches further away than max_backward. - Writes the best match into |out|. - |out|->score is updated only if a better match is found. */ + REQUIRES: PrepareDistanceCacheH5 must be invoked for current distance cache + values; if this method is invoked repeatedly with the same distance + cache values, it is enough to invoke PrepareDistanceCacheH5 once. + + Does not look for matches longer than max_length. + Does not look for matches further away than max_backward. + Writes the best match into |out|. + |out|->score is updated only if a better match is found. +*/ func (h *h5) FindLongestMatch(dictionary *encoderDictionary, data []byte, ring_buffer_mask uint, distance_cache []int, cur_ix uint, max_length uint, max_backward uint, gap uint, max_distance uint, out *hasherSearchResult) { var num []uint16 = h.num var buckets []uint32 = h.buckets diff --git a/backend/vendor/github.com/andybalholm/brotli/h6.go b/backend/vendor/github.com/andybalholm/brotli/h6.go index 80bb224a..d2902b46 100644 --- a/backend/vendor/github.com/andybalholm/brotli/h6.go +++ b/backend/vendor/github.com/andybalholm/brotli/h6.go @@ -8,12 +8,15 @@ import "encoding/binary" See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -/* A (forgetful) hash table to the data seen by the compressor, to - help create backward references to previous data. +/* +A (forgetful) hash table to the data seen by the compressor, to - This is a hash map of fixed size (bucket_size_) to a ring buffer of - fixed size (block_size_). The ring buffer contains the last block_size_ - index positions of the given hash key in the compressed data. */ + help create backward references to previous data. + + This is a hash map of fixed size (bucket_size_) to a ring buffer of + fixed size (block_size_). The ring buffer contains the last block_size_ + index positions of the given hash key in the compressed data. +*/ func (*h6) HashTypeLength() uint { return 8 } @@ -69,8 +72,11 @@ func (h *h6) Prepare(one_shot bool, input_size uint, data []byte) { } } -/* Look at 4 bytes at &data[ix & mask]. - Compute a hash from these, and store the value of ix at that position. */ +/* +Look at 4 bytes at &data[ix & mask]. + + Compute a hash from these, and store the value of ix at that position. +*/ func (h *h6) Store(data []byte, mask uint, ix uint) { var num []uint16 = h.num var key uint32 = hashBytesH6(data[ix&mask:], h.hash_mask_, h.hash_shift_) @@ -102,17 +108,20 @@ func (h *h6) PrepareDistanceCache(distance_cache []int) { prepareDistanceCache(distance_cache, h.params.num_last_distances_to_check) } -/* Find a longest backward match of &data[cur_ix] up to the length of - max_length and stores the position cur_ix in the hash table. +/* +Find a longest backward match of &data[cur_ix] up to the length of - REQUIRES: PrepareDistanceCacheH6 must be invoked for current distance cache - values; if this method is invoked repeatedly with the same distance - cache values, it is enough to invoke PrepareDistanceCacheH6 once. + max_length and stores the position cur_ix in the hash table. - Does not look for matches longer than max_length. - Does not look for matches further away than max_backward. - Writes the best match into |out|. - |out|->score is updated only if a better match is found. */ + REQUIRES: PrepareDistanceCacheH6 must be invoked for current distance cache + values; if this method is invoked repeatedly with the same distance + cache values, it is enough to invoke PrepareDistanceCacheH6 once. + + Does not look for matches longer than max_length. + Does not look for matches further away than max_backward. + Writes the best match into |out|. + |out|->score is updated only if a better match is found. +*/ func (h *h6) FindLongestMatch(dictionary *encoderDictionary, data []byte, ring_buffer_mask uint, distance_cache []int, cur_ix uint, max_length uint, max_backward uint, gap uint, max_distance uint, out *hasherSearchResult) { var num []uint16 = h.num var buckets []uint32 = h.buckets diff --git a/backend/vendor/github.com/andybalholm/brotli/hash.go b/backend/vendor/github.com/andybalholm/brotli/hash.go index 003b433e..5d49b86d 100644 --- a/backend/vendor/github.com/andybalholm/brotli/hash.go +++ b/backend/vendor/github.com/andybalholm/brotli/hash.go @@ -44,12 +44,14 @@ type hasherSearchResult struct { len_code_delta int } -/* kHashMul32 multiplier has these properties: - * The multiplier must be odd. Otherwise we may lose the highest bit. - * No long streaks of ones or zeros. - * There is no effort to ensure that it is a prime, the oddity is enough - for this use. - * The number has been tuned heuristically against compression benchmarks. */ +/* +kHashMul32 multiplier has these properties: + - The multiplier must be odd. Otherwise we may lose the highest bit. + - No long streaks of ones or zeros. + - There is no effort to ensure that it is a prime, the oddity is enough + for this use. + - The number has been tuned heuristically against compression benchmarks. +*/ const kHashMul32 uint32 = 0x1E35A7BD const kHashMul64 uint64 = 0x1E35A7BD1E35A7BD @@ -92,22 +94,25 @@ const distanceBitPenalty = 30 /* Score must be positive after applying maximal penalty. */ const scoreBase = (distanceBitPenalty * 8 * 8) -/* Usually, we always choose the longest backward reference. This function - allows for the exception of that rule. +/* +Usually, we always choose the longest backward reference. This function - If we choose a backward reference that is further away, it will - usually be coded with more bits. We approximate this by assuming - log2(distance). If the distance can be expressed in terms of the - last four distances, we use some heuristic constants to estimate - the bits cost. For the first up to four literals we use the bit - cost of the literals from the literal cost model, after that we - use the average bit cost of the cost model. + allows for the exception of that rule. - This function is used to sometimes discard a longer backward reference - when it is not much longer and the bit cost for encoding it is more - than the saved literals. + If we choose a backward reference that is further away, it will + usually be coded with more bits. We approximate this by assuming + log2(distance). If the distance can be expressed in terms of the + last four distances, we use some heuristic constants to estimate + the bits cost. For the first up to four literals we use the bit + cost of the literals from the literal cost model, after that we + use the average bit cost of the cost model. - backward_reference_offset MUST be positive. */ + This function is used to sometimes discard a longer backward reference + when it is not much longer and the bit cost for encoding it is more + than the saved literals. + + backward_reference_offset MUST be positive. +*/ func backwardReferenceScore(copy_length uint, backward_reference_offset uint) uint { return scoreBase + literalByteScore*uint(copy_length) - distanceBitPenalty*uint(log2FloorNonZero(backward_reference_offset)) } diff --git a/backend/vendor/github.com/andybalholm/brotli/hash_composite.go b/backend/vendor/github.com/andybalholm/brotli/hash_composite.go index a65fe2e6..1ad3c043 100644 --- a/backend/vendor/github.com/andybalholm/brotli/hash_composite.go +++ b/backend/vendor/github.com/andybalholm/brotli/hash_composite.go @@ -26,8 +26,11 @@ func (h *hashComposite) StoreLookahead() uint { } } -/* Composite hasher: This hasher allows to combine two other hashers, HASHER_A - and HASHER_B. */ +/* +Composite hasher: This hasher allows to combine two other hashers, HASHER_A + + and HASHER_B. +*/ type hashComposite struct { hasherCommon ha hasherHandle @@ -39,10 +42,13 @@ func (h *hashComposite) Initialize(params *encoderParams) { h.params = params } -/* TODO: Initialize of the hashers is defered to Prepare (and params - remembered here) because we don't get the one_shot and input_size params - here that are needed to know the memory size of them. Instead provide - those params to all hashers InitializehashComposite */ +/* +TODO: Initialize of the hashers is defered to Prepare (and params + + remembered here) because we don't get the one_shot and input_size params + here that are needed to know the memory size of them. Instead provide + those params to all hashers InitializehashComposite +*/ func (h *hashComposite) Prepare(one_shot bool, input_size uint, data []byte) { if h.ha == nil { var common_a *hasherCommon diff --git a/backend/vendor/github.com/andybalholm/brotli/hash_forgetful_chain.go b/backend/vendor/github.com/andybalholm/brotli/hash_forgetful_chain.go index 3364c44b..ba2c2bce 100644 --- a/backend/vendor/github.com/andybalholm/brotli/hash_forgetful_chain.go +++ b/backend/vendor/github.com/andybalholm/brotli/hash_forgetful_chain.go @@ -30,12 +30,15 @@ type slot struct { next uint16 } -/* A (forgetful) hash table to the data seen by the compressor, to - help create backward references to previous data. +/* +A (forgetful) hash table to the data seen by the compressor, to - Hashes are stored in chains which are bucketed to groups. Group of chains - share a storage "bank". When more than "bank size" chain nodes are added, - oldest nodes are replaced; this way several chains may share a tail. */ + help create backward references to previous data. + + Hashes are stored in chains which are bucketed to groups. Group of chains + share a storage "bank". When more than "bank size" chain nodes are added, + oldest nodes are replaced; this way several chains may share a tail. +*/ type hashForgetfulChain struct { hasherCommon @@ -105,8 +108,11 @@ func (h *hashForgetfulChain) Prepare(one_shot bool, input_size uint, data []byte } } -/* Look at 4 bytes at &data[ix & mask]. Compute a hash from these, and prepend - node to corresponding chain; also update tiny_hash for current position. */ +/* +Look at 4 bytes at &data[ix & mask]. Compute a hash from these, and prepend + + node to corresponding chain; also update tiny_hash for current position. +*/ func (h *hashForgetfulChain) Store(data []byte, mask uint, ix uint) { var key uint = h.HashBytes(data[ix&mask:]) var bank uint = key & (h.numBanks - 1) @@ -146,17 +152,20 @@ func (h *hashForgetfulChain) PrepareDistanceCache(distance_cache []int) { prepareDistanceCache(distance_cache, h.numLastDistancesToCheck) } -/* Find a longest backward match of &data[cur_ix] up to the length of - max_length and stores the position cur_ix in the hash table. +/* +Find a longest backward match of &data[cur_ix] up to the length of - REQUIRES: PrepareDistanceCachehashForgetfulChain must be invoked for current distance cache - values; if this method is invoked repeatedly with the same distance - cache values, it is enough to invoke PrepareDistanceCachehashForgetfulChain once. + max_length and stores the position cur_ix in the hash table. - Does not look for matches longer than max_length. - Does not look for matches further away than max_backward. - Writes the best match into |out|. - |out|->score is updated only if a better match is found. */ + REQUIRES: PrepareDistanceCachehashForgetfulChain must be invoked for current distance cache + values; if this method is invoked repeatedly with the same distance + cache values, it is enough to invoke PrepareDistanceCachehashForgetfulChain once. + + Does not look for matches longer than max_length. + Does not look for matches further away than max_backward. + Writes the best match into |out|. + |out|->score is updated only if a better match is found. +*/ func (h *hashForgetfulChain) FindLongestMatch(dictionary *encoderDictionary, data []byte, ring_buffer_mask uint, distance_cache []int, cur_ix uint, max_length uint, max_backward uint, gap uint, max_distance uint, out *hasherSearchResult) { var cur_ix_masked uint = cur_ix & ring_buffer_mask var min_score uint = out.score diff --git a/backend/vendor/github.com/andybalholm/brotli/hash_longest_match_quickly.go b/backend/vendor/github.com/andybalholm/brotli/hash_longest_match_quickly.go index 9375dc15..30d6b7d6 100644 --- a/backend/vendor/github.com/andybalholm/brotli/hash_longest_match_quickly.go +++ b/backend/vendor/github.com/andybalholm/brotli/hash_longest_match_quickly.go @@ -20,9 +20,12 @@ func (*hashLongestMatchQuickly) StoreLookahead() uint { return 8 } -/* HashBytes is the function that chooses the bucket to place - the address in. The HashLongestMatch and hashLongestMatchQuickly - classes have separate, different implementations of hashing. */ +/* +HashBytes is the function that chooses the bucket to place + + the address in. The HashLongestMatch and hashLongestMatchQuickly + classes have separate, different implementations of hashing. +*/ func (h *hashLongestMatchQuickly) HashBytes(data []byte) uint32 { var hash uint64 = ((binary.LittleEndian.Uint64(data) << (64 - 8*h.hashLen)) * kHashMul64) @@ -31,11 +34,14 @@ func (h *hashLongestMatchQuickly) HashBytes(data []byte) uint32 { return uint32(hash >> (64 - h.bucketBits)) } -/* A (forgetful) hash table to the data seen by the compressor, to - help create backward references to previous data. +/* +A (forgetful) hash table to the data seen by the compressor, to - This is a hash map of fixed size (1 << 16). Starting from the - given index, 1 buckets are used to store values of a key. */ + help create backward references to previous data. + + This is a hash map of fixed size (1 << 16). Starting from the + given index, 1 buckets are used to store values of a key. +*/ type hashLongestMatchQuickly struct { hasherCommon @@ -73,9 +79,12 @@ func (h *hashLongestMatchQuickly) Prepare(one_shot bool, input_size uint, data [ } } -/* Look at 5 bytes at &data[ix & mask]. - Compute a hash from these, and store the value somewhere within - [ix .. ix+3]. */ +/* +Look at 5 bytes at &data[ix & mask]. + + Compute a hash from these, and store the value somewhere within + [ix .. ix+3]. +*/ func (h *hashLongestMatchQuickly) Store(data []byte, mask uint, ix uint) { var key uint32 = h.HashBytes(data[ix&mask:]) var off uint32 = uint32(ix>>3) % uint32(h.bucketSweep) @@ -104,14 +113,17 @@ func (h *hashLongestMatchQuickly) StitchToPreviousBlock(num_bytes uint, position func (*hashLongestMatchQuickly) PrepareDistanceCache(distance_cache []int) { } -/* Find a longest backward match of &data[cur_ix & ring_buffer_mask] - up to the length of max_length and stores the position cur_ix in the - hash table. +/* +Find a longest backward match of &data[cur_ix & ring_buffer_mask] - Does not look for matches longer than max_length. - Does not look for matches further away than max_backward. - Writes the best match into |out|. - |out|->score is updated only if a better match is found. */ + up to the length of max_length and stores the position cur_ix in the + hash table. + + Does not look for matches longer than max_length. + Does not look for matches further away than max_backward. + Writes the best match into |out|. + |out|->score is updated only if a better match is found. +*/ func (h *hashLongestMatchQuickly) FindLongestMatch(dictionary *encoderDictionary, data []byte, ring_buffer_mask uint, distance_cache []int, cur_ix uint, max_length uint, max_backward uint, gap uint, max_distance uint, out *hasherSearchResult) { var best_len_in uint = out.len var cur_ix_masked uint = cur_ix & ring_buffer_mask diff --git a/backend/vendor/github.com/andybalholm/brotli/hash_rolling.go b/backend/vendor/github.com/andybalholm/brotli/hash_rolling.go index ad655a0a..02388abf 100644 --- a/backend/vendor/github.com/andybalholm/brotli/hash_rolling.go +++ b/backend/vendor/github.com/andybalholm/brotli/hash_rolling.go @@ -13,9 +13,12 @@ const kRollingHashMul32 uint32 = 69069 const kInvalidPosHashRolling uint32 = 0xffffffff -/* This hasher uses a longer forward length, but returning a higher value here - will hurt compression by the main hasher when combined with a composite - hasher. The hasher tests for forward itself instead. */ +/* +This hasher uses a longer forward length, but returning a higher value here + + will hurt compression by the main hasher when combined with a composite + hasher. The hasher tests for forward itself instead. +*/ func (*hashRolling) HashTypeLength() uint { return 4 } @@ -24,8 +27,11 @@ func (*hashRolling) StoreLookahead() uint { return 4 } -/* Computes a code from a single byte. A lookup table of 256 values could be - used, but simply adding 1 works about as good. */ +/* +Computes a code from a single byte. A lookup table of 256 values could be + + used, but simply adding 1 works about as good. +*/ func (*hashRolling) HashByte(b byte) uint32 { return uint32(b) + 1 } @@ -38,8 +44,11 @@ func (h *hashRolling) HashRollingFunction(state uint32, add byte, rem byte, fact return uint32(factor*state + h.HashByte(add) - factor_remove*h.HashByte(rem)) } -/* Rolling hash for long distance long string matches. Stores one position - per bucket, bucket key is computed over a long region. */ +/* +Rolling hash for long distance long string matches. Stores one position + + per bucket, bucket key is computed over a long region. +*/ type hashRolling struct { hasherCommon diff --git a/backend/vendor/github.com/andybalholm/brotli/huffman.go b/backend/vendor/github.com/andybalholm/brotli/huffman.go index 182f3d2a..46beb1fe 100644 --- a/backend/vendor/github.com/andybalholm/brotli/huffman.go +++ b/backend/vendor/github.com/andybalholm/brotli/huffman.go @@ -10,8 +10,11 @@ package brotli const huffmanMaxCodeLength = 15 -/* Maximum possible Huffman table size for an alphabet size of (index * 32), - max code length 15 and root table bits 8. */ +/* +Maximum possible Huffman table size for an alphabet size of (index * 32), + + max code length 15 and root table bits 8. +*/ var kMaxHuffmanTableSize = []uint16{ 256, 402, @@ -363,9 +366,12 @@ var kReverseBits = [1 << reverseBitsMax]byte{ const reverseBitsLowest = (uint64(1) << (reverseBitsMax - 1 + reverseBitsBase)) -/* Returns reverse(num >> BROTLI_REVERSE_BITS_BASE, BROTLI_REVERSE_BITS_MAX), - where reverse(value, len) is the bit-wise reversal of the len least - significant bits of value. */ +/* +Returns reverse(num >> BROTLI_REVERSE_BITS_BASE, BROTLI_REVERSE_BITS_MAX), + + where reverse(value, len) is the bit-wise reversal of the len least + significant bits of value. +*/ func reverseBits8(num uint64) uint64 { return uint64(kReverseBits[num]) } @@ -382,9 +388,12 @@ func replicateValue(table []huffmanCode, step int, end int, code huffmanCode) { } } -/* Returns the table width of the next 2nd level table. |count| is the histogram - of bit lengths for the remaining symbols, |len| is the code length of the - next processed symbol. */ +/* +Returns the table width of the next 2nd level table. |count| is the histogram + + of bit lengths for the remaining symbols, |len| is the code length of the + next processed symbol. +*/ func nextTableBitSize(count []uint16, len int, root_bits int) int { var left int = 1 << uint(len-root_bits) for len < huffmanMaxCodeLength { diff --git a/backend/vendor/github.com/andybalholm/brotli/metablock.go b/backend/vendor/github.com/andybalholm/brotli/metablock.go index 3014df8c..4bbea200 100644 --- a/backend/vendor/github.com/andybalholm/brotli/metablock.go +++ b/backend/vendor/github.com/andybalholm/brotli/metablock.go @@ -268,8 +268,11 @@ func buildMetaBlock(ringbuffer []byte, pos uint, mask uint, params *encoderParam const maxStaticContexts = 13 -/* Greedy block splitter for one block category (literal, command or distance). - Gathers histograms for all context buckets. */ +/* +Greedy block splitter for one block category (literal, command or distance). + + Gathers histograms for all context buckets. +*/ type contextBlockSplitter struct { alphabet_size_ uint num_contexts_ uint @@ -328,10 +331,13 @@ func initContextBlockSplitter(self *contextBlockSplitter, alphabet_size uint, nu self.last_histogram_ix_[0] = self.last_histogram_ix_[1] } -/* Does either of three things: - (1) emits the current block with a new block type; - (2) emits the current block with the type of the second last block; - (3) merges the current block with the last block. */ +/* +Does either of three things: + + (1) emits the current block with a new block type; + (2) emits the current block with the type of the second last block; + (3) merges the current block with the last block. +*/ func contextBlockSplitterFinishBlock(self *contextBlockSplitter, is_final bool) { var split *blockSplit = self.split_ var num_contexts uint = self.num_contexts_ @@ -459,8 +465,11 @@ func contextBlockSplitterFinishBlock(self *contextBlockSplitter, is_final bool) } } -/* Adds the next symbol to the current block type and context. When the - current block reaches the target size, decides on merging the block. */ +/* +Adds the next symbol to the current block type and context. When the + + current block reaches the target size, decides on merging the block. +*/ func contextBlockSplitterAddSymbol(self *contextBlockSplitter, symbol uint, context uint) { histogramAddLiteral(&self.histograms_[self.curr_histogram_ix_+context], symbol) self.block_size_++ diff --git a/backend/vendor/github.com/andybalholm/brotli/metablock_command.go b/backend/vendor/github.com/andybalholm/brotli/metablock_command.go index 14c7b771..e2d1b2de 100644 --- a/backend/vendor/github.com/andybalholm/brotli/metablock_command.go +++ b/backend/vendor/github.com/andybalholm/brotli/metablock_command.go @@ -58,10 +58,13 @@ func initBlockSplitterCommand(self *blockSplitterCommand, alphabet_size uint, mi self.last_histogram_ix_[0] = self.last_histogram_ix_[1] } -/* Does either of three things: - (1) emits the current block with a new block type; - (2) emits the current block with the type of the second last block; - (3) merges the current block with the last block. */ +/* +Does either of three things: + + (1) emits the current block with a new block type; + (2) emits the current block with the type of the second last block; + (3) merges the current block with the last block. +*/ func blockSplitterFinishBlockCommand(self *blockSplitterCommand, is_final bool) { var split *blockSplit = self.split_ var last_entropy []float64 = self.last_entropy_[:] @@ -154,8 +157,11 @@ func blockSplitterFinishBlockCommand(self *blockSplitterCommand, is_final bool) } } -/* Adds the next symbol to the current histogram. When the current histogram - reaches the target size, decides on merging the block. */ +/* +Adds the next symbol to the current histogram. When the current histogram + + reaches the target size, decides on merging the block. +*/ func blockSplitterAddSymbolCommand(self *blockSplitterCommand, symbol uint) { histogramAddCommand(&self.histograms_[self.curr_histogram_ix_], symbol) self.block_size_++ diff --git a/backend/vendor/github.com/andybalholm/brotli/metablock_distance.go b/backend/vendor/github.com/andybalholm/brotli/metablock_distance.go index 5110a810..9981513c 100644 --- a/backend/vendor/github.com/andybalholm/brotli/metablock_distance.go +++ b/backend/vendor/github.com/andybalholm/brotli/metablock_distance.go @@ -58,10 +58,13 @@ func initBlockSplitterDistance(self *blockSplitterDistance, alphabet_size uint, self.last_histogram_ix_[0] = self.last_histogram_ix_[1] } -/* Does either of three things: - (1) emits the current block with a new block type; - (2) emits the current block with the type of the second last block; - (3) merges the current block with the last block. */ +/* +Does either of three things: + + (1) emits the current block with a new block type; + (2) emits the current block with the type of the second last block; + (3) merges the current block with the last block. +*/ func blockSplitterFinishBlockDistance(self *blockSplitterDistance, is_final bool) { var split *blockSplit = self.split_ var last_entropy []float64 = self.last_entropy_[:] @@ -154,8 +157,11 @@ func blockSplitterFinishBlockDistance(self *blockSplitterDistance, is_final bool } } -/* Adds the next symbol to the current histogram. When the current histogram - reaches the target size, decides on merging the block. */ +/* +Adds the next symbol to the current histogram. When the current histogram + + reaches the target size, decides on merging the block. +*/ func blockSplitterAddSymbolDistance(self *blockSplitterDistance, symbol uint) { histogramAddDistance(&self.histograms_[self.curr_histogram_ix_], symbol) self.block_size_++ diff --git a/backend/vendor/github.com/andybalholm/brotli/metablock_literal.go b/backend/vendor/github.com/andybalholm/brotli/metablock_literal.go index 307f8da8..36630969 100644 --- a/backend/vendor/github.com/andybalholm/brotli/metablock_literal.go +++ b/backend/vendor/github.com/andybalholm/brotli/metablock_literal.go @@ -58,10 +58,13 @@ func initBlockSplitterLiteral(self *blockSplitterLiteral, alphabet_size uint, mi self.last_histogram_ix_[0] = self.last_histogram_ix_[1] } -/* Does either of three things: - (1) emits the current block with a new block type; - (2) emits the current block with the type of the second last block; - (3) merges the current block with the last block. */ +/* +Does either of three things: + + (1) emits the current block with a new block type; + (2) emits the current block with the type of the second last block; + (3) merges the current block with the last block. +*/ func blockSplitterFinishBlockLiteral(self *blockSplitterLiteral, is_final bool) { var split *blockSplit = self.split_ var last_entropy []float64 = self.last_entropy_[:] @@ -154,8 +157,11 @@ func blockSplitterFinishBlockLiteral(self *blockSplitterLiteral, is_final bool) } } -/* Adds the next symbol to the current histogram. When the current histogram - reaches the target size, decides on merging the block. */ +/* +Adds the next symbol to the current histogram. When the current histogram + + reaches the target size, decides on merging the block. +*/ func blockSplitterAddSymbolLiteral(self *blockSplitterLiteral, symbol uint) { histogramAddLiteral(&self.histograms_[self.curr_histogram_ix_], symbol) self.block_size_++ diff --git a/backend/vendor/github.com/andybalholm/brotli/prefix.go b/backend/vendor/github.com/andybalholm/brotli/prefix.go index 484df0d6..8b657d25 100644 --- a/backend/vendor/github.com/andybalholm/brotli/prefix.go +++ b/backend/vendor/github.com/andybalholm/brotli/prefix.go @@ -9,8 +9,11 @@ package brotli /* Functions for encoding of integers into prefix codes the amount of extra bits, and the actual values of the extra bits. */ -/* Here distance_code is an intermediate code, i.e. one of the special codes or - the actual distance increased by BROTLI_NUM_DISTANCE_SHORT_CODES - 1. */ +/* +Here distance_code is an intermediate code, i.e. one of the special codes or + + the actual distance increased by BROTLI_NUM_DISTANCE_SHORT_CODES - 1. +*/ func prefixEncodeCopyDistance(distance_code uint, num_direct_codes uint, postfix_bits uint, code *uint16, extra_bits *uint32) { if distance_code < numDistanceShortCodes+num_direct_codes { *code = uint16(distance_code) diff --git a/backend/vendor/github.com/andybalholm/brotli/quality.go b/backend/vendor/github.com/andybalholm/brotli/quality.go index 49709a38..a970f284 100644 --- a/backend/vendor/github.com/andybalholm/brotli/quality.go +++ b/backend/vendor/github.com/andybalholm/brotli/quality.go @@ -24,8 +24,11 @@ const minQualityForHqContextModeling = 7 const minQualityForHqBlockSplitting = 10 -/* For quality below MIN_QUALITY_FOR_BLOCK_SPLIT there is no block splitting, - so we buffer at most this much literals and commands. */ +/* +For quality below MIN_QUALITY_FOR_BLOCK_SPLIT there is no block splitting, + + so we buffer at most this much literals and commands. +*/ const maxNumDelayedSymbols = 0x2FFF /* Returns hash-table size for quality levels 0 and 1. */ @@ -102,11 +105,14 @@ func computeLgBlock(params *encoderParams) int { return lgblock } -/* Returns log2 of the size of main ring buffer area. - Allocate at least lgwin + 1 bits for the ring buffer so that the newly - added block fits there completely and we still get lgwin bits and at least - read_block_size_bits + 1 bits because the copy tail length needs to be - smaller than ring-buffer size. */ +/* +Returns log2 of the size of main ring buffer area. + + Allocate at least lgwin + 1 bits for the ring buffer so that the newly + added block fits there completely and we still get lgwin bits and at least + read_block_size_bits + 1 bits because the copy tail length needs to be + smaller than ring-buffer size. +*/ func computeRbBits(params *encoderParams) int { return 1 + brotli_max_int(int(params.lgwin), params.lgblock) } @@ -116,12 +122,15 @@ func maxMetablockSize(params *encoderParams) uint { return uint(1) << uint(bits) } -/* When searching for backward references and have not seen matches for a long - time, we can skip some match lookups. Unsuccessful match lookups are very - expensive and this kind of a heuristic speeds up compression quite a lot. - At first 8 byte strides are taken and every second byte is put to hasher. - After 4x more literals stride by 16 bytes, every put 4-th byte to hasher. - Applied only to qualities 2 to 9. */ +/* +When searching for backward references and have not seen matches for a long + + time, we can skip some match lookups. Unsuccessful match lookups are very + expensive and this kind of a heuristic speeds up compression quite a lot. + At first 8 byte strides are taken and every second byte is put to hasher. + After 4x more literals stride by 16 bytes, every put 4-th byte to hasher. + Applied only to qualities 2 to 9. +*/ func literalSpreeLengthForSparseSearch(params *encoderParams) uint { if params.quality < 9 { return 64 diff --git a/backend/vendor/github.com/andybalholm/brotli/ringbuffer.go b/backend/vendor/github.com/andybalholm/brotli/ringbuffer.go index 1c8f86fe..630f3079 100644 --- a/backend/vendor/github.com/andybalholm/brotli/ringbuffer.go +++ b/backend/vendor/github.com/andybalholm/brotli/ringbuffer.go @@ -6,15 +6,18 @@ package brotli See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -/* A ringBuffer(window_bits, tail_bits) contains `1 << window_bits' bytes of - data in a circular manner: writing a byte writes it to: - `position() % (1 << window_bits)'. - For convenience, the ringBuffer array contains another copy of the - first `1 << tail_bits' bytes: - buffer_[i] == buffer_[i + (1 << window_bits)], if i < (1 << tail_bits), - and another copy of the last two bytes: - buffer_[-1] == buffer_[(1 << window_bits) - 1] and - buffer_[-2] == buffer_[(1 << window_bits) - 2]. */ +/* +A ringBuffer(window_bits, tail_bits) contains `1 << window_bits' bytes of + + data in a circular manner: writing a byte writes it to: + `position() % (1 << window_bits)'. + For convenience, the ringBuffer array contains another copy of the + first `1 << tail_bits' bytes: + buffer_[i] == buffer_[i + (1 << window_bits)], if i < (1 << tail_bits), + and another copy of the last two bytes: + buffer_[-1] == buffer_[(1 << window_bits) - 1] and + buffer_[-2] == buffer_[(1 << window_bits) - 2]. +*/ type ringBuffer struct { size_ uint32 mask_ uint32 @@ -41,8 +44,11 @@ func ringBufferSetup(params *encoderParams, rb *ringBuffer) { const kSlackForEightByteHashingEverywhere uint = 7 -/* Allocates or re-allocates data_ to the given length + plus some slack - region before and after. Fills the slack regions with zeros. */ +/* +Allocates or re-allocates data_ to the given length + plus some slack + + region before and after. Fills the slack regions with zeros. +*/ func ringBufferInitBuffer(buflen uint32, rb *ringBuffer) { var new_data []byte var i uint diff --git a/backend/vendor/github.com/andybalholm/brotli/static_dict.go b/backend/vendor/github.com/andybalholm/brotli/static_dict.go index 8e7492d7..0bd725d8 100644 --- a/backend/vendor/github.com/andybalholm/brotli/static_dict.go +++ b/backend/vendor/github.com/andybalholm/brotli/static_dict.go @@ -14,10 +14,11 @@ const maxStaticDictionaryMatchLen = 37 const kInvalidMatch uint32 = 0xFFFFFFF -/* Copyright 2013 Google Inc. All Rights Reserved. +/* +Copyright 2013 Google Inc. All Rights Reserved. - Distributed under MIT license. - See file LICENSE for detail or copy at https://opensource.org/licenses/MIT + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ func hash(data []byte) uint32 { var h uint32 = binary.LittleEndian.Uint32(data) * kDictHashMul32 diff --git a/backend/vendor/github.com/andybalholm/brotli/utf8_util.go b/backend/vendor/github.com/andybalholm/brotli/utf8_util.go index f86de3d2..f2553405 100644 --- a/backend/vendor/github.com/andybalholm/brotli/utf8_util.go +++ b/backend/vendor/github.com/andybalholm/brotli/utf8_util.go @@ -10,9 +10,12 @@ package brotli const kMinUTF8Ratio float64 = 0.75 -/* Returns 1 if at least min_fraction of the bytes between pos and - pos + length in the (data, mask) ring-buffer is UTF8-encoded, otherwise - returns 0. */ +/* +Returns 1 if at least min_fraction of the bytes between pos and + + pos + length in the (data, mask) ring-buffer is UTF8-encoded, otherwise + returns 0. +*/ func parseAsUTF8(symbol *int, input []byte, size uint) uint { /* ASCII */ if input[0]&0x80 == 0 { diff --git a/backend/vendor/github.com/asdine/storm/v3/sink.go b/backend/vendor/github.com/asdine/storm/v3/sink.go index 117119e9..90a80ff0 100644 --- a/backend/vendor/github.com/asdine/storm/v3/sink.go +++ b/backend/vendor/github.com/asdine/storm/v3/sink.go @@ -1,12 +1,12 @@ package storm import ( - "reflect" - "sort" - "time" "github.com/asdine/storm/v3/index" "github.com/asdine/storm/v3/q" bolt "go.etcd.io/bbolt" + "reflect" + "sort" + "time" ) type item struct { diff --git a/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap.go b/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap.go index 43af7cdc..2a581e12 100644 --- a/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap.go +++ b/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap.go @@ -1,3 +1,4 @@ +//go:build !go1.8 // +build !go1.8 package storm diff --git a/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap_go1.8.go b/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap_go1.8.go index 21bf7ae9..4f6fdfe1 100644 --- a/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap_go1.8.go +++ b/backend/vendor/github.com/asdine/storm/v3/sink_sorter_swap_go1.8.go @@ -1,3 +1,4 @@ +//go:build go1.8 // +build go1.8 package storm diff --git a/backend/vendor/github.com/davecgh/go-spew/spew/bypass.go b/backend/vendor/github.com/davecgh/go-spew/spew/bypass.go index 79299478..70ddeaad 100644 --- a/backend/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ b/backend/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -18,6 +18,7 @@ // tag is deprecated and thus should not be used. // Go versions prior to 1.4 are disabled because they use a different layout // for interfaces which make the implementation of unsafeReflectValue more complex. +//go:build !js && !appengine && !safe && !disableunsafe && go1.4 // +build !js,!appengine,!safe,!disableunsafe,go1.4 package spew diff --git a/backend/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/backend/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go index 205c28d6..5e2d890d 100644 --- a/backend/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ b/backend/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -16,6 +16,7 @@ // when the code is running on Google App Engine, compiled by GopherJS, or // "-tags safe" is added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. +//go:build js || appengine || safe || disableunsafe || !go1.4 // +build js appengine safe disableunsafe !go1.4 package spew diff --git a/backend/vendor/github.com/davecgh/go-spew/spew/config.go b/backend/vendor/github.com/davecgh/go-spew/spew/config.go index 2e3d22f3..161895fc 100644 --- a/backend/vendor/github.com/davecgh/go-spew/spew/config.go +++ b/backend/vendor/github.com/davecgh/go-spew/spew/config.go @@ -254,15 +254,15 @@ pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output The configuration options are controlled by modifying the public members of c. See ConfigState for options documentation. @@ -295,12 +295,12 @@ func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) // NewDefaultConfig returns a ConfigState with the following default settings. // -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false +// Indent: " " +// MaxDepth: 0 +// DisableMethods: false +// DisablePointerMethods: false +// ContinueOnMethod: false +// SortKeys: false func NewDefaultConfig() *ConfigState { return &ConfigState{Indent: " "} } diff --git a/backend/vendor/github.com/davecgh/go-spew/spew/doc.go b/backend/vendor/github.com/davecgh/go-spew/spew/doc.go index aacaac6f..722e9aa7 100644 --- a/backend/vendor/github.com/davecgh/go-spew/spew/doc.go +++ b/backend/vendor/github.com/davecgh/go-spew/spew/doc.go @@ -21,35 +21,36 @@ debugging. A quick overview of the additional features spew provides over the built-in printing facilities for Go data types are as follows: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output (only when using - Dump style) + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output (only when using + Dump style) There are two different approaches spew allows for dumping Go data structures: - * Dump style which prints with newlines, customizable indentation, - and additional debug information such as types and all pointer addresses - used to indirect to the final value - * A custom Formatter interface that integrates cleanly with the standard fmt - package and replaces %v, %+v, %#v, and %#+v to provide inline printing - similar to the default %v while providing the additional functionality - outlined above and passing unsupported format verbs such as %x and %q - along to fmt + - Dump style which prints with newlines, customizable indentation, + and additional debug information such as types and all pointer addresses + used to indirect to the final value + - A custom Formatter interface that integrates cleanly with the standard fmt + package and replaces %v, %+v, %#v, and %#+v to provide inline printing + similar to the default %v while providing the additional functionality + outlined above and passing unsupported format verbs such as %x and %q + along to fmt -Quick Start +# Quick Start This section demonstrates how to quickly get started with spew. See the sections below for further details on formatting and configuration options. To dump a variable with full newlines, indentation, type, and pointer information use Dump, Fdump, or Sdump: + spew.Dump(myVar1, myVar2, ...) spew.Fdump(someWriter, myVar1, myVar2, ...) str := spew.Sdump(myVar1, myVar2, ...) @@ -58,12 +59,13 @@ Alternatively, if you would prefer to use format strings with a compacted inline printing style, use the convenience wrappers Printf, Fprintf, etc with %v (most compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types and pointer addresses): + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) -Configuration Options +# Configuration Options Configuration of spew is handled by fields in the ConfigState type. For convenience, all of the top-level functions use a global state available @@ -74,51 +76,52 @@ equivalent to the top-level functions. This allows concurrent configuration options. See the ConfigState documentation for more details. The following configuration options are available: - * Indent - String to use for each indentation level for Dump functions. - It is a single space by default. A popular alternative is "\t". - * MaxDepth - Maximum number of levels to descend into nested data structures. - There is no limit by default. + - Indent + String to use for each indentation level for Dump functions. + It is a single space by default. A popular alternative is "\t". - * DisableMethods - Disables invocation of error and Stringer interface methods. - Method invocation is enabled by default. + - MaxDepth + Maximum number of levels to descend into nested data structures. + There is no limit by default. - * DisablePointerMethods - Disables invocation of error and Stringer interface methods on types - which only accept pointer receivers from non-pointer variables. - Pointer method invocation is enabled by default. + - DisableMethods + Disables invocation of error and Stringer interface methods. + Method invocation is enabled by default. - * DisablePointerAddresses - DisablePointerAddresses specifies whether to disable the printing of - pointer addresses. This is useful when diffing data structures in tests. + - DisablePointerMethods + Disables invocation of error and Stringer interface methods on types + which only accept pointer receivers from non-pointer variables. + Pointer method invocation is enabled by default. - * DisableCapacities - DisableCapacities specifies whether to disable the printing of - capacities for arrays, slices, maps and channels. This is useful when - diffing data structures in tests. + - DisablePointerAddresses + DisablePointerAddresses specifies whether to disable the printing of + pointer addresses. This is useful when diffing data structures in tests. - * ContinueOnMethod - Enables recursion into types after invoking error and Stringer interface - methods. Recursion after method invocation is disabled by default. + - DisableCapacities + DisableCapacities specifies whether to disable the printing of + capacities for arrays, slices, maps and channels. This is useful when + diffing data structures in tests. - * SortKeys - Specifies map keys should be sorted before being printed. Use - this to have a more deterministic, diffable output. Note that - only native types (bool, int, uint, floats, uintptr and string) - and types which implement error or Stringer interfaces are - supported with other types sorted according to the - reflect.Value.String() output which guarantees display - stability. Natural map order is used by default. + - ContinueOnMethod + Enables recursion into types after invoking error and Stringer interface + methods. Recursion after method invocation is disabled by default. - * SpewKeys - Specifies that, as a last resort attempt, map keys should be - spewed to strings and sorted by those strings. This is only - considered if SortKeys is true. + - SortKeys + Specifies map keys should be sorted before being printed. Use + this to have a more deterministic, diffable output. Note that + only native types (bool, int, uint, floats, uintptr and string) + and types which implement error or Stringer interfaces are + supported with other types sorted according to the + reflect.Value.String() output which guarantees display + stability. Natural map order is used by default. -Dump Usage + - SpewKeys + Specifies that, as a last resort attempt, map keys should be + spewed to strings and sorted by those strings. This is only + considered if SortKeys is true. + +# Dump Usage Simply call spew.Dump with a list of variables you want to dump: @@ -133,7 +136,7 @@ A third option is to call spew.Sdump to get the formatted output as a string: str := spew.Sdump(myVar1, myVar2, ...) -Sample Dump Output +# Sample Dump Output See the Dump example for details on the setup of the types and variables being shown here. @@ -150,13 +153,14 @@ shown here. Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C command as shown. + ([]uint8) (len=32 cap=32) { 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| 00000020 31 32 |12| } -Custom Formatter +# Custom Formatter Spew provides a custom formatter that implements the fmt.Formatter interface so that it integrates cleanly with standard fmt package printing functions. The @@ -170,7 +174,7 @@ standard fmt package for formatting. In addition, the custom formatter ignores the width and precision arguments (however they will still work on the format specifiers not handled by the custom formatter). -Custom Formatter Usage +# Custom Formatter Usage The simplest way to make use of the spew custom formatter is to call one of the convenience functions such as spew.Printf, spew.Println, or spew.Printf. The @@ -184,15 +188,17 @@ functions have syntax you are most likely already familiar with: See the Index for the full list convenience functions. -Sample Formatter Output +# Sample Formatter Output Double pointer to a uint8: + %v: <**>5 %+v: <**>(0xf8400420d0->0xf8400420c8)5 %#v: (**uint8)5 %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 Pointer to circular struct with a uint8 field and a pointer to itself: + %v: <*>{1 <*>} %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} @@ -201,7 +207,7 @@ Pointer to circular struct with a uint8 field and a pointer to itself: See the Printf example for details on the setup of variables being shown here. -Errors +# Errors Since it is possible for custom Stringer/error interfaces to panic, spew detects them and handles them internally by printing the panic information diff --git a/backend/vendor/github.com/davecgh/go-spew/spew/dump.go b/backend/vendor/github.com/davecgh/go-spew/spew/dump.go index f78d89fc..8323041a 100644 --- a/backend/vendor/github.com/davecgh/go-spew/spew/dump.go +++ b/backend/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -488,15 +488,15 @@ pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output The configuration options are controlled by an exported package global, spew.Config. See ConfigState for options documentation. diff --git a/backend/vendor/github.com/disintegration/imaging/adjust.go b/backend/vendor/github.com/disintegration/imaging/adjust.go index daaf1de8..243fc7d9 100644 --- a/backend/vendor/github.com/disintegration/imaging/adjust.go +++ b/backend/vendor/github.com/disintegration/imaging/adjust.go @@ -58,9 +58,9 @@ func Invert(img image.Image) *image.NRGBA { // The percentage = -100 gives the image with the saturation value zeroed for each pixel (grayscale). // // Examples: -// dstImage = imaging.AdjustSaturation(srcImage, 25) // Increase image saturation by 25%. -// dstImage = imaging.AdjustSaturation(srcImage, -10) // Decrease image saturation by 10%. // +// dstImage = imaging.AdjustSaturation(srcImage, 25) // Increase image saturation by 25%. +// dstImage = imaging.AdjustSaturation(srcImage, -10) // Decrease image saturation by 10%. func AdjustSaturation(img image.Image, percentage float64) *image.NRGBA { percentage = math.Min(math.Max(percentage, -100), 100) multiplier := 1 + percentage/100 @@ -84,7 +84,6 @@ func AdjustSaturation(img image.Image, percentage float64) *image.NRGBA { // // dstImage = imaging.AdjustContrast(srcImage, -10) // Decrease image contrast by 10%. // dstImage = imaging.AdjustContrast(srcImage, 20) // Increase image contrast by 20%. -// func AdjustContrast(img image.Image, percentage float64) *image.NRGBA { percentage = math.Min(math.Max(percentage, -100.0), 100.0) lut := make([]uint8, 256) @@ -112,7 +111,6 @@ func AdjustContrast(img image.Image, percentage float64) *image.NRGBA { // // dstImage = imaging.AdjustBrightness(srcImage, -15) // Decrease image brightness by 15%. // dstImage = imaging.AdjustBrightness(srcImage, 10) // Increase image brightness by 10%. -// func AdjustBrightness(img image.Image, percentage float64) *image.NRGBA { percentage = math.Min(math.Max(percentage, -100.0), 100.0) lut := make([]uint8, 256) @@ -132,7 +130,6 @@ func AdjustBrightness(img image.Image, percentage float64) *image.NRGBA { // Example: // // dstImage = imaging.AdjustGamma(srcImage, 0.7) -// func AdjustGamma(img image.Image, gamma float64) *image.NRGBA { e := 1.0 / math.Max(gamma, 0.0001) lut := make([]uint8, 256) @@ -154,7 +151,6 @@ func AdjustGamma(img image.Image, gamma float64) *image.NRGBA { // // dstImage = imaging.AdjustSigmoid(srcImage, 0.5, 3.0) // Increase the contrast. // dstImage = imaging.AdjustSigmoid(srcImage, 0.5, -3.0) // Decrease the contrast. -// func AdjustSigmoid(img image.Image, midpoint, factor float64) *image.NRGBA { if factor == 0 { return Clone(img) @@ -226,7 +222,6 @@ func adjustLUT(img image.Image, lut []uint8) *image.NRGBA { // return color.NRGBA{uint8(r), c.G, c.B, c.A} // } // ) -// func AdjustFunc(img image.Image, fn func(c color.NRGBA) color.NRGBA) *image.NRGBA { src := newScanner(img) dst := image.NewNRGBA(image.Rect(0, 0, src.w, src.h)) diff --git a/backend/vendor/github.com/disintegration/imaging/effects.go b/backend/vendor/github.com/disintegration/imaging/effects.go index 47316b70..a63e7711 100644 --- a/backend/vendor/github.com/disintegration/imaging/effects.go +++ b/backend/vendor/github.com/disintegration/imaging/effects.go @@ -15,7 +15,6 @@ func gaussianBlurKernel(x, sigma float64) float64 { // Example: // // dstImage := imaging.Blur(srcImage, 3.5) -// func Blur(img image.Image, sigma float64) *image.NRGBA { if sigma <= 0 { return Clone(img) @@ -137,7 +136,6 @@ func blurVertical(img image.Image, kernel []float64) *image.NRGBA { // Example: // // dstImage := imaging.Sharpen(srcImage, 3.5) -// func Sharpen(img image.Image, sigma float64) *image.NRGBA { if sigma <= 0 { return Clone(img) diff --git a/backend/vendor/github.com/disintegration/imaging/io.go b/backend/vendor/github.com/disintegration/imaging/io.go index f6c6da86..ca30bf79 100644 --- a/backend/vendor/github.com/disintegration/imaging/io.go +++ b/backend/vendor/github.com/disintegration/imaging/io.go @@ -91,7 +91,6 @@ func Decode(r io.Reader, opts ...DecodeOption) (image.Image, error) { // // // Load an image and transform it depending on the EXIF orientation tag (if present). // img, err := imaging.Open("test.jpg", imaging.AutoOrientation(true)) -// func Open(filename string, opts ...DecodeOption) (image.Image, error) { file, err := fs.Open(filename) if err != nil { @@ -264,7 +263,6 @@ func Encode(w io.Writer, img image.Image, format Format, opts ...EncodeOption) e // // // Save the image as JPEG with optional quality parameter set to 80. // err := imaging.Save(img, "out.jpg", imaging.JPEGQuality(80)) -// func Save(img image.Image, filename string, opts ...EncodeOption) (err error) { f, err := FormatFromFilename(filename) if err != nil { diff --git a/backend/vendor/github.com/disintegration/imaging/resize.go b/backend/vendor/github.com/disintegration/imaging/resize.go index 706435e3..ec5dc5f3 100644 --- a/backend/vendor/github.com/disintegration/imaging/resize.go +++ b/backend/vendor/github.com/disintegration/imaging/resize.go @@ -61,7 +61,6 @@ func precomputeWeights(dstSize, srcSize int, filter ResampleFilter) [][]indexWei // Example: // // dstImage := imaging.Resize(srcImage, 800, 600, imaging.Lanczos) -// func Resize(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA { dstW, dstH := width, height if dstW < 0 || dstH < 0 { @@ -218,7 +217,6 @@ func resizeNearest(img image.Image, width, height int) *image.NRGBA { // Example: // // dstImage := imaging.Fit(srcImage, 800, 600, imaging.Lanczos) -// func Fit(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA { maxW, maxH := width, height @@ -259,7 +257,6 @@ func Fit(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA // Example: // // dstImage := imaging.Fill(srcImage, 800, 600, imaging.Center, imaging.Lanczos) -// func Fill(img image.Image, width, height int, anchor Anchor, filter ResampleFilter) *image.NRGBA { dstW, dstH := width, height @@ -338,7 +335,6 @@ func resizeAndCrop(img image.Image, width, height int, anchor Anchor, filter Res // Example: // // dstImage := imaging.Thumbnail(srcImage, 100, 100, imaging.Lanczos) -// func Thumbnail(img image.Image, width, height int, filter ResampleFilter) *image.NRGBA { return Fill(img, width, height, Center, filter) } @@ -365,7 +361,6 @@ func Thumbnail(img image.Image, width, height int, filter ResampleFilter) *image // // - NearestNeighbor // Fastest resampling filter, no antialiasing. -// type ResampleFilter struct { Support float64 Kernel func(float64) float64 diff --git a/backend/vendor/github.com/disintegration/imaging/tools.go b/backend/vendor/github.com/disintegration/imaging/tools.go index 0ec19a03..bcb4013f 100644 --- a/backend/vendor/github.com/disintegration/imaging/tools.go +++ b/backend/vendor/github.com/disintegration/imaging/tools.go @@ -176,7 +176,6 @@ func PasteCenter(background, img image.Image) *image.NRGBA { // // // Blend two opaque images of the same size. // dstImage := imaging.Overlay(imageOne, imageTwo, image.Pt(0, 0), 0.5) -// func Overlay(background, img image.Image, pos image.Point, opacity float64) *image.NRGBA { opacity = math.Min(math.Max(opacity, 0.0), 1.0) // Ensure 0.0 <= opacity <= 1.0. dst := Clone(background) diff --git a/backend/vendor/github.com/dsnet/compress/bzip2/bwt.go b/backend/vendor/github.com/dsnet/compress/bzip2/bwt.go index 44a2541f..4ed2d744 100644 --- a/backend/vendor/github.com/dsnet/compress/bzip2/bwt.go +++ b/backend/vendor/github.com/dsnet/compress/bzip2/bwt.go @@ -15,6 +15,7 @@ import "github.com/dsnet/compress/bzip2/internal/sais" // Transform, such that a SA can be converted to a BWT in O(n) time. // // References: +// // http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-124.pdf // https://github.com/cscott/compressjs/blob/master/lib/BWT.js // https://www.quora.com/How-can-I-optimize-burrows-wheeler-transform-and-inverse-transform-to-work-in-O-n-time-O-n-space diff --git a/backend/vendor/github.com/dsnet/compress/bzip2/common.go b/backend/vendor/github.com/dsnet/compress/bzip2/common.go index c6339815..ae4c966e 100644 --- a/backend/vendor/github.com/dsnet/compress/bzip2/common.go +++ b/backend/vendor/github.com/dsnet/compress/bzip2/common.go @@ -5,9 +5,11 @@ // Package bzip2 implements the BZip2 compressed data format. // // Canonical C implementation: +// // http://bzip.org // // Unofficial format specification: +// // https://github.com/dsnet/compress/blob/master/doc/bzip2-format.pdf package bzip2 diff --git a/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_off.go b/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_off.go index ddd32f50..ec894e2e 100644 --- a/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_off.go +++ b/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_off.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. +//go:build !gofuzz // +build !gofuzz // This file exists to suppress fuzzing details from release builds. diff --git a/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_on.go b/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_on.go index 54122351..0bae7718 100644 --- a/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_on.go +++ b/backend/vendor/github.com/dsnet/compress/bzip2/fuzz_on.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. +//go:build gofuzz // +build gofuzz // This file exists to export internal implementation details for fuzz testing. diff --git a/backend/vendor/github.com/dsnet/compress/bzip2/mtf_rle2.go b/backend/vendor/github.com/dsnet/compress/bzip2/mtf_rle2.go index 5c71b343..8f5c1ac9 100644 --- a/backend/vendor/github.com/dsnet/compress/bzip2/mtf_rle2.go +++ b/backend/vendor/github.com/dsnet/compress/bzip2/mtf_rle2.go @@ -14,6 +14,7 @@ import "github.com/dsnet/compress/internal/errors" // normal two's complement arithmetic. The methodology for doing so is below. // // Assuming the following: +// // num: The value being encoded by RLE encoding. // run: A sequence of RUNA and RUNB symbols represented as a binary integer, // where RUNA is the 0 bit, RUNB is the 1 bit, and least-significant RUN @@ -21,6 +22,7 @@ import "github.com/dsnet/compress/internal/errors" // cnt: The number of RUNA and RUNB symbols. // // Then the RLE encoding used by bzip2 has this mathematical property: +// // num+1 == (1< 4 // 111110 <=> 5 // 111111 <=> 6 Invalid tree index, so should fail -// var encSel, decSel = func() (e prefix.Encoder, d prefix.Decoder) { var selCodes [maxNumTrees + 1]prefix.PrefixCode for i := range selCodes { @@ -150,6 +149,7 @@ func (pw *prefixWriter) WritePrefixCodes(codes []prefix.PrefixCodes, trees []pre // handleDegenerateCodes converts a degenerate tree into a canonical tree. // // For example, when the input is an under-subscribed tree: +// // input: []PrefixCode{ // {Sym: 0, Len: 3}, // {Sym: 1, Len: 4}, @@ -165,6 +165,7 @@ func (pw *prefixWriter) WritePrefixCodes(codes []prefix.PrefixCodes, trees []pre // } // // For example, when the input is an over-subscribed tree: +// // input: []PrefixCode{ // {Sym: 0, Len: 1}, // {Sym: 1, Len: 3}, diff --git a/backend/vendor/github.com/dsnet/compress/bzip2/rle1.go b/backend/vendor/github.com/dsnet/compress/bzip2/rle1.go index 1d789f65..b96f0cfc 100644 --- a/backend/vendor/github.com/dsnet/compress/bzip2/rle1.go +++ b/backend/vendor/github.com/dsnet/compress/bzip2/rle1.go @@ -17,9 +17,11 @@ var rleDone = errorf(errors.Unknown, "RLE1 stage is completed") // run lengths of 256..259. The decoder can handle the latter case. // // For example, if the input was: +// // input: "AAAAAAABBBBCCCD" // // Then the output will be: +// // output: "AAAA\x03BBBB\x00CCCD" type runLengthEncoding struct { buf []byte diff --git a/backend/vendor/github.com/dsnet/compress/internal/debug.go b/backend/vendor/github.com/dsnet/compress/internal/debug.go index 01df1f89..92435377 100644 --- a/backend/vendor/github.com/dsnet/compress/internal/debug.go +++ b/backend/vendor/github.com/dsnet/compress/internal/debug.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. +//go:build debug && !gofuzz // +build debug,!gofuzz package internal diff --git a/backend/vendor/github.com/dsnet/compress/internal/errors/errors.go b/backend/vendor/github.com/dsnet/compress/internal/errors/errors.go index c631afbd..daf3fe93 100644 --- a/backend/vendor/github.com/dsnet/compress/internal/errors/errors.go +++ b/backend/vendor/github.com/dsnet/compress/internal/errors/errors.go @@ -17,6 +17,7 @@ // recover from errors only generated from within this repository. // // Example usage: +// // func Foo() (err error) { // defer errors.Recover(&err) // @@ -28,7 +29,6 @@ // errors.Panic(errors.New("whoopsie")) // } // } -// package errors import "strings" diff --git a/backend/vendor/github.com/dsnet/compress/internal/gofuzz.go b/backend/vendor/github.com/dsnet/compress/internal/gofuzz.go index 5035c9d6..38f44d0e 100644 --- a/backend/vendor/github.com/dsnet/compress/internal/gofuzz.go +++ b/backend/vendor/github.com/dsnet/compress/internal/gofuzz.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. +//go:build gofuzz // +build gofuzz package internal diff --git a/backend/vendor/github.com/dsnet/compress/internal/prefix/debug.go b/backend/vendor/github.com/dsnet/compress/internal/prefix/debug.go index 04fce70b..2a1cb25a 100644 --- a/backend/vendor/github.com/dsnet/compress/internal/prefix/debug.go +++ b/backend/vendor/github.com/dsnet/compress/internal/prefix/debug.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. +//go:build debug // +build debug package prefix diff --git a/backend/vendor/github.com/dsnet/compress/internal/prefix/prefix.go b/backend/vendor/github.com/dsnet/compress/internal/prefix/prefix.go index c73e748e..0c333f92 100644 --- a/backend/vendor/github.com/dsnet/compress/internal/prefix/prefix.go +++ b/backend/vendor/github.com/dsnet/compress/internal/prefix/prefix.go @@ -91,8 +91,8 @@ func (pc PrefixCodes) checkPrefixes() bool { // checkCanonical reports whether all codes are canonical. // That is, they have the following properties: // -// 1. All codes of a given bit-length are consecutive values. -// 2. Shorter codes lexicographically precede longer codes. +// 1. All codes of a given bit-length are consecutive values. +// 2. Shorter codes lexicographically precede longer codes. // // The codes must have unique symbols and be sorted by the symbol // The Len and Val fields in each code must be populated. diff --git a/backend/vendor/github.com/dsnet/compress/internal/prefix/range.go b/backend/vendor/github.com/dsnet/compress/internal/prefix/range.go index b7eddad5..15ec9343 100644 --- a/backend/vendor/github.com/dsnet/compress/internal/prefix/range.go +++ b/backend/vendor/github.com/dsnet/compress/internal/prefix/range.go @@ -37,6 +37,7 @@ func (rcs RangeCodes) End() uint32 { return rcs[len(rcs)-1].End() } // checkValid reports whether the RangeCodes is valid. In order to be valid, // the following must hold true: +// // rcs[i-1].Base <= rcs[i].Base // rcs[i-1].End <= rcs[i].End // rcs[i-1].End >= rcs[i].Base diff --git a/backend/vendor/github.com/dsnet/compress/internal/release.go b/backend/vendor/github.com/dsnet/compress/internal/release.go index 0990be1c..2d25f2fa 100644 --- a/backend/vendor/github.com/dsnet/compress/internal/release.go +++ b/backend/vendor/github.com/dsnet/compress/internal/release.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. +//go:build !debug && !gofuzz // +build !debug,!gofuzz package internal diff --git a/backend/vendor/github.com/dsoprea/go-exif/v3/common/value_encoder.go b/backend/vendor/github.com/dsoprea/go-exif/v3/common/value_encoder.go index 2cd26cc7..695aa610 100644 --- a/backend/vendor/github.com/dsoprea/go-exif/v3/common/value_encoder.go +++ b/backend/vendor/github.com/dsoprea/go-exif/v3/common/value_encoder.go @@ -60,14 +60,13 @@ func (ve *ValueEncoder) encodeAscii(value string) (ed EncodedData, err error) { // // Note that: // -// 1. This type can not be automatically encoded using `Encode()`. The default -// mode is to encode *with* a trailing NUL byte using `encodeAscii`. Only -// certain undefined-type tags using an unterminated ASCII string and these -// are exceptional in nature. -// -// 2. The presence of this method allows us to completely test the complimentary -// no-nul parser. +// 1. This type can not be automatically encoded using `Encode()`. The default +// mode is to encode *with* a trailing NUL byte using `encodeAscii`. Only +// certain undefined-type tags using an unterminated ASCII string and these +// are exceptional in nature. // +// 2. The presence of this method allows us to completely test the complimentary +// no-nul parser. func (ve *ValueEncoder) encodeAsciiNoNul(value string) (ed EncodedData, err error) { ed.Type = TypeAsciiNoNul ed.Encoded = []byte(value) diff --git a/backend/vendor/github.com/dsoprea/go-exif/v3/ifd_builder.go b/backend/vendor/github.com/dsoprea/go-exif/v3/ifd_builder.go index a404b362..f2ef3bad 100644 --- a/backend/vendor/github.com/dsoprea/go-exif/v3/ifd_builder.go +++ b/backend/vendor/github.com/dsoprea/go-exif/v3/ifd_builder.go @@ -478,13 +478,13 @@ func (ib *IfdBuilder) Tags() (tags []*BuilderTag) { // // NOTES: // -// - We don't manage any facet of the thumbnail data. This is the -// responsibility of the user/developer. -// - This method will fail unless the thumbnail is set on a the root IFD. -// However, in order to be valid, it must be set on the second one, linked to -// by the first, as per the EXIF/TIFF specification. -// - We set the offset to (0) now but will allocate the data and properly assign -// the offset when the IB is encoded (later). +// - We don't manage any facet of the thumbnail data. This is the +// responsibility of the user/developer. +// - This method will fail unless the thumbnail is set on a the root IFD. +// However, in order to be valid, it must be set on the second one, linked to +// by the first, as per the EXIF/TIFF specification. +// - We set the offset to (0) now but will allocate the data and properly assign +// the offset when the IB is encoded (later). func (ib *IfdBuilder) SetThumbnail(data []byte) (err error) { defer func() { if state := recover(); state != nil { diff --git a/backend/vendor/github.com/dsoprea/go-logging/log.go b/backend/vendor/github.com/dsoprea/go-logging/log.go index 84117a92..711c00ac 100644 --- a/backend/vendor/github.com/dsoprea/go-logging/log.go +++ b/backend/vendor/github.com/dsoprea/go-logging/log.go @@ -128,8 +128,9 @@ type LogAdapter interface { } // TODO(dustin): !! Also populate whether we've bypassed an exception so that -// we can add a template macro to prefix an exclamation of -// some sort. +// +// we can add a template macro to prefix an exclamation of +// some sort. type MessageContext struct { Level *string Noun *string diff --git a/backend/vendor/github.com/dsoprea/go-utility/v2/filesystem/graceful_copy.go b/backend/vendor/github.com/dsoprea/go-utility/v2/filesystem/graceful_copy.go index 8705e5fe..7c18f60a 100644 --- a/backend/vendor/github.com/dsoprea/go-utility/v2/filesystem/graceful_copy.go +++ b/backend/vendor/github.com/dsoprea/go-utility/v2/filesystem/graceful_copy.go @@ -11,11 +11,11 @@ const ( // GracefulCopy willcopy while enduring lesser normal issues. // -// - We'll ignore EOF if the read byte-count is more than zero. Only an EOF when -// zero bytes were read will terminate the loop. +// - We'll ignore EOF if the read byte-count is more than zero. Only an EOF when +// zero bytes were read will terminate the loop. // -// - Ignore short-writes. If less bytes were written than the bytes that were -// given, we'll keep trying until done. +// - Ignore short-writes. If less bytes were written than the bytes that were +// given, we'll keep trying until done. func GracefulCopy(w io.Writer, r io.Reader, buffer []byte) (copyCount int, err error) { if buffer == nil { buffer = make([]byte, defaultCopyBufferSize) diff --git a/backend/vendor/github.com/fsnotify/fsnotify/backend_fen.go b/backend/vendor/github.com/fsnotify/fsnotify/backend_fen.go index 1a95ad8e..a23559de 100644 --- a/backend/vendor/github.com/fsnotify/fsnotify/backend_fen.go +++ b/backend/vendor/github.com/fsnotify/fsnotify/backend_fen.go @@ -17,9 +17,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -33,16 +33,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. diff --git a/backend/vendor/github.com/fsnotify/fsnotify/backend_inotify.go b/backend/vendor/github.com/fsnotify/fsnotify/backend_inotify.go index 54c77fbb..724b355a 100644 --- a/backend/vendor/github.com/fsnotify/fsnotify/backend_inotify.go +++ b/backend/vendor/github.com/fsnotify/fsnotify/backend_inotify.go @@ -26,9 +26,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -42,16 +42,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. diff --git a/backend/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go b/backend/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go index 29087469..190e97b9 100644 --- a/backend/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go +++ b/backend/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go @@ -24,9 +24,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -40,16 +40,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. diff --git a/backend/vendor/github.com/fsnotify/fsnotify/backend_windows.go b/backend/vendor/github.com/fsnotify/fsnotify/backend_windows.go index ae392867..ee68abfe 100644 --- a/backend/vendor/github.com/fsnotify/fsnotify/backend_windows.go +++ b/backend/vendor/github.com/fsnotify/fsnotify/backend_windows.go @@ -27,9 +27,9 @@ import ( // When a file is removed a Remove event won't be emitted until all file // descriptors are closed, and deletes will always emit a Chmod. For example: // -// fp := os.Open("file") -// os.Remove("file") // Triggers Chmod -// fp.Close() // Triggers Remove +// fp := os.Open("file") +// os.Remove("file") // Triggers Chmod +// fp.Close() // Triggers Remove // // This is the event that inotify sends, so not much can be changed about this. // @@ -43,16 +43,16 @@ import ( // // To increase them you can use sysctl or write the value to the /proc file: // -// # Default values on Linux 5.18 -// sysctl fs.inotify.max_user_watches=124983 -// sysctl fs.inotify.max_user_instances=128 +// # Default values on Linux 5.18 +// sysctl fs.inotify.max_user_watches=124983 +// sysctl fs.inotify.max_user_instances=128 // // To make the changes persist on reboot edit /etc/sysctl.conf or // /usr/lib/sysctl.d/50-default.conf (details differ per Linux distro; check // your distro's documentation): // -// fs.inotify.max_user_watches=124983 -// fs.inotify.max_user_instances=128 +// fs.inotify.max_user_watches=124983 +// fs.inotify.max_user_instances=128 // // Reaching the limit will result in a "no space left on device" or "too many open // files" error. diff --git a/backend/vendor/github.com/go-errors/errors/error.go b/backend/vendor/github.com/go-errors/errors/error.go index ccbc2e42..533f1bb2 100644 --- a/backend/vendor/github.com/go-errors/errors/error.go +++ b/backend/vendor/github.com/go-errors/errors/error.go @@ -9,36 +9,36 @@ // // For example: // -// package crashy +// package crashy // -// import "github.com/go-errors/errors" +// import "github.com/go-errors/errors" // -// var Crashed = errors.Errorf("oh dear") +// var Crashed = errors.Errorf("oh dear") // -// func Crash() error { -// return errors.New(Crashed) -// } +// func Crash() error { +// return errors.New(Crashed) +// } // // This can be called as follows: // -// package main +// package main // -// import ( -// "crashy" -// "fmt" -// "github.com/go-errors/errors" -// ) +// import ( +// "crashy" +// "fmt" +// "github.com/go-errors/errors" +// ) // -// func main() { -// err := crashy.Crash() -// if err != nil { -// if errors.Is(err, crashy.Crashed) { -// fmt.Println(err.(*errors.Error).ErrorStack()) -// } else { -// panic(err) -// } -// } -// } +// func main() { +// err := crashy.Crash() +// if err != nil { +// if errors.Is(err, crashy.Crashed) { +// fmt.Println(err.(*errors.Error).ErrorStack()) +// } else { +// panic(err) +// } +// } +// } // // This package was original written to allow reporting to Bugsnag, // but after I found similar packages by Facebook and Dropbox, it diff --git a/backend/vendor/github.com/go-errors/errors/error_1_13.go b/backend/vendor/github.com/go-errors/errors/error_1_13.go index 0af2fc80..09d8a555 100644 --- a/backend/vendor/github.com/go-errors/errors/error_1_13.go +++ b/backend/vendor/github.com/go-errors/errors/error_1_13.go @@ -1,3 +1,4 @@ +//go:build go1.13 // +build go1.13 package errors diff --git a/backend/vendor/github.com/go-errors/errors/error_backward.go b/backend/vendor/github.com/go-errors/errors/error_backward.go index 80b0695e..69a79474 100644 --- a/backend/vendor/github.com/go-errors/errors/error_backward.go +++ b/backend/vendor/github.com/go-errors/errors/error_backward.go @@ -1,3 +1,4 @@ +//go:build !go1.13 // +build !go1.13 package errors diff --git a/backend/vendor/github.com/go-errors/errors/parse_panic.go b/backend/vendor/github.com/go-errors/errors/parse_panic.go index cc37052d..d295563d 100644 --- a/backend/vendor/github.com/go-errors/errors/parse_panic.go +++ b/backend/vendor/github.com/go-errors/errors/parse_panic.go @@ -75,8 +75,8 @@ func ParsePanic(text string) (*Error, error) { // The lines we're passing look like this: // -// main.(*foo).destruct(0xc208067e98) -// /0/go/src/github.com/bugsnag/bugsnag-go/pan/main.go:22 +0x151 +// main.(*foo).destruct(0xc208067e98) +// /0/go/src/github.com/bugsnag/bugsnag-go/pan/main.go:22 +0x151 func parsePanicFrame(name string, line string, createdBy bool) (*StackFrame, error) { idx := strings.LastIndex(name, "(") if idx == -1 && !createdBy { diff --git a/backend/vendor/github.com/go-ole/go-ole/com.go b/backend/vendor/github.com/go-ole/go-ole/com.go index a9bef150..6333441f 100644 --- a/backend/vendor/github.com/go-ole/go-ole/com.go +++ b/backend/vendor/github.com/go-ole/go-ole/com.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/com_func.go b/backend/vendor/github.com/go-ole/go-ole/com_func.go index cef539d9..7b9fa67f 100644 --- a/backend/vendor/github.com/go-ole/go-ole/com_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/com_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/error_func.go b/backend/vendor/github.com/go-ole/go-ole/error_func.go index 8a2ffaa2..6478b339 100644 --- a/backend/vendor/github.com/go-ole/go-ole/error_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/error_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/error_windows.go b/backend/vendor/github.com/go-ole/go-ole/error_windows.go index d0e8e685..8da277c0 100644 --- a/backend/vendor/github.com/go-ole/go-ole/error_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/error_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/guid.go b/backend/vendor/github.com/go-ole/go-ole/guid.go index 8d20f68f..27f9557b 100644 --- a/backend/vendor/github.com/go-ole/go-ole/guid.go +++ b/backend/vendor/github.com/go-ole/go-ole/guid.go @@ -108,9 +108,9 @@ type GUID struct { // // The supplied string may be in any of these formats: // -// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -// XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +// XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} // // The conversion of the supplied string is not case-sensitive. func NewGUID(guid string) *GUID { @@ -216,11 +216,11 @@ func decodeHexChar(c byte) (byte, bool) { // String converts the GUID to string form. It will adhere to this pattern: // -// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} +// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} // // If the GUID is nil, the string representation of an empty GUID is returned: // -// {00000000-0000-0000-0000-000000000000} +// {00000000-0000-0000-0000-000000000000} func (guid *GUID) String() string { if guid == nil { return emptyGUID diff --git a/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go b/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go index 5414dc3c..999720a0 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go b/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go index 32bc1832..c7325ad0 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/iconnectionpoint_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go b/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go index 5dfa42aa..26e264d1 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go b/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go index ad30d79e..8b090f49 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/iconnectionpointcontainer_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/idispatch_func.go b/backend/vendor/github.com/go-ole/go-ole/idispatch_func.go index b8fbbe31..5315505a 100644 --- a/backend/vendor/github.com/go-ole/go-ole/idispatch_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/idispatch_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/idispatch_windows.go b/backend/vendor/github.com/go-ole/go-ole/idispatch_windows.go index b399f047..ec2950aa 100644 --- a/backend/vendor/github.com/go-ole/go-ole/idispatch_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/idispatch_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/ienumvariant_func.go b/backend/vendor/github.com/go-ole/go-ole/ienumvariant_func.go index c1484819..f332e439 100644 --- a/backend/vendor/github.com/go-ole/go-ole/ienumvariant_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/ienumvariant_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go b/backend/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go index 4781f3b8..72e5f31d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/ienumvariant_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iinspectable_func.go b/backend/vendor/github.com/go-ole/go-ole/iinspectable_func.go index 348829bf..cf0fba0d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iinspectable_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/iinspectable_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iinspectable_windows.go b/backend/vendor/github.com/go-ole/go-ole/iinspectable_windows.go index 4519a4aa..9a686d25 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iinspectable_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/iinspectable_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go b/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go index 7e3cb63e..90109f55 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go b/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go index 2ad01639..c758acd9 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/iprovideclassinfo_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/itypeinfo_func.go b/backend/vendor/github.com/go-ole/go-ole/itypeinfo_func.go index 8364a659..31c0677c 100644 --- a/backend/vendor/github.com/go-ole/go-ole/itypeinfo_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/itypeinfo_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go b/backend/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go index 54782b3d..2abab821 100644 --- a/backend/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/itypeinfo_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iunknown_func.go b/backend/vendor/github.com/go-ole/go-ole/iunknown_func.go index d0a62cfd..247fccb3 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iunknown_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/iunknown_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/iunknown_windows.go b/backend/vendor/github.com/go-ole/go-ole/iunknown_windows.go index ede5bb8c..faf9c4c7 100644 --- a/backend/vendor/github.com/go-ole/go-ole/iunknown_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/iunknown_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/oleutil/connection.go b/backend/vendor/github.com/go-ole/go-ole/oleutil/connection.go index 60df73cd..4c52d55e 100644 --- a/backend/vendor/github.com/go-ole/go-ole/oleutil/connection.go +++ b/backend/vendor/github.com/go-ole/go-ole/oleutil/connection.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package oleutil diff --git a/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go b/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go index 8818fb82..b00ac4a9 100644 --- a/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package oleutil diff --git a/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go b/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go index ab9c0d8d..19fa27e5 100644 --- a/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package oleutil diff --git a/backend/vendor/github.com/go-ole/go-ole/oleutil/go-get.go b/backend/vendor/github.com/go-ole/go-ole/oleutil/go-get.go index 58347628..40bd9ff6 100644 --- a/backend/vendor/github.com/go-ole/go-ole/oleutil/go-get.go +++ b/backend/vendor/github.com/go-ole/go-ole/oleutil/go-get.go @@ -1,6 +1,7 @@ // This file is here so go get succeeds as without it errors with: // no buildable Go source files in ... // +//go:build !windows // +build !windows package oleutil diff --git a/backend/vendor/github.com/go-ole/go-ole/safearray_func.go b/backend/vendor/github.com/go-ole/go-ole/safearray_func.go index 0dee670c..afb1d02d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/safearray_func.go +++ b/backend/vendor/github.com/go-ole/go-ole/safearray_func.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/safearray_windows.go b/backend/vendor/github.com/go-ole/go-ole/safearray_windows.go index 0c1b3a10..0a322f5d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/safearray_windows.go +++ b/backend/vendor/github.com/go-ole/go-ole/safearray_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/safearrayconversion.go b/backend/vendor/github.com/go-ole/go-ole/safearrayconversion.go index da737293..dde3e17e 100644 --- a/backend/vendor/github.com/go-ole/go-ole/safearrayconversion.go +++ b/backend/vendor/github.com/go-ole/go-ole/safearrayconversion.go @@ -84,7 +84,7 @@ func (sac *SafeArrayConversion) ToValueArray() (values []interface{}) { safeArrayGetElement(sac.Array, i, unsafe.Pointer(&v)) values[i] = v case VT_BSTR: - v , _ := safeArrayGetElementString(sac.Array, i) + v, _ := safeArrayGetElementString(sac.Array, i) values[i] = v case VT_VARIANT: var v VARIANT diff --git a/backend/vendor/github.com/go-ole/go-ole/safearrayslices.go b/backend/vendor/github.com/go-ole/go-ole/safearrayslices.go index a9fa885f..063dbbfe 100644 --- a/backend/vendor/github.com/go-ole/go-ole/safearrayslices.go +++ b/backend/vendor/github.com/go-ole/go-ole/safearrayslices.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variables.go b/backend/vendor/github.com/go-ole/go-ole/variables.go index a6add1b0..056f844d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variables.go +++ b/backend/vendor/github.com/go-ole/go-ole/variables.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_386.go b/backend/vendor/github.com/go-ole/go-ole/variant_386.go index e73736bf..2e3d3aa4 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_386.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_386.go @@ -1,3 +1,4 @@ +//go:build 386 // +build 386 package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_amd64.go b/backend/vendor/github.com/go-ole/go-ole/variant_amd64.go index dccdde13..b48c3ce6 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_amd64.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_amd64.go @@ -1,3 +1,4 @@ +//go:build amd64 // +build amd64 package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_arm.go b/backend/vendor/github.com/go-ole/go-ole/variant_arm.go index d4724544..5c8d492d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_arm.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_arm.go @@ -1,3 +1,4 @@ +//go:build arm // +build arm package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_date_386.go b/backend/vendor/github.com/go-ole/go-ole/variant_date_386.go index 1b970f63..8c3d3085 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_date_386.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_date_386.go @@ -1,3 +1,4 @@ +//go:build windows && 386 // +build windows,386 package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_date_amd64.go b/backend/vendor/github.com/go-ole/go-ole/variant_date_amd64.go index 6952f1f0..8554d38d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_date_amd64.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_date_amd64.go @@ -1,3 +1,4 @@ +//go:build windows && amd64 // +build windows,amd64 package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_date_arm.go b/backend/vendor/github.com/go-ole/go-ole/variant_date_arm.go index 09ec7b5c..7afe38b8 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_date_arm.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_date_arm.go @@ -1,3 +1,4 @@ +//go:build windows && arm // +build windows,arm package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_ppc64le.go b/backend/vendor/github.com/go-ole/go-ole/variant_ppc64le.go index 326427a7..4ce060d8 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_ppc64le.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_ppc64le.go @@ -1,3 +1,4 @@ +//go:build ppc64le // +build ppc64le package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/variant_s390x.go b/backend/vendor/github.com/go-ole/go-ole/variant_s390x.go index 9874ca66..f8373109 100644 --- a/backend/vendor/github.com/go-ole/go-ole/variant_s390x.go +++ b/backend/vendor/github.com/go-ole/go-ole/variant_s390x.go @@ -1,3 +1,4 @@ +//go:build s390x // +build s390x package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/winrt.go b/backend/vendor/github.com/go-ole/go-ole/winrt.go index 4e9eca73..f503d685 100644 --- a/backend/vendor/github.com/go-ole/go-ole/winrt.go +++ b/backend/vendor/github.com/go-ole/go-ole/winrt.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package ole diff --git a/backend/vendor/github.com/go-ole/go-ole/winrt_doc.go b/backend/vendor/github.com/go-ole/go-ole/winrt_doc.go index 52e6d74c..a392928d 100644 --- a/backend/vendor/github.com/go-ole/go-ole/winrt_doc.go +++ b/backend/vendor/github.com/go-ole/go-ole/winrt_doc.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package ole diff --git a/backend/vendor/github.com/golang/geo/r1/interval.go b/backend/vendor/github.com/golang/geo/r1/interval.go index 48ea5198..81b05684 100644 --- a/backend/vendor/github.com/golang/geo/r1/interval.go +++ b/backend/vendor/github.com/golang/geo/r1/interval.go @@ -165,7 +165,8 @@ func (i Interval) ApproxEqual(other Interval) bool { // DirectedHausdorffDistance returns the Hausdorff distance to the given interval. For two // intervals x and y, this distance is defined as -// h(x, y) = max_{p in x} min_{q in y} d(p, q). +// +// h(x, y) = max_{p in x} min_{q in y} d(p, q). func (i Interval) DirectedHausdorffDistance(other Interval) float64 { if i.IsEmpty() { return 0 diff --git a/backend/vendor/github.com/golang/geo/r3/vector.go b/backend/vendor/github.com/golang/geo/r3/vector.go index ccda622f..692bb705 100644 --- a/backend/vendor/github.com/golang/geo/r3/vector.go +++ b/backend/vendor/github.com/golang/geo/r3/vector.go @@ -146,9 +146,9 @@ func (v Vector) SmallestComponent() Axis { // Cmp compares v and ov lexicographically and returns: // -// -1 if v < ov -// 0 if v == ov -// +1 if v > ov +// -1 if v < ov +// 0 if v == ov +// +1 if v > ov // // This method is based on C++'s std::lexicographical_compare. Two entities // are compared element by element with the given operator. The first mismatch diff --git a/backend/vendor/github.com/golang/geo/s1/angle.go b/backend/vendor/github.com/golang/geo/s1/angle.go index 747b23de..338471b9 100644 --- a/backend/vendor/github.com/golang/geo/s1/angle.go +++ b/backend/vendor/github.com/golang/geo/s1/angle.go @@ -26,26 +26,26 @@ import ( // // The following conversions between degrees and radians are exact: // -// Degree*180 == Radian*math.Pi -// Degree*(180/n) == Radian*(math.Pi/n) for n == 0..8 +// Degree*180 == Radian*math.Pi +// Degree*(180/n) == Radian*(math.Pi/n) for n == 0..8 // // These identities hold when the arguments are scaled up or down by any power // of 2. Some similar identities are also true, for example, // -// Degree*60 == Radian*(math.Pi/3) +// Degree*60 == Radian*(math.Pi/3) // // But be aware that this type of identity does not hold in general. For example, // -// Degree*3 != Radian*(math.Pi/60) +// Degree*3 != Radian*(math.Pi/60) // // Similarly, the conversion to radians means that (Angle(x)*Degree).Degrees() // does not always equal x. For example, // -// (Angle(45*n)*Degree).Degrees() == 45*n for n == 0..8 +// (Angle(45*n)*Degree).Degrees() == 45*n for n == 0..8 // // but // -// (60*Degree).Degrees() != 60 +// (60*Degree).Degrees() != 60 // // When testing for equality, you should allow for numerical errors (ApproxEqual) // or convert to discrete E5/E6/E7 values first. diff --git a/backend/vendor/github.com/golang/geo/s1/chordangle.go b/backend/vendor/github.com/golang/geo/s1/chordangle.go index 77d71648..c1b9cfb1 100644 --- a/backend/vendor/github.com/golang/geo/s1/chordangle.go +++ b/backend/vendor/github.com/golang/geo/s1/chordangle.go @@ -39,43 +39,43 @@ import ( // radians, i.e. A and B are within "x" radians of being antipodal. The // corresponding chord length is // -// r = 2 * sin((π - x) / 2) = 2 * cos(x / 2) +// r = 2 * sin((π - x) / 2) = 2 * cos(x / 2) // // For values of x not close to π the relative error in the squared chord // length is at most 4.5 * dblEpsilon (see MaxPointError below). // The relative error in "r" is thus at most 2.25 * dblEpsilon ~= 5e-16. To // convert this error into an equivalent angle, we have // -// |dr / dx| = sin(x / 2) +// |dr / dx| = sin(x / 2) // // and therefore // -// |dx| = dr / sin(x / 2) -// = 5e-16 * (2 * cos(x / 2)) / sin(x / 2) -// = 1e-15 / tan(x / 2) +// |dx| = dr / sin(x / 2) +// = 5e-16 * (2 * cos(x / 2)) / sin(x / 2) +// = 1e-15 / tan(x / 2) // // The maximum error is attained when // -// x = |dx| -// = 1e-15 / tan(x / 2) -// ~= 1e-15 / (x / 2) -// ~= sqrt(2e-15) +// x = |dx| +// = 1e-15 / tan(x / 2) +// ~= 1e-15 / (x / 2) +// ~= sqrt(2e-15) // // In summary, the measurement error for an angle (π - x) is at most // -// dx = min(1e-15 / tan(x / 2), sqrt(2e-15)) -// (~= min(2e-15 / x, sqrt(2e-15)) when x is small) +// dx = min(1e-15 / tan(x / 2), sqrt(2e-15)) +// (~= min(2e-15 / x, sqrt(2e-15)) when x is small) // // On the Earth's surface (assuming a radius of 6371km), this corresponds to // the following worst-case measurement errors: // -// Accuracy: Unless antipodal to within: -// --------- --------------------------- -// 6.4 nanometers 10,000 km (90 degrees) -// 1 micrometer 81.2 kilometers -// 1 millimeter 81.2 meters -// 1 centimeter 8.12 meters -// 28.5 centimeters 28.5 centimeters +// Accuracy: Unless antipodal to within: +// --------- --------------------------- +// 6.4 nanometers 10,000 km (90 degrees) +// 1 micrometer 81.2 kilometers +// 1 millimeter 81.2 meters +// 1 centimeter 8.12 meters +// 28.5 centimeters 28.5 centimeters // // The representational and conversion errors referred to earlier are somewhat // smaller than this. For example, maximum distance between adjacent @@ -84,11 +84,11 @@ import ( // r^2 = 4 * (1 - dblEpsilon / 2). Thus r = 2 * (1 - dblEpsilon / 4) and // the angle between these two representable values is // -// x = 2 * acos(r / 2) -// = 2 * acos(1 - dblEpsilon / 4) -// ~= 2 * asin(sqrt(dblEpsilon / 2) -// ~= sqrt(2 * dblEpsilon) -// ~= 2.1e-8 +// x = 2 * acos(r / 2) +// = 2 * acos(1 - dblEpsilon / 4) +// ~= 2 * asin(sqrt(dblEpsilon / 2) +// ~= sqrt(2 * dblEpsilon) +// ~= 2.1e-8 // // which is 13.5 cm on the Earth's surface. // @@ -97,11 +97,11 @@ import ( // r^2 = (4 * (1 - dblEpsilon / 4)), thus r = 2 * (1 - dblEpsilon / 8) and // the worst case rounding error is // -// x = 2 * acos(r / 2) -// = 2 * acos(1 - dblEpsilon / 8) -// ~= 2 * asin(sqrt(dblEpsilon / 4) -// ~= sqrt(dblEpsilon) -// ~= 1.5e-8 +// x = 2 * acos(r / 2) +// = 2 * acos(1 - dblEpsilon / 8) +// ~= 2 * asin(sqrt(dblEpsilon / 4) +// ~= sqrt(dblEpsilon) +// ~= 1.5e-8 // // which is 9.5 cm on the Earth's surface. type ChordAngle float64 @@ -148,8 +148,9 @@ func ChordAngleFromSquaredLength(length2 float64) ChordAngle { // Expanded returns a new ChordAngle that has been adjusted by the given error // bound (which can be positive or negative). Error should be the value // returned by either MaxPointError or MaxAngleError. For example: -// a := ChordAngleFromPoints(x, y) -// a1 := a.Expanded(a.MaxPointError()) +// +// a := ChordAngleFromPoints(x, y) +// a1 := a.Expanded(a.MaxPointError()) func (c ChordAngle) Expanded(e float64) ChordAngle { // If the angle is special, don't change it. Otherwise clamp it to the valid range. if c.isSpecial() { @@ -195,9 +196,10 @@ func (c ChordAngle) isValid() bool { // This can be used to convert a "<" comparison to a "<=" comparison. // // Note the following special cases: -// NegativeChordAngle.Successor == 0 -// StraightChordAngle.Successor == InfChordAngle -// InfChordAngle.Successor == InfChordAngle +// +// NegativeChordAngle.Successor == 0 +// StraightChordAngle.Successor == InfChordAngle +// InfChordAngle.Successor == InfChordAngle func (c ChordAngle) Successor() ChordAngle { if c >= maxLength2 { return InfChordAngle() @@ -211,9 +213,10 @@ func (c ChordAngle) Successor() ChordAngle { // Predecessor returns the largest representable ChordAngle less than this one. // // Note the following special cases: -// InfChordAngle.Predecessor == StraightChordAngle -// ChordAngle(0).Predecessor == NegativeChordAngle -// NegativeChordAngle.Predecessor == NegativeChordAngle +// +// InfChordAngle.Predecessor == StraightChordAngle +// ChordAngle(0).Predecessor == NegativeChordAngle +// NegativeChordAngle.Predecessor == NegativeChordAngle func (c ChordAngle) Predecessor() ChordAngle { if c <= 0 { return NegativeChordAngle diff --git a/backend/vendor/github.com/golang/geo/s1/interval.go b/backend/vendor/github.com/golang/geo/s1/interval.go index 6fea5221..8b1131cc 100644 --- a/backend/vendor/github.com/golang/geo/s1/interval.go +++ b/backend/vendor/github.com/golang/geo/s1/interval.go @@ -35,8 +35,9 @@ import ( // of normal intervals are in the range (-π, π]. We normalize the latter to // the former in IntervalFromEndpoints. However, we take advantage of the point // -π to construct two special intervals: -// The full interval is [-π, π] -// The empty interval is [π, -π]. +// +// The full interval is [-π, π] +// The empty interval is [π, -π]. // // Treat the exported fields as read-only. type Interval struct { @@ -414,7 +415,9 @@ func (i Interval) ComplementCenter() float64 { // DirectedHausdorffDistance returns the Hausdorff distance to the given interval. // For two intervals i and y, this distance is defined by -// h(i, y) = max_{p in i} min_{q in y} d(p, q), +// +// h(i, y) = max_{p in i} min_{q in y} d(p, q), +// // where d(.,.) is measured along S1. func (i Interval) DirectedHausdorffDistance(y Interval) Angle { if y.ContainsInterval(i) { diff --git a/backend/vendor/github.com/golang/geo/s2/bits_go18.go b/backend/vendor/github.com/golang/geo/s2/bits_go18.go index 10a674da..4b8bfef9 100644 --- a/backend/vendor/github.com/golang/geo/s2/bits_go18.go +++ b/backend/vendor/github.com/golang/geo/s2/bits_go18.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build !go1.9 // +build !go1.9 package s2 diff --git a/backend/vendor/github.com/golang/geo/s2/bits_go19.go b/backend/vendor/github.com/golang/geo/s2/bits_go19.go index 9532b377..0de1ac69 100644 --- a/backend/vendor/github.com/golang/geo/s2/bits_go19.go +++ b/backend/vendor/github.com/golang/geo/s2/bits_go19.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.9 // +build go1.9 package s2 diff --git a/backend/vendor/github.com/golang/geo/s2/cap.go b/backend/vendor/github.com/golang/geo/s2/cap.go index c4fb2e1e..9327b6bb 100644 --- a/backend/vendor/github.com/golang/geo/s2/cap.go +++ b/backend/vendor/github.com/golang/geo/s2/cap.go @@ -52,10 +52,10 @@ var ( // radius (r), the maximum chord length from the cap's center (d), and the // radius of cap's base (a). // -// h = 1 - cos(r) -// = 2 * sin^2(r/2) -// d^2 = 2 * h -// = a^2 + h^2 +// h = 1 - cos(r) +// = 2 * sin^2(r/2) +// d^2 = 2 * h +// = a^2 + h^2 // // The zero value of Cap is an invalid cap. Use EmptyCap to get a valid empty cap. type Cap struct { diff --git a/backend/vendor/github.com/golang/geo/s2/cell_index.go b/backend/vendor/github.com/golang/geo/s2/cell_index.go index ef16d089..acbe7378 100644 --- a/backend/vendor/github.com/golang/geo/s2/cell_index.go +++ b/backend/vendor/github.com/golang/geo/s2/cell_index.go @@ -343,7 +343,7 @@ func (c *CellIndexContentsIterator) StartUnion(r *CellIndexRangeIterator) { // There is also a helper method that adds all elements of CellUnion with the // same label: // -// index.AddCellUnion(cellUnion, label) +// index.AddCellUnion(cellUnion, label) // // Note that the index is not dynamic; the contents of the index cannot be // changed once it has been built. Adding more after calling Build results in @@ -353,7 +353,7 @@ func (c *CellIndexContentsIterator) StartUnion(r *CellIndexRangeIterator) { // is to use a built-in method such as IntersectingLabels (which returns // the labels of all cells that intersect a given target CellUnion): // -// labels := index.IntersectingLabels(targetUnion); +// labels := index.IntersectingLabels(targetUnion); // // Alternatively, you can use a ClosestCellQuery which computes the cell(s) // that are closest to a given target geometry. diff --git a/backend/vendor/github.com/golang/geo/s2/cellid.go b/backend/vendor/github.com/golang/geo/s2/cellid.go index c6cbaf2d..f847b061 100644 --- a/backend/vendor/github.com/golang/geo/s2/cellid.go +++ b/backend/vendor/github.com/golang/geo/s2/cellid.go @@ -39,15 +39,15 @@ import ( // Sequentially increasing cell IDs follow a continuous space-filling curve // over the entire sphere. They have the following properties: // -// - The ID of a cell at level k consists of a 3-bit face number followed -// by k bit pairs that recursively select one of the four children of -// each cell. The next bit is always 1, and all other bits are 0. -// Therefore, the level of a cell is determined by the position of its -// lowest-numbered bit that is turned on (for a cell at level k, this -// position is 2 * (maxLevel - k)). +// - The ID of a cell at level k consists of a 3-bit face number followed +// by k bit pairs that recursively select one of the four children of +// each cell. The next bit is always 1, and all other bits are 0. +// Therefore, the level of a cell is determined by the position of its +// lowest-numbered bit that is turned on (for a cell at level k, this +// position is 2 * (maxLevel - k)). // -// - The ID of a parent cell is at the midpoint of the range of IDs spanned -// by its children (or by its descendants at any level). +// - The ID of a parent cell is at the midpoint of the range of IDs spanned +// by its children (or by its descendants at any level). // // Leaf cells are often used to represent points on the unit sphere, and // this type provides methods for converting directly between these two @@ -373,9 +373,9 @@ func (ci CellID) LatLng() LatLng { return LatLngFromPoint(Point{ci.rawPoint()}) // ChildBegin returns the first child in a traversal of the children of this cell, in Hilbert curve order. // -// for ci := c.ChildBegin(); ci != c.ChildEnd(); ci = ci.Next() { -// ... -// } +// for ci := c.ChildBegin(); ci != c.ChildEnd(); ci = ci.Next() { +// ... +// } func (ci CellID) ChildBegin() CellID { ol := ci.lsb() return CellID(uint64(ci) - ol + ol>>2) @@ -644,7 +644,7 @@ func stToIJ(s float64) int { // s2.CellIDs are considered to be closed sets. The returned cell will // always contain the given point, i.e. // -// CellFromPoint(p).ContainsPoint(p) +// CellFromPoint(p).ContainsPoint(p) // // is always true. func cellIDFromPoint(p Point) CellID { @@ -839,19 +839,19 @@ func expandEndpoint(u, maxV, sinDist float64) float64 { // it contains all points within 5km of the original cell. You can then // test whether a point lies within the expanded bounds like this: // -// if u, v, ok := faceXYZtoUV(face, point); ok && bound.ContainsPoint(r2.Point{u,v}) { ... } +// if u, v, ok := faceXYZtoUV(face, point); ok && bound.ContainsPoint(r2.Point{u,v}) { ... } // // Limitations: // -// - Because the rectangle is drawn on one of the six cube-face planes -// (i.e., {x,y,z} = +/-1), it can cover at most one hemisphere. This -// limits the maximum amount that a rectangle can be expanded. For -// example, CellID bounds can be expanded safely by at most 45 degrees -// (about 5000 km on the Earth's surface). +// - Because the rectangle is drawn on one of the six cube-face planes +// (i.e., {x,y,z} = +/-1), it can cover at most one hemisphere. This +// limits the maximum amount that a rectangle can be expanded. For +// example, CellID bounds can be expanded safely by at most 45 degrees +// (about 5000 km on the Earth's surface). // -// - The implementation is not exact for negative distances. The resulting -// rectangle will exclude all points within the given distance of the -// boundary but may be slightly smaller than necessary. +// - The implementation is not exact for negative distances. The resulting +// rectangle will exclude all points within the given distance of the +// boundary but may be slightly smaller than necessary. func expandedByDistanceUV(uv r2.Rect, distance s1.Angle) r2.Rect { // Expand each of the four sides of the rectangle just enough to include all // points within the given distance of that side. (The rectangle may be @@ -872,7 +872,7 @@ func expandedByDistanceUV(uv r2.Rect, distance s1.Angle) r2.Rect { // a given range (a tiling). This example shows how to generate a tiling // for a semi-open range of leaf cells [start, limit): // -// for id := start.MaxTile(limit); id != limit; id = id.Next().MaxTile(limit)) { ... } +// for id := start.MaxTile(limit); id != limit; id = id.Next().MaxTile(limit)) { ... } // // Note that in general the cells in the tiling will be of different sizes; // they gradually get larger (near the middle of the range) and then diff --git a/backend/vendor/github.com/golang/geo/s2/convex_hull_query.go b/backend/vendor/github.com/golang/geo/s2/convex_hull_query.go index 68539abb..2a87377e 100644 --- a/backend/vendor/github.com/golang/geo/s2/convex_hull_query.go +++ b/backend/vendor/github.com/golang/geo/s2/convex_hull_query.go @@ -31,16 +31,16 @@ import ( // // Containment of input geometry is defined as follows: // -// - Each input loop and polygon is contained by the convex hull exactly -// (i.e., according to Polygon's Contains(Polygon)). +// - Each input loop and polygon is contained by the convex hull exactly +// (i.e., according to Polygon's Contains(Polygon)). // -// - Each input point is either contained by the convex hull or is a vertex -// of the convex hull. (Recall that S2Loops do not necessarily contain their -// vertices.) +// - Each input point is either contained by the convex hull or is a vertex +// of the convex hull. (Recall that S2Loops do not necessarily contain their +// vertices.) // -// - For each input polyline, the convex hull contains all of its vertices -// according to the rule for points above. (The definition of convexity -// then ensures that the convex hull also contains the polyline edges.) +// - For each input polyline, the convex hull contains all of its vertices +// according to the rule for points above. (The definition of convexity +// then ensures that the convex hull also contains the polyline edges.) // // To use this type, call the various Add... methods to add your input geometry, and // then call ConvexHull. Note that ConvexHull does *not* reset the diff --git a/backend/vendor/github.com/golang/geo/s2/doc.go b/backend/vendor/github.com/golang/geo/s2/doc.go index 43e7a634..e554af21 100644 --- a/backend/vendor/github.com/golang/geo/s2/doc.go +++ b/backend/vendor/github.com/golang/geo/s2/doc.go @@ -20,7 +20,7 @@ r2 (operates on ℝ²) and r3 (operates on ℝ³). This package provides types and functions for the S2 cell hierarchy and coordinate systems. The S2 cell hierarchy is a hierarchical decomposition of the surface of a unit sphere (S²) -into ``cells''; it is highly efficient, scales from continental size to under 1 cm² +into “cells”; it is highly efficient, scales from continental size to under 1 cm² and preserves spatial locality (nearby cells have close IDs). More information including an in-depth introduction to S2 can be found on the diff --git a/backend/vendor/github.com/golang/geo/s2/edge_clipping.go b/backend/vendor/github.com/golang/geo/s2/edge_clipping.go index 57a53bf0..813bf98d 100644 --- a/backend/vendor/github.com/golang/geo/s2/edge_clipping.go +++ b/backend/vendor/github.com/golang/geo/s2/edge_clipping.go @@ -482,9 +482,10 @@ func clipEdgeBound(a, b r2.Point, clip, bound r2.Rect) (r2.Rect, bool) { // interpolateFloat64 returns a value with the same combination of a1 and b1 as the // given value x is of a and b. This function makes the following guarantees: -// - If x == a, then x1 = a1 (exactly). -// - If x == b, then x1 = b1 (exactly). -// - If a <= x <= b, then a1 <= x1 <= b1 (even if a1 == b1). +// - If x == a, then x1 = a1 (exactly). +// - If x == b, then x1 = b1 (exactly). +// - If a <= x <= b, then a1 <= x1 <= b1 (even if a1 == b1). +// // This requires a != b. func interpolateFloat64(x, a, b, a1, b1 float64) float64 { // To get results that are accurate near both A and B, we interpolate diff --git a/backend/vendor/github.com/golang/geo/s2/edge_crosser.go b/backend/vendor/github.com/golang/geo/s2/edge_crosser.go index 69c6da6b..81d94f9c 100644 --- a/backend/vendor/github.com/golang/geo/s2/edge_crosser.go +++ b/backend/vendor/github.com/golang/geo/s2/edge_crosser.go @@ -34,7 +34,6 @@ import ( // } // return count // } -// type EdgeCrosser struct { a Point b Point @@ -70,10 +69,10 @@ func NewEdgeCrosser(a, b Point) *EdgeCrosser { // // Properties of CrossingSign: // -// (1) CrossingSign(b,a,c,d) == CrossingSign(a,b,c,d) -// (2) CrossingSign(c,d,a,b) == CrossingSign(a,b,c,d) -// (3) CrossingSign(a,b,c,d) == MaybeCross if a==c, a==d, b==c, b==d -// (3) CrossingSign(a,b,c,d) == DoNotCross or MaybeCross if a==b or c==d +// (1) CrossingSign(b,a,c,d) == CrossingSign(a,b,c,d) +// (2) CrossingSign(c,d,a,b) == CrossingSign(a,b,c,d) +// (3) CrossingSign(a,b,c,d) == MaybeCross if a==c, a==d, b==c, b==d +// (3) CrossingSign(a,b,c,d) == DoNotCross or MaybeCross if a==b or c==d // // Note that if you want to check an edge against a chain of other edges, // it is slightly more efficient to use the single-argument version diff --git a/backend/vendor/github.com/golang/geo/s2/edge_crossings.go b/backend/vendor/github.com/golang/geo/s2/edge_crossings.go index a98ec76f..5b29da3f 100644 --- a/backend/vendor/github.com/golang/geo/s2/edge_crossings.go +++ b/backend/vendor/github.com/golang/geo/s2/edge_crossings.go @@ -74,10 +74,10 @@ func (c Crossing) String() string { // // Properties of CrossingSign: // -// (1) CrossingSign(b,a,c,d) == CrossingSign(a,b,c,d) -// (2) CrossingSign(c,d,a,b) == CrossingSign(a,b,c,d) -// (3) CrossingSign(a,b,c,d) == MaybeCross if a==c, a==d, b==c, b==d -// (3) CrossingSign(a,b,c,d) == DoNotCross or MaybeCross if a==b or c==d +// (1) CrossingSign(b,a,c,d) == CrossingSign(a,b,c,d) +// (2) CrossingSign(c,d,a,b) == CrossingSign(a,b,c,d) +// (3) CrossingSign(a,b,c,d) == MaybeCross if a==c, a==d, b==c, b==d +// (3) CrossingSign(a,b,c,d) == DoNotCross or MaybeCross if a==b or c==d // // This method implements an exact, consistent perturbation model such // that no three points are ever considered to be collinear. This means @@ -107,11 +107,11 @@ func CrossingSign(a, b, c, d Point) Crossing { // // Useful properties of VertexCrossing (VC): // -// (1) VC(a,a,c,d) == VC(a,b,c,c) == false -// (2) VC(a,b,a,b) == VC(a,b,b,a) == true -// (3) VC(a,b,c,d) == VC(a,b,d,c) == VC(b,a,c,d) == VC(b,a,d,c) -// (3) If exactly one of a,b equals one of c,d, then exactly one of -// VC(a,b,c,d) and VC(c,d,a,b) is true +// (1) VC(a,a,c,d) == VC(a,b,c,c) == false +// (2) VC(a,b,a,b) == VC(a,b,b,a) == true +// (3) VC(a,b,c,d) == VC(a,b,d,c) == VC(b,a,c,d) == VC(b,a,d,c) +// (3) If exactly one of a,b equals one of c,d, then exactly one of +// VC(a,b,c,d) and VC(c,d,a,b) is true // // It is an error to call this method with 4 distinct vertices. func VertexCrossing(a, b, c, d Point) bool { @@ -162,8 +162,8 @@ func EdgeOrVertexCrossing(a, b, c, d Point) bool { // // Useful properties of Intersection: // -// (1) Intersection(b,a,c,d) == Intersection(a,b,d,c) == Intersection(a,b,c,d) -// (2) Intersection(c,d,a,b) == Intersection(a,b,c,d) +// (1) Intersection(b,a,c,d) == Intersection(a,b,d,c) == Intersection(a,b,c,d) +// (2) Intersection(c,d,a,b) == Intersection(a,b,c,d) // // The returned intersection point X is guaranteed to be very close to the // true intersection point of AB and CD, even if the edges intersect at a diff --git a/backend/vendor/github.com/golang/geo/s2/edge_query.go b/backend/vendor/github.com/golang/geo/s2/edge_query.go index 2d443d1c..91f4fb64 100644 --- a/backend/vendor/github.com/golang/geo/s2/edge_query.go +++ b/backend/vendor/github.com/golang/geo/s2/edge_query.go @@ -24,16 +24,16 @@ import ( // // Options can be chained together builder-style: // -// opts = NewClosestEdgeQueryOptions(). -// MaxResults(1). -// DistanceLimit(s1.ChordAngleFromAngle(3 * s1.Degree)). -// MaxError(s1.ChordAngleFromAngle(0.001 * s1.Degree)) -// query = NewClosestEdgeQuery(index, opts) +// opts = NewClosestEdgeQueryOptions(). +// MaxResults(1). +// DistanceLimit(s1.ChordAngleFromAngle(3 * s1.Degree)). +// MaxError(s1.ChordAngleFromAngle(0.001 * s1.Degree)) +// query = NewClosestEdgeQuery(index, opts) // -// or set individually: +// or set individually: // -// opts = NewClosestEdgeQueryOptions() -// opts.IncludeInteriors(true) +// opts = NewClosestEdgeQueryOptions() +// opts.IncludeInteriors(true) // // or just inline: // @@ -102,11 +102,11 @@ func NewFurthestEdgeQueryOptions() *EdgeQueryOptions { // EdgeQueryResult represents an edge that meets the target criteria for the // query. Note the following special cases: // -// - ShapeID >= 0 && EdgeID < 0 represents the interior of a shape. -// Such results may be returned when the option IncludeInteriors is true. +// - ShapeID >= 0 && EdgeID < 0 represents the interior of a shape. +// Such results may be returned when the option IncludeInteriors is true. // -// - ShapeID < 0 && EdgeID < 0 is returned to indicate that no edge -// satisfies the requested query options. +// - ShapeID < 0 && EdgeID < 0 is returned to indicate that no edge +// satisfies the requested query options. type EdgeQueryResult struct { distance distance shapeID int32 @@ -162,9 +162,9 @@ func (e EdgeQueryResult) Less(other EdgeQueryResult) bool { // // By using the appropriate options, this type can answer questions such as: // -// - Find the minimum distance between two geometries A and B. -// - Find all edges of geometry A that are within a distance D of geometry B. -// - Find the k edges of geometry A that are closest to a given point P. +// - Find the minimum distance between two geometries A and B. +// - Find all edges of geometry A that are within a distance D of geometry B. +// - Find the k edges of geometry A that are closest to a given point P. // // You can also specify whether polygons should include their interiors (i.e., // if a point is contained by a polygon, should the distance be zero or should @@ -322,7 +322,6 @@ func (e *EdgeQuery) Distance(target distanceTarget) s1.ChordAngle { // If you wish to check if the distance is less than or equal to the limit, use: // // query.IsDistanceLess(target, limit.Successor()) -// func (e *EdgeQuery) IsDistanceLess(target distanceTarget, limit s1.ChordAngle) bool { opts := e.opts opts = opts.MaxResults(1). @@ -339,7 +338,6 @@ func (e *EdgeQuery) IsDistanceLess(target distanceTarget, limit s1.ChordAngle) b // If you wish to check if the distance is less than or equal to the limit, use: // // query.IsDistanceGreater(target, limit.Predecessor()) -// func (e *EdgeQuery) IsDistanceGreater(target distanceTarget, limit s1.ChordAngle) bool { return e.IsDistanceLess(target, limit) } diff --git a/backend/vendor/github.com/golang/geo/s2/edge_tessellator.go b/backend/vendor/github.com/golang/geo/s2/edge_tessellator.go index 1d5805c2..903ad47c 100644 --- a/backend/vendor/github.com/golang/geo/s2/edge_tessellator.go +++ b/backend/vendor/github.com/golang/geo/s2/edge_tessellator.go @@ -180,10 +180,10 @@ const ( // of edges in a given 2D projection such that the maximum distance between the // geodesic edge and the chain of projected edges is at most the requested tolerance. // -// Method | Input | Output -// ------------|------------------------|----------------------- -// Projected | S2 geodesics | Planar projected edges -// Unprojected | Planar projected edges | S2 geodesics +// Method | Input | Output +// ------------|------------------------|----------------------- +// Projected | S2 geodesics | Planar projected edges +// Unprojected | Planar projected edges | S2 geodesics type EdgeTessellator struct { projection Projection diff --git a/backend/vendor/github.com/golang/geo/s2/lexicon.go b/backend/vendor/github.com/golang/geo/s2/lexicon.go index 41cbffdc..23bc6f3b 100644 --- a/backend/vendor/github.com/golang/geo/s2/lexicon.go +++ b/backend/vendor/github.com/golang/geo/s2/lexicon.go @@ -53,10 +53,10 @@ func newIDSetLexicon() *idSetLexicon { // sorted and duplicates are removed. // // The primary difference between this and sequenceLexicon are: -// 1. Empty and singleton sets are represented implicitly; they use no space. -// 2. Sets are represented rather than sequences; the ordering of values is -// not important and duplicates are removed. -// 3. The values must be 32-bit non-negative integers only. +// 1. Empty and singleton sets are represented implicitly; they use no space. +// 2. Sets are represented rather than sequences; the ordering of values is +// not important and duplicates are removed. +// 3. The values must be 32-bit non-negative integers only. func (l *idSetLexicon) add(ids ...int32) int32 { // Empty sets have a special ID chosen not to conflict with other IDs. if len(ids) == 0 { diff --git a/backend/vendor/github.com/golang/geo/s2/loop.go b/backend/vendor/github.com/golang/geo/s2/loop.go index bfb55ec1..95d3d19b 100644 --- a/backend/vendor/github.com/golang/geo/s2/loop.go +++ b/backend/vendor/github.com/golang/geo/s2/loop.go @@ -413,12 +413,12 @@ func (l *Loop) BoundaryEqual(o *Loop) bool { // -1 if it excludes the boundary of the other, and 0 if the boundaries of the two // loops cross. Shared edges are handled as follows: // -// If XY is a shared edge, define Reversed(XY) to be true if XY -// appears in opposite directions in both loops. -// Then this loop contains XY if and only if Reversed(XY) == the other loop is a hole. -// (Intuitively, this checks whether this loop contains a vanishingly small region -// extending from the boundary of the other toward the interior of the polygon to -// which the other belongs.) +// If XY is a shared edge, define Reversed(XY) to be true if XY +// appears in opposite directions in both loops. +// Then this loop contains XY if and only if Reversed(XY) == the other loop is a hole. +// (Intuitively, this checks whether this loop contains a vanishingly small region +// extending from the boundary of the other toward the interior of the polygon to +// which the other belongs.) // // This function is used for testing containment and intersection of // multi-loop polygons. Note that this method is not symmetric, since the @@ -979,21 +979,23 @@ func (l *Loop) ContainsNested(other *Loop) bool { // surface integral" means: // // (1) f(A,B,C) must be the integral of f if ABC is counterclockwise, -// and the integral of -f if ABC is clockwise. +// +// and the integral of -f if ABC is clockwise. // // (2) The result of this function is *either* the integral of f over the -// loop interior, or the integral of (-f) over the loop exterior. +// +// loop interior, or the integral of (-f) over the loop exterior. // // Note that there are at least two common situations where it easy to work // around property (2) above: // -// - If the integral of f over the entire sphere is zero, then it doesn't -// matter which case is returned because they are always equal. +// - If the integral of f over the entire sphere is zero, then it doesn't +// matter which case is returned because they are always equal. // -// - If f is non-negative, then it is easy to detect when the integral over -// the loop exterior has been returned, and the integral over the loop -// interior can be obtained by adding the integral of f over the entire -// unit sphere (a constant) to the result. +// - If f is non-negative, then it is easy to detect when the integral over +// the loop exterior has been returned, and the integral over the loop +// interior can be obtained by adding the integral of f over the entire +// unit sphere (a constant) to the result. // // Any changes to this method may need corresponding changes to surfaceIntegralPoint as well. func (l *Loop) surfaceIntegralFloat64(f func(a, b, c Point) float64) float64 { @@ -1748,10 +1750,12 @@ func (i *intersectsRelation) wedgesCross(a0, ab1, a2, b0, b2 Point) bool { // so we return crossingTargetDontCare for both crossing targets. // // Aside: A possible early exit condition could be based on the following. -// If A contains a point of both B and ~B, then A intersects Boundary(B). -// If ~A contains a point of both B and ~B, then ~A intersects Boundary(B). -// So if the intersections of {A, ~A} with {B, ~B} are all non-empty, -// the return value is 0, i.e., Boundary(A) intersects Boundary(B). +// +// If A contains a point of both B and ~B, then A intersects Boundary(B). +// If ~A contains a point of both B and ~B, then ~A intersects Boundary(B). +// So if the intersections of {A, ~A} with {B, ~B} are all non-empty, +// the return value is 0, i.e., Boundary(A) intersects Boundary(B). +// // Unfortunately it isn't worth detecting this situation because by the // time we have seen a point in all four intersection regions, we are also // guaranteed to have seen at least one pair of crossing edges. diff --git a/backend/vendor/github.com/golang/geo/s2/nthderivative.go b/backend/vendor/github.com/golang/geo/s2/nthderivative.go index 73445d6c..4d6898b4 100644 --- a/backend/vendor/github.com/golang/geo/s2/nthderivative.go +++ b/backend/vendor/github.com/golang/geo/s2/nthderivative.go @@ -15,7 +15,8 @@ package s2 // nthDerivativeCoder provides Nth Derivative Coding. -// (In signal processing disciplines, this is known as N-th Delta Coding.) +// +// (In signal processing disciplines, this is known as N-th Delta Coding.) // // Good for varint coding integer sequences with polynomial trends. // @@ -23,28 +24,32 @@ package s2 // derivative. Overflow in integer addition and subtraction makes this a // lossless transform. // -// constant linear quadratic -// trend trend trend -// / \ / \ / \_ +// constant linear quadratic +// trend trend trend +// / \ / \ / \_ +// // input |0 0 0 0 1 2 3 4 9 16 25 36 // 0th derivative(identity) |0 0 0 0 1 2 3 4 9 16 25 36 // 1st derivative(delta coding) | 0 0 0 1 1 1 1 5 7 9 11 // 2nd derivative(linear prediction) | 0 0 1 0 0 0 4 2 2 2 -// ------------------------------------- -// 0 1 2 3 4 5 6 7 8 9 10 11 -// n in sequence +// +// ------------------------------------- +// 0 1 2 3 4 5 6 7 8 9 10 11 +// n in sequence // // Higher-order codings can break even or be detrimental on other sequences. // -// random oscillating -// / \ / \_ +// random oscillating +// / \ / \_ +// // input |5 9 6 1 8 8 2 -2 4 -4 6 -6 // 0th derivative(identity) |5 9 6 1 8 8 2 -2 4 -4 6 -6 // 1st derivative(delta coding) | 4 -3 -5 7 0 -6 -4 6 -8 10 -12 // 2nd derivative(linear prediction) | -7 -2 12 -7 -6 2 10 -14 18 -22 -// --------------------------------------- -// 0 1 2 3 4 5 6 7 8 9 10 11 -// n in sequence +// +// --------------------------------------- +// 0 1 2 3 4 5 6 7 8 9 10 11 +// n in sequence // // Note that the nth derivative isn't available until sequence item n. Earlier // values are coded at lower order. For the above table, read 5 4 -7 -2 12 ... diff --git a/backend/vendor/github.com/golang/geo/s2/point.go b/backend/vendor/github.com/golang/geo/s2/point.go index 89e7ae0e..ce9b16ab 100644 --- a/backend/vendor/github.com/golang/geo/s2/point.go +++ b/backend/vendor/github.com/golang/geo/s2/point.go @@ -75,10 +75,10 @@ func OriginPoint() Point { // // It satisfies the following properties (f == PointCross): // -// (1) f(p, op) != 0 for all p, op -// (2) f(op,p) == -f(p,op) unless p == op or p == -op -// (3) f(-p,op) == -f(p,op) unless p == op or p == -op -// (4) f(p,-op) == -f(p,op) unless p == op or p == -op +// (1) f(p, op) != 0 for all p, op +// (2) f(op,p) == -f(p,op) unless p == op or p == -op +// (3) f(-p,op) == -f(p,op) unless p == op or p == -op +// (4) f(p,-op) == -f(p,op) unless p == op or p == -op func (p Point) PointCross(op Point) Point { // NOTE(dnadasi): In the C++ API the equivalent method here was known as "RobustCrossProd", // but PointCross more accurately describes how this method is used. @@ -102,11 +102,11 @@ func (p Point) PointCross(op Point) Point { // contained in the range of angles (inclusive) that starts at A and extends // CCW to C. Properties: // -// (1) If OrderedCCW(a,b,c,o) && OrderedCCW(b,a,c,o), then a == b -// (2) If OrderedCCW(a,b,c,o) && OrderedCCW(a,c,b,o), then b == c -// (3) If OrderedCCW(a,b,c,o) && OrderedCCW(c,b,a,o), then a == b == c -// (4) If a == b or b == c, then OrderedCCW(a,b,c,o) is true -// (5) Otherwise if a == c, then OrderedCCW(a,b,c,o) is false +// (1) If OrderedCCW(a,b,c,o) && OrderedCCW(b,a,c,o), then a == b +// (2) If OrderedCCW(a,b,c,o) && OrderedCCW(a,c,b,o), then b == c +// (3) If OrderedCCW(a,b,c,o) && OrderedCCW(c,b,a,o), then a == b == c +// (4) If a == b or b == c, then OrderedCCW(a,b,c,o) is true +// (5) Otherwise if a == c, then OrderedCCW(a,b,c,o) is false func OrderedCCW(a, b, c, o Point) bool { sum := 0 if RobustSign(b, o, a) != Clockwise { diff --git a/backend/vendor/github.com/golang/geo/s2/pointcompression.go b/backend/vendor/github.com/golang/geo/s2/pointcompression.go index 01838179..c56295e0 100644 --- a/backend/vendor/github.com/golang/geo/s2/pointcompression.go +++ b/backend/vendor/github.com/golang/geo/s2/pointcompression.go @@ -106,19 +106,20 @@ func encodeFirstPointFixedLength(e *encoder, pi, qi uint32, level int, piCoder, // encodePointCompressed encodes points into e. // Given a sequence of Points assumed to be the center of level-k cells, // compresses it into a stream using the following method: -// - decompose the points into (face, si, ti) tuples. -// - run-length encode the faces, combining face number and count into a +// - decompose the points into (face, si, ti) tuples. +// - run-length encode the faces, combining face number and count into a // varint32. See the faceRun struct. -// - right shift the (si, ti) to remove the part that's constant for all cells +// - right shift the (si, ti) to remove the part that's constant for all cells // of level-k. The result is called the (pi, qi) space. -// - 2nd derivative encode the pi and qi sequences (linear prediction) -// - zig-zag encode all derivative values but the first, which cannot be +// - 2nd derivative encode the pi and qi sequences (linear prediction) +// - zig-zag encode all derivative values but the first, which cannot be // negative -// - interleave the zig-zag encoded values -// - encode the first interleaved value in a fixed length encoding +// - interleave the zig-zag encoded values +// - encode the first interleaved value in a fixed length encoding // (varint would make this value larger) -// - encode the remaining interleaved values as varint64s, as the +// - encode the remaining interleaved values as varint64s, as the // derivative encoding should make the values small. +// // In addition, provides a lossless method to compress a sequence of points even // if some points are not the center of level-k cells. These points are stored // exactly, using 3 double precision values, after the above encoded string, diff --git a/backend/vendor/github.com/golang/geo/s2/polygon.go b/backend/vendor/github.com/golang/geo/s2/polygon.go index c691ec08..31fe285e 100644 --- a/backend/vendor/github.com/golang/geo/s2/polygon.go +++ b/backend/vendor/github.com/golang/geo/s2/polygon.go @@ -38,16 +38,16 @@ import ( // // Polygons have the following restrictions: // -// - Loops may not cross, i.e. the boundary of a loop may not intersect -// both the interior and exterior of any other loop. +// - Loops may not cross, i.e. the boundary of a loop may not intersect +// both the interior and exterior of any other loop. // -// - Loops may not share edges, i.e. if a loop contains an edge AB, then -// no other loop may contain AB or BA. +// - Loops may not share edges, i.e. if a loop contains an edge AB, then +// no other loop may contain AB or BA. // -// - Loops may share vertices, however no vertex may appear twice in a -// single loop (see Loop). +// - Loops may share vertices, however no vertex may appear twice in a +// single loop (see Loop). // -// - No loop may be empty. The full loop may appear only in the full polygon. +// - No loop may be empty. The full loop may appear only in the full polygon. type Polygon struct { loops []*Loop diff --git a/backend/vendor/github.com/golang/geo/s2/polyline.go b/backend/vendor/github.com/golang/geo/s2/polyline.go index 51796834..90eb7195 100644 --- a/backend/vendor/github.com/golang/geo/s2/polyline.go +++ b/backend/vendor/github.com/golang/geo/s2/polyline.go @@ -318,19 +318,19 @@ func findEndVertex(p Polyline, tolerance s1.Angle, index int) int { // // Some useful properties of the algorithm: // -// - It runs in linear time. +// - It runs in linear time. // -// - The output always represents a valid polyline. In particular, adjacent -// output vertices are never identical or antipodal. +// - The output always represents a valid polyline. In particular, adjacent +// output vertices are never identical or antipodal. // -// - The method is not optimal, but it tends to produce 2-3% fewer -// vertices than the Douglas-Peucker algorithm with the same tolerance. +// - The method is not optimal, but it tends to produce 2-3% fewer +// vertices than the Douglas-Peucker algorithm with the same tolerance. // -// - The output is parametrically equivalent to the original polyline to -// within the given tolerance. For example, if a polyline backtracks on -// itself and then proceeds onwards, the backtracking will be preserved -// (to within the given tolerance). This is different than the -// Douglas-Peucker algorithm which only guarantees geometric equivalence. +// - The output is parametrically equivalent to the original polyline to +// within the given tolerance. For example, if a polyline backtracks on +// itself and then proceeds onwards, the backtracking will be preserved +// (to within the given tolerance). This is different than the +// Douglas-Peucker algorithm which only guarantees geometric equivalence. func (p *Polyline) SubsampleVertices(tolerance s1.Angle) []int { var result []int diff --git a/backend/vendor/github.com/golang/geo/s2/predicates.go b/backend/vendor/github.com/golang/geo/s2/predicates.go index 9fc5e175..37f48934 100644 --- a/backend/vendor/github.com/golang/geo/s2/predicates.go +++ b/backend/vendor/github.com/golang/geo/s2/predicates.go @@ -120,15 +120,15 @@ func Sign(a, b, c Point) bool { // // RobustSign satisfies the following conditions: // -// (1) RobustSign(a,b,c) == Indeterminate if and only if a == b, b == c, or c == a -// (2) RobustSign(b,c,a) == RobustSign(a,b,c) for all a,b,c -// (3) RobustSign(c,b,a) == -RobustSign(a,b,c) for all a,b,c +// (1) RobustSign(a,b,c) == Indeterminate if and only if a == b, b == c, or c == a +// (2) RobustSign(b,c,a) == RobustSign(a,b,c) for all a,b,c +// (3) RobustSign(c,b,a) == -RobustSign(a,b,c) for all a,b,c // // In other words: // -// (1) The result is Indeterminate if and only if two points are the same. -// (2) Rotating the order of the arguments does not affect the result. -// (3) Exchanging any two arguments inverts the result. +// (1) The result is Indeterminate if and only if two points are the same. +// (2) Rotating the order of the arguments does not affect the result. +// (3) Exchanging any two arguments inverts the result. // // On the other hand, note that it is not true in general that // RobustSign(-a,b,c) == -RobustSign(a,b,c), or any similar identities @@ -298,9 +298,9 @@ func exactSign(a, b, c Point, perturb bool) Direction { // And the points must be distinct, with A < B < C in lexicographic order. // // Reference: -// "Simulation of Simplicity" (Edelsbrunner and Muecke, ACM Transactions on -// Graphics, 1990). // +// "Simulation of Simplicity" (Edelsbrunner and Muecke, ACM Transactions on +// Graphics, 1990). func symbolicallyPerturbedSign(a, b, c, bCrossC r3.PreciseVector) Direction { // This method requires that the points are sorted in lexicographically // increasing order. This is because every possible Point has its own diff --git a/backend/vendor/github.com/golang/geo/s2/rect.go b/backend/vendor/github.com/golang/geo/s2/rect.go index f6b52a59..434366c6 100644 --- a/backend/vendor/github.com/golang/geo/s2/rect.go +++ b/backend/vendor/github.com/golang/geo/s2/rect.go @@ -56,9 +56,10 @@ func RectFromLatLng(p LatLng) Rect { // 360 degrees or more. // // Examples of clamping (in degrees): -// center=(80,170), size=(40,60) -> lat=[60,90], lng=[140,-160] -// center=(10,40), size=(210,400) -> lat=[-90,90], lng=[-180,180] -// center=(-90,180), size=(20,50) -> lat=[-90,-80], lng=[155,-155] +// +// center=(80,170), size=(40,60) -> lat=[60,90], lng=[140,-160] +// center=(10,40), size=(210,400) -> lat=[-90,90], lng=[-180,180] +// center=(-90,180), size=(20,50) -> lat=[-90,-80], lng=[155,-155] func RectFromCenterSize(center, size LatLng) Rect { half := LatLng{size.Lat / 2, size.Lng / 2} return RectFromLatLng(center).expanded(half) @@ -484,7 +485,8 @@ func (r Rect) DistanceToLatLng(ll LatLng) s1.Angle { // DirectedHausdorffDistance returns the directed Hausdorff distance (measured along the // surface of the sphere) to the given Rect. The directed Hausdorff // distance from rectangle A to rectangle B is given by -// h(A, B) = max_{p in A} min_{q in B} d(p, q). +// +// h(A, B) = max_{p in A} min_{q in B} d(p, q). func (r Rect) DirectedHausdorffDistance(other Rect) s1.Angle { if r.IsEmpty() { return 0 * s1.Radian @@ -500,7 +502,8 @@ func (r Rect) DirectedHausdorffDistance(other Rect) s1.Angle { // HausdorffDistance returns the undirected Hausdorff distance (measured along the // surface of the sphere) to the given Rect. // The Hausdorff distance between rectangle A and rectangle B is given by -// H(A, B) = max{h(A, B), h(B, A)}. +// +// H(A, B) = max{h(A, B), h(B, A)}. func (r Rect) HausdorffDistance(other Rect) s1.Angle { return maxAngle(r.DirectedHausdorffDistance(other), other.DirectedHausdorffDistance(r)) diff --git a/backend/vendor/github.com/golang/geo/s2/rect_bounder.go b/backend/vendor/github.com/golang/geo/s2/rect_bounder.go index 419dea0c..a4a68349 100644 --- a/backend/vendor/github.com/golang/geo/s2/rect_bounder.go +++ b/backend/vendor/github.com/golang/geo/s2/rect_bounder.go @@ -216,8 +216,7 @@ func (r *RectBounder) RectBound() Rect { // More precisely, if L is a loop that does not contain either pole, and S // is a loop such that L.Contains(S), then // -// ExpandForSubregions(L.RectBound).Contains(S.RectBound). -// +// ExpandForSubregions(L.RectBound).Contains(S.RectBound). func ExpandForSubregions(bound Rect) Rect { // Empty bounds don't need expansion. if bound.IsEmpty() { diff --git a/backend/vendor/github.com/golang/geo/s2/regioncoverer.go b/backend/vendor/github.com/golang/geo/s2/regioncoverer.go index de5b0c20..89904028 100644 --- a/backend/vendor/github.com/golang/geo/s2/regioncoverer.go +++ b/backend/vendor/github.com/golang/geo/s2/regioncoverer.go @@ -38,21 +38,21 @@ import ( // // Note the following: // -// - MinLevel takes priority over MaxCells, i.e. cells below the given level will -// never be used even if this causes a large number of cells to be returned. +// - MinLevel takes priority over MaxCells, i.e. cells below the given level will +// never be used even if this causes a large number of cells to be returned. // -// - For any setting of MaxCells, up to 6 cells may be returned if that -// is the minimum number of cells required (e.g. if the region intersects -// all six face cells). Up to 3 cells may be returned even for very tiny -// convex regions if they happen to be located at the intersection of -// three cube faces. +// - For any setting of MaxCells, up to 6 cells may be returned if that +// is the minimum number of cells required (e.g. if the region intersects +// all six face cells). Up to 3 cells may be returned even for very tiny +// convex regions if they happen to be located at the intersection of +// three cube faces. // -// - For any setting of MaxCells, an arbitrary number of cells may be -// returned if MinLevel is too high for the region being approximated. +// - For any setting of MaxCells, an arbitrary number of cells may be +// returned if MinLevel is too high for the region being approximated. // -// - If MaxCells is less than 4, the area of the covering may be -// arbitrarily large compared to the area of the original region even if -// the region is convex (e.g. a Cap or Rect). +// - If MaxCells is less than 4, the area of the covering may be +// arbitrarily large compared to the area of the original region even if +// the region is convex (e.g. a Cap or Rect). // // The approximation algorithm is not optimal but does a pretty good job in // practice. The output does not always use the maximum number of cells @@ -404,17 +404,17 @@ func (rc *RegionCoverer) FastCovering(region Region) CellUnion { // IsCanonical reports whether the given CellUnion represents a valid covering // that conforms to the current covering parameters. In particular: // -// - All CellIDs must be valid. +// - All CellIDs must be valid. // -// - CellIDs must be sorted and non-overlapping. +// - CellIDs must be sorted and non-overlapping. // -// - CellID levels must satisfy MinLevel, MaxLevel, and LevelMod. +// - CellID levels must satisfy MinLevel, MaxLevel, and LevelMod. // -// - If the covering has more than MaxCells, there must be no two cells with -// a common ancestor at MinLevel or higher. +// - If the covering has more than MaxCells, there must be no two cells with +// a common ancestor at MinLevel or higher. // -// - There must be no sequence of cells that could be replaced by an -// ancestor (i.e. with LevelMod == 1, the 4 child cells of a parent). +// - There must be no sequence of cells that could be replaced by an +// ancestor (i.e. with LevelMod == 1, the 4 child cells of a parent). func (rc *RegionCoverer) IsCanonical(covering CellUnion) bool { return rc.newCoverer().isCanonical(covering) } diff --git a/backend/vendor/github.com/golang/geo/s2/shape.go b/backend/vendor/github.com/golang/geo/s2/shape.go index 2cbf170c..1830719a 100644 --- a/backend/vendor/github.com/golang/geo/s2/shape.go +++ b/backend/vendor/github.com/golang/geo/s2/shape.go @@ -26,9 +26,9 @@ type Edge struct { // Cmp compares the two edges using the underlying Points Cmp method and returns // -// -1 if e < other -// 0 if e == other -// +1 if e > other +// -1 if e < other +// 0 if e == other +// +1 if e > other // // The two edges are compared by first vertex, and then by the second vertex. func (e Edge) Cmp(other Edge) int { @@ -59,9 +59,9 @@ type ShapeEdgeID struct { // Cmp compares the two ShapeEdgeIDs and returns // -// -1 if s < other -// 0 if s == other -// +1 if s > other +// -1 if s < other +// 0 if s == other +// +1 if s > other // // The two are compared first by shape id and then by edge id. func (s ShapeEdgeID) Cmp(other ShapeEdgeID) int { diff --git a/backend/vendor/github.com/golang/geo/s2/shapeindex.go b/backend/vendor/github.com/golang/geo/s2/shapeindex.go index 6efa213a..e4a01c9a 100644 --- a/backend/vendor/github.com/golang/geo/s2/shapeindex.go +++ b/backend/vendor/github.com/golang/geo/s2/shapeindex.go @@ -197,10 +197,9 @@ const ( // ShapeIndexIterator is an iterator that provides low-level access to // the cells of the index. Cells are returned in increasing order of CellID. // -// for it := index.Iterator(); !it.Done(); it.Next() { -// fmt.Print(it.CellID()) -// } -// +// for it := index.Iterator(); !it.Done(); it.Next() { +// fmt.Print(it.CellID()) +// } type ShapeIndexIterator struct { index *ShapeIndex position int @@ -571,12 +570,11 @@ const ( // // Example showing how to build an index of Polylines: // -// index := NewShapeIndex() -// for _, polyline := range polylines { -// index.Add(polyline); -// } -// // Now you can use a CrossingEdgeQuery or ClosestEdgeQuery here. -// +// index := NewShapeIndex() +// for _, polyline := range polylines { +// index.Add(polyline); +// } +// // Now you can use a CrossingEdgeQuery or ClosestEdgeQuery here. type ShapeIndex struct { // shapes is a map of shape ID to shape. shapes map[int32]Shape diff --git a/backend/vendor/github.com/golang/snappy/decode_asm.go b/backend/vendor/github.com/golang/snappy/decode_asm.go index 7082b349..27f5997a 100644 --- a/backend/vendor/github.com/golang/snappy/decode_asm.go +++ b/backend/vendor/github.com/golang/snappy/decode_asm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !appengine && gc && !noasm && (amd64 || arm64) // +build !appengine // +build gc // +build !noasm diff --git a/backend/vendor/github.com/golang/snappy/decode_other.go b/backend/vendor/github.com/golang/snappy/decode_other.go index 2f672be5..27df7bfe 100644 --- a/backend/vendor/github.com/golang/snappy/decode_other.go +++ b/backend/vendor/github.com/golang/snappy/decode_other.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (!amd64 && !arm64) || appengine || !gc || noasm // +build !amd64,!arm64 appengine !gc noasm package snappy diff --git a/backend/vendor/github.com/golang/snappy/encode_asm.go b/backend/vendor/github.com/golang/snappy/encode_asm.go index 107c1e71..0bef69b7 100644 --- a/backend/vendor/github.com/golang/snappy/encode_asm.go +++ b/backend/vendor/github.com/golang/snappy/encode_asm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !appengine && gc && !noasm && (amd64 || arm64) // +build !appengine // +build gc // +build !noasm diff --git a/backend/vendor/github.com/golang/snappy/encode_other.go b/backend/vendor/github.com/golang/snappy/encode_other.go index 296d7f0b..d7c9305c 100644 --- a/backend/vendor/github.com/golang/snappy/encode_other.go +++ b/backend/vendor/github.com/golang/snappy/encode_other.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (!amd64 && !arm64) || appengine || !gc || noasm // +build !amd64,!arm64 appengine !gc noasm package snappy @@ -20,6 +21,7 @@ func load64(b []byte, i int) uint64 { // emitLiteral writes a literal chunk and returns the number of bytes written. // // It assumes that: +// // dst is long enough to hold the encoded bytes // 1 <= len(lit) && len(lit) <= 65536 func emitLiteral(dst, lit []byte) int { @@ -44,6 +46,7 @@ func emitLiteral(dst, lit []byte) int { // emitCopy writes a copy chunk and returns the number of bytes written. // // It assumes that: +// // dst is long enough to hold the encoded bytes // 1 <= offset && offset <= 65535 // 4 <= length && length <= 65535 @@ -91,6 +94,7 @@ func emitCopy(dst []byte, offset, length int) int { // src[i:i+k-j] and src[j:k] have the same contents. // // It assumes that: +// // 0 <= i && i < j && j <= len(src) func extendMatch(src []byte, i, j int) int { for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 { @@ -107,8 +111,9 @@ func hash(u, shift uint32) uint32 { // been written. // // It also assumes that: +// // len(dst) >= MaxEncodedLen(len(src)) && -// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize +// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize func encodeBlock(dst, src []byte) (d int) { // Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive. // The table element type is uint16, as s < sLimit and sLimit < len(src) diff --git a/backend/vendor/github.com/gorilla/mux/doc.go b/backend/vendor/github.com/gorilla/mux/doc.go index bd5a38b5..80601351 100644 --- a/backend/vendor/github.com/gorilla/mux/doc.go +++ b/backend/vendor/github.com/gorilla/mux/doc.go @@ -10,18 +10,18 @@ http.ServeMux, mux.Router matches incoming requests against a list of registered routes and calls a handler for the route that matches the URL or other conditions. The main features are: - * Requests can be matched based on URL host, path, path prefix, schemes, - header and query values, HTTP methods or using custom matchers. - * URL hosts, paths and query values can have variables with an optional - regular expression. - * Registered URLs can be built, or "reversed", which helps maintaining - references to resources. - * Routes can be used as subrouters: nested routes are only tested if the - parent route matches. This is useful to define groups of routes that - share common conditions like a host, a path prefix or other repeated - attributes. As a bonus, this optimizes request matching. - * It implements the http.Handler interface so it is compatible with the - standard http.ServeMux. + - Requests can be matched based on URL host, path, path prefix, schemes, + header and query values, HTTP methods or using custom matchers. + - URL hosts, paths and query values can have variables with an optional + regular expression. + - Registered URLs can be built, or "reversed", which helps maintaining + references to resources. + - Routes can be used as subrouters: nested routes are only tested if the + parent route matches. This is useful to define groups of routes that + share common conditions like a host, a path prefix or other repeated + attributes. As a bonus, this optimizes request matching. + - It implements the http.Handler interface so it is compatible with the + standard http.ServeMux. Let's start registering a couple of URL paths and handlers: @@ -301,6 +301,5 @@ A more complex authentication middleware, which maps session token to users, cou r.Use(amw.Middleware) Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. - */ package mux diff --git a/backend/vendor/github.com/gorilla/mux/mux.go b/backend/vendor/github.com/gorilla/mux/mux.go index 782a34b2..c94209a8 100644 --- a/backend/vendor/github.com/gorilla/mux/mux.go +++ b/backend/vendor/github.com/gorilla/mux/mux.go @@ -31,17 +31,17 @@ func NewRouter() *Router { // It implements the http.Handler interface, so it can be registered to serve // requests: // -// var router = mux.NewRouter() +// var router = mux.NewRouter() // -// func main() { -// http.Handle("/", router) -// } +// func main() { +// http.Handle("/", router) +// } // // Or, for Google App Engine, register it in a init() function: // -// func init() { -// http.Handle("/", router) -// } +// func init() { +// http.Handle("/", router) +// } // // This will send all incoming requests to the router. type Router struct { diff --git a/backend/vendor/github.com/gorilla/mux/route.go b/backend/vendor/github.com/gorilla/mux/route.go index 750afe57..dbf59080 100644 --- a/backend/vendor/github.com/gorilla/mux/route.go +++ b/backend/vendor/github.com/gorilla/mux/route.go @@ -230,9 +230,9 @@ func (m headerMatcher) Match(r *http.Request, match *RouteMatch) bool { // Headers adds a matcher for request header values. // It accepts a sequence of key/value pairs to be matched. For example: // -// r := mux.NewRouter() -// r.Headers("Content-Type", "application/json", -// "X-Requested-With", "XMLHttpRequest") +// r := mux.NewRouter() +// r.Headers("Content-Type", "application/json", +// "X-Requested-With", "XMLHttpRequest") // // The above route will only match if both request header values match. // If the value is an empty string, it will match any value if the key is set. @@ -255,9 +255,9 @@ func (m headerRegexMatcher) Match(r *http.Request, match *RouteMatch) bool { // HeadersRegexp accepts a sequence of key/value pairs, where the value has regex // support. For example: // -// r := mux.NewRouter() -// r.HeadersRegexp("Content-Type", "application/(text|json)", -// "X-Requested-With", "XMLHttpRequest") +// r := mux.NewRouter() +// r.HeadersRegexp("Content-Type", "application/(text|json)", +// "X-Requested-With", "XMLHttpRequest") // // The above route will only match if both the request header matches both regular expressions. // If the value is an empty string, it will match any value if the key is set. @@ -283,10 +283,10 @@ func (r *Route) HeadersRegexp(pairs ...string) *Route { // // For example: // -// r := mux.NewRouter() -// r.Host("www.example.com") -// r.Host("{subdomain}.domain.com") -// r.Host("{subdomain:[a-z]+}.domain.com") +// r := mux.NewRouter() +// r.Host("www.example.com") +// r.Host("{subdomain}.domain.com") +// r.Host("{subdomain:[a-z]+}.domain.com") // // Variable names must be unique in a given route. They can be retrieved // calling mux.Vars(request). @@ -342,11 +342,11 @@ func (r *Route) Methods(methods ...string) *Route { // // For example: // -// r := mux.NewRouter() -// r.Path("/products/").Handler(ProductsHandler) -// r.Path("/products/{key}").Handler(ProductsHandler) -// r.Path("/articles/{category}/{id:[0-9]+}"). -// Handler(ArticleHandler) +// r := mux.NewRouter() +// r.Path("/products/").Handler(ProductsHandler) +// r.Path("/products/{key}").Handler(ProductsHandler) +// r.Path("/articles/{category}/{id:[0-9]+}"). +// Handler(ArticleHandler) // // Variable names must be unique in a given route. They can be retrieved // calling mux.Vars(request). @@ -377,8 +377,8 @@ func (r *Route) PathPrefix(tpl string) *Route { // It accepts a sequence of key/value pairs. Values may define variables. // For example: // -// r := mux.NewRouter() -// r.Queries("foo", "bar", "id", "{id:[0-9]+}") +// r := mux.NewRouter() +// r.Queries("foo", "bar", "id", "{id:[0-9]+}") // // The above route will only match if the URL contains the defined queries // values, e.g.: ?foo=bar&id=42. @@ -473,11 +473,11 @@ func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route { // // It will test the inner routes only if the parent route matched. For example: // -// r := mux.NewRouter() -// s := r.Host("www.example.com").Subrouter() -// s.HandleFunc("/products/", ProductsHandler) -// s.HandleFunc("/products/{key}", ProductHandler) -// s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler) +// r := mux.NewRouter() +// s := r.Host("www.example.com").Subrouter() +// s.HandleFunc("/products/", ProductsHandler) +// s.HandleFunc("/products/{key}", ProductHandler) +// s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler) // // Here, the routes registered in the subrouter won't be tested if the host // doesn't match. @@ -497,36 +497,36 @@ func (r *Route) Subrouter() *Router { // It accepts a sequence of key/value pairs for the route variables. For // example, given this route: // -// r := mux.NewRouter() -// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). -// Name("article") +// r := mux.NewRouter() +// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). +// Name("article") // // ...a URL for it can be built using: // -// url, err := r.Get("article").URL("category", "technology", "id", "42") +// url, err := r.Get("article").URL("category", "technology", "id", "42") // // ...which will return an url.URL with the following path: // -// "/articles/technology/42" +// "/articles/technology/42" // // This also works for host variables: // -// r := mux.NewRouter() -// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). -// Host("{subdomain}.domain.com"). -// Name("article") +// r := mux.NewRouter() +// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). +// Host("{subdomain}.domain.com"). +// Name("article") // -// // url.String() will be "http://news.domain.com/articles/technology/42" -// url, err := r.Get("article").URL("subdomain", "news", -// "category", "technology", -// "id", "42") +// // url.String() will be "http://news.domain.com/articles/technology/42" +// url, err := r.Get("article").URL("subdomain", "news", +// "category", "technology", +// "id", "42") // // The scheme of the resulting url will be the first argument that was passed to Schemes: // -// // url.String() will be "https://example.com" -// r := mux.NewRouter() -// url, err := r.Host("example.com") -// .Schemes("https", "http").URL() +// // url.String() will be "https://example.com" +// r := mux.NewRouter() +// url, err := r.Host("example.com") +// .Schemes("https", "http").URL() // // All variables defined in the route are required, and their values must // conform to the corresponding patterns. diff --git a/backend/vendor/github.com/gorilla/websocket/doc.go b/backend/vendor/github.com/gorilla/websocket/doc.go index 8db0cef9..677a8272 100644 --- a/backend/vendor/github.com/gorilla/websocket/doc.go +++ b/backend/vendor/github.com/gorilla/websocket/doc.go @@ -4,40 +4,40 @@ // Package websocket implements the WebSocket protocol defined in RFC 6455. // -// Overview +// # Overview // // The Conn type represents a WebSocket connection. A server application calls // the Upgrader.Upgrade method from an HTTP request handler to get a *Conn: // -// var upgrader = websocket.Upgrader{ -// ReadBufferSize: 1024, -// WriteBufferSize: 1024, -// } +// var upgrader = websocket.Upgrader{ +// ReadBufferSize: 1024, +// WriteBufferSize: 1024, +// } // -// func handler(w http.ResponseWriter, r *http.Request) { -// conn, err := upgrader.Upgrade(w, r, nil) -// if err != nil { -// log.Println(err) -// return -// } -// ... Use conn to send and receive messages. -// } +// func handler(w http.ResponseWriter, r *http.Request) { +// conn, err := upgrader.Upgrade(w, r, nil) +// if err != nil { +// log.Println(err) +// return +// } +// ... Use conn to send and receive messages. +// } // // Call the connection's WriteMessage and ReadMessage methods to send and // receive messages as a slice of bytes. This snippet of code shows how to echo // messages using these methods: // -// for { -// messageType, p, err := conn.ReadMessage() -// if err != nil { -// log.Println(err) -// return -// } -// if err := conn.WriteMessage(messageType, p); err != nil { -// log.Println(err) -// return -// } -// } +// for { +// messageType, p, err := conn.ReadMessage() +// if err != nil { +// log.Println(err) +// return +// } +// if err := conn.WriteMessage(messageType, p); err != nil { +// log.Println(err) +// return +// } +// } // // In above snippet of code, p is a []byte and messageType is an int with value // websocket.BinaryMessage or websocket.TextMessage. @@ -49,24 +49,24 @@ // method to get an io.Reader and read until io.EOF is returned. This snippet // shows how to echo messages using the NextWriter and NextReader methods: // -// for { -// messageType, r, err := conn.NextReader() -// if err != nil { -// return -// } -// w, err := conn.NextWriter(messageType) -// if err != nil { -// return err -// } -// if _, err := io.Copy(w, r); err != nil { -// return err -// } -// if err := w.Close(); err != nil { -// return err -// } -// } +// for { +// messageType, r, err := conn.NextReader() +// if err != nil { +// return +// } +// w, err := conn.NextWriter(messageType) +// if err != nil { +// return err +// } +// if _, err := io.Copy(w, r); err != nil { +// return err +// } +// if err := w.Close(); err != nil { +// return err +// } +// } // -// Data Messages +// # Data Messages // // The WebSocket protocol distinguishes between text and binary data messages. // Text messages are interpreted as UTF-8 encoded text. The interpretation of @@ -80,7 +80,7 @@ // It is the application's responsibility to ensure that text messages are // valid UTF-8 encoded text. // -// Control Messages +// # Control Messages // // The WebSocket protocol defines three types of control messages: close, ping // and pong. Call the connection WriteControl, WriteMessage or NextWriter @@ -110,16 +110,16 @@ // in messages from the peer, then the application should start a goroutine to // read and discard messages from the peer. A simple example is: // -// func readLoop(c *websocket.Conn) { -// for { -// if _, _, err := c.NextReader(); err != nil { -// c.Close() -// break -// } -// } -// } +// func readLoop(c *websocket.Conn) { +// for { +// if _, _, err := c.NextReader(); err != nil { +// c.Close() +// break +// } +// } +// } // -// Concurrency +// # Concurrency // // Connections support one concurrent reader and one concurrent writer. // @@ -133,7 +133,7 @@ // The Close and WriteControl methods can be called concurrently with all other // methods. // -// Origin Considerations +// # Origin Considerations // // Web browsers allow Javascript applications to open a WebSocket connection to // any host. It's up to the server to enforce an origin policy using the Origin @@ -151,7 +151,7 @@ // checking. The application is responsible for checking the Origin header // before calling the Upgrade function. // -// Buffers +// # Buffers // // Connections buffer network input and output to reduce the number // of system calls when reading or writing messages. @@ -198,16 +198,16 @@ // buffer size has a reduced impact on total memory use and has the benefit of // reducing system calls and frame overhead. // -// Compression EXPERIMENTAL +// # Compression EXPERIMENTAL // // Per message compression extensions (RFC 7692) are experimentally supported // by this package in a limited capacity. Setting the EnableCompression option // to true in Dialer or Upgrader will attempt to negotiate per message deflate // support. // -// var upgrader = websocket.Upgrader{ -// EnableCompression: true, -// } +// var upgrader = websocket.Upgrader{ +// EnableCompression: true, +// } // // If compression was successfully negotiated with the connection's peer, any // message received in compressed form will be automatically decompressed. @@ -216,7 +216,7 @@ // Per message compression of messages written to a connection can be enabled // or disabled by calling the corresponding Conn method: // -// conn.EnableWriteCompression(false) +// conn.EnableWriteCompression(false) // // Currently this package does not support compression with "context takeover". // This means that messages must be compressed and decompressed in isolation, diff --git a/backend/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go b/backend/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go index 7c038d12..f207bf92 100644 --- a/backend/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go +++ b/backend/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go @@ -721,10 +721,9 @@ func (p *printer) heredocIndent(buf []byte) []byte { // // A single line object: // -// * has no lead comments (hence multi-line) -// * has no assignment -// * has no values in the stanza (within {}) -// +// - has no lead comments (hence multi-line) +// - has no assignment +// - has no values in the stanza (within {}) func (p *printer) isSingleLineObject(val *ast.ObjectItem) bool { // If there is a lead comment, can't be one line if val.LeadComment != nil { diff --git a/backend/vendor/github.com/klauspost/compress/flate/dict_decoder.go b/backend/vendor/github.com/klauspost/compress/flate/dict_decoder.go index 71c75a06..bb36351a 100644 --- a/backend/vendor/github.com/klauspost/compress/flate/dict_decoder.go +++ b/backend/vendor/github.com/klauspost/compress/flate/dict_decoder.go @@ -7,19 +7,19 @@ package flate // dictDecoder implements the LZ77 sliding dictionary as used in decompression. // LZ77 decompresses data through sequences of two forms of commands: // -// * Literal insertions: Runs of one or more symbols are inserted into the data -// stream as is. This is accomplished through the writeByte method for a -// single symbol, or combinations of writeSlice/writeMark for multiple symbols. -// Any valid stream must start with a literal insertion if no preset dictionary -// is used. +// - Literal insertions: Runs of one or more symbols are inserted into the data +// stream as is. This is accomplished through the writeByte method for a +// single symbol, or combinations of writeSlice/writeMark for multiple symbols. +// Any valid stream must start with a literal insertion if no preset dictionary +// is used. // -// * Backward copies: Runs of one or more symbols are copied from previously -// emitted data. Backward copies come as the tuple (dist, length) where dist -// determines how far back in the stream to copy from and length determines how -// many bytes to copy. Note that it is valid for the length to be greater than -// the distance. Since LZ77 uses forward copies, that situation is used to -// perform a form of run-length encoding on repeated runs of symbols. -// The writeCopy and tryWriteCopy are used to implement this command. +// - Backward copies: Runs of one or more symbols are copied from previously +// emitted data. Backward copies come as the tuple (dist, length) where dist +// determines how far back in the stream to copy from and length determines how +// many bytes to copy. Note that it is valid for the length to be greater than +// the distance. Since LZ77 uses forward copies, that situation is used to +// perform a form of run-length encoding on repeated runs of symbols. +// The writeCopy and tryWriteCopy are used to implement this command. // // For performance reasons, this implementation performs little to no sanity // checks about the arguments. As such, the invariants documented for each diff --git a/backend/vendor/github.com/klauspost/compress/flate/gen_inflate.go b/backend/vendor/github.com/klauspost/compress/flate/gen_inflate.go index 35fc072a..513d348f 100644 --- a/backend/vendor/github.com/klauspost/compress/flate/gen_inflate.go +++ b/backend/vendor/github.com/klauspost/compress/flate/gen_inflate.go @@ -1,3 +1,4 @@ +//go:build generate // +build generate //go:generate go run $GOFILE && gofmt -w inflate_gen.go diff --git a/backend/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go b/backend/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go index 208d6671..5f7a06f0 100644 --- a/backend/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go +++ b/backend/vendor/github.com/klauspost/compress/flate/huffman_bit_writer.go @@ -244,9 +244,9 @@ func (w *huffmanBitWriter) writeBytes(bytes []byte) { // Codes 0-15 are single byte codes. Codes 16-18 are followed by additional // information. Code badCode is an end marker // -// numLiterals The number of literals in literalEncoding -// numOffsets The number of offsets in offsetEncoding -// litenc, offenc The literal and offset encoder to use +// numLiterals The number of literals in literalEncoding +// numOffsets The number of offsets in offsetEncoding +// litenc, offenc The literal and offset encoder to use func (w *huffmanBitWriter) generateCodegen(numLiterals int, numOffsets int, litEnc, offEnc *huffmanEncoder) { for i := range w.codegenFreq { w.codegenFreq[i] = 0 @@ -440,9 +440,9 @@ func (w *huffmanBitWriter) writeOutBits() { // Write the header of a dynamic Huffman block to the output stream. // -// numLiterals The number of literals specified in codegen -// numOffsets The number of offsets specified in codegen -// numCodegens The number of codegens used in codegen +// numLiterals The number of literals specified in codegen +// numOffsets The number of offsets specified in codegen +// numCodegens The number of codegens used in codegen func (w *huffmanBitWriter) writeDynamicHeader(numLiterals int, numOffsets int, numCodegens int, isEof bool) { if w.err != nil { return diff --git a/backend/vendor/github.com/klauspost/compress/flate/huffman_code.go b/backend/vendor/github.com/klauspost/compress/flate/huffman_code.go index 4c39a301..f55a2c8c 100644 --- a/backend/vendor/github.com/klauspost/compress/flate/huffman_code.go +++ b/backend/vendor/github.com/klauspost/compress/flate/huffman_code.go @@ -128,13 +128,18 @@ func (h *huffmanEncoder) bitLength(freq []uint16) int { // The cases of 0, 1, and 2 literals are handled by special case code. // // list An array of the literals with non-zero frequencies -// and their associated frequencies. The array is in order of increasing -// frequency, and has as its last element a special element with frequency -// MaxInt32 +// +// and their associated frequencies. The array is in order of increasing +// frequency, and has as its last element a special element with frequency +// MaxInt32 +// // maxBits The maximum number of bits that should be used to encode any literal. -// Must be less than 16. +// +// Must be less than 16. +// // return An integer array in which array[i] indicates the number of literals -// that should be encoded in i bits. +// +// that should be encoded in i bits. func (h *huffmanEncoder) bitCounts(list []literalNode, maxBits int32) []int32 { if maxBits >= maxBitsLimit { panic("flate: maxBits too large") diff --git a/backend/vendor/github.com/klauspost/compress/flate/regmask_other.go b/backend/vendor/github.com/klauspost/compress/flate/regmask_other.go index f477a5d6..1b7a2cbd 100644 --- a/backend/vendor/github.com/klauspost/compress/flate/regmask_other.go +++ b/backend/vendor/github.com/klauspost/compress/flate/regmask_other.go @@ -1,4 +1,5 @@ -//+build !amd64 +//go:build !amd64 +// +build !amd64 package flate diff --git a/backend/vendor/github.com/klauspost/compress/snappy/decode_amd64.go b/backend/vendor/github.com/klauspost/compress/snappy/decode_amd64.go index fcd192b8..69557228 100644 --- a/backend/vendor/github.com/klauspost/compress/snappy/decode_amd64.go +++ b/backend/vendor/github.com/klauspost/compress/snappy/decode_amd64.go @@ -2,9 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !appengine -// +build gc -// +build !noasm +//go:build !appengine && gc && !noasm +// +build !appengine,gc,!noasm package snappy diff --git a/backend/vendor/github.com/klauspost/compress/snappy/decode_other.go b/backend/vendor/github.com/klauspost/compress/snappy/decode_other.go index 94a96c5d..c45c75fb 100644 --- a/backend/vendor/github.com/klauspost/compress/snappy/decode_other.go +++ b/backend/vendor/github.com/klauspost/compress/snappy/decode_other.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !amd64 || appengine || !gc || noasm // +build !amd64 appengine !gc noasm package snappy diff --git a/backend/vendor/github.com/klauspost/compress/snappy/encode_amd64.go b/backend/vendor/github.com/klauspost/compress/snappy/encode_amd64.go index 150d91bc..f7bc84a1 100644 --- a/backend/vendor/github.com/klauspost/compress/snappy/encode_amd64.go +++ b/backend/vendor/github.com/klauspost/compress/snappy/encode_amd64.go @@ -2,9 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !appengine -// +build gc -// +build !noasm +//go:build !appengine && gc && !noasm +// +build !appengine,gc,!noasm package snappy diff --git a/backend/vendor/github.com/klauspost/compress/snappy/encode_other.go b/backend/vendor/github.com/klauspost/compress/snappy/encode_other.go index dbcae905..d07a36fd 100644 --- a/backend/vendor/github.com/klauspost/compress/snappy/encode_other.go +++ b/backend/vendor/github.com/klauspost/compress/snappy/encode_other.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !amd64 || appengine || !gc || noasm // +build !amd64 appengine !gc noasm package snappy @@ -20,6 +21,7 @@ func load64(b []byte, i int) uint64 { // emitLiteral writes a literal chunk and returns the number of bytes written. // // It assumes that: +// // dst is long enough to hold the encoded bytes // 1 <= len(lit) && len(lit) <= 65536 func emitLiteral(dst, lit []byte) int { @@ -44,6 +46,7 @@ func emitLiteral(dst, lit []byte) int { // emitCopy writes a copy chunk and returns the number of bytes written. // // It assumes that: +// // dst is long enough to hold the encoded bytes // 1 <= offset && offset <= 65535 // 4 <= length && length <= 65535 @@ -91,6 +94,7 @@ func emitCopy(dst []byte, offset, length int) int { // src[i:i+k-j] and src[j:k] have the same contents. // // It assumes that: +// // 0 <= i && i < j && j <= len(src) func extendMatch(src []byte, i, j int) int { for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 { @@ -107,8 +111,9 @@ func hash(u, shift uint32) uint32 { // been written. // // It also assumes that: +// // len(dst) >= MaxEncodedLen(len(src)) && -// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize +// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize func encodeBlock(dst, src []byte) (d int) { // Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive. // The table element type is uint16, as s < sLimit and sLimit < len(src) diff --git a/backend/vendor/github.com/klauspost/compress/zstd/decoder.go b/backend/vendor/github.com/klauspost/compress/zstd/decoder.go index cdda0de5..13c95054 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/decoder.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/decoder.go @@ -469,10 +469,12 @@ var errEndOfStream = errors.New("end-of-stream") // Create goroutine that handles stream processing, this will send history to decoders as they are available. // Decoders update the history as they decode. // When a block is returned: -// a) history is sent to the next decoder, -// b) content written to CRC. -// c) return data to WRITER. -// d) wait for next block to return data. +// +// a) history is sent to the next decoder, +// b) content written to CRC. +// c) return data to WRITER. +// d) wait for next block to return data. +// // Once WRITTEN, the decoders reused by the writer frame decoder for re-use. func (d *Decoder) startStreamDecoder(inStream chan decodeStream) { defer d.streamWg.Done() diff --git a/backend/vendor/github.com/klauspost/compress/zstd/hash.go b/backend/vendor/github.com/klauspost/compress/zstd/hash.go index 4a752067..6b0f2c7c 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/hash.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/hash.go @@ -18,7 +18,8 @@ const ( // h should always be <32. // Preferably h and l should be a constant. // FIXME: This does NOT get resolved, if 'mls' is constant, -// so this cannot be used. +// +// so this cannot be used. func hashLen(u uint64, hashLog, mls uint8) uint32 { switch mls { case 5: diff --git a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go index 35318d7c..3ddbd5c0 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go @@ -1,6 +1,5 @@ -// +build !appengine -// +build gc -// +build !purego +//go:build !appengine && gc && !purego +// +build !appengine,gc,!purego package xxhash diff --git a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go index 4a5a8216..1f52f296 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go @@ -1,3 +1,4 @@ +//go:build !amd64 || appengine || !gc || purego // +build !amd64 appengine !gc purego package xxhash diff --git a/backend/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/backend/vendor/github.com/mitchellh/mapstructure/mapstructure.go index 1efb22ac..fadccc4a 100644 --- a/backend/vendor/github.com/mitchellh/mapstructure/mapstructure.go +++ b/backend/vendor/github.com/mitchellh/mapstructure/mapstructure.go @@ -9,84 +9,84 @@ // // The simplest function to start with is Decode. // -// Field Tags +// # Field Tags // // When decoding to a struct, mapstructure will use the field name by // default to perform the mapping. For example, if a struct has a field // "Username" then mapstructure will look for a key in the source value // of "username" (case insensitive). // -// type User struct { -// Username string -// } +// type User struct { +// Username string +// } // // You can change the behavior of mapstructure by using struct tags. // The default struct tag that mapstructure looks for is "mapstructure" // but you can customize it using DecoderConfig. // -// Renaming Fields +// # Renaming Fields // // To rename the key that mapstructure looks for, use the "mapstructure" // tag and set a value directly. For example, to change the "username" example // above to "user": // -// type User struct { -// Username string `mapstructure:"user"` -// } +// type User struct { +// Username string `mapstructure:"user"` +// } // -// Embedded Structs and Squashing +// # Embedded Structs and Squashing // // Embedded structs are treated as if they're another field with that name. // By default, the two structs below are equivalent when decoding with // mapstructure: // -// type Person struct { -// Name string -// } +// type Person struct { +// Name string +// } // -// type Friend struct { -// Person -// } +// type Friend struct { +// Person +// } // -// type Friend struct { -// Person Person -// } +// type Friend struct { +// Person Person +// } // // This would require an input that looks like below: // -// map[string]interface{}{ -// "person": map[string]interface{}{"name": "alice"}, -// } +// map[string]interface{}{ +// "person": map[string]interface{}{"name": "alice"}, +// } // // If your "person" value is NOT nested, then you can append ",squash" to // your tag value and mapstructure will treat it as if the embedded struct // were part of the struct directly. Example: // -// type Friend struct { -// Person `mapstructure:",squash"` -// } +// type Friend struct { +// Person `mapstructure:",squash"` +// } // // Now the following input would be accepted: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // When decoding from a struct to a map, the squash tag squashes the struct // fields into a single map. Using the example structs from above: // -// Friend{Person: Person{Name: "alice"}} +// Friend{Person: Person{Name: "alice"}} // // Will be decoded into a map: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // DecoderConfig has a field that changes the behavior of mapstructure // to always squash embedded structs. // -// Remainder Values +// # Remainder Values // // If there are any unmapped keys in the source value, mapstructure by // default will silently ignore them. You can error by setting ErrorUnused @@ -98,20 +98,20 @@ // probably be a "map[string]interface{}" or "map[interface{}]interface{}". // See example below: // -// type Friend struct { -// Name string -// Other map[string]interface{} `mapstructure:",remain"` -// } +// type Friend struct { +// Name string +// Other map[string]interface{} `mapstructure:",remain"` +// } // // Given the input below, Other would be populated with the other // values that weren't used (everything but "name"): // -// map[string]interface{}{ -// "name": "bob", -// "address": "123 Maple St.", -// } +// map[string]interface{}{ +// "name": "bob", +// "address": "123 Maple St.", +// } // -// Omit Empty Values +// # Omit Empty Values // // When decoding from a struct to any other value, you may use the // ",omitempty" suffix on your tag to omit that value if it equates to @@ -122,37 +122,37 @@ // field value is zero and a numeric type, the field is empty, and it won't // be encoded into the destination type. // -// type Source struct { -// Age int `mapstructure:",omitempty"` -// } +// type Source struct { +// Age int `mapstructure:",omitempty"` +// } // -// Unexported fields +// # Unexported fields // // Since unexported (private) struct fields cannot be set outside the package // where they are defined, the decoder will simply skip them. // // For this output type definition: // -// type Exported struct { -// private string // this unexported field will be skipped -// Public string -// } +// type Exported struct { +// private string // this unexported field will be skipped +// Public string +// } // // Using this map as input: // -// map[string]interface{}{ -// "private": "I will be ignored", -// "Public": "I made it through!", -// } +// map[string]interface{}{ +// "private": "I will be ignored", +// "Public": "I made it through!", +// } // // The following struct will be decoded: // -// type Exported struct { -// private: "" // field is left with an empty string (zero value) -// Public: "I made it through!" -// } +// type Exported struct { +// private: "" // field is left with an empty string (zero value) +// Public: "I made it through!" +// } // -// Other Configuration +// # Other Configuration // // mapstructure is highly configurable. See the DecoderConfig struct // for other features and options that are supported. diff --git a/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_asm.go b/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_asm.go index e26f8cd6..b557a06f 100644 --- a/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_asm.go +++ b/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_asm.go @@ -1,3 +1,4 @@ +//go:build (amd64 || arm) && !appengine && gc && !noasm // +build amd64 arm // +build !appengine // +build gc diff --git a/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go b/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go index 52df2f2b..73343e9f 100644 --- a/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go +++ b/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4block/decode_other.go @@ -1,3 +1,4 @@ +//go:build (!amd64 && !arm) || appengine || !gc || noasm // +build !amd64,!arm appengine !gc noasm package lz4block diff --git a/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/frame_gen.go b/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/frame_gen.go index d33a6be9..c7d245f7 100644 --- a/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/frame_gen.go +++ b/backend/vendor/github.com/pierrec/lz4/v4/internal/lz4stream/frame_gen.go @@ -5,17 +5,18 @@ package lz4stream import "github.com/pierrec/lz4/v4/internal/lz4block" // DescriptorFlags is defined as follow: -// field bits -// ----- ---- -// _ 2 -// ContentChecksum 1 -// Size 1 -// BlockChecksum 1 -// BlockIndependence 1 -// Version 2 -// _ 4 -// BlockSizeIndex 3 -// _ 1 +// +// field bits +// ----- ---- +// _ 2 +// ContentChecksum 1 +// Size 1 +// BlockChecksum 1 +// BlockIndependence 1 +// Version 2 +// _ 4 +// BlockSizeIndex 3 +// _ 1 type DescriptorFlags uint16 // Getters. @@ -77,10 +78,11 @@ func (x *DescriptorFlags) BlockSizeIndexSet(v lz4block.BlockSizeIndex) *Descript // Code generated by `gen.exe`. DO NOT EDIT. // DataBlockSize is defined as follow: -// field bits -// ----- ---- -// size 31 -// Uncompressed 1 +// +// field bits +// ----- ---- +// size 31 +// Uncompressed 1 type DataBlockSize uint32 // Getters. diff --git a/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_arm.go b/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_arm.go index 0978b266..6ea9e128 100644 --- a/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_arm.go +++ b/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_arm.go @@ -1,3 +1,4 @@ +//go:build !noasm // +build !noasm package xxh32 diff --git a/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_other.go b/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_other.go index c96b59b8..054195f6 100644 --- a/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_other.go +++ b/backend/vendor/github.com/pierrec/lz4/v4/internal/xxh32/xxh32zero_other.go @@ -1,3 +1,4 @@ +//go:build !arm || noasm // +build !arm noasm package xxh32 diff --git a/backend/vendor/github.com/pierrec/lz4/v4/reader.go b/backend/vendor/github.com/pierrec/lz4/v4/reader.go index 403aaf69..b1bff118 100644 --- a/backend/vendor/github.com/pierrec/lz4/v4/reader.go +++ b/backend/vendor/github.com/pierrec/lz4/v4/reader.go @@ -146,9 +146,9 @@ func (r *Reader) Read(buf []byte) (n int, err error) { } // read uncompresses the next block as follow: -// - if buf has enough room, the block is uncompressed into it directly -// and the lenght of used space is returned -// - else, the uncompress data is stored in r.data and 0 is returned +// - if buf has enough room, the block is uncompressed into it directly +// and the lenght of used space is returned +// - else, the uncompress data is stored in r.data and 0 is returned func (r *Reader) read(buf []byte) (int, error) { block := r.frame.Blocks.Block _, err := block.Read(r.frame, r.src, r.cum) diff --git a/backend/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/backend/vendor/github.com/pmezard/go-difflib/difflib/difflib.go index 003e99fa..2a73737a 100644 --- a/backend/vendor/github.com/pmezard/go-difflib/difflib/difflib.go +++ b/backend/vendor/github.com/pmezard/go-difflib/difflib/difflib.go @@ -199,12 +199,15 @@ func (m *SequenceMatcher) isBJunk(s string) bool { // If IsJunk is not defined: // // Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where -// alo <= i <= i+k <= ahi -// blo <= j <= j+k <= bhi +// +// alo <= i <= i+k <= ahi +// blo <= j <= j+k <= bhi +// // and for all (i',j',k') meeting those conditions, -// k >= k' -// i <= i' -// and if i == i', j <= j' +// +// k >= k' +// i <= i' +// and if i == i', j <= j' // // In other words, of all maximal matching blocks, return one that // starts earliest in a, and of all those maximal matching blocks that diff --git a/backend/vendor/github.com/power-devops/perfstat/config.go b/backend/vendor/github.com/power-devops/perfstat/config.go index de7230d2..a6df39c6 100644 --- a/backend/vendor/github.com/power-devops/perfstat/config.go +++ b/backend/vendor/github.com/power-devops/perfstat/config.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/cpustat.go b/backend/vendor/github.com/power-devops/perfstat/cpustat.go index 902727fb..61937af8 100644 --- a/backend/vendor/github.com/power-devops/perfstat/cpustat.go +++ b/backend/vendor/github.com/power-devops/perfstat/cpustat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/diskstat.go b/backend/vendor/github.com/power-devops/perfstat/diskstat.go index fc70dfaa..06763b4b 100644 --- a/backend/vendor/github.com/power-devops/perfstat/diskstat.go +++ b/backend/vendor/github.com/power-devops/perfstat/diskstat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/doc.go b/backend/vendor/github.com/power-devops/perfstat/doc.go index 85eaf3e7..9730a61c 100644 --- a/backend/vendor/github.com/power-devops/perfstat/doc.go +++ b/backend/vendor/github.com/power-devops/perfstat/doc.go @@ -1,3 +1,4 @@ +//go:build !aix // +build !aix // Copyright 2020 Power-Devops.com. All rights reserved. @@ -36,24 +37,24 @@ func DisableLVMStat() {} // CpuStat() returns array of CPU structures with information about // logical CPUs on the system. // IBM documentation: -// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html -// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_int_cpu.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu.html func CpuStat() ([]CPU, error) { return nil, fmt.Errorf("not implemented") } // CpuTotalStat() returns general information about CPUs on the system. // IBM documentation: -// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html -// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_glob_cpu.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cputot.html func CpuTotalStat() (*CPUTotal, error) { return nil, fmt.Errorf("not implemented") } // CpuUtilStat() calculates CPU utilization. // IBM documentation: -// * https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html -// * https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html +// - https://www.ibm.com/support/knowledgecenter/ssw_aix_72/performancetools/idprftools_perfstat_cpu_util.html +// - https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/p_bostechref/perfstat_cpu_util.html func CpuUtilStat(intvl time.Duration) (*CPUUtil, error) { return nil, fmt.Errorf("not implemented") } diff --git a/backend/vendor/github.com/power-devops/perfstat/fsstat.go b/backend/vendor/github.com/power-devops/perfstat/fsstat.go index 27f4c06c..d3913197 100644 --- a/backend/vendor/github.com/power-devops/perfstat/fsstat.go +++ b/backend/vendor/github.com/power-devops/perfstat/fsstat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/helpers.go b/backend/vendor/github.com/power-devops/perfstat/helpers.go index e8d69976..3e3c1208 100644 --- a/backend/vendor/github.com/power-devops/perfstat/helpers.go +++ b/backend/vendor/github.com/power-devops/perfstat/helpers.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/lparstat.go b/backend/vendor/github.com/power-devops/perfstat/lparstat.go index 0ce35e3c..06f79fd5 100644 --- a/backend/vendor/github.com/power-devops/perfstat/lparstat.go +++ b/backend/vendor/github.com/power-devops/perfstat/lparstat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/lvmstat.go b/backend/vendor/github.com/power-devops/perfstat/lvmstat.go index eb2064c8..2ce99086 100644 --- a/backend/vendor/github.com/power-devops/perfstat/lvmstat.go +++ b/backend/vendor/github.com/power-devops/perfstat/lvmstat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/memstat.go b/backend/vendor/github.com/power-devops/perfstat/memstat.go index d211a73a..52133f0a 100644 --- a/backend/vendor/github.com/power-devops/perfstat/memstat.go +++ b/backend/vendor/github.com/power-devops/perfstat/memstat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/netstat.go b/backend/vendor/github.com/power-devops/perfstat/netstat.go index 4070da21..847d2946 100644 --- a/backend/vendor/github.com/power-devops/perfstat/netstat.go +++ b/backend/vendor/github.com/power-devops/perfstat/netstat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/procstat.go b/backend/vendor/github.com/power-devops/perfstat/procstat.go index ecafebd8..957ec2b3 100644 --- a/backend/vendor/github.com/power-devops/perfstat/procstat.go +++ b/backend/vendor/github.com/power-devops/perfstat/procstat.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/sysconf.go b/backend/vendor/github.com/power-devops/perfstat/sysconf.go index c7454d03..b557da0d 100644 --- a/backend/vendor/github.com/power-devops/perfstat/sysconf.go +++ b/backend/vendor/github.com/power-devops/perfstat/sysconf.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/systemcfg.go b/backend/vendor/github.com/power-devops/perfstat/systemcfg.go index 6287eb46..7f9277bc 100644 --- a/backend/vendor/github.com/power-devops/perfstat/systemcfg.go +++ b/backend/vendor/github.com/power-devops/perfstat/systemcfg.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/power-devops/perfstat/uptime.go b/backend/vendor/github.com/power-devops/perfstat/uptime.go index 2bd3e568..86087874 100644 --- a/backend/vendor/github.com/power-devops/perfstat/uptime.go +++ b/backend/vendor/github.com/power-devops/perfstat/uptime.go @@ -1,3 +1,4 @@ +//go:build aix // +build aix package perfstat diff --git a/backend/vendor/github.com/spf13/pflag/flag.go b/backend/vendor/github.com/spf13/pflag/flag.go index 24a5036e..e368aaf1 100644 --- a/backend/vendor/github.com/spf13/pflag/flag.go +++ b/backend/vendor/github.com/spf13/pflag/flag.go @@ -27,23 +27,32 @@ unaffected. Define flags using flag.String(), Bool(), Int(), etc. This declares an integer flag, -flagname, stored in the pointer ip, with type *int. + var ip = flag.Int("flagname", 1234, "help message for flagname") + If you like, you can bind the flag to a variable using the Var() functions. + var flagvar int func init() { flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") } + Or you can create custom flags that satisfy the Value interface (with pointer receivers) and couple them to flag parsing by + flag.Var(&flagVal, "name", "help message for flagname") + For such flags, the default value is just the initial value of the variable. After all flags are defined, call + flag.Parse() + to parse the command line into the defined flags. Flags may then be used directly. If you're using the flags themselves, they are all pointers; if you bind to variables, they're values. + fmt.Println("ip has value ", *ip) fmt.Println("flagvar has value ", flagvar) @@ -54,22 +63,26 @@ The arguments are indexed from 0 through flag.NArg()-1. The pflag package also defines some new functions that are not in flag, that give one-letter shorthands for flags. You can use these by appending 'P' to the name of any function that defines a flag. + var ip = flag.IntP("flagname", "f", 1234, "help message") var flagvar bool func init() { flag.BoolVarP(&flagvar, "boolname", "b", true, "help message") } flag.VarP(&flagval, "varname", "v", "help message") + Shorthand letters can be used with single dashes on the command line. Boolean shorthand flags can be combined with other shorthand flags. Command line flag syntax: + --flag // boolean flags only --flag=x Unlike the flag package, a single dash before an option means something different than a double dash. Single dashes signify a series of shorthand letters for flags. All but the last shorthand letter must be boolean flags. + // boolean flags -f -abc @@ -927,9 +940,9 @@ func (f *FlagSet) usage() { } } -//--unknown (args will be empty) -//--unknown --next-flag ... (args will be --next-flag ...) -//--unknown arg ... (args will be arg ...) +// --unknown (args will be empty) +// --unknown --next-flag ... (args will be --next-flag ...) +// --unknown arg ... (args will be arg ...) func stripUnknownFlagValue(args []string) []string { if len(args) == 0 { //--unknown diff --git a/backend/vendor/github.com/spf13/pflag/string_slice.go b/backend/vendor/github.com/spf13/pflag/string_slice.go index 3cb2e69d..d421887e 100644 --- a/backend/vendor/github.com/spf13/pflag/string_slice.go +++ b/backend/vendor/github.com/spf13/pflag/string_slice.go @@ -98,9 +98,12 @@ func (f *FlagSet) GetStringSlice(name string) ([]string, error) { // The argument p points to a []string variable in which to store the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) { f.VarP(newStringSliceValue(value, p), name, "", usage) } @@ -114,9 +117,12 @@ func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []s // The argument p points to a []string variable in which to store the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func StringSliceVar(p *[]string, name string, value []string, usage string) { CommandLine.VarP(newStringSliceValue(value, p), name, "", usage) } @@ -130,9 +136,12 @@ func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage // The return value is the address of a []string variable that stores the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string { p := []string{} f.StringSliceVarP(&p, name, "", value, usage) @@ -150,9 +159,12 @@ func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage str // The return value is the address of a []string variable that stores the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func StringSlice(name string, value []string, usage string) *[]string { return CommandLine.StringSliceP(name, "", value, usage) } diff --git a/backend/vendor/github.com/ulikunitz/xz/internal/xlog/xlog.go b/backend/vendor/github.com/ulikunitz/xz/internal/xlog/xlog.go index 678b5a05..fe0c956b 100644 --- a/backend/vendor/github.com/ulikunitz/xz/internal/xlog/xlog.go +++ b/backend/vendor/github.com/ulikunitz/xz/internal/xlog/xlog.go @@ -31,8 +31,7 @@ import ( // printed. There is no control over the order of the items printed and // the format. The full format is: // -// 2009-01-23 01:23:23.123123 /a/b/c/d.go:23: message -// +// 2009-01-23 01:23:23.123123 /a/b/c/d.go:23: message const ( Ldate = 1 << iota // the date: 2009-01-23 Ltime // the time: 01:23:23 diff --git a/backend/vendor/github.com/ulikunitz/xz/lzma/lengthcodec.go b/backend/vendor/github.com/ulikunitz/xz/lzma/lengthcodec.go index 35b06406..38e736fb 100644 --- a/backend/vendor/github.com/ulikunitz/xz/lzma/lengthcodec.go +++ b/backend/vendor/github.com/ulikunitz/xz/lzma/lengthcodec.go @@ -59,8 +59,7 @@ func (lc *lengthCodec) init() { // Encode encodes the length offset. The length offset l can be compute by // subtracting minMatchLen (2) from the actual length. // -// l = length - minMatchLen -// +// l = length - minMatchLen func (lc *lengthCodec) Encode(e *rangeEncoder, l uint32, posState uint32, ) (err error) { if l > maxMatchLen-minMatchLen { diff --git a/backend/vendor/github.com/xi2/xz/doc.go b/backend/vendor/github.com/xi2/xz/doc.go index f8c62e62..d8d97e17 100644 --- a/backend/vendor/github.com/xi2/xz/doc.go +++ b/backend/vendor/github.com/xi2/xz/doc.go @@ -1,11 +1,11 @@ // Package xz implements XZ decompression natively in Go. // -// Usage +// # Usage // // For ease of use, this package is designed to have a similar API to // compress/gzip. See the examples for further details. // -// Implementation +// # Implementation // // This package is a translation from C to Go of XZ Embedded // (http://tukaani.org/xz/embedded.html) with enhancements made so as @@ -14,20 +14,20 @@ // types, supports multiple streams, and performs index verification // using SHA-256 as recommended by the specification. // -// Speed +// # Speed // // On the author's Intel Ivybridge i5, decompression speed is about // half that of the standard XZ Utils (tested with a recent linux // kernel tarball). // -// Thanks +// # Thanks // // Thanks are due to Lasse Collin and Igor Pavlov, the authors of XZ // Embedded, on whose code package xz is based. It would not exist // without their decision to allow others to modify and reuse their // code. // -// Bug reports +// # Bug reports // // For bug reports relating to this package please contact the author // through https://github.com/xi2/xz/issues, and not the authors of XZ diff --git a/backend/vendor/gopkg.in/natefinch/lumberjack.v2/chown.go b/backend/vendor/gopkg.in/natefinch/lumberjack.v2/chown.go index 11d06697..948f989a 100644 --- a/backend/vendor/gopkg.in/natefinch/lumberjack.v2/chown.go +++ b/backend/vendor/gopkg.in/natefinch/lumberjack.v2/chown.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package lumberjack diff --git a/backend/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go b/backend/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go index 3447cdc0..8fe043e0 100644 --- a/backend/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go +++ b/backend/vendor/gopkg.in/natefinch/lumberjack.v2/lumberjack.go @@ -3,7 +3,7 @@ // Note that this is v2.0 of lumberjack, and should be imported using gopkg.in // thusly: // -// import "gopkg.in/natefinch/lumberjack.v2" +// import "gopkg.in/natefinch/lumberjack.v2" // // The package name remains simply lumberjack, and the code resides at // https://github.com/natefinch/lumberjack under the v2.0 branch. @@ -66,7 +66,7 @@ var _ io.WriteCloser = (*Logger)(nil) // `/var/log/foo/server.log`, a backup created at 6:30pm on Nov 11 2016 would // use the filename `/var/log/foo/server-2016-11-04T18-30-00.000.log` // -// Cleaning Up Old Log Files +// # Cleaning Up Old Log Files // // Whenever a new logfile gets created, old log files may be deleted. The most // recent files according to the encoded timestamp will be retained, up to a diff --git a/backend/vendor/gopkg.in/yaml.v2/apic.go b/backend/vendor/gopkg.in/yaml.v2/apic.go index acf71402..fb2821e1 100644 --- a/backend/vendor/gopkg.in/yaml.v2/apic.go +++ b/backend/vendor/gopkg.in/yaml.v2/apic.go @@ -143,7 +143,7 @@ func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { emitter.canonical = canonical } -//// Set the indentation increment. +// // Set the indentation increment. func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { if indent < 2 || indent > 9 { indent = 2 diff --git a/backend/vendor/gopkg.in/yaml.v2/emitterc.go b/backend/vendor/gopkg.in/yaml.v2/emitterc.go index a1c2cc52..638a268c 100644 --- a/backend/vendor/gopkg.in/yaml.v2/emitterc.go +++ b/backend/vendor/gopkg.in/yaml.v2/emitterc.go @@ -130,10 +130,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true diff --git a/backend/vendor/gopkg.in/yaml.v2/parserc.go b/backend/vendor/gopkg.in/yaml.v2/parserc.go index 81d05dfe..2883e5c5 100644 --- a/backend/vendor/gopkg.in/yaml.v2/parserc.go +++ b/backend/vendor/gopkg.in/yaml.v2/parserc.go @@ -170,7 +170,8 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ +// +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -192,9 +193,12 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// * +// +// * +// // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* +// +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -277,8 +281,8 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** // +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -299,9 +303,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -332,30 +337,41 @@ func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// // block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// // flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// // properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* +// +// ************************* +// // block_content ::= block_collection | flow_collection | SCALAR -// ****** +// +// ****** +// // flow_content ::= flow_collection | SCALAR -// ****** +// +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -574,8 +590,8 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* // +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -627,7 +643,8 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * +// +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -664,14 +681,14 @@ func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *y // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -723,13 +740,11 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// +// ((KEY block_node_or_indentless_sequence?)? // +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -757,16 +772,18 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -825,11 +842,10 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev return true } -// // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * // +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -849,8 +865,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * // +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -873,8 +889,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -891,16 +907,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev // Parse the productions: // flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * // +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -965,8 +982,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event // Parse the productions: // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// +// - ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/backend/vendor/gopkg.in/yaml.v2/readerc.go b/backend/vendor/gopkg.in/yaml.v2/readerc.go index 7c1f5fac..b0c436c4 100644 --- a/backend/vendor/gopkg.in/yaml.v2/readerc.go +++ b/backend/vendor/gopkg.in/yaml.v2/readerc.go @@ -95,7 +95,7 @@ func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { // [Go] This function was changed to guarantee the requested length size at EOF. // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests + // for that to be the case, and there are tests // If the EOF flag is set and the raw buffer is empty, do nothing. if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { diff --git a/backend/vendor/gopkg.in/yaml.v2/resolve.go b/backend/vendor/gopkg.in/yaml.v2/resolve.go index 4120e0c9..e29c364b 100644 --- a/backend/vendor/gopkg.in/yaml.v2/resolve.go +++ b/backend/vendor/gopkg.in/yaml.v2/resolve.go @@ -180,7 +180,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) { return yaml_INT_TAG, uintv } } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { return yaml_INT_TAG, int(intv) diff --git a/backend/vendor/gopkg.in/yaml.v2/scannerc.go b/backend/vendor/gopkg.in/yaml.v2/scannerc.go index 0b9bb603..d634dca4 100644 --- a/backend/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/backend/vendor/gopkg.in/yaml.v2/scannerc.go @@ -1500,11 +1500,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1601,11 +1601,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1640,8 +1640,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1679,10 +1680,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1716,9 +1718,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte diff --git a/backend/vendor/gopkg.in/yaml.v2/sorter.go b/backend/vendor/gopkg.in/yaml.v2/sorter.go index 4c45e660..2edd7340 100644 --- a/backend/vendor/gopkg.in/yaml.v2/sorter.go +++ b/backend/vendor/gopkg.in/yaml.v2/sorter.go @@ -52,7 +52,7 @@ func (l keyList) Less(i, j int) bool { var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { - for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 diff --git a/backend/vendor/gopkg.in/yaml.v2/yaml.go b/backend/vendor/gopkg.in/yaml.v2/yaml.go index 30813884..03756f6b 100644 --- a/backend/vendor/gopkg.in/yaml.v2/yaml.go +++ b/backend/vendor/gopkg.in/yaml.v2/yaml.go @@ -2,8 +2,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -67,16 +66,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -166,36 +164,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() diff --git a/backend/vendor/gopkg.in/yaml.v2/yamlh.go b/backend/vendor/gopkg.in/yaml.v2/yamlh.go index f6a9c8e3..640f9d95 100644 --- a/backend/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/backend/vendor/gopkg.in/yaml.v2/yamlh.go @@ -408,7 +408,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -604,13 +606,14 @@ type yaml_parser_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/backend/vendor/gopkg.in/yaml.v3/apic.go b/backend/vendor/gopkg.in/yaml.v3/apic.go index ae7d049f..05fd305d 100644 --- a/backend/vendor/gopkg.in/yaml.v3/apic.go +++ b/backend/vendor/gopkg.in/yaml.v3/apic.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/backend/vendor/gopkg.in/yaml.v3/emitterc.go b/backend/vendor/gopkg.in/yaml.v3/emitterc.go index 0f47c9ca..dde20e50 100644 --- a/backend/vendor/gopkg.in/yaml.v3/emitterc.go +++ b/backend/vendor/gopkg.in/yaml.v3/emitterc.go @@ -162,10 +162,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true @@ -241,7 +240,7 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool emitter.indent += 2 } else { // Everything else aligns to the chosen indentation. - emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) + emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent) } } return true diff --git a/backend/vendor/gopkg.in/yaml.v3/parserc.go b/backend/vendor/gopkg.in/yaml.v3/parserc.go index 268558a0..25fe8236 100644 --- a/backend/vendor/gopkg.in/yaml.v3/parserc.go +++ b/backend/vendor/gopkg.in/yaml.v3/parserc.go @@ -227,7 +227,8 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ +// +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -249,9 +250,12 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// * +// +// * +// // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* +// +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -356,8 +360,8 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** // +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -379,9 +383,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -428,30 +433,41 @@ func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// // block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// // flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// // properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* +// +// ************************* +// // block_content ::= block_collection | flow_collection | SCALAR -// ****** +// +// ****** +// // flow_content ::= flow_collection | SCALAR -// ****** +// +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -682,8 +698,8 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* // +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -740,7 +756,8 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * +// +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -805,14 +822,14 @@ func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -881,13 +898,11 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// +// ((KEY block_node_or_indentless_sequence?)? // +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -915,16 +930,18 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -987,11 +1004,10 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev return true } -// // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * // +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1011,8 +1027,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * // +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1035,8 +1051,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1053,16 +1069,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev // Parse the productions: // flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * // +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -1128,8 +1145,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event // Parse the productions: // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// +// - ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/backend/vendor/gopkg.in/yaml.v3/readerc.go b/backend/vendor/gopkg.in/yaml.v3/readerc.go index b7de0a89..56af2453 100644 --- a/backend/vendor/gopkg.in/yaml.v3/readerc.go +++ b/backend/vendor/gopkg.in/yaml.v3/readerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/backend/vendor/gopkg.in/yaml.v3/scannerc.go b/backend/vendor/gopkg.in/yaml.v3/scannerc.go index ca007010..30b1f089 100644 --- a/backend/vendor/gopkg.in/yaml.v3/scannerc.go +++ b/backend/vendor/gopkg.in/yaml.v3/scannerc.go @@ -1614,11 +1614,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1719,11 +1719,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1758,8 +1758,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1797,10 +1798,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1834,9 +1836,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte @@ -2847,7 +2849,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t continue } if parser.buffer[parser.buffer_pos+peek] == '#' { - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false @@ -2876,7 +2878,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t parser.comments = append(parser.comments, yaml_comment_t{ token_mark: token_mark, start_mark: start_mark, - line: text, + line: text, }) } return true @@ -2910,7 +2912,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo // the foot is the line below it. var foot_line = -1 if scan_mark.line > 0 { - foot_line = parser.mark.line-parser.newlines+1 + foot_line = parser.mark.line - parser.newlines + 1 if parser.newlines == 0 && parser.mark.column > 1 { foot_line++ } @@ -2996,7 +2998,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo recent_empty = false // Consume until after the consumed comment line. - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false diff --git a/backend/vendor/gopkg.in/yaml.v3/writerc.go b/backend/vendor/gopkg.in/yaml.v3/writerc.go index b8a116bf..266d0b09 100644 --- a/backend/vendor/gopkg.in/yaml.v3/writerc.go +++ b/backend/vendor/gopkg.in/yaml.v3/writerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/backend/vendor/gopkg.in/yaml.v3/yaml.go b/backend/vendor/gopkg.in/yaml.v3/yaml.go index 8cec6da4..f0bedf3d 100644 --- a/backend/vendor/gopkg.in/yaml.v3/yaml.go +++ b/backend/vendor/gopkg.in/yaml.v3/yaml.go @@ -17,8 +17,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -75,16 +74,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -185,36 +183,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() @@ -358,22 +355,21 @@ const ( // // For example: // -// var person struct { -// Name string -// Address yaml.Node -// } -// err := yaml.Unmarshal(data, &person) -// +// var person struct { +// Name string +// Address yaml.Node +// } +// err := yaml.Unmarshal(data, &person) +// // Or by itself: // -// var person Node -// err := yaml.Unmarshal(data, &person) -// +// var person Node +// err := yaml.Unmarshal(data, &person) type Node struct { // Kind defines whether the node is a document, a mapping, a sequence, // a scalar value, or an alias to another node. The specific data type of // scalar nodes may be obtained via the ShortTag and LongTag methods. - Kind Kind + Kind Kind // Style allows customizing the apperance of the node in the tree. Style Style @@ -421,7 +417,6 @@ func (n *Node) IsZero() bool { n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 } - // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. diff --git a/backend/vendor/gopkg.in/yaml.v3/yamlh.go b/backend/vendor/gopkg.in/yaml.v3/yamlh.go index 7c6d0077..ddcd5513 100644 --- a/backend/vendor/gopkg.in/yaml.v3/yamlh.go +++ b/backend/vendor/gopkg.in/yaml.v3/yamlh.go @@ -438,7 +438,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -639,7 +641,6 @@ type yaml_parser_t struct { } type yaml_comment_t struct { - scan_mark yaml_mark_t // Position where scanning for comments started token_mark yaml_mark_t // Position after which tokens will be associated with this comment start_mark yaml_mark_t // Position of '#' comment mark @@ -659,13 +660,14 @@ type yaml_comment_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/backend/vendor/gopkg.in/yaml.v3/yamlprivateh.go b/backend/vendor/gopkg.in/yaml.v3/yamlprivateh.go index e88f9c54..dea1ba96 100644 --- a/backend/vendor/gopkg.in/yaml.v3/yamlprivateh.go +++ b/backend/vendor/gopkg.in/yaml.v3/yamlprivateh.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -137,8 +137,8 @@ func is_crlf(b []byte, i int) bool { func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) return ( - // is_break: - b[i] == '\r' || // CR (#xD) + // is_break: + b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) @@ -151,8 +151,8 @@ func is_breakz(b []byte, i int) bool { func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) return ( - // is_space: - b[i] == ' ' || + // is_space: + b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) @@ -166,8 +166,8 @@ func is_spacez(b []byte, i int) bool { func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) return ( - // is_blank: - b[i] == ' ' || b[i] == '\t' || + // is_blank: + b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) diff --git a/frontend/package.json b/frontend/package.json index 2d954b88..2fe85594 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,6 +11,8 @@ "dependencies": { "ace-builds": "^1.4.7", "clipboard": "^2.0.4", + "normalize.css": "^8.0.1", + "file-loader": "^6.2.0", "css-vars-ponyfill": "^2.4.3", "js-base64": "^2.5.1", "lodash.clonedeep": "^4.5.0", diff --git a/frontend/public/themes/dark.css b/frontend/public/themes/dark.css index f202f157..ddd84014 100644 --- a/frontend/public/themes/dark.css +++ b/frontend/public/themes/dark.css @@ -207,4 +207,8 @@ nav { .share__box__element { border-top-color: var(--divider); -} \ No newline at end of file +} + +.helpButton { + background: var(--background); +} diff --git a/frontend/src/components/ButtonGroup.vue b/frontend/src/components/ButtonGroup.vue index 5215ccaa..6bbca446 100644 --- a/frontend/src/components/ButtonGroup.vue +++ b/frontend/src/components/ButtonGroup.vue @@ -1,11 +1,7 @@