Skip to content

Commit

Permalink
Simplify initialization of bool variables
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
  • Loading branch information
alexandear committed Sep 18, 2024
1 parent 4c687f7 commit c93a4ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
5 changes: 1 addition & 4 deletions cmd/limactl/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ func copyAction(cmd *cobra.Command, args []string) error {
if recursive {
scpFlags = append(scpFlags, "-r")
}
legacySSH := false
if sshutil.DetectOpenSSHVersion().LessThan(*semver.New("8.0.0")) {
legacySSH = true
}
legacySSH := sshutil.DetectOpenSSHVersion().LessThan(*semver.New("8.0.0"))
for _, arg := range args {
path := strings.Split(arg, ":")
switch len(path) {
Expand Down
5 changes: 1 addition & 4 deletions pkg/guestagent/iptables/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ func parsePortsFromRules(rules []string) ([]Entry, error) {
return nil, err
}

istcp := false
if found[2] == "tcp" {
istcp = true
}
istcp := found[2] == "tcp"

// When no IP is present the rule applies to all interfaces.
ip := found[1]
Expand Down
7 changes: 3 additions & 4 deletions pkg/instance/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ func Prepare(ctx context.Context, inst *store.Instance) (*Prepared, error) {
}

// Check if the instance has been created (the base disk already exists)
created := false
baseDisk := filepath.Join(inst.Dir, filenames.BaseDisk)
if _, err := os.Stat(baseDisk); err == nil {
created = true
}
_, err = os.Stat(baseDisk)
created := err == nil

if err := limaDriver.CreateDisk(ctx); err != nil {
return nil, err
}
Expand Down

0 comments on commit c93a4ac

Please sign in to comment.