mirror of
https://github.com/tuna/tunasync.git
synced 2025-06-13 04:17:00 +00:00
Fix numerous lint issues
Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
This commit is contained in:
parent
c01de06ac3
commit
d2b3e731bf
@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/moby/moby/pkg/reexec"
|
||||
"github.com/moby/sys/reexec"
|
||||
"github.com/pkg/profile"
|
||||
"github.com/urfave/cli"
|
||||
"gopkg.in/op/go-logging.v1"
|
||||
|
2
go.mod
2
go.mod
@ -18,6 +18,7 @@ require (
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/imdario/mergo v0.3.16
|
||||
github.com/moby/moby v28.0.1+incompatible
|
||||
github.com/moby/sys/reexec v0.1.0
|
||||
github.com/opencontainers/runtime-spec v1.2.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/profile v1.7.0
|
||||
@ -67,7 +68,6 @@ require (
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/moby/sys/reexec v0.1.0 // indirect
|
||||
github.com/moby/sys/userns v0.1.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
cgroups "github.com/containerd/cgroups/v3"
|
||||
cgv1 "github.com/containerd/cgroups/v3/cgroup1"
|
||||
cgv2 "github.com/containerd/cgroups/v3/cgroup2"
|
||||
"github.com/moby/moby/pkg/reexec"
|
||||
"github.com/moby/sys/reexec"
|
||||
contspecs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
cgv1 "github.com/containerd/cgroups/v3/cgroup1"
|
||||
cgv2 "github.com/containerd/cgroups/v3/cgroup2"
|
||||
units "github.com/docker/go-units"
|
||||
"github.com/moby/moby/pkg/reexec"
|
||||
"github.com/moby/sys/reexec"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
@ -250,7 +250,7 @@ sleep 30
|
||||
if cgcf.Group == "" {
|
||||
wkrg, err := cgv2.NestedGroupPath("")
|
||||
So(err, ShouldBeNil)
|
||||
wkrMgr, err := cgv2.Load(wkrg)
|
||||
wkrMgr, _ := cgv2.Load(wkrg)
|
||||
allCtrls, err := wkrMgr.Controllers()
|
||||
So(err, ShouldBeNil)
|
||||
err = wkrMgr.ToggleControllers(allCtrls, cgv2.Disable)
|
||||
|
@ -10,12 +10,12 @@ import (
|
||||
func TestConfigDiff(t *testing.T) {
|
||||
Convey("When old and new configs are equal", t, func() {
|
||||
oldList := []mirrorConfig{
|
||||
mirrorConfig{Name: "debian"},
|
||||
mirrorConfig{Name: "debian-security"},
|
||||
mirrorConfig{Name: "fedora"},
|
||||
mirrorConfig{Name: "archlinux"},
|
||||
mirrorConfig{Name: "AOSP"},
|
||||
mirrorConfig{Name: "ubuntu"},
|
||||
{Name: "debian"},
|
||||
{Name: "debian-security"},
|
||||
{Name: "fedora"},
|
||||
{Name: "archlinux"},
|
||||
{Name: "AOSP"},
|
||||
{Name: "ubuntu"},
|
||||
}
|
||||
newList := make([]mirrorConfig, len(oldList))
|
||||
copy(newList, oldList)
|
||||
@ -25,12 +25,12 @@ func TestConfigDiff(t *testing.T) {
|
||||
})
|
||||
Convey("When old config is empty", t, func() {
|
||||
newList := []mirrorConfig{
|
||||
mirrorConfig{Name: "debian"},
|
||||
mirrorConfig{Name: "debian-security"},
|
||||
mirrorConfig{Name: "fedora"},
|
||||
mirrorConfig{Name: "archlinux"},
|
||||
mirrorConfig{Name: "AOSP"},
|
||||
mirrorConfig{Name: "ubuntu"},
|
||||
{Name: "debian"},
|
||||
{Name: "debian-security"},
|
||||
{Name: "fedora"},
|
||||
{Name: "archlinux"},
|
||||
{Name: "AOSP"},
|
||||
{Name: "ubuntu"},
|
||||
}
|
||||
oldList := make([]mirrorConfig, 0)
|
||||
|
||||
@ -39,12 +39,12 @@ func TestConfigDiff(t *testing.T) {
|
||||
})
|
||||
Convey("When new config is empty", t, func() {
|
||||
oldList := []mirrorConfig{
|
||||
mirrorConfig{Name: "debian"},
|
||||
mirrorConfig{Name: "debian-security"},
|
||||
mirrorConfig{Name: "fedora"},
|
||||
mirrorConfig{Name: "archlinux"},
|
||||
mirrorConfig{Name: "AOSP"},
|
||||
mirrorConfig{Name: "ubuntu"},
|
||||
{Name: "debian"},
|
||||
{Name: "debian-security"},
|
||||
{Name: "fedora"},
|
||||
{Name: "archlinux"},
|
||||
{Name: "AOSP"},
|
||||
{Name: "ubuntu"},
|
||||
}
|
||||
newList := make([]mirrorConfig, 0)
|
||||
|
||||
@ -53,19 +53,19 @@ func TestConfigDiff(t *testing.T) {
|
||||
})
|
||||
Convey("When giving two config lists with different names", t, func() {
|
||||
oldList := []mirrorConfig{
|
||||
mirrorConfig{Name: "debian"},
|
||||
mirrorConfig{Name: "debian-security"},
|
||||
mirrorConfig{Name: "fedora"},
|
||||
mirrorConfig{Name: "archlinux"},
|
||||
mirrorConfig{Name: "AOSP", Env: map[string]string{"REPO": "/usr/bin/repo"}},
|
||||
mirrorConfig{Name: "ubuntu"},
|
||||
{Name: "debian"},
|
||||
{Name: "debian-security"},
|
||||
{Name: "fedora"},
|
||||
{Name: "archlinux"},
|
||||
{Name: "AOSP", Env: map[string]string{"REPO": "/usr/bin/repo"}},
|
||||
{Name: "ubuntu"},
|
||||
}
|
||||
newList := []mirrorConfig{
|
||||
mirrorConfig{Name: "debian"},
|
||||
mirrorConfig{Name: "debian-cd"},
|
||||
mirrorConfig{Name: "archlinuxcn"},
|
||||
mirrorConfig{Name: "AOSP", Env: map[string]string{"REPO": "/usr/local/bin/aosp-repo"}},
|
||||
mirrorConfig{Name: "ubuntu-ports"},
|
||||
{Name: "debian"},
|
||||
{Name: "debian-cd"},
|
||||
{Name: "archlinuxcn"},
|
||||
{Name: "AOSP", Env: map[string]string{"REPO": "/usr/local/bin/aosp-repo"}},
|
||||
{Name: "ubuntu-ports"},
|
||||
}
|
||||
|
||||
difference := diffMirrorConfig(oldList, newList)
|
||||
|
@ -77,7 +77,7 @@ func newRsyncProvider(c rsyncConfig) (*rsyncProvider, error) {
|
||||
options = c.overriddenOptions
|
||||
}
|
||||
|
||||
if c.useOverrideOnly == true {
|
||||
if c.useOverrideOnly {
|
||||
if c.overriddenOptions == nil {
|
||||
return nil, errors.New("rsync_override_only is set but no rsync_override provided")
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/codeskyblue/go-sh"
|
||||
cgv1 "github.com/containerd/cgroups/v3/cgroup1"
|
||||
"github.com/moby/moby/pkg/reexec"
|
||||
"github.com/moby/sys/reexec"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
|
@ -147,7 +147,7 @@ func TestWorker(t *testing.T) {
|
||||
})
|
||||
Convey("with one job", func(ctx C) {
|
||||
workerCfg.Mirrors = []mirrorConfig{
|
||||
mirrorConfig{
|
||||
{
|
||||
Name: "job-ls",
|
||||
Provider: provCommand,
|
||||
Command: "ls",
|
||||
@ -194,17 +194,17 @@ func TestWorker(t *testing.T) {
|
||||
})
|
||||
Convey("with several jobs", func(ctx C) {
|
||||
workerCfg.Mirrors = []mirrorConfig{
|
||||
mirrorConfig{
|
||||
{
|
||||
Name: "job-ls-1",
|
||||
Provider: provCommand,
|
||||
Command: "ls",
|
||||
},
|
||||
mirrorConfig{
|
||||
{
|
||||
Name: "job-fail",
|
||||
Provider: provCommand,
|
||||
Command: "non-existent-command-xxxx",
|
||||
},
|
||||
mirrorConfig{
|
||||
{
|
||||
Name: "job-ls-2",
|
||||
Provider: provCommand,
|
||||
Command: "ls",
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
func TestZFSHook(t *testing.T) {
|
||||
|
||||
Convey("ZFS Hook should work", t, func(ctx C) {
|
||||
tmpDir, err := os.MkdirTemp("", "tunasync")
|
||||
tmpDir, _ := os.MkdirTemp("", "tunasync")
|
||||
tmpFile := filepath.Join(tmpDir, "log_file")
|
||||
|
||||
c := cmdConfig{
|
||||
|
Loading…
x
Reference in New Issue
Block a user