mirror of
https://github.com/moby/moby.git
synced 2026-08-09 17:39:58 +00:00
@@ -11,9 +11,11 @@ import (
|
||||
// in the absence of go.dev/issue/29678.
|
||||
type HardwareAddr net.HardwareAddr
|
||||
|
||||
var _ encoding.TextMarshaler = (HardwareAddr)(nil)
|
||||
var _ encoding.TextUnmarshaler = (*HardwareAddr)(nil)
|
||||
var _ fmt.Stringer = (HardwareAddr)(nil)
|
||||
var (
|
||||
_ encoding.TextMarshaler = (HardwareAddr)(nil)
|
||||
_ encoding.TextUnmarshaler = (*HardwareAddr)(nil)
|
||||
_ fmt.Stringer = (HardwareAddr)(nil)
|
||||
)
|
||||
|
||||
func (m *HardwareAddr) UnmarshalText(text []byte) error {
|
||||
if len(text) == 0 {
|
||||
|
||||
@@ -14,8 +14,10 @@ type TestRanger interface {
|
||||
Range() PortRange
|
||||
}
|
||||
|
||||
var _ TestRanger = Port{}
|
||||
var _ TestRanger = PortRange{}
|
||||
var (
|
||||
_ TestRanger = Port{}
|
||||
_ TestRanger = PortRange{}
|
||||
)
|
||||
|
||||
func TestPort(t *testing.T) {
|
||||
t.Run("Zero Value", func(t *testing.T) {
|
||||
@@ -344,7 +346,6 @@ func TestPortRange(t *testing.T) {
|
||||
in string
|
||||
portRange PortRange // output of ParsePortRange() and Range()
|
||||
str string // output of String(). If "", use in.
|
||||
|
||||
}{
|
||||
// Zero port
|
||||
{
|
||||
|
||||
@@ -82,8 +82,7 @@ type ExecStartOptions struct {
|
||||
}
|
||||
|
||||
// ExecStartResult holds the result of starting a container exec.
|
||||
type ExecStartResult struct {
|
||||
}
|
||||
type ExecStartResult struct{}
|
||||
|
||||
// ExecStart starts an exec process already created in the docker host.
|
||||
func (cli *Client) ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) {
|
||||
@@ -160,8 +159,7 @@ func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) {
|
||||
}
|
||||
|
||||
// ExecInspectOptions holds options for inspecting a container exec.
|
||||
type ExecInspectOptions struct {
|
||||
}
|
||||
type ExecInspectOptions struct{}
|
||||
|
||||
// ExecInspectResult holds the result of inspecting a container exec.
|
||||
//
|
||||
|
||||
@@ -42,8 +42,7 @@ func (cli *Client) ContainerResize(ctx context.Context, containerID string, opti
|
||||
type ExecResizeOptions ContainerResizeOptions
|
||||
|
||||
// ExecResizeResult holds the result of resizing a container exec TTY.
|
||||
type ExecResizeResult struct {
|
||||
}
|
||||
type ExecResizeResult struct{}
|
||||
|
||||
// ExecResize changes the size of the tty for an exec process running inside a container.
|
||||
func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) {
|
||||
@@ -62,5 +61,4 @@ func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecRe
|
||||
return ExecResizeResult{}, err
|
||||
}
|
||||
return ExecResizeResult{}, nil
|
||||
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ func TestUnknownContentLength(t *testing.T) {
|
||||
|
||||
func TestDownloadRemote(t *testing.T) {
|
||||
contextDir := t.TempDir()
|
||||
createTestTempFile(t, contextDir, builder.DefaultDockerfileName, dockerfileContents, 0644)
|
||||
createTestTempFile(t, contextDir, builder.DefaultDockerfileName, dockerfileContents, 0o644)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
server := httptest.NewServer(mux)
|
||||
|
||||
@@ -44,9 +44,7 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string, platform *
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var (
|
||||
history []*imagetype.HistoryResponseItem
|
||||
)
|
||||
var history []*imagetype.HistoryResponseItem
|
||||
s := i.client.SnapshotService(i.snapshotter)
|
||||
|
||||
diffIDs := ociImage.RootFS.DiffIDs
|
||||
|
||||
@@ -399,6 +399,7 @@ func newReferrersList() *referrersList {
|
||||
m: make(map[digest.Digest][]ocispec.Descriptor),
|
||||
}
|
||||
}
|
||||
|
||||
func (rl *referrersList) Get(dgst digest.Digest) ([]ocispec.Descriptor, bool) {
|
||||
rl.mu.RLock()
|
||||
defer rl.mu.RUnlock()
|
||||
|
||||
@@ -168,6 +168,7 @@ func testOnlyAndOnlyStrict(t *testing.T, daemonPlatform platforms.MatchComparer,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestPlatformsWithPreferenceMatcher(t *testing.T) {
|
||||
platformList := []ocispec.Platform{
|
||||
pLinuxAmd64,
|
||||
|
||||
@@ -658,7 +658,6 @@ func (daemon *Daemon) restore(ctx context.Context, cfg *configStore, containers
|
||||
if err := daemon.containerRm(&cfg.Config, cid, &backend.ContainerRmConfig{ForceRemove: true, RemoveVolume: true}); err != nil {
|
||||
log.G(ctx).WithField("container", cid).WithError(err).Error("failed to remove container")
|
||||
}
|
||||
|
||||
}(id, c)
|
||||
}
|
||||
group.Wait()
|
||||
|
||||
@@ -2,8 +2,10 @@ package exporter
|
||||
|
||||
import "time"
|
||||
|
||||
const Moby = "moby"
|
||||
const BuildRefLabel = "moby/build.ref."
|
||||
const (
|
||||
Moby = "moby"
|
||||
BuildRefLabel = "moby/build.ref."
|
||||
)
|
||||
|
||||
type BuildRefLabelValue struct {
|
||||
CreatedAt *time.Time `json:"createdAt,omitempty"`
|
||||
|
||||
@@ -172,7 +172,7 @@ func (d *driver) DeleteNetwork(nid string) error {
|
||||
|
||||
// parseNetworkOptions parses docker network options
|
||||
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) {
|
||||
var config = &configuration{}
|
||||
config := &configuration{}
|
||||
|
||||
// parse generic labels first
|
||||
if genData, ok := option[netlabel.GenericData]; ok && genData != nil {
|
||||
|
||||
@@ -198,7 +198,7 @@ func (d *driver) DeleteNetwork(nid string) error {
|
||||
|
||||
// parseNetworkOptions parses docker network options
|
||||
func parseNetworkOptions(id string, option options.Generic) (*configuration, error) {
|
||||
var config = &configuration{}
|
||||
config := &configuration{}
|
||||
|
||||
// parse generic labels first
|
||||
if genData, ok := option[netlabel.GenericData]; ok && genData != nil {
|
||||
|
||||
@@ -22,7 +22,7 @@ func logEncKeys(ctx context.Context, keys ...[]byte) {
|
||||
"path": klpath,
|
||||
}).Error("could not write to NetworkDB encryption-key log")
|
||||
}
|
||||
f, err := os.OpenFile(klpath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
|
||||
f, err := os.OpenFile(klpath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600)
|
||||
if err != nil {
|
||||
die(err)
|
||||
return
|
||||
|
||||
@@ -110,11 +110,11 @@ func testConvergence(t *rapid.T) {
|
||||
|
||||
// Log the convergence time to disk for later statistical analysis.
|
||||
|
||||
if err := os.Mkdir("testdata", 0755); err != nil && !os.IsExist(err) {
|
||||
if err := os.Mkdir("testdata", 0o755); err != nil && !os.IsExist(err) {
|
||||
t.Logf("Could not log convergence time to disk: failed to create testdata directory: %v", err)
|
||||
return
|
||||
}
|
||||
f, err := os.OpenFile("testdata/convergence_time.csv", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
|
||||
f, err := os.OpenFile("testdata/convergence_time.csv", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644)
|
||||
if err != nil {
|
||||
t.Logf("Could not log convergence time to disk: failed to open file: %v", err)
|
||||
return
|
||||
|
||||
@@ -450,7 +450,6 @@ func generateIngressRules(port *PortConfig, destIP net.IP) []iptables.Rule {
|
||||
}
|
||||
|
||||
func programIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) (portErr error) {
|
||||
|
||||
rollbackRules := make([]iptables.Rule, 0, len(filteredPorts)*3)
|
||||
defer func() {
|
||||
if portErr != nil {
|
||||
@@ -463,7 +462,6 @@ func programIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) (portErr
|
||||
}()
|
||||
|
||||
for _, iPort := range filteredPorts {
|
||||
|
||||
for _, rule := range generateIngressRules(iPort, gwIP) {
|
||||
if portErr = rule.Insert(); portErr != nil {
|
||||
err := fmt.Errorf("set up rule failed, %v: %v", rule, portErr)
|
||||
@@ -477,7 +475,6 @@ func programIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) (portErr
|
||||
}
|
||||
|
||||
func deleteIngressPortsRules(gwIP net.IP, filteredPorts []*PortConfig) error {
|
||||
|
||||
var portErr error
|
||||
|
||||
for _, iPort := range filteredPorts {
|
||||
|
||||
@@ -336,7 +336,6 @@ func readSystemCPUUsage(r io.Reader) (cpuUsage uint64, cpuNum uint32, _ error) {
|
||||
|
||||
for {
|
||||
data, isPartial, err := rdr.ReadLine()
|
||||
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("error scanning /proc/stat file: %w", err)
|
||||
}
|
||||
|
||||
@@ -152,7 +152,6 @@ func TestContainerAPIPostContainerStop(t *testing.T) {
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.testName, func(t *testing.T) {
|
||||
|
||||
res, _, err := request.Post(ctx, "/containers/"+tc.id+"/stop")
|
||||
|
||||
assert.Equal(t, res.StatusCode, tc.expStatusCode)
|
||||
|
||||
@@ -242,5 +242,4 @@ func TestImageImportBadSrc(t *testing.T) {
|
||||
assert.Check(t, tc.expectErr(err))
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
8
vendor/github.com/moby/moby/api/types/network/hwaddr.go
generated
vendored
8
vendor/github.com/moby/moby/api/types/network/hwaddr.go
generated
vendored
@@ -11,9 +11,11 @@ import (
|
||||
// in the absence of go.dev/issue/29678.
|
||||
type HardwareAddr net.HardwareAddr
|
||||
|
||||
var _ encoding.TextMarshaler = (HardwareAddr)(nil)
|
||||
var _ encoding.TextUnmarshaler = (*HardwareAddr)(nil)
|
||||
var _ fmt.Stringer = (HardwareAddr)(nil)
|
||||
var (
|
||||
_ encoding.TextMarshaler = (HardwareAddr)(nil)
|
||||
_ encoding.TextUnmarshaler = (*HardwareAddr)(nil)
|
||||
_ fmt.Stringer = (HardwareAddr)(nil)
|
||||
)
|
||||
|
||||
func (m *HardwareAddr) UnmarshalText(text []byte) error {
|
||||
if len(text) == 0 {
|
||||
|
||||
6
vendor/github.com/moby/moby/client/container_exec.go
generated
vendored
6
vendor/github.com/moby/moby/client/container_exec.go
generated
vendored
@@ -82,8 +82,7 @@ type ExecStartOptions struct {
|
||||
}
|
||||
|
||||
// ExecStartResult holds the result of starting a container exec.
|
||||
type ExecStartResult struct {
|
||||
}
|
||||
type ExecStartResult struct{}
|
||||
|
||||
// ExecStart starts an exec process already created in the docker host.
|
||||
func (cli *Client) ExecStart(ctx context.Context, execID string, options ExecStartOptions) (ExecStartResult, error) {
|
||||
@@ -160,8 +159,7 @@ func getConsoleSize(hasTTY bool, consoleSize ConsoleSize) (*[2]uint, error) {
|
||||
}
|
||||
|
||||
// ExecInspectOptions holds options for inspecting a container exec.
|
||||
type ExecInspectOptions struct {
|
||||
}
|
||||
type ExecInspectOptions struct{}
|
||||
|
||||
// ExecInspectResult holds the result of inspecting a container exec.
|
||||
//
|
||||
|
||||
4
vendor/github.com/moby/moby/client/container_resize.go
generated
vendored
4
vendor/github.com/moby/moby/client/container_resize.go
generated
vendored
@@ -42,8 +42,7 @@ func (cli *Client) ContainerResize(ctx context.Context, containerID string, opti
|
||||
type ExecResizeOptions ContainerResizeOptions
|
||||
|
||||
// ExecResizeResult holds the result of resizing a container exec TTY.
|
||||
type ExecResizeResult struct {
|
||||
}
|
||||
type ExecResizeResult struct{}
|
||||
|
||||
// ExecResize changes the size of the tty for an exec process running inside a container.
|
||||
func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecResizeOptions) (ExecResizeResult, error) {
|
||||
@@ -62,5 +61,4 @@ func (cli *Client) ExecResize(ctx context.Context, execID string, options ExecRe
|
||||
return ExecResizeResult{}, err
|
||||
}
|
||||
return ExecResizeResult{}, nil
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user