Fix code formatting according to go-staticcheck

This commit is contained in:
kebyn 2022-03-12 13:16:45 +00:00
parent c07aaffe65
commit d8b2675fda
15 changed files with 309 additions and 308 deletions

View File

@ -9,10 +9,10 @@ import (
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/pkg/profile"
"gopkg.in/op/go-logging.v1"
"github.com/urfave/cli"
"github.com/moby/moby/pkg/reexec" "github.com/moby/moby/pkg/reexec"
"github.com/pkg/profile"
"github.com/urfave/cli"
"gopkg.in/op/go-logging.v1"
tunasync "github.com/tuna/tunasync/internal" tunasync "github.com/tuna/tunasync/internal"
"github.com/tuna/tunasync/manager" "github.com/tuna/tunasync/manager"

View File

@ -12,9 +12,9 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/moby/moby/pkg/reexec"
cgv1 "github.com/containerd/cgroups" cgv1 "github.com/containerd/cgroups"
cgv2 "github.com/containerd/cgroups/v2" cgv2 "github.com/containerd/cgroups/v2"
"github.com/moby/moby/pkg/reexec"
contspecs "github.com/opencontainers/runtime-spec/specs-go" contspecs "github.com/opencontainers/runtime-spec/specs-go"
) )
@ -51,14 +51,15 @@ func waitExec () {
panic(err) panic(err)
} }
if err := pipe.Close(); err != nil { if err := pipe.Close(); err != nil {
panic(err)
} }
cmd := execCmd(string(cmdBytes)) cmd := execCmd(string(cmdBytes))
switch cmd { switch cmd {
case cmdAbrt: case cmdAbrt:
fallthrough fallthrough
case cmdCont:
default: default:
panic("Exited on request") panic("Exited on request")
case cmdCont:
} }
} }
} }
@ -71,7 +72,7 @@ func waitExec () {
panic("Exec failed.") panic("Exec failed.")
} }
func initCgroup(cfg *cgroupConfig) (error) { func initCgroup(cfg *cgroupConfig) error {
logger.Debugf("Initializing cgroup") logger.Debugf("Initializing cgroup")
baseGroup := cfg.Group baseGroup := cfg.Group
@ -103,7 +104,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
} }
if baseGroup == "" { if baseGroup == "" {
logger.Debugf("Creating a sub group and move all processes into it") logger.Debugf("Creating a sub group and move all processes into it")
wkrMgr, err := cfg.cgMgrV2.NewChild("__worker", nil); wkrMgr, err := cfg.cgMgrV2.NewChild("__worker", nil)
if err != nil { if err != nil {
return err return err
} }
@ -117,7 +118,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
if len(procs) == 0 { if len(procs) == 0 {
break break
} }
for _, p := range(procs) { for _, p := range procs {
if err := wkrMgr.AddProc(p); err != nil { if err := wkrMgr.AddProc(p); err != nil {
if errors.Is(err, syscall.ESRCH) { if errors.Is(err, syscall.ESRCH) {
logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring") logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring")
@ -129,7 +130,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
} }
} else { } else {
logger.Debugf("Trying to create a sub group in that group") logger.Debugf("Trying to create a sub group in that group")
testMgr, err := cfg.cgMgrV2.NewChild("__test", nil); testMgr, err := cfg.cgMgrV2.NewChild("__test", nil)
if err != nil { if err != nil {
logger.Errorf("Cannot create a sub group in the cgroup") logger.Errorf("Cannot create a sub group in the cgroup")
return err return err
@ -143,7 +144,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
return err return err
} }
if len(procs) != 0 { if len(procs) != 0 {
return fmt.Errorf("There are remaining processes in cgroup %s", baseGroup) return fmt.Errorf("there are remaining processes in cgroup %s", baseGroup)
} }
} }
} else { } else {
@ -152,9 +153,9 @@ func initCgroup(cfg *cgroupConfig) (error) {
if baseGroup != "" { if baseGroup != "" {
pather = cgv1.StaticPath(baseGroup) pather = cgv1.StaticPath(baseGroup)
} else { } else {
pather = (func(p cgv1.Path) (cgv1.Path){ pather = (func(p cgv1.Path) cgv1.Path {
return func(subsys cgv1.Name) (string, error) { return func(subsys cgv1.Name) (string, error) {
path, err := p(subsys); path, err := p(subsys)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -174,7 +175,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
return err return err
} }
logger.Debugf("Available subsystems:") logger.Debugf("Available subsystems:")
for _, subsys := range(cfg.cgMgrV1.Subsystems()) { for _, subsys := range cfg.cgMgrV1.Subsystems() {
p, err := pather(subsys.Name()) p, err := pather(subsys.Name())
if err != nil { if err != nil {
return err return err
@ -183,11 +184,11 @@ func initCgroup(cfg *cgroupConfig) (error) {
} }
if baseGroup == "" { if baseGroup == "" {
logger.Debugf("Creating a sub group and move all processes into it") logger.Debugf("Creating a sub group and move all processes into it")
wkrMgr, err := cfg.cgMgrV1.New("__worker", &contspecs.LinuxResources{}); wkrMgr, err := cfg.cgMgrV1.New("__worker", &contspecs.LinuxResources{})
if err != nil { if err != nil {
return err return err
} }
for _, subsys := range(cfg.cgMgrV1.Subsystems()) { for _, subsys := range cfg.cgMgrV1.Subsystems() {
logger.Debugf("Reading pids for subsystem %s", subsys.Name()) logger.Debugf("Reading pids for subsystem %s", subsys.Name())
for { for {
procs, err := cfg.cgMgrV1.Processes(subsys.Name(), false) procs, err := cfg.cgMgrV1.Processes(subsys.Name(), false)
@ -202,7 +203,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
if len(procs) == 0 { if len(procs) == 0 {
break break
} }
for _, proc := range(procs) { for _, proc := range procs {
if err := wkrMgr.Add(proc); err != nil { if err := wkrMgr.Add(proc); err != nil {
if errors.Is(err, syscall.ESRCH) { if errors.Is(err, syscall.ESRCH) {
logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring") logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring")
@ -215,7 +216,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
} }
} else { } else {
logger.Debugf("Trying to create a sub group in that group") logger.Debugf("Trying to create a sub group in that group")
testMgr, err := cfg.cgMgrV1.New("__test", &contspecs.LinuxResources{}); testMgr, err := cfg.cgMgrV1.New("__test", &contspecs.LinuxResources{})
if err != nil { if err != nil {
logger.Errorf("Cannot create a sub group in the cgroup") logger.Errorf("Cannot create a sub group in the cgroup")
return err return err
@ -223,7 +224,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
if err := testMgr.Delete(); err != nil { if err := testMgr.Delete(); err != nil {
return err return err
} }
for _, subsys := range(cfg.cgMgrV1.Subsystems()) { for _, subsys := range cfg.cgMgrV1.Subsystems() {
logger.Debugf("Reading pids for subsystem %s", subsys.Name()) logger.Debugf("Reading pids for subsystem %s", subsys.Name())
procs, err := cfg.cgMgrV1.Processes(subsys.Name(), false) procs, err := cfg.cgMgrV1.Processes(subsys.Name(), false)
if err != nil { if err != nil {
@ -239,7 +240,7 @@ func initCgroup(cfg *cgroupConfig) (error) {
if err != nil { if err != nil {
return err return err
} }
return fmt.Errorf("There are remaining processes in cgroup %s of subsystem %s", p, subsys.Name()) return fmt.Errorf("there are remaining processes in cgroup %s of subsystem %s", p, subsys.Name())
} }
} }
} }
@ -334,7 +335,7 @@ func (c *cgroupHook) killAll() error {
taskList := []int{} taskList := []int{}
if c.cgCfg.isUnified { if c.cgCfg.isUnified {
procs, err := c.cgMgrV2.Procs(false) procs, err := c.cgMgrV2.Procs(false)
if (err != nil) { if err != nil {
return []int{}, err return []int{}, err
} }
for _, proc := range procs { for _, proc := range procs {
@ -342,16 +343,16 @@ func (c *cgroupHook) killAll() error {
} }
} else { } else {
taskSet := make(map[int]struct{}) taskSet := make(map[int]struct{})
for _, subsys := range(c.cgMgrV1.Subsystems()) { for _, subsys := range c.cgMgrV1.Subsystems() {
procs, err := c.cgMgrV1.Processes(subsys.Name(), false) procs, err := c.cgMgrV1.Processes(subsys.Name(), false)
if err != nil { if err != nil {
return []int{}, err return []int{}, err
} }
for _, proc := range(procs) { for _, proc := range procs {
taskSet[proc.Pid] = struct{}{} taskSet[proc.Pid] = struct{}{}
} }
} }
for proc := range(taskSet) { for proc := range taskSet {
taskList = append(taskList, proc) taskList = append(taskList, proc)
} }
} }
@ -360,7 +361,7 @@ func (c *cgroupHook) killAll() error {
for i := 0; i < 4; i++ { for i := 0; i < 4; i++ {
if i == 3 { if i == 3 {
return errors.New("Unable to kill all child tasks") return errors.New("unable to kill all child tasks")
} }
taskList, err := readTaskList() taskList, err := readTaskList()
if err != nil { if err != nil {

View File

@ -1,16 +1,17 @@
package worker package worker
import ( import (
"errors"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"syscall"
"testing" "testing"
"time" "time"
"errors"
"syscall"
cgv1 "github.com/containerd/cgroups" cgv1 "github.com/containerd/cgroups"
cgv2 "github.com/containerd/cgroups/v2" cgv2 "github.com/containerd/cgroups/v2"
units "github.com/docker/go-units" units "github.com/docker/go-units"
@ -228,7 +229,7 @@ sleep 30
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024)) So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024))
} else { } else {
for _, subsys := range(cg.cgMgrV1.Subsystems()) { for _, subsys := range cg.cgMgrV1.Subsystems() {
if subsys.Name() == cgv1.Memory { if subsys.Name() == cgv1.Memory {
cgpath := filepath.Join(cgcf.Group, provider.Name()) cgpath := filepath.Join(cgcf.Group, provider.Name())
if useCurrentCgroup { if useCurrentCgroup {
@ -248,9 +249,9 @@ sleep 30
Reset(func() { Reset(func() {
if cgcf.isUnified { if cgcf.isUnified {
if cgcf.Group == "" { if cgcf.Group == "" {
wkrg, err := cgv2.NestedGroupPath(""); wkrg, err := cgv2.NestedGroupPath("")
So(err, ShouldBeNil) So(err, ShouldBeNil)
wkrMgr, err := cgv2.LoadManager("/sys/fs/cgroup", wkrg); wkrMgr, _ := cgv2.LoadManager("/sys/fs/cgroup", wkrg)
allCtrls, err := wkrMgr.Controllers() allCtrls, err := wkrMgr.Controllers()
So(err, ShouldBeNil) So(err, ShouldBeNil)
err = wkrMgr.ToggleControllers(allCtrls, cgv2.Disable) err = wkrMgr.ToggleControllers(allCtrls, cgv2.Disable)
@ -263,7 +264,7 @@ sleep 30
if len(procs) == 0 { if len(procs) == 0 {
break break
} }
for _, p := range(procs) { for _, p := range procs {
if err := origMgr.AddProc(p); err != nil { if err := origMgr.AddProc(p); err != nil {
if errors.Is(err, syscall.ESRCH) { if errors.Is(err, syscall.ESRCH) {
logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring") logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring")
@ -278,9 +279,9 @@ sleep 30
} }
} else { } else {
if cgcf.Group == "" { if cgcf.Group == "" {
pather := (func(p cgv1.Path) (cgv1.Path){ pather := (func(p cgv1.Path) cgv1.Path {
return func(subsys cgv1.Name) (string, error) { return func(subsys cgv1.Name) (string, error) {
path, err := p(subsys); path, err := p(subsys)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -296,14 +297,14 @@ sleep 30
}) })
So(err, ShouldBeNil) So(err, ShouldBeNil)
origMgr := cgcf.cgMgrV1 origMgr := cgcf.cgMgrV1
for _, subsys := range(wkrMgr.Subsystems()){ for _, subsys := range wkrMgr.Subsystems() {
for { for {
procs, err := wkrMgr.Processes(subsys.Name(), false) procs, err := wkrMgr.Processes(subsys.Name(), false)
So(err, ShouldBeNil) So(err, ShouldBeNil)
if len(procs) == 0 { if len(procs) == 0 {
break break
} }
for _, proc := range(procs) { for _, proc := range procs {
if err := origMgr.Add(proc); err != nil { if err := origMgr.Add(proc); err != nil {
if errors.Is(err, syscall.ESRCH) { if errors.Is(err, syscall.ESRCH) {
logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring") logger.Debugf("Write pid %d to sub group failed: process vanished, ignoring")

View File

@ -106,7 +106,7 @@ func (p *cmdProvider) Run(started chan empty) error {
} }
if len(matches) != 0 { if len(matches) != 0 {
logger.Debug("Fail-on-match: %r", matches) logger.Debug("Fail-on-match: %r", matches)
return fmt.Errorf("Fail-on-match regexp found %d matches", len(matches)) return fmt.Errorf("fail-on-match regexp found %d matches", len(matches))
} }
} }
if p.sizePattern != nil { if p.sizePattern != nil {

View File

@ -6,10 +6,10 @@ import (
"path/filepath" "path/filepath"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/imdario/mergo"
units "github.com/docker/go-units"
cgv1 "github.com/containerd/cgroups" cgv1 "github.com/containerd/cgroups"
cgv2 "github.com/containerd/cgroups/v2" cgv2 "github.com/containerd/cgroups/v2"
units "github.com/docker/go-units"
"github.com/imdario/mergo"
) )
type providerEnum uint8 type providerEnum uint8
@ -30,7 +30,7 @@ func (p *providerEnum) UnmarshalText(text []byte) error {
case `two-stage-rsync`: case `two-stage-rsync`:
*p = provTwoStageRsync *p = provTwoStageRsync
default: default:
return errors.New("Invalid value to provierEnum") return errors.New("invalid value to provierEnum")
} }
return nil return nil
} }

View File

@ -10,12 +10,12 @@ import (
func TestConfigDiff(t *testing.T) { func TestConfigDiff(t *testing.T) {
Convey("When old and new configs are equal", t, func() { Convey("When old and new configs are equal", t, func() {
oldList := []mirrorConfig{ oldList := []mirrorConfig{
mirrorConfig{Name: "debian"}, {Name: "debian"},
mirrorConfig{Name: "debian-security"}, {Name: "debian-security"},
mirrorConfig{Name: "fedora"}, {Name: "fedora"},
mirrorConfig{Name: "archlinux"}, {Name: "archlinux"},
mirrorConfig{Name: "AOSP"}, {Name: "AOSP"},
mirrorConfig{Name: "ubuntu"}, {Name: "ubuntu"},
} }
newList := make([]mirrorConfig, len(oldList)) newList := make([]mirrorConfig, len(oldList))
copy(newList, oldList) copy(newList, oldList)
@ -25,19 +25,19 @@ func TestConfigDiff(t *testing.T) {
}) })
Convey("When giving two config lists with different names", t, func() { Convey("When giving two config lists with different names", t, func() {
oldList := []mirrorConfig{ oldList := []mirrorConfig{
mirrorConfig{Name: "debian"}, {Name: "debian"},
mirrorConfig{Name: "debian-security"}, {Name: "debian-security"},
mirrorConfig{Name: "fedora"}, {Name: "fedora"},
mirrorConfig{Name: "archlinux"}, {Name: "archlinux"},
mirrorConfig{Name: "AOSP", Env: map[string]string{"REPO": "/usr/bin/repo"}}, {Name: "AOSP", Env: map[string]string{"REPO": "/usr/bin/repo"}},
mirrorConfig{Name: "ubuntu"}, {Name: "ubuntu"},
} }
newList := []mirrorConfig{ newList := []mirrorConfig{
mirrorConfig{Name: "debian"}, {Name: "debian"},
mirrorConfig{Name: "debian-cd"}, {Name: "debian-cd"},
mirrorConfig{Name: "archlinuxcn"}, {Name: "archlinuxcn"},
mirrorConfig{Name: "AOSP", Env: map[string]string{"REPO": "/usr/local/bin/aosp-repo"}}, {Name: "AOSP", Env: map[string]string{"REPO": "/usr/local/bin/aosp-repo"}},
mirrorConfig{Name: "ubuntu-ports"}, {Name: "ubuntu-ports"},
} }
difference := diffMirrorConfig(oldList, newList) difference := diffMirrorConfig(oldList, newList)

View File

@ -34,7 +34,7 @@ func (ctx *Context) Enter() *Context {
// Exit return the upper layer of context // Exit return the upper layer of context
func (ctx *Context) Exit() (*Context, error) { func (ctx *Context) Exit() (*Context, error) {
if ctx.parent == nil { if ctx.parent == nil {
return nil, errors.New("Cannot exit the bottom layer context") return nil, errors.New("cannot exit the bottom layer context")
} }
return ctx.parent, nil return ctx.parent, nil
} }

View File

@ -49,7 +49,7 @@ func (d *dockerHook) preExec() error {
if _, err := os.Stat(workingDir); os.IsNotExist(err) { if _, err := os.Stat(workingDir); os.IsNotExist(err) {
logger.Debugf("Making dir %s", workingDir) logger.Debugf("Making dir %s", workingDir)
if err = os.MkdirAll(workingDir, 0755); err != nil { if err = os.MkdirAll(workingDir, 0755); err != nil {
return fmt.Errorf("Error making dir %s: %s", workingDir, err.Error()) return fmt.Errorf("error making dir %s: %s", workingDir, err.Error())
} }
} }

View File

@ -32,7 +32,7 @@ func newExecPostHook(provider mirrorProvider, execOn uint8, command string) (*ex
return nil, err return nil, err
} }
if execOn != execOnSuccess && execOn != execOnFailure { if execOn != execOnSuccess && execOn != execOnFailure {
return nil, fmt.Errorf("Invalid option for exec-on: %d", execOn) return nil, fmt.Errorf("invalid option for exec-on: %d", execOn)
} }
return &execPostHook{ return &execPostHook{
@ -92,7 +92,7 @@ func (h *execPostHook) Do() error {
args = append(args, arg) args = append(args, arg)
} }
} else { } else {
return errors.New("Invalid Command") return errors.New("invalid command")
} }
return session.Command(cmd, args...).Run() return session.Command(cmd, args...).Run()
} }

View File

@ -79,7 +79,7 @@ func (m *mirrorJob) SetState(state uint32) {
func (m *mirrorJob) SetProvider(provider mirrorProvider) error { func (m *mirrorJob) SetProvider(provider mirrorProvider) error {
s := m.State() s := m.State()
if (s != stateNone) && (s != stateDisabled) { if (s != stateNone) && (s != stateDisabled) {
return fmt.Errorf("Provider cannot be switched when job state is %d", s) return fmt.Errorf("provider cannot be switched when job state is %d", s)
} }
m.provider = provider m.provider = provider
return nil return nil

View File

@ -188,7 +188,7 @@ func newMirrorProvider(mirror mirrorConfig, cfg *Config) mirrorProvider {
p.isMaster = isMaster p.isMaster = isMaster
provider = p provider = p
default: default:
panic(errors.New("Invalid mirror provider")) panic(errors.New("invalid mirror provider"))
} }
// Add Logging Hook // Add Logging Hook

View File

@ -11,22 +11,21 @@ import (
"time" "time"
"github.com/codeskyblue/go-sh" "github.com/codeskyblue/go-sh"
"golang.org/x/sys/unix"
"github.com/moby/moby/pkg/reexec"
cgv1 "github.com/containerd/cgroups" cgv1 "github.com/containerd/cgroups"
"github.com/moby/moby/pkg/reexec"
"golang.org/x/sys/unix"
) )
// runner is to run os commands giving command line, env and log file // runner is to run os commands giving command line, env and log file
// it's an alternative to python-sh or go-sh // it's an alternative to python-sh or go-sh
var errProcessNotStarted = errors.New("Process Not Started") var errProcessNotStarted = errors.New("process not started")
type cmdJob struct { type cmdJob struct {
sync.Mutex sync.Mutex
cmd *exec.Cmd cmd *exec.Cmd
workingDir string workingDir string
env map[string]string env map[string]string
logFile *os.File
finished chan empty finished chan empty
provider mirrorProvider provider mirrorProvider
retErr error retErr error
@ -115,7 +114,7 @@ func (c *cmdJob) Start() error {
if cg != nil { if cg != nil {
logger.Debugf("Preparing cgroup sync pipes for job %s", c.provider.Name()) logger.Debugf("Preparing cgroup sync pipes for job %s", c.provider.Name())
var err error var err error
pipeR, pipeW, err = os.Pipe(); pipeR, pipeW, err = os.Pipe()
if err != nil { if err != nil {
return err return err
} }

View File

@ -112,7 +112,7 @@ func (p *twoStageRsyncProvider) Options(stage int) ([]string, error) {
options = append(options, p.stage1Options...) options = append(options, p.stage1Options...)
stage1Profile, ok := rsyncStage1Profiles[p.stage1Profile] stage1Profile, ok := rsyncStage1Profiles[p.stage1Profile]
if !ok { if !ok {
return nil, errors.New("Invalid Stage 1 Profile") return nil, errors.New("invalid stage 1 profile")
} }
for _, exc := range stage1Profile { for _, exc := range stage1Profile {
options = append(options, exc) options = append(options, exc)
@ -124,7 +124,7 @@ func (p *twoStageRsyncProvider) Options(stage int) ([]string, error) {
options = append(options, p.extraOptions...) options = append(options, p.extraOptions...)
} }
} else { } else {
return []string{}, fmt.Errorf("Invalid stage: %d", stage) return []string{}, fmt.Errorf("invalid stage: %d", stage)
} }
if !p.rsyncNeverTimeout { if !p.rsyncNeverTimeout {

View File

@ -147,7 +147,7 @@ func TestWorker(t *testing.T) {
}) })
Convey("with one job", func(ctx C) { Convey("with one job", func(ctx C) {
workerCfg.Mirrors = []mirrorConfig{ workerCfg.Mirrors = []mirrorConfig{
mirrorConfig{ {
Name: "job-ls", Name: "job-ls",
Provider: provCommand, Provider: provCommand,
Command: "ls", Command: "ls",
@ -194,17 +194,17 @@ func TestWorker(t *testing.T) {
}) })
Convey("with several jobs", func(ctx C) { Convey("with several jobs", func(ctx C) {
workerCfg.Mirrors = []mirrorConfig{ workerCfg.Mirrors = []mirrorConfig{
mirrorConfig{ {
Name: "job-ls-1", Name: "job-ls-1",
Provider: provCommand, Provider: provCommand,
Command: "ls", Command: "ls",
}, },
mirrorConfig{ {
Name: "job-fail", Name: "job-fail",
Provider: provCommand, Provider: provCommand,
Command: "non-existent-command-xxxx", Command: "non-existent-command-xxxx",
}, },
mirrorConfig{ {
Name: "job-ls-2", Name: "job-ls-2",
Provider: provCommand, Provider: provCommand,
Command: "ls", Command: "ls",

View File

@ -13,7 +13,7 @@ import (
func TestZFSHook(t *testing.T) { func TestZFSHook(t *testing.T) {
Convey("ZFS Hook should work", t, func(ctx C) { Convey("ZFS Hook should work", t, func(ctx C) {
tmpDir, err := ioutil.TempDir("", "tunasync") tmpDir, _ := ioutil.TempDir("", "tunasync")
tmpFile := filepath.Join(tmpDir, "log_file") tmpFile := filepath.Join(tmpDir, "log_file")
c := cmdConfig{ c := cmdConfig{