Skip to content

Commit

Permalink
refactor: extract go-cmd into a separate library
Browse files Browse the repository at this point in the history
To be used in the `go-blockdevice` library.

Signed-off-by: Artem Chernyshev <artem.0xD2@gmail.com>
  • Loading branch information
Unix4ever authored and talos-bot committed Feb 16, 2021
1 parent 8d7a36c commit f96548e
Show file tree
Hide file tree
Showing 27 changed files with 23 additions and 798 deletions.
2 changes: 1 addition & 1 deletion cmd/installer/cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"strings"

"github.com/spf13/cobra"
"github.com/talos-systems/go-cmd/pkg/cmd"

"github.com/talos-systems/talos/cmd/installer/pkg"
"github.com/talos-systems/talos/cmd/installer/pkg/install"
Expand All @@ -22,7 +23,6 @@ import (
"github.com/talos-systems/talos/internal/app/machined/pkg/runtime"
"github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/platform"
"github.com/talos-systems/talos/pkg/archiver"
"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/talos/pkg/machinery/constants"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/installer/pkg/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package pkg
import (
"fmt"

"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/go-cmd/pkg/cmd"
)

// CreateISO creates an iso by invoking the `grub-mkrescue` command.
Expand Down
2 changes: 1 addition & 1 deletion cmd/installer/pkg/losetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"strings"

"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/go-cmd/pkg/cmd"
)

// Loattach attaches a loopback device by inoking the `losetup` command.
Expand Down
3 changes: 2 additions & 1 deletion cmd/installer/pkg/ova/ova.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import (
"strings"
"text/template"

"github.com/talos-systems/go-cmd/pkg/cmd"

"github.com/talos-systems/talos/cmd/installer/pkg"
"github.com/talos-systems/talos/cmd/installer/pkg/qemuimg"
"github.com/talos-systems/talos/pkg/cmd"
)

