Skip to content

Commit

Permalink
Just use stdlib "path.Dir"
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
  • Loading branch information
kke committed Jan 3, 2024
1 parent bd3b0cc commit 505456a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 69 deletions.
4 changes: 2 additions & 2 deletions phase/configure_k0s.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"bytes"
"context"
"fmt"
gopath "path"
"time"

"github.com/k0sproject/dig"
"github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1"
"github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster"
"github.com/k0sproject/k0sctl/pkg/node"
"github.com/k0sproject/k0sctl/pkg/paths"
"github.com/k0sproject/k0sctl/pkg/retry"
"github.com/k0sproject/rig/exec"
"github.com/k0sproject/version"
Expand Down Expand Up @@ -241,7 +241,7 @@ func (p *ConfigureK0s) configureK0s(h *cluster.Host) error {

log.Infof("%s: installing new configuration", h)
configPath := h.K0sConfigPath()
configDir := paths.Dir(configPath)
configDir := gopath.Dir(configPath)

if !h.Configurer.FileExist(h, configDir) {
if err := h.Execf(`install -d 0750 -o root -g root "%s"`, configDir, exec.Sudo(h)); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cluster
import (
"fmt"
gos "os"
gopath "path"
"regexp"
"strconv"
"strings"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/go-playground/validator/v10"
"github.com/jellydator/validation"
"github.com/jellydator/validation/is"
"github.com/k0sproject/k0sctl/pkg/paths"
"github.com/k0sproject/rig"
"github.com/k0sproject/rig/exec"
"github.com/k0sproject/rig/os"
Expand Down Expand Up @@ -377,7 +377,7 @@ func (h *Host) InstallK0sBinary(path string) error {
return fmt.Errorf("k0s binary tempfile not found")
}

dir := paths.Dir(h.Configurer.K0sBinaryPath())
dir := gopath.Dir(h.Configurer.K0sBinaryPath())
if err := h.Execf(`install -m 0755 -o root -g root -d "%s"`, dir, exec.Sudo(h)); err != nil {
return fmt.Errorf("create k0s binary dir: %w", err)
}
Expand Down
32 changes: 0 additions & 32 deletions pkg/paths/dirname.go

This file was deleted.

33 changes: 0 additions & 33 deletions pkg/paths/dirname_test.go

This file was deleted.

0 comments on commit 505456a

Please sign in to comment.