Skip to content

daemon: Daemon.newContainer: inline Daemon.generateHostname#48704

Merged
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:refactor_hostname
Oct 21, 2024
Merged

daemon: Daemon.newContainer: inline Daemon.generateHostname#48704
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:refactor_hostname

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

generateHostname was only used here, and defined as a method on Daemon without depending on the daemon type. Inline the function and simplify the logic (as both the "network=host" and non-host code only had to be executed if no hostname was set).

@thaJeztah thaJeztah added status/2-code-review area/daemon Core Engine kind/refactor PR's that refactor, or clean-up code labels Oct 20, 2024
@thaJeztah thaJeztah added this to the 28.0.0 milestone Oct 20, 2024
@thaJeztah thaJeztah self-assigned this Oct 20, 2024
Comment thread daemon/container.go
generateHostname was only used here, and defined as a method on Daemon
without depending on the daemon type. Inline the function and simplify
the logic (as both the "network=host" and non-host code only had to be
executed if no hostname was set).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
The error would always be nil at this point, so let's make that explicit.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah merged commit 03b2d96 into moby:master Oct 21, 2024
@thaJeztah thaJeztah deleted the refactor_hostname branch October 21, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine kind/refactor PR's that refactor, or clean-up code status/4-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants