Updated dependencies

This commit is contained in:
Quentin McGaw
2020-04-19 18:13:48 +00:00
parent cbd11bfdf2
commit e805d42197
21 changed files with 140 additions and 108 deletions

7
internal/env/env.go vendored
View File

@@ -1,6 +1,7 @@
package env
import (
"context"
"os"
"github.com/qdm12/golibs/logging"
@@ -8,7 +9,7 @@ import (
type Env interface {
FatalOnError(err error)
PrintVersion(program string, commandFn func() (string, error))
PrintVersion(ctx context.Context, program string, commandFn func(ctx context.Context) (string, error))
}
type env struct {
@@ -30,8 +31,8 @@ func (e *env) FatalOnError(err error) {
}
}
func (e *env) PrintVersion(program string, commandFn func() (string, error)) {
version, err := commandFn()
func (e *env) PrintVersion(ctx context.Context, program string, commandFn func(ctx context.Context) (string, error)) {
version, err := commandFn(ctx)
if err != nil {
e.logger.Error(err)
} else {

View File

@@ -1,6 +1,7 @@
package env
import (
"context"
"fmt"
"testing"
@@ -75,8 +76,8 @@ func Test_PrintVersion(t *testing.T) {
}).Times(1)
}
e := &env{logger: logger}
commandFn := func() (string, error) { return tc.commandVersion, tc.commandErr }
e.PrintVersion(tc.program, commandFn)
commandFn := func(ctx context.Context) (string, error) { return tc.commandVersion, tc.commandErr }
e.PrintVersion(context.Background(), tc.program, commandFn)
if tc.commandErr != nil {
assert.Equal(t, logged, tc.commandErr.Error())
} else {