mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Params of non-exported struct should be non-exported
- in error.go Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
bfc5721970
commit
781bcc94a7
1 changed files with 21 additions and 21 deletions
|
@ -53,15 +53,15 @@ type JoinOption func(ep *endpoint)
|
||||||
type LeaveOption func(ep *endpoint)
|
type LeaveOption func(ep *endpoint)
|
||||||
|
|
||||||
type containerConfig struct {
|
type containerConfig struct {
|
||||||
Hostname string
|
hostName string
|
||||||
Domainname string
|
domainName string
|
||||||
generic map[string]interface{}
|
generic map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type containerInfo struct {
|
type containerInfo struct {
|
||||||
ID string
|
id string
|
||||||
Config containerConfig
|
config containerConfig
|
||||||
Data ContainerData
|
data ContainerData
|
||||||
}
|
}
|
||||||
|
|
||||||
type endpoint struct {
|
type endpoint struct {
|
||||||
|
@ -163,8 +163,8 @@ func (ep *endpoint) Join(containerID string, options ...JoinOption) (*ContainerD
|
||||||
|
|
||||||
ep.processJoinOptions(options...)
|
ep.processJoinOptions(options...)
|
||||||
|
|
||||||
ep.container.Data.HostsPath = prefix + "/" + containerID + "/hosts"
|
ep.container.data.HostsPath = prefix + "/" + containerID + "/hosts"
|
||||||
err = createHostsFile(ep.container.Data.HostsPath)
|
err = createHostsFile(ep.container.data.HostsPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -211,28 +211,28 @@ func (ep *endpoint) Join(containerID string, options ...JoinOption) (*ContainerD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ep.container.ID = containerID
|
ep.container.id = containerID
|
||||||
ep.container.Data.SandboxKey = sb.Key()
|
ep.container.data.SandboxKey = sb.Key()
|
||||||
|
|
||||||
cData := ep.container.Data
|
cData := ep.container.data
|
||||||
return &cData, nil
|
return &cData, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ep *endpoint) Leave(containerID string, options ...LeaveOption) error {
|
func (ep *endpoint) Leave(containerID string, options ...LeaveOption) error {
|
||||||
if ep.container == nil || ep.container.ID == "" ||
|
if ep.container == nil || ep.container.id == "" ||
|
||||||
containerID == "" || ep.container.ID != containerID {
|
containerID == "" || ep.container.id != containerID {
|
||||||
return InvalidContainerIDError(containerID)
|
return InvalidContainerIDError(containerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
n := ep.network
|
|
||||||
ep.processLeaveOptions(options...)
|
ep.processLeaveOptions(options...)
|
||||||
|
|
||||||
|
n := ep.network
|
||||||
err := n.driver.Leave(n.id, ep.id, ep.context)
|
err := n.driver.Leave(n.id, ep.id, ep.context)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ep.network.ctrlr.sandboxRm(ep.container.Data.SandboxKey)
|
ep.network.ctrlr.sandboxRm(ep.container.data.SandboxKey)
|
||||||
ep.container = nil
|
ep.container = nil
|
||||||
ep.context = nil
|
ep.context = nil
|
||||||
return nil
|
return nil
|
||||||
|
@ -266,9 +266,9 @@ func (ep *endpoint) Delete() error {
|
||||||
func (ep *endpoint) buildHostsFiles() error {
|
func (ep *endpoint) buildHostsFiles() error {
|
||||||
var extraContent []etchosts.Record
|
var extraContent []etchosts.Record
|
||||||
|
|
||||||
name := ep.container.Config.Hostname
|
name := ep.container.config.hostName
|
||||||
if ep.container.Config.Domainname != "" {
|
if ep.container.config.domainName != "" {
|
||||||
name = name + "." + ep.container.Config.Domainname
|
name = name + "." + ep.container.config.domainName
|
||||||
}
|
}
|
||||||
|
|
||||||
IP := ""
|
IP := ""
|
||||||
|
@ -277,15 +277,15 @@ func (ep *endpoint) buildHostsFiles() error {
|
||||||
IP = ep.sandboxInfo.Interfaces[0].Address.IP.String()
|
IP = ep.sandboxInfo.Interfaces[0].Address.IP.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
return etchosts.Build(ep.container.Data.HostsPath, IP, ep.container.Config.Hostname,
|
return etchosts.Build(ep.container.data.HostsPath, IP, ep.container.config.hostName,
|
||||||
ep.container.Config.Domainname, extraContent)
|
ep.container.config.domainName, extraContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// JoinOptionHostname function returns an option setter for hostname option to
|
// JoinOptionHostname function returns an option setter for hostname option to
|
||||||
// be passed to endpoint Join method.
|
// be passed to endpoint Join method.
|
||||||
func JoinOptionHostname(name string) JoinOption {
|
func JoinOptionHostname(name string) JoinOption {
|
||||||
return func(ep *endpoint) {
|
return func(ep *endpoint) {
|
||||||
ep.container.Config.Hostname = name
|
ep.container.config.hostName = name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ func JoinOptionHostname(name string) JoinOption {
|
||||||
// be passed to endpoint Join method.
|
// be passed to endpoint Join method.
|
||||||
func JoinOptionDomainname(name string) JoinOption {
|
func JoinOptionDomainname(name string) JoinOption {
|
||||||
return func(ep *endpoint) {
|
return func(ep *endpoint) {
|
||||||
ep.container.Config.Domainname = name
|
ep.container.config.domainName = name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue