Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2017-09-27 13:58:21 -07:00
Родитель 554e8f9a7f
Коммит 1ba7b4d3c5
3 изменённых файлов: 130 добавлений и 0 удалений

33
Gopkg.toml Normal file
Просмотреть файл

@ -0,0 +1,33 @@
[[constraint]]
name = "github.com/docker/distribution"
revision = "5db89f0ca68677abc5eefce8f2a0a772c98ba52d"
# branch = "master"
[[constraint]]
name = "github.com/docker/go-connections"
version = "0.3.0"
[[constraint]]
name = "github.com/docker/go-units"
version = "0.3.2"
[[constraint]]
name = "github.com/gogo/protobuf"
version = "0.4.0"
[[constraint]]
name = "github.com/opencontainers/go-digest"
version = "1.0.0-rc1"
[[constraint]]
name = "github.com/opencontainers/image-spec"
version = "1.0.0"
[[constraint]]
name = "github.com/pkg/errors"
version = "0.8.0"
[[constraint]]
name = "golang.org/x/net"
# branch = "master"

42
scripts/files/doc.go Normal file
Просмотреть файл

@ -0,0 +1,42 @@
/*
Package docker is the official Go client for the Docker API.
For more information about the Docker API, see the documentation:
https://docs.docker.com/develop/api
Usage
You use the library by creating a client object and calling methods on it. The
client can be created either from environment variables with NewEnvClient, or
configured manually with NewClient.
For example, to list running containers (the equivalent of "docker ps"):
package main
import (
"context"
"fmt"
"docker.io/go-docker"
"docker.io/go-docker/api/types"
)
func main() {
cli, err := docker.NewEnvClient()
if err != nil {
panic(err)
}
containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{})
if err != nil {
panic(err)
}
for _, container := range containers {
fmt.Printf("%s %s\n", container.ID[:10], container.Image)
}
}
*/
package docker // import "docker.io/go-docker"

55
scripts/update.sh Executable file
Просмотреть файл

@ -0,0 +1,55 @@
#!/bin/bash
set -e
ENGINE_BRANCH=master
domain=docker.io
urlpath=go-docker
importpath="$domain/$urlpath"
package=docker
sed=$(which gsed) || sed=$(which sed)
dir=$(pwd)
rm -rf *.go api
tmp=${1:-/tmp/go-docker.tmp}
set -x
cd "$tmp"
[ ! -d docker ] && git clone --depth 1 -b "$ENGINE_BRANCH" https://github.com/docker/docker
pushd docker
for folder in api client; do
find "$folder" -name '*.go' -type f -exec sed -i'' -E 's#github.com/docker/docker/api(/?)#'"${importpath}"'/api\1#g' {} \;
find "$folder" -name '*.go' -type f -exec sed -i'' -E 's#github.com/docker/docker/client(/?)#'"${importpath}"'\1#g' {} \;
done
cp client/*.go "$dir/"
cp -rf api "$dir/"
rm -rf \
"$dir/api/server" \
"$dir/swarm_get_unlock_key_test.go" \
"$dir/api/errdefs" \
"$dir/api/templates" \
"$dir/api/types/backend" \
"$dir/api/swagger*"
popd
pushd "$dir"
find . -name '*.go' -depth 1 -print | xargs $sed -i'' -E 's,^package client\b,package '"${package}"' // import "'${importpath}'",g'
find . -name '*.go' -depth 1 -print | xargs $sed -i'' -E 's,^Package client\b,Package '"${package}"',g'
sed -i'' -E 's#client(\.NewEnvClient\(\))#docker\1#g' client.go
popd
cd "$dir"
# reset README.md
git checkout README.md
function strip_doc() {
tail -n +$(grep -n '^package ' "$1" | cut -d: -f1) "$1" > "$1".new
mv "$1".new "$1"
}
# replace documentation
strip_doc client.go
cp scripts/files/*.go .