mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: buildkit, docker/docker and docker/cli v27.0.1
diffs: - https://github.com/docker/cli/compare/v26.1.4..v27.0.1 - https://github.com/docker/docker/compare/v26.1.4..v27.0.1 - https://github.com/moby/buildkit/compare/v0.14.1...aaaf86e5470bffbb395f5c15ad4a1c152642ea30 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
30
vendor/github.com/tonistiigi/go-csvvalue/.golangci.yml
generated
vendored
Normal file
30
vendor/github.com/tonistiigi/go-csvvalue/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
run:
|
||||
timeout: 10m
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- depguard
|
||||
- errname
|
||||
- forbidigo
|
||||
- gocritic
|
||||
- gofmt
|
||||
- goimports
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- importas
|
||||
- ineffassign
|
||||
- makezero
|
||||
- misspell
|
||||
- noctx
|
||||
- nolintlint
|
||||
- revive
|
||||
- staticcheck
|
||||
- typecheck
|
||||
- unused
|
||||
- whitespace
|
||||
disable-all: true
|
||||
|
||||
issues:
|
||||
exclude-use-default: false
|
13
vendor/github.com/tonistiigi/go-csvvalue/.yamllint.yml
generated
vendored
Normal file
13
vendor/github.com/tonistiigi/go-csvvalue/.yamllint.yml
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
ignore: |
|
||||
/vendor
|
||||
|
||||
extends: default
|
||||
|
||||
yaml-files:
|
||||
- '*.yaml'
|
||||
- '*.yml'
|
||||
|
||||
rules:
|
||||
truthy: disable
|
||||
line-length: disable
|
||||
document-start: disable
|
42
vendor/github.com/tonistiigi/go-csvvalue/Dockerfile
generated
vendored
Normal file
42
vendor/github.com/tonistiigi/go-csvvalue/Dockerfile
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
#syntax=docker/dockerfile:1.8
|
||||
#check=error=true
|
||||
|
||||
ARG GO_VERSION=1.22
|
||||
ARG XX_VERSION=1.4.0
|
||||
|
||||
ARG COVER_FILENAME="cover.out"
|
||||
ARG BENCH_FILENAME="bench.txt"
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS golang
|
||||
COPY --link --from=xx / /
|
||||
WORKDIR /src
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
FROM golang AS build
|
||||
RUN --mount=target=/root/.cache,type=cache \
|
||||
--mount=type=bind xx-go build .
|
||||
|
||||
FROM golang AS runbench
|
||||
ARG BENCH_FILENAME
|
||||
RUN --mount=target=/root/.cache,type=cache \
|
||||
--mount=type=bind \
|
||||
xx-go test -v --run skip --bench . | tee /tmp/${BENCH_FILENAME}
|
||||
|
||||
FROM scratch AS bench
|
||||
ARG BENCH_FILENAME
|
||||
COPY --from=runbench /tmp/${BENCH_FILENAME} /
|
||||
|
||||
FROM golang AS runtest
|
||||
ARG TESTFLAGS="-v"
|
||||
ARG COVER_FILENAME
|
||||
RUN --mount=target=/root/.cache,type=cache \
|
||||
--mount=type=bind \
|
||||
xx-go test -coverprofile=/tmp/${COVER_FILENAME} $TESTFLAGS .
|
||||
|
||||
FROM scratch AS test
|
||||
ARG COVER_FILENAME
|
||||
COPY --from=runtest /tmp/${COVER_FILENAME} /
|
||||
|
||||
FROM build
|
22
vendor/github.com/tonistiigi/go-csvvalue/LICENSE
generated
vendored
Normal file
22
vendor/github.com/tonistiigi/go-csvvalue/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
MIT
|
||||
|
||||
Copyright 2024 Tõnis Tiigi <tonistiigi@gmail.com>
|
||||
|
||||
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 AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
vendor/github.com/tonistiigi/go-csvvalue/codecov.yml
generated
vendored
Normal file
1
vendor/github.com/tonistiigi/go-csvvalue/codecov.yml
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
comment: false
|
172
vendor/github.com/tonistiigi/go-csvvalue/csvvalue.go
generated
vendored
Normal file
172
vendor/github.com/tonistiigi/go-csvvalue/csvvalue.go
generated
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
// Package csvvalue provides an efficient parser for a single line CSV value.
|
||||
// It is more efficient than the standard library csv package for parsing many
|
||||
// small values. For multi-line CSV parsing, the standard library is recommended.
|
||||
package csvvalue
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"errors"
|
||||
"io"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
var errInvalidDelim = errors.New("csv: invalid field or comment delimiter")
|
||||
|
||||
var defaultParser = NewParser()
|
||||
|
||||
// Fields parses the line with default parser and returns
|
||||
// slice of fields for the record. If dst is nil, a new slice is allocated.
|
||||
func Fields(inp string, dst []string) ([]string, error) {
|
||||
return defaultParser.Fields(inp, dst)
|
||||
}
|
||||
|
||||
// Parser is a CSV parser for a single line value.
|
||||
type Parser struct {
|
||||
Comma rune
|
||||
LazyQuotes bool
|
||||
TrimLeadingSpace bool
|
||||
}
|
||||
|
||||
// NewParser returns a new Parser with default settings.
|
||||
func NewParser() *Parser {
|
||||
return &Parser{Comma: ','}
|
||||
}
|
||||
|
||||
// Fields parses the line and returns slice of fields for the record.
|
||||
// If dst is nil, a new slice is allocated.
|
||||
// For backward compatibility, a trailing newline is allowed.
|
||||
func (r *Parser) Fields(line string, dst []string) ([]string, error) {
|
||||
if !validDelim(r.Comma) {
|
||||
return nil, errInvalidDelim
|
||||
}
|
||||
|
||||
if cap(dst) == 0 {
|
||||
// imprecise estimate, strings.Count is fast
|
||||
dst = make([]string, 0, 1+strings.Count(line, string(r.Comma)))
|
||||
} else {
|
||||
dst = dst[:0]
|
||||
}
|
||||
|
||||
const quoteLen = len(`"`)
|
||||
var (
|
||||
pos int
|
||||
commaLen = utf8.RuneLen(r.Comma)
|
||||
trim = r.TrimLeadingSpace
|
||||
)
|
||||
|
||||
// allow trailing newline for compatibility
|
||||
if n := len(line); n > 0 && line[n-1] == '\n' {
|
||||
if n > 1 && line[n-2] == '\r' {
|
||||
line = line[:n-2]
|
||||
} else {
|
||||
line = line[:n-1]
|
||||
}
|
||||
}
|
||||
|
||||
if len(line) == 0 {
|
||||
return nil, io.EOF
|
||||
}
|
||||
|
||||
parseField:
|
||||
for {
|
||||
if trim {
|
||||
i := strings.IndexFunc(line, func(r rune) bool {
|
||||
return !unicode.IsSpace(r)
|
||||
})
|
||||
if i < 0 {
|
||||
i = len(line)
|
||||
}
|
||||
line = line[i:]
|
||||
pos += i
|
||||
}
|
||||
if len(line) == 0 || line[0] != '"' {
|
||||
// Non-quoted string field
|
||||
i := strings.IndexRune(line, r.Comma)
|
||||
var field string
|
||||
if i >= 0 {
|
||||
field = line[:i]
|
||||
} else {
|
||||
field = line
|
||||
}
|
||||
// Check to make sure a quote does not appear in field.
|
||||
if !r.LazyQuotes {
|
||||
if j := strings.IndexRune(field, '"'); j >= 0 {
|
||||
return nil, parseErr(pos+j, csv.ErrBareQuote)
|
||||
}
|
||||
}
|
||||
dst = append(dst, field)
|
||||
if i >= 0 {
|
||||
line = line[i+commaLen:]
|
||||
pos += i + commaLen
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
// Quoted string field
|
||||
line = line[quoteLen:]
|
||||
pos += quoteLen
|
||||
halfOpen := false
|
||||
for {
|
||||
i := strings.IndexRune(line, '"')
|
||||
if i >= 0 {
|
||||
// Hit next quote.
|
||||
if !halfOpen {
|
||||
dst = append(dst, line[:i])
|
||||
} else {
|
||||
appendToLast(dst, line[:i])
|
||||
}
|
||||
halfOpen = false
|
||||
line = line[i+quoteLen:]
|
||||
pos += i + quoteLen
|
||||
switch rn := nextRune(line); {
|
||||
case rn == '"':
|
||||
// `""` sequence (append quote).
|
||||
appendToLast(dst, "\"")
|
||||
line = line[quoteLen:]
|
||||
pos += quoteLen
|
||||
case rn == r.Comma:
|
||||
// `",` sequence (end of field).
|
||||
line = line[commaLen:]
|
||||
pos += commaLen
|
||||
continue parseField
|
||||
case len(line) == 0:
|
||||
break parseField
|
||||
case r.LazyQuotes:
|
||||
// `"` sequence (bare quote).
|
||||
appendToLast(dst, "\"")
|
||||
halfOpen = true
|
||||
default:
|
||||
// `"*` sequence (invalid non-escaped quote).
|
||||
return nil, parseErr(pos-quoteLen, csv.ErrQuote)
|
||||
}
|
||||
} else {
|
||||
if !r.LazyQuotes {
|
||||
return nil, parseErr(pos, csv.ErrQuote)
|
||||
}
|
||||
// Hit end of line (copy all data so far).
|
||||
dst = append(dst, line)
|
||||
break parseField
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst, nil
|
||||
}
|
||||
|
||||
func validDelim(r rune) bool {
|
||||
return r != 0 && r != '"' && r != '\r' && r != '\n' && utf8.ValidRune(r) && r != utf8.RuneError
|
||||
}
|
||||
|
||||
func appendToLast(dst []string, s string) {
|
||||
dst[len(dst)-1] += s
|
||||
}
|
||||
|
||||
func nextRune(b string) rune {
|
||||
r, _ := utf8.DecodeRuneInString(b)
|
||||
return r
|
||||
}
|
||||
|
||||
func parseErr(pos int, err error) error {
|
||||
return &csv.ParseError{StartLine: 1, Line: 1, Column: pos + 1, Err: err}
|
||||
}
|
68
vendor/github.com/tonistiigi/go-csvvalue/docker-bake.hcl
generated
vendored
Normal file
68
vendor/github.com/tonistiigi/go-csvvalue/docker-bake.hcl
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
variable "COVER_FILENAME" {
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "BENCH_FILENAME" {
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "GO_VERSION" {
|
||||
default = null
|
||||
}
|
||||
|
||||
target "default" {
|
||||
targets = ["build"]
|
||||
}
|
||||
|
||||
target "_all_platforms" {
|
||||
platforms = [
|
||||
"linux/amd64",
|
||||
"linux/arm64",
|
||||
"linux/arm/v7",
|
||||
"linux/arm/v6",
|
||||
"linux/386",
|
||||
"linux/ppc64le",
|
||||
"linux/s390x",
|
||||
"darwin/amd64",
|
||||
"darwin/arm64",
|
||||
"windows/amd64",
|
||||
]
|
||||
}
|
||||
|
||||
target "build" {
|
||||
output = ["type=cacheonly"]
|
||||
args = {
|
||||
GO_VERSION = GO_VERSION
|
||||
}
|
||||
}
|
||||
|
||||
target "build-all" {
|
||||
inherits = ["build", "_all_platforms"]
|
||||
}
|
||||
|
||||
target "test" {
|
||||
target = "test"
|
||||
args = {
|
||||
COVER_FILENAME = COVER_FILENAME
|
||||
GO_VERSION = GO_VERSION
|
||||
}
|
||||
output = [COVER_FILENAME!=null?".":"type=cacheonly"]
|
||||
}
|
||||
|
||||
target "bench" {
|
||||
target = "bench"
|
||||
args = {
|
||||
BENCH_FILENAME = BENCH_FILENAME
|
||||
GO_VERSION = GO_VERSION
|
||||
}
|
||||
output = [BENCH_FILENAME!=null?".":"type=cacheonly"]
|
||||
}
|
||||
|
||||
target "lint" {
|
||||
dockerfile = "hack/dockerfiles/lint.Dockerfile"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "lint-all" {
|
||||
inherits = ["lint", "_all_platforms"]
|
||||
}
|
44
vendor/github.com/tonistiigi/go-csvvalue/readme.md
generated
vendored
Normal file
44
vendor/github.com/tonistiigi/go-csvvalue/readme.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
### go-csvvalue
|
||||
|
||||

|
||||
[](https://pkg.go.dev/github.com/tonistiigi/go-csvvalue)
|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
`go-csvvalue` provides an efficient parser for a single-line CSV value.
|
||||
|
||||
It is more efficient than the standard library `encoding/csv` package for parsing many small values. The main problem with stdlib implementation is that it calls `bufio.NewReader` internally, allocating 4KB of memory on each invocation. For multi-line CSV parsing, the standard library is still recommended. If you wish to optimize memory usage for `encoding/csv`, call `csv.NewReader` with an instance of `*bufio.Reader` that already has a 4KB buffer allocated and then reuse that buffer for all reads.
|
||||
|
||||
For further memory optimization, an existing string slice can be optionally passed to be reused for returning the parsed fields.
|
||||
|
||||
For backwards compatibility with stdlib record parser, the input may contain a trailing newline character.
|
||||
|
||||
### Benchmark
|
||||
|
||||
```
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/tonistiigi/go-csvvalue
|
||||
cpu: AMD EPYC 7763 64-Core Processor
|
||||
BenchmarkFields/stdlib/withcache-4 1109917 1103 ns/op 4520 B/op 14 allocs/op
|
||||
BenchmarkFields/stdlib/nocache-4 1082838 1125 ns/op 4520 B/op 14 allocs/op
|
||||
BenchmarkFields/csvvalue/withcache-4 28554976 42.12 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkFields/csvvalue/nocache-4 13666134 83.77 ns/op 48 B/op 1 allocs/op
|
||||
```
|
||||
```
|
||||
goos: darwin
|
||||
goarch: arm64
|
||||
pkg: github.com/tonistiigi/go-csvvalue
|
||||
BenchmarkFields/stdlib/nocache-10 1679923 784.9 ns/op 4520 B/op 14 allocs/op
|
||||
BenchmarkFields/stdlib/withcache-10 1641891 826.9 ns/op 4520 B/op 14 allocs/op
|
||||
BenchmarkFields/csvvalue/withcache-10 34399642 33.93 ns/op 0 B/op 0 allocs/op
|
||||
BenchmarkFields/csvvalue/nocache-10 17441373 67.21 ns/op 48 B/op 1 allocs/op
|
||||
PASS
|
||||
```
|
||||
|
||||
### Credits
|
||||
|
||||
This package is mostly based on `encoding/csv` implementation and also uses that package for compatibility testing.
|
||||
|
Reference in New Issue
Block a user