vendor: github.com/docker/cli-docs-tool v0.9.0

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2025-01-13 17:53:44 +01:00
parent 807d15ff9d
commit 8a472c6c9d
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
10 changed files with 72 additions and 37 deletions

4
go.mod
View File

@ -18,7 +18,7 @@ require (
github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew v1.1.1
github.com/distribution/reference v0.6.0 github.com/distribution/reference v0.6.0
github.com/docker/cli v27.4.1+incompatible github.com/docker/cli v27.4.1+incompatible
github.com/docker/cli-docs-tool v0.8.0 github.com/docker/cli-docs-tool v0.9.0
github.com/docker/docker v27.4.1+incompatible github.com/docker/docker v27.4.1+incompatible
github.com/docker/go-units v0.5.0 github.com/docker/go-units v0.5.0
github.com/gofrs/flock v0.12.1 github.com/gofrs/flock v0.12.1
@ -87,7 +87,7 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/containerd/api v1.7.19 // indirect github.com/containerd/containerd/api v1.7.19 // indirect
github.com/containerd/ttrpc v1.2.5 // indirect github.com/containerd/ttrpc v1.2.5 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.2 // indirect github.com/docker/docker-credential-helpers v0.8.2 // indirect
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect

8
go.sum
View File

@ -114,8 +114,8 @@ github.com/containerd/ttrpc v1.2.5/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQ
github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40= github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40=
github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk= github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0= github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
@ -127,8 +127,8 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfr
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli v27.4.1+incompatible h1:VzPiUlRJ/xh+otB75gva3r05isHMo5wXDfPRi5/b4hI= github.com/docker/cli v27.4.1+incompatible h1:VzPiUlRJ/xh+otB75gva3r05isHMo5wXDfPRi5/b4hI=
github.com/docker/cli v27.4.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v27.4.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/cli-docs-tool v0.8.0 h1:YcDWl7rQJC3lJ7WVZRwSs3bc9nka97QLWfyJQli8yJU= github.com/docker/cli-docs-tool v0.9.0 h1:CVwQbE+ZziwlPqrJ7LRyUF6GvCA+6gj7MTCsayaK9t0=
github.com/docker/cli-docs-tool v0.8.0/go.mod h1:8TQQ3E7mOXoYUs811LiPdUnAhXrcVsBIrW21a5pUbdk= github.com/docker/cli-docs-tool v0.9.0/go.mod h1:ClrwlNW+UioiRyH9GiAOe1o3J/TsY3Tr1ipoypjAUtc=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=

View File

@ -104,7 +104,7 @@ func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering
node.Parent.Prev.Type == blackfriday.Heading && node.Parent.Prev.Type == blackfriday.Heading &&
node.Parent.Prev.FirstChild != nil && node.Parent.Prev.FirstChild != nil &&
bytes.EqualFold(node.Parent.Prev.FirstChild.Literal, []byte("NAME")) { bytes.EqualFold(node.Parent.Prev.FirstChild.Literal, []byte("NAME")) {
before, after, found := bytes.Cut(node.Literal, []byte(" - ")) before, after, found := bytesCut(node.Literal, []byte(" - "))
escapeSpecialChars(w, before) escapeSpecialChars(w, before)
if found { if found {
out(w, ` \- `) out(w, ` \- `)
@ -406,3 +406,12 @@ func escapeSpecialCharsLine(w io.Writer, text []byte) {
w.Write([]byte{'\\', text[i]}) // nolint: errcheck w.Write([]byte{'\\', text[i]}) // nolint: errcheck
} }
} }
// bytesCut is a copy of [bytes.Cut] to provide compatibility with go1.17
// and older. We can remove this once we drop support for go1.17 and older.
func bytesCut(s, sep []byte) (before, after []byte, found bool) {
if i := bytes.Index(s, sep); i >= 0 {
return s[:i], s[i+len(sep):], true
}
return s, nil, false
}

View File

@ -3,7 +3,6 @@ run:
linters: linters:
enable: enable:
- deadcode
- depguard - depguard
- gofmt - gofmt
- goimports - goimports
@ -13,7 +12,6 @@ linters:
- ineffassign - ineffassign
- misspell - misspell
- typecheck - typecheck
- varcheck
- errname - errname
- makezero - makezero
- whitespace - whitespace
@ -21,12 +19,11 @@ linters:
linters-settings: linters-settings:
depguard: depguard:
list-type: blacklist rules:
include-go-root: true main:
packages: deny:
# The io/ioutil package has been deprecated. - pkg: io/ioutil
# https://go.dev/doc/go1.16#ioutil desc: The io/ioutil package has been deprecated, see https://go.dev/doc/go1.16#ioutil
- io/ioutil
importas: importas:
no-unaliased: true no-unaliased: true

View File

@ -14,20 +14,37 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
ARG GO_VERSION="1.18" ARG GO_VERSION="1.23"
ARG GOLANGCI_LINT_VERSION="v1.45" ARG XX_VERSION="1.6.1"
ARG ADDLICENSE_VERSION="v1.0.0" ARG GOLANGCI_LINT_VERSION="v1.62"
ARG ADDLICENSE_VERSION="v1.1.1"
ARG LICENSE_ARGS="-c cli-docs-tool -l apache" ARG LICENSE_ARGS="-c cli-docs-tool -l apache"
ARG LICENSE_FILES=".*\(Dockerfile\|\.go\|\.hcl\|\.sh\)" ARG LICENSE_FILES=".*\(Dockerfile\|\.go\|\.hcl\|\.sh\)"
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
FROM ghcr.io/google/addlicense:${ADDLICENSE_VERSION} AS addlicense FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
FROM golang:${GO_VERSION}-alpine AS base FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git linux-headers RUN apk add --no-cache cpio findutils git linux-headers
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
WORKDIR /src WORKDIR /src
COPY --link --from=xx / /
FROM base AS addlicense
ARG ADDLICENSE_VERSION
ARG TARGETPLATFORM
RUN --mount=target=/root/.cache,type=cache \
--mount=type=cache,target=/go/pkg/mod <<EOT
set -ex
xx-go install "github.com/google/addlicense@${ADDLICENSE_VERSION}"
mkdir /out
if ! xx-info is-cross; then
mv /go/bin/addlicense /out
else
mv /go/bin/*/addlicense* /out
fi
EOT
FROM base AS vendored FROM base AS vendored
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
@ -40,15 +57,15 @@ COPY --from=vendored /out /
FROM vendored AS vendor-validate FROM vendored AS vendor-validate
RUN --mount=type=bind,target=.,rw <<EOT RUN --mount=type=bind,target=.,rw <<EOT
set -e set -e
git add -A git add -A
cp -rf /out/* . cp -rf /out/* .
diff=$(git status --porcelain -- go.mod go.sum) diff=$(git status --porcelain -- go.mod go.sum)
if [ -n "$diff" ]; then if [ -n "$diff" ]; then
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"' echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
echo "$diff" echo "$diff"
exit 1 exit 1
fi fi
EOT EOT
FROM base AS lint FROM base AS lint
@ -61,7 +78,7 @@ FROM base AS license-set
ARG LICENSE_ARGS ARG LICENSE_ARGS
ARG LICENSE_FILES ARG LICENSE_FILES
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=from=addlicense,source=/app/addlicense,target=/usr/bin/addlicense \ --mount=from=addlicense,source=/out/addlicense,target=/usr/bin/addlicense \
find . -regex "${LICENSE_FILES}" | xargs addlicense ${LICENSE_ARGS} \ find . -regex "${LICENSE_FILES}" | xargs addlicense ${LICENSE_ARGS} \
&& mkdir /out \ && mkdir /out \
&& find . -regex "${LICENSE_FILES}" | cpio -pdm /out && find . -regex "${LICENSE_FILES}" | cpio -pdm /out
@ -73,7 +90,7 @@ FROM base AS license-validate
ARG LICENSE_ARGS ARG LICENSE_ARGS
ARG LICENSE_FILES ARG LICENSE_FILES
RUN --mount=type=bind,target=. \ RUN --mount=type=bind,target=. \
--mount=from=addlicense,source=/app/addlicense,target=/usr/bin/addlicense \ --mount=from=addlicense,source=/out/addlicense,target=/usr/bin/addlicense \
find . -regex "${LICENSE_FILES}" | xargs addlicense -check ${LICENSE_ARGS} find . -regex "${LICENSE_FILES}" | xargs addlicense -check ${LICENSE_ARGS}
FROM vendored AS test FROM vendored AS test

View File

@ -65,7 +65,7 @@ func New(opts Options) (*Client, error) {
} else { } else {
c.target = opts.TargetDir c.target = opts.TargetDir
} }
if err := os.MkdirAll(c.target, 0755); err != nil { if err := os.MkdirAll(c.target, 0o755); err != nil {
return nil, err return nil, err
} }
return c, nil return c, nil

View File

@ -94,7 +94,7 @@ func (c *Client) GenMarkdownTree(cmd *cobra.Command) error {
}); err != nil { }); err != nil {
return err return err
} }
if err = os.WriteFile(targetPath, icBuf.Bytes(), 0644); err != nil { if err = os.WriteFile(targetPath, icBuf.Bytes(), 0o644); err != nil {
return err return err
} }
} else if err := copyFile(sourcePath, targetPath); err != nil { } else if err := copyFile(sourcePath, targetPath); err != nil {

View File

@ -77,7 +77,7 @@ type cmdDoc struct {
// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` // subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third`
// it is undefined which help output will be in the file `cmd-sub-third.1`. // it is undefined which help output will be in the file `cmd-sub-third.1`.
func (c *Client) GenYamlTree(cmd *cobra.Command) error { func (c *Client) GenYamlTree(cmd *cobra.Command) error {
emptyStr := func(s string) string { return "" } emptyStr := func(string) string { return "" }
if err := c.loadLongDescription(cmd, "yaml"); err != nil { if err := c.loadLongDescription(cmd, "yaml"); err != nil {
return err return err
} }

View File

@ -12,6 +12,12 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
target "_common" {
args = {
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
}
}
group "default" { group "default" {
targets = ["test"] targets = ["test"]
} }
@ -21,31 +27,37 @@ group "validate" {
} }
target "lint" { target "lint" {
inherits = ["_common"]
target = "lint" target = "lint"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }
target "vendor-validate" { target "vendor-validate" {
inherits = ["_common"]
target = "vendor-validate" target = "vendor-validate"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }
target "vendor-update" { target "vendor-update" {
inherits = ["_common"]
target = "vendor-update" target = "vendor-update"
output = ["."] output = ["."]
} }
target "test" { target "test" {
inherits = ["_common"]
target = "test-coverage" target = "test-coverage"
output = ["."] output = ["."]
} }
target "license-validate" { target "license-validate" {
inherits = ["_common"]
target = "license-validate" target = "license-validate"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }
target "license-update" { target "license-update" {
inherits = ["_common"]
target = "license-update" target = "license-update"
output = ["."] output = ["."]
} }

6
vendor/modules.txt vendored
View File

@ -209,8 +209,8 @@ github.com/containerd/ttrpc
# github.com/containerd/typeurl/v2 v2.2.3 # github.com/containerd/typeurl/v2 v2.2.3
## explicit; go 1.21 ## explicit; go 1.21
github.com/containerd/typeurl/v2 github.com/containerd/typeurl/v2
# github.com/cpuguy83/go-md2man/v2 v2.0.5 # github.com/cpuguy83/go-md2man/v2 v2.0.6
## explicit; go 1.11 ## explicit; go 1.12
github.com/cpuguy83/go-md2man/v2/md2man github.com/cpuguy83/go-md2man/v2/md2man
# github.com/creack/pty v1.1.21 # github.com/creack/pty v1.1.21
## explicit; go 1.13 ## explicit; go 1.13
@ -253,7 +253,7 @@ github.com/docker/cli/cli/version
github.com/docker/cli/opts github.com/docker/cli/opts
github.com/docker/cli/pkg/kvfile github.com/docker/cli/pkg/kvfile
github.com/docker/cli/templates github.com/docker/cli/templates
# github.com/docker/cli-docs-tool v0.8.0 # github.com/docker/cli-docs-tool v0.9.0
## explicit; go 1.18 ## explicit; go 1.18
github.com/docker/cli-docs-tool github.com/docker/cli-docs-tool
github.com/docker/cli-docs-tool/annotation github.com/docker/cli-docs-tool/annotation