Skip to content

Commit

Permalink
chore: remove redundant len check
Browse files Browse the repository at this point in the history
From the Go specification [1]:

  "3. If the map is nil, the number of iterations is 0."

`len` returns 0 if the map is nil [2]. Therefore, checking `len(v) > 0`
around a loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range
[2]: https://pkg.go.dev/builtin#len

Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee committed Oct 7, 2023
1 parent fdc6c23 commit 87172fe
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ func (l processManager) Start(ctx context.Context, conf config.Config) error {
}
if conf.Network.Driver == gvproxy.Name {
args = append(args, "--gvproxy")
if len(conf.Network.DNSHosts) > 0 {
for host, ip := range conf.Network.DNSHosts {
args = append(args, "--gvproxy-hosts", host+"="+ip)
}
for host, ip := range conf.Network.DNSHosts {
args = append(args, "--gvproxy-hosts", host+"="+ip)
}
}

Expand Down

0 comments on commit 87172fe

Please sign in to comment.