Skip to content

Commit df5d2e6

Browse files
authored
Merge pull request #2628 from alexandear/refactor/simplify-bool-var-init
Simplify initialization of bool variables
2 parents 95d1863 + c93a4ac commit df5d2e6

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

cmd/limactl/copy.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ func copyAction(cmd *cobra.Command, args []string) error {
6565
if recursive {
6666
scpFlags = append(scpFlags, "-r")
6767
}
68-
legacySSH := false
69-
if sshutil.DetectOpenSSHVersion().LessThan(*semver.New("8.0.0")) {
70-
legacySSH = true
71-
}
68+
legacySSH := sshutil.DetectOpenSSHVersion().LessThan(*semver.New("8.0.0"))
7269
for _, arg := range args {
7370
path := strings.Split(arg, ":")
7471
switch len(path) {

pkg/guestagent/iptables/iptables.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ func parsePortsFromRules(rules []string) ([]Entry, error) {
7272
return nil, err
7373
}
7474

75-
istcp := false
76-
if found[2] == "tcp" {
77-
istcp = true
78-
}
75+
istcp := found[2] == "tcp"
7976

8077
// When no IP is present the rule applies to all interfaces.
8178
ip := found[1]

pkg/instance/start.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ func Prepare(ctx context.Context, inst *store.Instance) (*Prepared, error) {
9797
}
9898

9999
// Check if the instance has been created (the base disk already exists)
100-
created := false
101100
baseDisk := filepath.Join(inst.Dir, filenames.BaseDisk)
102-
if _, err := os.Stat(baseDisk); err == nil {
103-
created = true
104-
}
101+
_, err = os.Stat(baseDisk)
102+
created := err == nil
103+
105104
if err := limaDriver.CreateDisk(ctx); err != nil {
106105
return nil, err
107106
}

0 commit comments

Comments
 (0)