const mfTpl = `SHA256({{ .VMDK }})= {{ .VMDKSHA }}
Expand Down
2 changes: 1 addition & 1 deletion cmd/installer/pkg/qemuimg/qemuimg.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package qemuimg

import "github.com/talos-systems/talos/pkg/cmd"
import "github.com/talos-systems/go-cmd/pkg/cmd"

// Convert converts an image from one format to another.
func Convert(inputFmt, outputFmt, options, src, dest string) (err error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/installer/pkg/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package pkg
import (
"fmt"

"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/go-cmd/pkg/cmd"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/Microsoft/hcsshim v0.8.10 // indirect
github.com/Microsoft/hcsshim/test v0.0.0-20201124231931-de74fe8b94ae // indirect
github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2
github.com/beevik/ntp v0.3.0
github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327
github.com/containerd/containerd v1.4.3
Expand Down Expand Up @@ -66,6 +65,7 @@ require (
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
github.com/talos-systems/crypto v0.2.1-0.20210202170911-39584f1b6e54
github.com/talos-systems/go-blockdevice v0.2.0
github.com/talos-systems/go-cmd v0.0.0-20210216164758-68eb0067e0f0
github.com/talos-systems/go-loadbalancer v0.1.0
github.com/talos-systems/go-procfs v0.0.0-20210108152626-8cbc42d3dc24
github.com/talos-systems/go-retry v0.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,8 @@ github.com/talos-systems/crypto v0.2.1-0.20210202170911-39584f1b6e54 h1:2IGs3f0q
github.com/talos-systems/crypto v0.2.1-0.20210202170911-39584f1b6e54/go.mod h1:OXCK52Q0dzm88YRG4VdTBdidkPUtqrCxCyW7bUs4DAw=
github.com/talos-systems/go-blockdevice v0.2.0 h1:tTu0ak3GfF8iSxNsdsicVhTKebIcyBARQYxhRV86AF0=
github.com/talos-systems/go-blockdevice v0.2.0/go.mod h1:DGbop5CJa0PYdhQK9cNVF61pPJNedas1m7Gi/qAnrsM=
github.com/talos-systems/go-cmd v0.0.0-20210216164758-68eb0067e0f0 h1:DI+BjK+fcrLBc70Fi50dZocQcaHosqsuWHrGHKp2NzE=
github.com/talos-systems/go-cmd v0.0.0-20210216164758-68eb0067e0f0/go.mod h1:kf+rZzTEmlDiYQ6ulslvRONnKLQH8x83TowltGMhO+k=
github.com/talos-systems/go-loadbalancer v0.1.0 h1:MQFONvSjoleU8RrKq1O1Z8CyTCJGd4SLqdAHDlR6o9s=
github.com/talos-systems/go-loadbalancer v0.1.0/go.mod h1:D5Qjfz+29WVjONWECZvOkmaLsBb3f5YeWME0u/5HmIc=
github.com/talos-systems/go-procfs v0.0.0-20210108152626-8cbc42d3dc24 h1:fN8vYvlB9XBQ5aImb1vLgR0ZaDwvfZfBMptqkpi3aEg=
Expand Down
4 changes: 2 additions & 2 deletions internal/app/machined/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"syscall"
"time"

"github.com/talos-systems/go-cmd/pkg/cmd/proc"
"github.com/talos-systems/go-cmd/pkg/cmd/proc/reaper"
"github.com/talos-systems/go-procfs/procfs"
"golang.org/x/net/http/httpproxy"
"golang.org/x/sys/unix"
Expand All @@ -31,8 +33,6 @@ import (
"github.com/talos-systems/talos/pkg/machinery/api/common"
"github.com/talos-systems/talos/pkg/machinery/api/machine"
"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/proc"
"github.com/talos-systems/talos/pkg/proc/reaper"
"github.com/talos-systems/talos/pkg/startup"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import (
"regexp"
"text/template"

"github.com/talos-systems/go-cmd/pkg/cmd"
"golang.org/x/sys/unix"

"github.com/talos-systems/talos/internal/app/machined/pkg/runtime"
advcommon "github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv"
"github.com/talos-systems/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/syslinux"
"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/talos/pkg/machinery/constants"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/talos-systems/go-blockdevice/blockdevice"
"github.com/talos-systems/go-blockdevice/blockdevice/partition/gpt"
"github.com/talos-systems/go-blockdevice/blockdevice/util"
"github.com/talos-systems/go-cmd/pkg/cmd"
"github.com/talos-systems/go-procfs/procfs"
"github.com/talos-systems/go-retry/retry"
"golang.org/x/sys/unix"
Expand All @@ -53,7 +54,6 @@ import (
"github.com/talos-systems/talos/internal/pkg/kernel/kspp"
"github.com/talos-systems/talos/internal/pkg/kmsg"
"github.com/talos-systems/talos/internal/pkg/mount"
"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/talos/pkg/conditions"
"github.com/talos-systems/talos/pkg/images"
"github.com/talos-systems/talos/pkg/kubernetes"
Expand Down
3 changes: 2 additions & 1 deletion internal/app/machined/pkg/system/runner/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
"syscall"
"time"

"github.com/talos-systems/go-cmd/pkg/cmd/proc/reaper"

"github.com/talos-systems/talos/internal/app/machined/pkg/system/events"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/runner"
"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/proc/reaper"
)

// processRunner is a runner.Runner that runs a process on the host.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import (
"time"

"github.com/stretchr/testify/suite"
"github.com/talos-systems/go-cmd/pkg/cmd/proc/reaper"

"github.com/talos-systems/talos/internal/app/machined/pkg/runtime"
"github.com/talos-systems/talos/internal/app/machined/pkg/runtime/logging"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/events"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/runner"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/runner/process"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/runner/restart"
"github.com/talos-systems/talos/pkg/proc/reaper"
)

func MockEventSink(state events.ServiceState, message string, args ...interface{}) {
Expand Down
3 changes: 2 additions & 1 deletion internal/app/machined/pkg/system/services/udevd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"fmt"
"time"

"github.com/talos-systems/go-cmd/pkg/cmd"

"github.com/talos-systems/talos/internal/app/machined/pkg/runtime"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/events"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/health"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/runner"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/runner/process"
"github.com/talos-systems/talos/internal/app/machined/pkg/system/runner/restart"
"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/talos/pkg/conditions"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/integration/base/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"time"

"github.com/stretchr/testify/suite"
"github.com/talos-systems/go-cmd/pkg/cmd"
"github.com/talos-systems/go-retry/retry"

"github.com/talos-systems/talos/pkg/cluster"
"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/machinery/constants"
)
Expand Down
58 changes: 0 additions & 58 deletions pkg/cmd/cmd.go

This file was deleted.

120 changes: 0 additions & 120 deletions pkg/cmd/cmd_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/makefs/vfat.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package makefs

import (
"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/go-cmd/pkg/cmd"
)

// VFAT creates a VFAT filesystem on the specified partition.
Expand Down
2 changes: 1 addition & 1 deletion pkg/makefs/xfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package makefs
import (
"fmt"

"github.com/talos-systems/talos/pkg/cmd"
"github.com/talos-systems/go-cmd/pkg/cmd"
)

// XFSGrow expands a XFS filesystem to the maximum possible. The partition
Expand Down

0 comments on commit f96548e

Please sign in to comment.