From c6d5a68e2b9c0f1fb9890cdfcc9133f2eb7e295d Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 8 Oct 2018 16:52:45 +0200 Subject: [PATCH] Fix tests Signed-off-by: Knut Ahlers --- Makefile | 8 +------- configfile.go | 2 +- configfile_test.go | 4 +--- main.go | 6 +++--- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 5523bf9..8aad006 100644 --- a/Makefile +++ b/Makefile @@ -14,13 +14,7 @@ setup-testenv: gometalinter --install --update test: - ginkgo - gometalinter \ - --cyclo-over=15 \ - --deadline=20s \ - --exclude=bindata.go \ - --exclude=configfile_test.go \ - -D errcheck + go test -v install: go install -a -ldflags "-X main.version=$(shell git describe --tags || git rev-parse --short HEAD || echo dev)" diff --git a/configfile.go b/configfile.go index a60450d..7d99313 100644 --- a/configfile.go +++ b/configfile.go @@ -63,7 +63,7 @@ type configFile struct { } `yaml:"swift"` Include []string `yaml:"inclist"` Exclude []string `yaml:"exclist"` - IncExcFile string `yaml:"incexcfile" valid:"customFileExistsValidator,required"` + IncExcFile string `yaml:"incexcfile" valid:"customFileExistsValidator"` ExcludeDeviceFiles bool `yaml:"excdevicefiles"` Encryption struct { Enable bool `yaml:"enable"` diff --git a/configfile_test.go b/configfile_test.go index 43a3006..575bc06 100644 --- a/configfile_test.go +++ b/configfile_test.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "regexp" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -30,7 +29,6 @@ logdir: /var/log/duplicity/ var ( commandLine, env, argv []string - logFilter *regexp.Regexp loadErr, err error t string cf *configFile @@ -42,7 +40,7 @@ logdir: /var/log/duplicity/ if loadErr != nil { panic(loadErr) } - commandLine, env, logFilter, err = cf.GenerateCommand(argv, t) + commandLine, env, _, err = cf.GenerateCommand(argv, t) }) Context("Backup with given config", func() { diff --git a/main.go b/main.go index dcd3cd5..a292899 100644 --- a/main.go +++ b/main.go @@ -39,8 +39,7 @@ var ( ) func initCFG() { - var err error - if err = rconfig.Parse(&cfg); err != nil { + if err := rconfig.Parse(&cfg); err != nil { log.WithError(err).Fatal("Error while parsing arguments") } @@ -55,6 +54,7 @@ func initCFG() { log.Fatalf("Unable to parse log level: %s", err) } + var err error if cfg.ConfigFile, err = homedir.Expand(cfg.ConfigFile); err != nil { log.WithError(err).Fatal("Unable to expand config-file") } @@ -101,7 +101,7 @@ func main() { } // Initialize logfile - if err := os.MkdirAll(config.LogDirectory, 0750); err != nil { + if err = os.MkdirAll(config.LogDirectory, 0750); err != nil { log.WithError(err).Fatal("Unable to create log dir") }