Skip to content

Commit f222c1e

Browse files
authored
Merge pull request moby#52054 from thaJeztah/TrySetNetworkMount_switch
daemon/container: Container.TrySetNetworkMount: use switch
2 parents 8dfa3a9 + 9d77f4a commit f222c1e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

daemon/container/container_unix.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,19 @@ const (
3232
// TrySetNetworkMount attempts to set the network mounts given a provided destination and
3333
// the path to use for it; return true if the given destination was a network mount file
3434
func (container *Container) TrySetNetworkMount(destination string, path string) bool {
35-
if destination == "/etc/resolv.conf" {
35+
switch destination {
36+
case "/etc/resolv.conf":
3637
container.ResolvConfPath = path
3738
return true
38-
}
39-
if destination == "/etc/hostname" {
39+
case "/etc/hostname":
4040
container.HostnamePath = path
4141
return true
42-
}
43-
if destination == "/etc/hosts" {
42+
case "/etc/hosts":
4443
container.HostsPath = path
4544
return true
45+
default:
46+
return false
4647
}
47-
48-
return false
4948
}
5049

5150
// BuildHostnameFile writes the container's hostname file.

0 commit comments

Comments
 (0)