Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ed913b885 | |||
| ab45dc8fdc | |||
| 5a12f90b4c | |||
| 521a636a86 | |||
| 8b8ec04cd6 | |||
| 4e7c875e3b | |||
| 2e6ff15dac | |||
| f56d1b3646 | |||
| 8e7ff60ee1 | |||
| 6cb678f16f | |||
| 4515c51870 | |||
| 43a4e09bb2 | |||
| cfa1fd9acd | |||
| 6051b36dbf | |||
| 31d338dd3a | |||
| 9cc05b9cec | |||
| 936d328da9 | |||
| 97afb72954 | |||
| c280cdfd66 |
@ -4,7 +4,7 @@ clone_folder: c:\gopath\src\github.com\docker\cli
|
||||
|
||||
environment:
|
||||
GOPATH: c:\gopath
|
||||
GOVERSION: 1.13.11
|
||||
GOVERSION: 1.13.12
|
||||
DEPVERSION: v0.4.1
|
||||
|
||||
install:
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
@ -280,9 +279,9 @@ func attachContainer(
|
||||
func reportError(stderr io.Writer, name string, str string, withHelp bool) {
|
||||
str = strings.TrimSuffix(str, ".") + "."
|
||||
if withHelp {
|
||||
str += "\nSee '" + os.Args[0] + " " + name + " --help'."
|
||||
str += "\nSee 'docker " + name + " --help'."
|
||||
}
|
||||
fmt.Fprintf(stderr, "%s: %s\n", os.Args[0], str)
|
||||
fmt.Fprintln(stderr, "docker:", str)
|
||||
}
|
||||
|
||||
// if container start fails with 'not found'/'no such' error, return 127
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/docker/cli/cli/context/store"
|
||||
@ -8,8 +9,48 @@ import (
|
||||
|
||||
// DockerContext is a typed representation of what we put in Context metadata
|
||||
type DockerContext struct {
|
||||
Description string `json:",omitempty"`
|
||||
StackOrchestrator Orchestrator `json:",omitempty"`
|
||||
Description string
|
||||
StackOrchestrator Orchestrator
|
||||
AdditionalFields map[string]interface{}
|
||||
}
|
||||
|
||||
// MarshalJSON implements custom JSON marshalling
|
||||
func (dc DockerContext) MarshalJSON() ([]byte, error) {
|
||||
s := map[string]interface{}{}
|
||||
if dc.Description != "" {
|
||||
s["Description"] = dc.Description
|
||||
}
|
||||
if dc.StackOrchestrator != "" {
|
||||
s["StackOrchestrator"] = dc.StackOrchestrator
|
||||
}
|
||||
if dc.AdditionalFields != nil {
|
||||
for k, v := range dc.AdditionalFields {
|
||||
s[k] = v
|
||||
}
|
||||
}
|
||||
return json.Marshal(s)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements custom JSON marshalling
|
||||
func (dc *DockerContext) UnmarshalJSON(payload []byte) error {
|
||||
var data map[string]interface{}
|
||||
if err := json.Unmarshal(payload, &data); err != nil {
|
||||
return err
|
||||
}
|
||||
for k, v := range data {
|
||||
switch k {
|
||||
case "Description":
|
||||
dc.Description = v.(string)
|
||||
case "StackOrchestrator":
|
||||
dc.StackOrchestrator = Orchestrator(v.(string))
|
||||
default:
|
||||
if dc.AdditionalFields == nil {
|
||||
dc.AdditionalFields = make(map[string]interface{})
|
||||
}
|
||||
dc.AdditionalFields[k] = v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDockerContext extracts metadata from stored context metadata
|
||||
|
||||
27
cli/command/context_test.go
Normal file
27
cli/command/context_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
||||
func TestDockerContextMetadataKeepAdditionalFields(t *testing.T) {
|
||||
c := DockerContext{
|
||||
Description: "test",
|
||||
StackOrchestrator: OrchestratorSwarm,
|
||||
AdditionalFields: map[string]interface{}{
|
||||
"foo": "bar",
|
||||
},
|
||||
}
|
||||
jsonBytes, err := json.Marshal(c)
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, `{"Description":"test","StackOrchestrator":"swarm","foo":"bar"}`, string(jsonBytes))
|
||||
|
||||
var c2 DockerContext
|
||||
assert.NilError(t, json.Unmarshal(jsonBytes, &c2))
|
||||
assert.Equal(t, c2.AdditionalFields["foo"], "bar")
|
||||
assert.Equal(t, c2.StackOrchestrator, OrchestratorSwarm)
|
||||
assert.Equal(t, c2.Description, "test")
|
||||
}
|
||||
@ -39,36 +39,29 @@ func runLogout(dockerCli command.Cli, serverAddress string) error {
|
||||
}
|
||||
|
||||
var (
|
||||
loggedIn bool
|
||||
regsToLogout []string
|
||||
regsToLogout = []string{serverAddress}
|
||||
hostnameAddress = serverAddress
|
||||
regsToTry = []string{serverAddress}
|
||||
)
|
||||
if !isDefaultRegistry {
|
||||
hostnameAddress = registry.ConvertToHostname(serverAddress)
|
||||
// the tries below are kept for backward compatibility where a user could have
|
||||
// saved the registry in one of the following format.
|
||||
regsToTry = append(regsToTry, hostnameAddress, "http://"+hostnameAddress, "https://"+hostnameAddress)
|
||||
}
|
||||
|
||||
// check if we're logged in based on the records in the config file
|
||||
// which means it couldn't have user/pass cause they may be in the creds store
|
||||
for _, s := range regsToTry {
|
||||
if _, ok := dockerCli.ConfigFile().AuthConfigs[s]; ok {
|
||||
loggedIn = true
|
||||
regsToLogout = append(regsToLogout, s)
|
||||
}
|
||||
}
|
||||
|
||||
if !loggedIn {
|
||||
fmt.Fprintf(dockerCli.Out(), "Not logged in to %s\n", hostnameAddress)
|
||||
return nil
|
||||
regsToLogout = append(regsToLogout, hostnameAddress, "http://"+hostnameAddress, "https://"+hostnameAddress)
|
||||
}
|
||||
|
||||
fmt.Fprintf(dockerCli.Out(), "Removing login credentials for %s\n", hostnameAddress)
|
||||
errs := make(map[string]error)
|
||||
for _, r := range regsToLogout {
|
||||
if err := dockerCli.ConfigFile().GetCredentialsStore(r).Erase(r); err != nil {
|
||||
fmt.Fprintf(dockerCli.Err(), "WARNING: could not erase credentials: %v\n", err)
|
||||
errs[r] = err
|
||||
}
|
||||
}
|
||||
|
||||
// if at least one removal succeeded, report success. Otherwise report errors
|
||||
if len(errs) == len(regsToLogout) {
|
||||
fmt.Fprintln(dockerCli.Err(), "WARNING: could not erase credentials:")
|
||||
for k, v := range errs {
|
||||
fmt.Fprintf(dockerCli.Err(), "%s: %s\n", k, v)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
ARG GO_VERSION=1.13.11
|
||||
ARG GO_VERSION=1.13.12
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
ARG GO_VERSION=1.13.11
|
||||
ARG GO_VERSION=1.13.12
|
||||
|
||||
FROM dockercore/golang-cross:${GO_VERSION}
|
||||
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
ARG GO_VERSION=1.13.11
|
||||
ARG GO_VERSION=1.13.12
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
ARG GO_VERSION=1.13.11
|
||||
ARG GO_VERSION=1.13.12
|
||||
|
||||
# Use Debian based image as docker-compose requires glibc.
|
||||
FROM golang:${GO_VERSION}-buster
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# syntax=docker/dockerfile:1.1.3-experimental
|
||||
|
||||
ARG GO_VERSION=1.13.11
|
||||
ARG GO_VERSION=1.13.12
|
||||
ARG GOLANGCI_LINTER_SHA="v1.21.0"
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine AS build
|
||||
|
||||
@ -34,11 +34,11 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`description`** *string*
|
||||
|
||||
description of the plugin
|
||||
description of the plugin
|
||||
|
||||
- **`documentation`** *string*
|
||||
|
||||
link to the documentation about the plugin
|
||||
link to the documentation about the plugin
|
||||
|
||||
- **`interface`** *PluginInterface*
|
||||
|
||||
@ -96,7 +96,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`name`** *string*
|
||||
|
||||
name of the mount.
|
||||
name of the mount.
|
||||
|
||||
- **`description`** *string*
|
||||
|
||||
@ -104,11 +104,11 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`source`** *string*
|
||||
|
||||
source of the mount.
|
||||
source of the mount.
|
||||
|
||||
- **`destination`** *string*
|
||||
|
||||
destination of the mount.
|
||||
destination of the mount.
|
||||
|
||||
- **`type`** *string*
|
||||
|
||||
@ -116,7 +116,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`options`** *string array*
|
||||
|
||||
options of the mount.
|
||||
options of the mount.
|
||||
|
||||
- **`ipchost`** *boolean*
|
||||
Access to host ipc namespace.
|
||||
@ -135,7 +135,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`name`** *string*
|
||||
|
||||
name of the env.
|
||||
name of the env.
|
||||
|
||||
- **`description`** *string*
|
||||
|
||||
@ -143,7 +143,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`value`** *string*
|
||||
|
||||
value of the env.
|
||||
value of the env.
|
||||
|
||||
- **`args`** *PluginArgs*
|
||||
|
||||
@ -151,7 +151,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`name`** *string*
|
||||
|
||||
name of the args.
|
||||
name of the args.
|
||||
|
||||
- **`description`** *string*
|
||||
|
||||
@ -159,7 +159,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`value`** *string array*
|
||||
|
||||
values of the args.
|
||||
values of the args.
|
||||
|
||||
- **`linux`** *PluginLinux*
|
||||
|
||||
@ -169,7 +169,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`allowAllDevices`** *boolean*
|
||||
|
||||
If `/dev` is bind mounted from the host, and allowAllDevices is set to true, the plugin will have `rwm` access to all devices on the host.
|
||||
If `/dev` is bind mounted from the host, and allowAllDevices is set to true, the plugin will have `rwm` access to all devices on the host.
|
||||
|
||||
- **`devices`** *PluginDevice array*
|
||||
|
||||
@ -177,7 +177,7 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
- **`name`** *string*
|
||||
|
||||
name of the device.
|
||||
name of the device.
|
||||
|
||||
- **`description`** *string*
|
||||
|
||||
@ -193,45 +193,45 @@ Config provides the base accessible fields for working with V0 plugin format
|
||||
|
||||
```json
|
||||
{
|
||||
"Args": {
|
||||
"Description": "",
|
||||
"Name": "",
|
||||
"Settable": null,
|
||||
"Value": null
|
||||
},
|
||||
"Description": "A sample volume plugin for Docker",
|
||||
"Documentation": "https://docs.docker.com/engine/extend/plugins/",
|
||||
"Entrypoint": [
|
||||
"/usr/bin/sample-volume-plugin",
|
||||
"/data"
|
||||
],
|
||||
"Env": [
|
||||
{
|
||||
"Description": "",
|
||||
"Name": "DEBUG",
|
||||
"Settable": [
|
||||
"value"
|
||||
],
|
||||
"Value": "0"
|
||||
}
|
||||
],
|
||||
"Interface": {
|
||||
"Socket": "plugin.sock",
|
||||
"Types": [
|
||||
"docker.volumedriver/1.0"
|
||||
]
|
||||
},
|
||||
"Linux": {
|
||||
"Capabilities": null,
|
||||
"AllowAllDevices": false,
|
||||
"Devices": null
|
||||
},
|
||||
"Mounts": null,
|
||||
"Network": {
|
||||
"Type": ""
|
||||
},
|
||||
"PropagatedMount": "/data",
|
||||
"User": {},
|
||||
"Workdir": ""
|
||||
"Args": {
|
||||
"Description": "",
|
||||
"Name": "",
|
||||
"Settable": null,
|
||||
"Value": null
|
||||
},
|
||||
"Description": "A sample volume plugin for Docker",
|
||||
"Documentation": "https://docs.docker.com/engine/extend/plugins/",
|
||||
"Entrypoint": [
|
||||
"/usr/bin/sample-volume-plugin",
|
||||
"/data"
|
||||
],
|
||||
"Env": [
|
||||
{
|
||||
"Description": "",
|
||||
"Name": "DEBUG",
|
||||
"Settable": [
|
||||
"value"
|
||||
],
|
||||
"Value": "0"
|
||||
}
|
||||
],
|
||||
"Interface": {
|
||||
"Socket": "plugin.sock",
|
||||
"Types": [
|
||||
"docker.volumedriver/1.0"
|
||||
]
|
||||
},
|
||||
"Linux": {
|
||||
"Capabilities": null,
|
||||
"AllowAllDevices": false,
|
||||
"Devices": null
|
||||
},
|
||||
"Mounts": null,
|
||||
"Network": {
|
||||
"Type": ""
|
||||
},
|
||||
"PropagatedMount": "/data",
|
||||
"User": {},
|
||||
"Workdir": ""
|
||||
}
|
||||
```
|
||||
|
||||
@ -42,14 +42,18 @@ Once running however, network driver plugins are used just like the built-in
|
||||
network drivers: by being mentioned as a driver in network-oriented Docker
|
||||
commands. For example,
|
||||
|
||||
$ docker network create --driver weave mynet
|
||||
```bash
|
||||
$ docker network create --driver weave mynet
|
||||
```
|
||||
|
||||
Some network driver plugins are listed in [plugins](legacy_plugins.md)
|
||||
|
||||
The `mynet` network is now owned by `weave`, so subsequent commands
|
||||
referring to that network will be sent to the plugin,
|
||||
|
||||
$ docker run --network=mynet busybox top
|
||||
```bash
|
||||
$ docker run --network=mynet busybox top
|
||||
```
|
||||
|
||||
|
||||
## Find network plugins
|
||||
@ -61,8 +65,8 @@ or on the third party's site.
|
||||
|
||||
## Write a network plugin
|
||||
|
||||
Network plugins implement the [Docker plugin
|
||||
API](plugin_api.md) and the network plugin protocol
|
||||
Network plugins implement the [Docker plugin API](plugin_api.md) and the network
|
||||
plugin protocol
|
||||
|
||||
## Network plugin protocol
|
||||
|
||||
@ -74,5 +78,5 @@ documented as part of libnetwork:
|
||||
|
||||
To interact with the Docker maintainers and other interested users, see the IRC channel `#docker-network`.
|
||||
|
||||
- [Docker networks feature overview](https://docs.docker.com/engine/userguide/networking/)
|
||||
- The [LibNetwork](https://github.com/docker/libnetwork) project
|
||||
- [Docker networks feature overview](https://docs.docker.com/engine/userguide/networking/)
|
||||
- The [LibNetwork](https://github.com/docker/libnetwork) project
|
||||
|
||||
@ -608,7 +608,7 @@ FROM [--platform=<platform>] <image>[@<digest>] [AS <name>]
|
||||
```
|
||||
|
||||
The `FROM` instruction initializes a new build stage and sets the
|
||||
[*Base Image*](../../glossary/#base-image) for subsequent instructions. As such, a
|
||||
[*Base Image*](https://docs.docker.com/glossary/#base_image) for subsequent instructions. As such, a
|
||||
valid `Dockerfile` must start with a `FROM` instruction. The image can be
|
||||
any valid image – it is especially easy to start by **pulling an image** from
|
||||
the [*Public Repositories*](https://docs.docker.com/engine/tutorials/dockerrepos/).
|
||||
|
||||
@ -61,16 +61,9 @@ by the `docker` command line:
|
||||
|
||||
* `DOCKER_API_VERSION` The API version to use (e.g. `1.19`)
|
||||
* `DOCKER_CONFIG` The location of your client configuration files.
|
||||
* `DOCKER_CERT_PATH` The location of your authentication keys.
|
||||
* `DOCKER_CLI_EXPERIMENTAL` Enable experimental features for the cli (e.g. `enabled` or `disabled`)
|
||||
* `DOCKER_DRIVER` The graph driver to use.
|
||||
* `DOCKER_HOST` Daemon socket to connect to.
|
||||
* `DOCKER_NOWARN_KERNEL_VERSION` Prevent warnings that your Linux kernel is
|
||||
unsuitable for Docker.
|
||||
* `DOCKER_RAMDISK` If set this will disable 'pivot_root'.
|
||||
* `DOCKER_STACK_ORCHESTRATOR` Configure the default orchestrator to use when using `docker stack` management commands.
|
||||
* `DOCKER_TLS` When set Docker uses TLS.
|
||||
* `DOCKER_TLS_VERIFY` When set Docker uses TLS and verifies the remote.
|
||||
* `DOCKER_CONTENT_TRUST` When set Docker uses notary to sign and verify images.
|
||||
Equates to `--disable-content-trust=false` for build, create, pull, push, run.
|
||||
* `DOCKER_CONTENT_TRUST_SERVER` The URL of the Notary server to use. This defaults
|
||||
@ -78,10 +71,17 @@ by the `docker` command line:
|
||||
* `DOCKER_HIDE_LEGACY_COMMANDS` When set, Docker hides "legacy" top-level commands (such as `docker rm`, and
|
||||
`docker pull`) in `docker help` output, and only `Management commands` per object-type (e.g., `docker container`) are
|
||||
printed. This may become the default in a future release, at which point this environment-variable is removed.
|
||||
* `DOCKER_TMPDIR` Location for temporary Docker files.
|
||||
* `DOCKER_CONTEXT` Specify the context to use (overrides DOCKER_HOST env var and default context set with "docker context use")
|
||||
* `DOCKER_DEFAULT_PLATFORM` Specify the default platform for the commands that take the `--platform` flag.
|
||||
|
||||
#### Shared Environment variables
|
||||
|
||||
These environment variables can be used both with the `docker` command line and
|
||||
`dockerd` command line:
|
||||
|
||||
* `DOCKER_CERT_PATH` The location of your authentication keys.
|
||||
* `DOCKER_TLS_VERIFY` When set Docker uses TLS and verifies the remote.
|
||||
|
||||
Because Docker is developed using Go, you can also use any environment
|
||||
variables used by the Go runtime. In particular, you may find these useful:
|
||||
|
||||
|
||||
@ -117,11 +117,24 @@ the `daemon.json` file.
|
||||
> Enable experimental features by starting `dockerd` with the `--experimental`
|
||||
> flag or adding `"experimental": true` to the `daemon.json` file.
|
||||
|
||||
### Environment variables
|
||||
|
||||
For easy reference, the following list of environment variables are supported
|
||||
by the `dockerd` command line:
|
||||
|
||||
* `DOCKER_DRIVER` The graph driver to use.
|
||||
* `DOCKER_NOWARN_KERNEL_VERSION` Prevent warnings that your Linux kernel is
|
||||
unsuitable for Docker.
|
||||
* `DOCKER_RAMDISK` If set this will disable 'pivot_root'.
|
||||
* `DOCKER_TMPDIR` Location for temporary Docker files.
|
||||
* `MOBY_DISABLE_PIGZ` Do not use [`unpigz`](https://linux.die.net/man/1/pigz) to
|
||||
decompress layers in parallel when pulling images, even if it is installed.
|
||||
|
||||
## Examples
|
||||
|
||||
### Daemon socket option
|
||||
|
||||
The Docker daemon can listen for [Docker Engine API](../api/)
|
||||
The Docker daemon can listen for [Docker Engine API](https://docs.docker.com/engine/api/)
|
||||
requests via three different types of Socket: `unix`, `tcp`, and `fd`.
|
||||
|
||||
By default, a `unix` domain socket (or IPC socket) is created at
|
||||
|
||||
@ -84,7 +84,7 @@ golang.org/x/net eb5bcb51f2a31c7d5141d810b708
|
||||
golang.org/x/oauth2 ef147856a6ddbb60760db74283d2424e98c87bff
|
||||
golang.org/x/sync e225da77a7e68af35c70ccbf71af2b83e6acac3c
|
||||
golang.org/x/sys 4b34438f7a67ee5f45cc6132e2bad873a20324e9
|
||||
golang.org/x/text f21a4dfb5e38f5895301dc265a8def02365cc3d0 # v0.3.0
|
||||
golang.org/x/text 23ae387dee1f90d29a23c0e87ee0b46038fbed0e # v0.3.3
|
||||
golang.org/x/time fbb02b2291d28baffd63558aa44b4b56f178d650
|
||||
google.golang.org/genproto 02b4e95473316948020af0b7a4f0f22c73929b0e
|
||||
google.golang.org/grpc 39e8a7b072a67ca2a75f57fa2e0d50995f5b22f6 # v1.23.1
|
||||
|
||||
6
vendor/golang.org/x/text/README.md
generated
vendored
6
vendor/golang.org/x/text/README.md
generated
vendored
@ -66,7 +66,7 @@ To update a Unicode version run
|
||||
|
||||
UNICODE_VERSION=x.x.x go generate
|
||||
|
||||
where `x.x.x` must correspond to a directory in http://www.unicode.org/Public/.
|
||||
where `x.x.x` must correspond to a directory in https://www.unicode.org/Public/.
|
||||
If this version is newer than the version in core it will also update the
|
||||
relevant packages there. The idna package in x/net will always be updated.
|
||||
|
||||
@ -75,7 +75,7 @@ To update a CLDR version run
|
||||
CLDR_VERSION=version go generate
|
||||
|
||||
where `version` must correspond to a directory in
|
||||
http://www.unicode.org/Public/cldr/.
|
||||
https://www.unicode.org/Public/cldr/.
|
||||
|
||||
Note that the code gets adapted over time to changes in the data and that
|
||||
backwards compatibility is not maintained.
|
||||
@ -89,5 +89,5 @@ This repository uses Gerrit for code changes. To learn how to submit changes to
|
||||
this repository, see https://golang.org/doc/contribute.html.
|
||||
|
||||
The main issue tracker for the image repository is located at
|
||||
https://github.com/golang/go/issues. Prefix your issue with "x/image:" in the
|
||||
https://github.com/golang/go/issues. Prefix your issue with "x/text:" in the
|
||||
subject line, so it is easy to find.
|
||||
|
||||
5
vendor/golang.org/x/text/go.mod
generated
vendored
Normal file
5
vendor/golang.org/x/text/go.mod
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module golang.org/x/text
|
||||
|
||||
require golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
|
||||
|
||||
go 1.11
|
||||
12
vendor/golang.org/x/text/transform/transform.go
generated
vendored
12
vendor/golang.org/x/text/transform/transform.go
generated
vendored
@ -78,8 +78,8 @@ type SpanningTransformer interface {
|
||||
// considering the error err.
|
||||
//
|
||||
// A nil error means that all input bytes are known to be identical to the
|
||||
// output produced by the Transformer. A nil error can be be returned
|
||||
// regardless of whether atEOF is true. If err is nil, then then n must
|
||||
// output produced by the Transformer. A nil error can be returned
|
||||
// regardless of whether atEOF is true. If err is nil, then n must
|
||||
// equal len(src); the converse is not necessarily true.
|
||||
//
|
||||
// ErrEndOfSpan means that the Transformer output may differ from the
|
||||
@ -493,7 +493,7 @@ func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err erro
|
||||
return dstL.n, srcL.p, err
|
||||
}
|
||||
|
||||
// Deprecated: use runes.Remove instead.
|
||||
// Deprecated: Use runes.Remove instead.
|
||||
func RemoveFunc(f func(r rune) bool) Transformer {
|
||||
return removeF(f)
|
||||
}
|
||||
@ -648,7 +648,8 @@ func String(t Transformer, s string) (result string, n int, err error) {
|
||||
// Transform the remaining input, growing dst and src buffers as necessary.
|
||||
for {
|
||||
n := copy(src, s[pSrc:])
|
||||
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], pSrc+n == len(s))
|
||||
atEOF := pSrc+n == len(s)
|
||||
nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], atEOF)
|
||||
pDst += nDst
|
||||
pSrc += nSrc
|
||||
|
||||
@ -659,6 +660,9 @@ func String(t Transformer, s string) (result string, n int, err error) {
|
||||
dst = grow(dst, pDst)
|
||||
}
|
||||
} else if err == ErrShortSrc {
|
||||
if atEOF {
|
||||
return string(dst[:pDst]), pSrc, err
|
||||
}
|
||||
if nSrc == 0 {
|
||||
src = grow(src, 0)
|
||||
}
|
||||
|
||||
2
vendor/golang.org/x/text/unicode/bidi/bidi.go
generated
vendored
2
vendor/golang.org/x/text/unicode/bidi/bidi.go
generated
vendored
@ -6,7 +6,7 @@
|
||||
|
||||
// Package bidi contains functionality for bidirectional text support.
|
||||
//
|
||||
// See http://www.unicode.org/reports/tr9.
|
||||
// See https://www.unicode.org/reports/tr9.
|
||||
//
|
||||
// NOTE: UNDER CONSTRUCTION. This API may change in backwards incompatible ways
|
||||
// and without notice.
|
||||
|
||||
4
vendor/golang.org/x/text/unicode/bidi/bracket.go
generated
vendored
4
vendor/golang.org/x/text/unicode/bidi/bracket.go
generated
vendored
@ -12,7 +12,7 @@ import (
|
||||
|
||||
// This file contains a port of the reference implementation of the
|
||||
// Bidi Parentheses Algorithm:
|
||||
// http://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/BidiPBAReference.java
|
||||
// https://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/BidiPBAReference.java
|
||||
//
|
||||
// The implementation in this file covers definitions BD14-BD16 and rule N0
|
||||
// of UAX#9.
|
||||
@ -246,7 +246,7 @@ func (p *bracketPairer) getStrongTypeN0(index int) Class {
|
||||
// assuming the given embedding direction.
|
||||
//
|
||||
// It returns ON if no strong type is found. If a single strong type is found,
|
||||
// it returns this this type. Otherwise it returns the embedding direction.
|
||||
// it returns this type. Otherwise it returns the embedding direction.
|
||||
//
|
||||
// TODO: use separate type for "strong" directionality.
|
||||
func (p *bracketPairer) classifyPairContent(loc bracketPair, dirEmbed Class) Class {
|
||||
|
||||
10
vendor/golang.org/x/text/unicode/bidi/core.go
generated
vendored
10
vendor/golang.org/x/text/unicode/bidi/core.go
generated
vendored
@ -7,7 +7,7 @@ package bidi
|
||||
import "log"
|
||||
|
||||
// This implementation is a port based on the reference implementation found at:
|
||||
// http://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/
|
||||
// https://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/
|
||||
//
|
||||
// described in Unicode Bidirectional Algorithm (UAX #9).
|
||||
//
|
||||
@ -480,15 +480,15 @@ func (s *isolatingRunSequence) resolveWeakTypes() {
|
||||
|
||||
// Rule W1.
|
||||
// Changes all NSMs.
|
||||
preceedingCharacterType := s.sos
|
||||
precedingCharacterType := s.sos
|
||||
for i, t := range s.types {
|
||||
if t == NSM {
|
||||
s.types[i] = preceedingCharacterType
|
||||
s.types[i] = precedingCharacterType
|
||||
} else {
|
||||
if t.in(LRI, RLI, FSI, PDI) {
|
||||
preceedingCharacterType = ON
|
||||
precedingCharacterType = ON
|
||||
}
|
||||
preceedingCharacterType = t
|
||||
precedingCharacterType = t
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
generated
vendored
2
vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
generated
vendored
@ -1,6 +1,6 @@
|
||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||
|
||||
// +build go1.10
|
||||
// +build go1.10,!go1.13
|
||||
|
||||
package bidi
|
||||
|
||||
|
||||
1887
vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go
generated
vendored
Normal file
1887
vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1923
vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go
generated
vendored
Normal file
1923
vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
vendor/golang.org/x/text/unicode/norm/composition.go
generated
vendored
8
vendor/golang.org/x/text/unicode/norm/composition.go
generated
vendored
@ -407,7 +407,7 @@ func decomposeHangul(buf []byte, r rune) int {
|
||||
|
||||
// decomposeHangul algorithmically decomposes a Hangul rune into
|
||||
// its Jamo components.
|
||||
// See http://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul.
|
||||
// See https://unicode.org/reports/tr15/#Hangul for details on decomposing Hangul.
|
||||
func (rb *reorderBuffer) decomposeHangul(r rune) {
|
||||
r -= hangulBase
|
||||
x := r % jamoTCount
|
||||
@ -420,7 +420,7 @@ func (rb *reorderBuffer) decomposeHangul(r rune) {
|
||||
}
|
||||
|
||||
// combineHangul algorithmically combines Jamo character components into Hangul.
|
||||
// See http://unicode.org/reports/tr15/#Hangul for details on combining Hangul.
|
||||
// See https://unicode.org/reports/tr15/#Hangul for details on combining Hangul.
|
||||
func (rb *reorderBuffer) combineHangul(s, i, k int) {
|
||||
b := rb.rune[:]
|
||||
bn := rb.nrune
|
||||
@ -461,6 +461,10 @@ func (rb *reorderBuffer) combineHangul(s, i, k int) {
|
||||
// It should only be used to recompose a single segment, as it will not
|
||||
// handle alternations between Hangul and non-Hangul characters correctly.
|
||||
func (rb *reorderBuffer) compose() {
|
||||
// Lazily load the map used by the combine func below, but do
|
||||
// it outside of the loop.
|
||||
recompMapOnce.Do(buildRecompMap)
|
||||
|
||||
// UAX #15, section X5 , including Corrigendum #5
|
||||
// "In any character sequence beginning with starter S, a character C is
|
||||
// blocked from S if and only if there is some character B between S
|
||||
|
||||
19
vendor/golang.org/x/text/unicode/norm/forminfo.go
generated
vendored
19
vendor/golang.org/x/text/unicode/norm/forminfo.go
generated
vendored
@ -4,6 +4,8 @@
|
||||
|
||||
package norm
|
||||
|
||||
import "encoding/binary"
|
||||
|
||||
// This file contains Form-specific logic and wrappers for data in tables.go.
|
||||
|
||||
// Rune info is stored in a separate trie per composing form. A composing form
|
||||
@ -178,6 +180,17 @@ func (p Properties) TrailCCC() uint8 {
|
||||
return ccc[p.tccc]
|
||||
}
|
||||
|
||||
func buildRecompMap() {
|
||||
recompMap = make(map[uint32]rune, len(recompMapPacked)/8)
|
||||
var buf [8]byte
|
||||
for i := 0; i < len(recompMapPacked); i += 8 {
|
||||
copy(buf[:], recompMapPacked[i:i+8])
|
||||
key := binary.BigEndian.Uint32(buf[:4])
|
||||
val := binary.BigEndian.Uint32(buf[4:])
|
||||
recompMap[key] = rune(val)
|
||||
}
|
||||
}
|
||||
|
||||
// Recomposition
|
||||
// We use 32-bit keys instead of 64-bit for the two codepoint keys.
|
||||
// This clips off the bits of three entries, but we know this will not
|
||||
@ -186,8 +199,14 @@ func (p Properties) TrailCCC() uint8 {
|
||||
// Note that the recomposition map for NFC and NFKC are identical.
|
||||
|
||||
// combine returns the combined rune or 0 if it doesn't exist.
|
||||
//
|
||||
// The caller is responsible for calling
|
||||
// recompMapOnce.Do(buildRecompMap) sometime before this is called.
|
||||
func combine(a, b rune) rune {
|
||||
key := uint32(uint16(a))<<16 + uint32(uint16(b))
|
||||
if recompMap == nil {
|
||||
panic("caller error") // see func comment
|
||||
}
|
||||
return recompMap[key]
|
||||
}
|
||||
|
||||
|
||||
3
vendor/golang.org/x/text/unicode/norm/iter.go
generated
vendored
3
vendor/golang.org/x/text/unicode/norm/iter.go
generated
vendored
@ -128,8 +128,9 @@ func (i *Iter) Next() []byte {
|
||||
func nextASCIIBytes(i *Iter) []byte {
|
||||
p := i.p + 1
|
||||
if p >= i.rb.nsrc {
|
||||
p0 := i.p
|
||||
i.setDone()
|
||||
return i.rb.src.bytes[i.p:p]
|
||||
return i.rb.src.bytes[p0:p]
|
||||
}
|
||||
if i.rb.src.bytes[p] < utf8.RuneSelf {
|
||||
p0 := i.p
|
||||
|
||||
4
vendor/golang.org/x/text/unicode/norm/normalize.go
generated
vendored
4
vendor/golang.org/x/text/unicode/norm/normalize.go
generated
vendored
@ -29,8 +29,8 @@ import (
|
||||
// proceed independently on both sides:
|
||||
// f(x) == append(f(x[0:n]), f(x[n:])...)
|
||||
//
|
||||
// References: http://unicode.org/reports/tr15/ and
|
||||
// http://unicode.org/notes/tn5/.
|
||||
// References: https://unicode.org/reports/tr15/ and
|
||||
// https://unicode.org/notes/tn5/.
|
||||
type Form int
|
||||
|
||||
const (
|
||||
|
||||
4
vendor/golang.org/x/text/unicode/norm/readwriter.go
generated
vendored
4
vendor/golang.org/x/text/unicode/norm/readwriter.go
generated
vendored
@ -60,8 +60,8 @@ func (w *normWriter) Close() error {
|
||||
}
|
||||
|
||||
// Writer returns a new writer that implements Write(b)
|
||||
// by writing f(b) to w. The returned writer may use an
|
||||
// an internal buffer to maintain state across Write calls.
|
||||
// by writing f(b) to w. The returned writer may use an
|
||||
// internal buffer to maintain state across Write calls.
|
||||
// Calling its Close method writes any buffered data to w.
|
||||
func (f Form) Writer(w io.Writer) io.WriteCloser {
|
||||
wr := &normWriter{rb: reorderBuffer{}, w: w}
|
||||
|
||||
1892
vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
generated
vendored
1892
vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
generated
vendored
File diff suppressed because it is too large
Load Diff
7693
vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
generated
vendored
Normal file
7693
vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7710
vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
generated
vendored
Normal file
7710
vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1890
vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
generated
vendored
1890
vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
generated
vendored
File diff suppressed because it is too large
Load Diff
10
vendor/golang.org/x/text/unicode/norm/transform.go
generated
vendored
10
vendor/golang.org/x/text/unicode/norm/transform.go
generated
vendored
@ -18,7 +18,6 @@ func (Form) Reset() {}
|
||||
// Users should either catch ErrShortDst and allow dst to grow or have dst be at
|
||||
// least of size MaxTransformChunkSize to be guaranteed of progress.
|
||||
func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
|
||||
n := 0
|
||||
// Cap the maximum number of src bytes to check.
|
||||
b := src
|
||||
eof := atEOF
|
||||
@ -27,13 +26,14 @@ func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error)
|
||||
eof = false
|
||||
b = b[:ns]
|
||||
}
|
||||
i, ok := formTable[f].quickSpan(inputBytes(b), n, len(b), eof)
|
||||
n += copy(dst[n:], b[n:i])
|
||||
i, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), eof)
|
||||
n := copy(dst, b[:i])
|
||||
if !ok {
|
||||
nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF)
|
||||
return nDst + n, nSrc + n, err
|
||||
}
|
||||
if n < len(src) && !atEOF {
|
||||
|
||||
if err == nil && n < len(src) && !atEOF {
|
||||
err = transform.ErrShortSrc
|
||||
}
|
||||
return n, n, err
|
||||
@ -79,7 +79,7 @@ func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error)
|
||||
nSrc += n
|
||||
nDst += n
|
||||
if ok {
|
||||
if n < rb.nsrc && !atEOF {
|
||||
if err == nil && n < rb.nsrc && !atEOF {
|
||||
err = transform.ErrShortSrc
|
||||
}
|
||||
return nDst, nSrc, err
|
||||
|
||||
16
vendor/golang.org/x/text/width/kind_string.go
generated
vendored
16
vendor/golang.org/x/text/width/kind_string.go
generated
vendored
@ -2,7 +2,19 @@
|
||||
|
||||
package width
|
||||
|
||||
import "fmt"
|
||||
import "strconv"
|
||||
|
||||
func _() {
|
||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
// Re-run the stringer command to generate them again.
|
||||
var x [1]struct{}
|
||||
_ = x[Neutral-0]
|
||||
_ = x[EastAsianAmbiguous-1]
|
||||
_ = x[EastAsianWide-2]
|
||||
_ = x[EastAsianNarrow-3]
|
||||
_ = x[EastAsianFullwidth-4]
|
||||
_ = x[EastAsianHalfwidth-5]
|
||||
}
|
||||
|
||||
const _Kind_name = "NeutralEastAsianAmbiguousEastAsianWideEastAsianNarrowEastAsianFullwidthEastAsianHalfwidth"
|
||||
|
||||
@ -10,7 +22,7 @@ var _Kind_index = [...]uint8{0, 7, 25, 38, 53, 71, 89}
|
||||
|
||||
func (i Kind) String() string {
|
||||
if i < 0 || i >= Kind(len(_Kind_index)-1) {
|
||||
return fmt.Sprintf("Kind(%d)", i)
|
||||
return "Kind(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Kind_name[_Kind_index[i]:_Kind_index[i+1]]
|
||||
}
|
||||
|
||||
2
vendor/golang.org/x/text/width/tables10.0.0.go
generated
vendored
2
vendor/golang.org/x/text/width/tables10.0.0.go
generated
vendored
@ -1,6 +1,6 @@
|
||||
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
|
||||
|
||||
// +build go1.10
|
||||
// +build go1.10,!go1.13
|
||||
|
||||
package width
|
||||
|
||||
|
||||
1330
vendor/golang.org/x/text/width/tables11.0.0.go
generated
vendored
Normal file
1330
vendor/golang.org/x/text/width/tables11.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1350
vendor/golang.org/x/text/width/tables12.0.0.go
generated
vendored
Normal file
1350
vendor/golang.org/x/text/width/tables12.0.0.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
vendor/golang.org/x/text/width/width.go
generated
vendored
6
vendor/golang.org/x/text/width/width.go
generated
vendored
@ -12,7 +12,7 @@
|
||||
// are kept together in words or runs that are rotated sideways in vertical text
|
||||
// layout.
|
||||
//
|
||||
// For more information, see http://unicode.org/reports/tr11/.
|
||||
// For more information, see https://unicode.org/reports/tr11/.
|
||||
package width // import "golang.org/x/text/width"
|
||||
|
||||
import (
|
||||
@ -27,7 +27,7 @@ import (
|
||||
// (approximation, fixed pitch only).
|
||||
// 3) Implement display length.
|
||||
|
||||
// Kind indicates the type of width property as defined in http://unicode.org/reports/tr11/.
|
||||
// Kind indicates the type of width property as defined in https://unicode.org/reports/tr11/.
|
||||
type Kind int
|
||||
|
||||
const (
|
||||
@ -106,7 +106,7 @@ func (e elem) kind() Kind {
|
||||
}
|
||||
|
||||
// Kind returns the Kind of a rune as defined in Unicode TR #11.
|
||||
// See http://unicode.org/reports/tr11/ for more details.
|
||||
// See https://unicode.org/reports/tr11/ for more details.
|
||||
func (p Properties) Kind() Kind {
|
||||
return p.elem.kind()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user