util: Port all code to new errwrap package

This should keep things more uniform.
This commit is contained in:
James Shubin
2019-03-12 16:09:14 -04:00
parent 54c81d6bb2
commit 880652f5d4
97 changed files with 109 additions and 136 deletions

View File

@@ -24,8 +24,8 @@ import (
"strings"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/util/errwrap"
errwrap "github.com/pkg/errors"
git "gopkg.in/src-d/go-git.v4"
)

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -32,10 +32,10 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
"github.com/purpleidea/mgmt/util"
"github.com/purpleidea/mgmt/util/errwrap"
"github.com/davecgh/go-spew/spew"
"github.com/kylelemons/godebug/pretty"
errwrap "github.com/pkg/errors"
)
func TestPureFuncExec0(t *testing.T) {

View File

@@ -29,8 +29,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
func init() {

View File

@@ -24,8 +24,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
"github.com/purpleidea/mgmt/util"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
func init() {

View File

@@ -26,8 +26,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
"github.com/purpleidea/mgmt/recwatch"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
func init() {

View File

@@ -25,8 +25,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

View File

@@ -28,9 +28,9 @@ import (
"github.com/purpleidea/mgmt/lang/funcs/facts"
"github.com/purpleidea/mgmt/lang/types"
"github.com/purpleidea/mgmt/util/errwrap"
"github.com/purpleidea/mgmt/util/socketset"
errwrap "github.com/pkg/errors"
"golang.org/x/sys/unix"
)

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs/facts"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs/facts"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
func init() {

View File

@@ -28,8 +28,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs/simple"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
var (

View File

@@ -23,8 +23,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
func init() {

View File

@@ -23,8 +23,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
func init() {

View File

@@ -37,8 +37,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -26,9 +26,9 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
"github.com/purpleidea/mgmt/pgraph"
"github.com/purpleidea/mgmt/util/errwrap"
multierr "github.com/hashicorp/go-multierror"
errwrap "github.com/pkg/errors"
)
// State represents the state of a function vertex. This corresponds to an AST

View File

@@ -26,9 +26,9 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
"github.com/purpleidea/mgmt/util"
"github.com/purpleidea/mgmt/util/errwrap"
multierr "github.com/hashicorp/go-multierror"
errwrap "github.com/pkg/errors"
)
const (

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -25,8 +25,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
"github.com/purpleidea/mgmt/util"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -23,8 +23,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
// RegisteredFuncs maps a function name to the corresponding static, pure func.

View File

@@ -23,8 +23,7 @@ import (
"github.com/purpleidea/mgmt/lang/funcs"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
// RegisteredFuncs maps a function name to the corresponding static, pure funcs.

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
// CompositeFunc is a function that passes through the value it receives. It is

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
// VarFunc is a function that passes through a function that came from a bind

View File

@@ -29,9 +29,9 @@ import (
"github.com/purpleidea/mgmt/lang/unification"
"github.com/purpleidea/mgmt/pgraph"
"github.com/purpleidea/mgmt/util"
"github.com/purpleidea/mgmt/util/errwrap"
multierr "github.com/hashicorp/go-multierror"
errwrap "github.com/pkg/errors"
"github.com/spf13/afero"
"github.com/urfave/cli"
)

View File

@@ -27,8 +27,7 @@ import (
"github.com/purpleidea/mgmt/engine"
"github.com/purpleidea/mgmt/gapi"
"github.com/purpleidea/mgmt/lang/interfaces"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
// Module logic: We want one single file to start from. That single file will

View File

@@ -23,7 +23,8 @@ import (
"io/ioutil"
"strings"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
"gopkg.in/yaml.v2"
)

View File

@@ -21,10 +21,10 @@ import (
"fmt"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/util/errwrap"
"github.com/hashicorp/hil"
hilast "github.com/hashicorp/hil/ast"
errwrap "github.com/pkg/errors"
)
// Pos represents a position in the code.

View File

@@ -24,8 +24,7 @@ import (
engineUtil "github.com/purpleidea/mgmt/engine/util"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/pgraph"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
// interpret runs the program and causes a graph generation as a side effect.

View File

@@ -29,8 +29,7 @@ import (
"github.com/purpleidea/mgmt/lang/unification"
"github.com/purpleidea/mgmt/pgraph"
"github.com/purpleidea/mgmt/util"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -29,9 +29,9 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/pgraph"
"github.com/purpleidea/mgmt/util"
"github.com/purpleidea/mgmt/util/errwrap"
multierr "github.com/hashicorp/go-multierror"
errwrap "github.com/pkg/errors"
"github.com/spf13/afero"
)

View File

@@ -29,8 +29,7 @@ import (
"github.com/purpleidea/mgmt/engine"
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/util"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (

View File

@@ -34,8 +34,8 @@ import (
"github.com/purpleidea/mgmt/lang/unification"
"github.com/purpleidea/mgmt/pgraph"
"github.com/purpleidea/mgmt/util"
"github.com/purpleidea/mgmt/util/errwrap"
errwrap "github.com/pkg/errors"
"golang.org/x/time/rate"
)

View File

@@ -24,7 +24,7 @@ import (
"strconv"
"strings"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
// Value represents an interface to get values out of each type. It is similar

View File

@@ -22,8 +22,7 @@ import (
"github.com/purpleidea/mgmt/lang/interfaces"
"github.com/purpleidea/mgmt/lang/types"
errwrap "github.com/pkg/errors"
"github.com/purpleidea/mgmt/util/errwrap"
)
const (