From 880652f5d4bdb1d56a3b0b7e5ad468e3de0cfb4c Mon Sep 17 00:00:00 2001 From: James Shubin Date: Tue, 12 Mar 2019 16:09:14 -0400 Subject: [PATCH] util: Port all code to new errwrap package This should keep things more uniform. --- engine/copy.go | 2 +- engine/graph/actions.go | 2 +- engine/graph/autoedge/autoedge.go | 2 +- engine/graph/autogroup.go | 3 +-- engine/graph/autogroup/autogroup.go | 3 +-- engine/graph/autogroup/autogroup_test.go | 3 +-- engine/graph/autogroup/nonreachability.go | 3 +-- engine/graph/autogroup/util.go | 3 +-- engine/graph/engine.go | 2 +- engine/graph/sendrecv.go | 2 +- engine/graph/state.go | 3 +-- engine/graph/vardir.go | 2 +- engine/metaparams.go | 2 +- engine/resources.go | 3 ++- engine/resources/augeas.go | 2 +- engine/resources/aws_ec2.go | 2 +- engine/resources/cron.go | 2 +- engine/resources/docker_container.go | 2 +- engine/resources/exec.go | 2 +- engine/resources/file.go | 3 +-- engine/resources/group.go | 3 +-- engine/resources/hostname.go | 2 +- engine/resources/kv.go | 3 +-- engine/resources/mount.go | 2 +- engine/resources/net.go | 2 +- engine/resources/nspawn.go | 2 +- engine/resources/packagekit/packagekit.go | 2 +- engine/resources/password.go | 3 +-- engine/resources/pkg.go | 3 +-- engine/resources/svc.go | 2 +- engine/resources/user.go | 3 +-- engine/resources/virt.go | 2 +- engine/util/util.go | 2 +- etcd/client.go | 3 ++- etcd/deploy.go | 3 ++- etcd/fs/file.go | 3 ++- etcd/fs/fs.go | 3 ++- etcd/fs/fs_test.go | 2 +- etcd/scheduler/scheduler.go | 3 ++- etcd/str.go | 3 ++- etcd/strmap.go | 2 +- examples/lib/libmgmt-subgraph0.go | 2 +- gapi/deploy.go | 2 +- gapi/helpers.go | 3 +-- integration/cluster.go | 3 ++- integration/instance.go | 3 +-- integration/patterns.go | 2 +- integration/util.go | 2 +- lang/download.go | 2 +- lang/funcs/contains_polyfunc.go | 3 +-- lang/funcs/core/core_test.go | 2 +- lang/funcs/core/example/vumeter_func.go | 3 +-- lang/funcs/core/fmt/printf_func.go | 3 +-- lang/funcs/core/os/readfile_func.go | 3 +-- lang/funcs/core/random1_func.go | 3 +-- lang/funcs/core/sys/cpucount_fact.go | 2 +- lang/funcs/core/sys/load_fact.go | 3 +-- lang/funcs/core/sys/uptime_fact.go | 3 +-- lang/funcs/core/template_func.go | 3 +-- lang/funcs/core/world/exchange_func.go | 3 +-- lang/funcs/core/world/kvlookup_func.go | 3 +-- lang/funcs/core/world/schedule_func.go | 3 +-- lang/funcs/engine.go | 2 +- lang/funcs/funcs.go | 2 +- lang/funcs/maplookup_polyfunc.go | 3 +-- lang/funcs/operator_polyfunc.go | 3 +-- lang/funcs/simple/simple.go | 3 +-- lang/funcs/simplepoly/simplepoly.go | 3 +-- lang/funcs/structlookup_polyfunc.go | 3 +-- lang/funcs/structs/composite.go | 3 +-- lang/funcs/structs/var.go | 3 +-- lang/gapi.go | 2 +- lang/inputs.go | 3 +-- lang/interfaces/metadata.go | 3 ++- lang/interpolate.go | 2 +- lang/interpret.go | 3 +-- lang/lang.go | 3 +-- lang/lang_test.go | 2 +- lang/lexparse.go | 3 +-- lang/structs.go | 2 +- lang/types/value.go | 2 +- lang/unification/simplesolver.go | 3 +-- langpuppet/gapi.go | 2 +- lib/deploy.go | 2 +- lib/main.go | 2 +- lib/run.go | 2 +- pgp/pgp.go | 3 ++- pgraph/graphsync.go | 2 +- pgraph/pgraph.go | 2 +- prometheus/prometheus.go | 3 +-- puppet/gapi.go | 2 +- puppet/puppet.go | 3 +-- test/test-govet.sh | 3 ++- util/home.go | 2 +- util/socketset/socketset.go | 3 ++- yamlgraph/gapi.go | 2 +- yamlgraph/gconfig.go | 2 +- 97 files changed, 109 insertions(+), 136 deletions(-) diff --git a/engine/copy.go b/engine/copy.go index 2eea98f5..bd137d2c 100644 --- a/engine/copy.go +++ b/engine/copy.go @@ -20,7 +20,7 @@ package engine import ( "fmt" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // ResCopy copies a resource. This is the main entry point for copying a diff --git a/engine/graph/actions.go b/engine/graph/actions.go index 4f464bd4..5828a4b8 100644 --- a/engine/graph/actions.go +++ b/engine/graph/actions.go @@ -25,9 +25,9 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/pgraph" + "github.com/purpleidea/mgmt/util/errwrap" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" "golang.org/x/time/rate" ) diff --git a/engine/graph/autoedge/autoedge.go b/engine/graph/autoedge/autoedge.go index 84907123..e4466b1a 100644 --- a/engine/graph/autoedge/autoedge.go +++ b/engine/graph/autoedge/autoedge.go @@ -22,9 +22,9 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/pgraph" + "github.com/purpleidea/mgmt/util/errwrap" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) // AutoEdge adds the automatic edges to the graph. diff --git a/engine/graph/autogroup.go b/engine/graph/autogroup.go index f78fb752..f74c7189 100644 --- a/engine/graph/autogroup.go +++ b/engine/graph/autogroup.go @@ -24,8 +24,7 @@ import ( "github.com/purpleidea/mgmt/engine/graph/autogroup" "github.com/purpleidea/mgmt/pgraph" "github.com/purpleidea/mgmt/util" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // AutoGroup runs the auto grouping on the loaded graph. diff --git a/engine/graph/autogroup/autogroup.go b/engine/graph/autogroup/autogroup.go index 58a37f12..39f1a4c8 100644 --- a/engine/graph/autogroup/autogroup.go +++ b/engine/graph/autogroup/autogroup.go @@ -22,8 +22,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/pgraph" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // AutoGroup is the mechanical auto group "runner" that runs the interface spec. diff --git a/engine/graph/autogroup/autogroup_test.go b/engine/graph/autogroup/autogroup_test.go index 438bd72b..f7dabb5f 100644 --- a/engine/graph/autogroup/autogroup_test.go +++ b/engine/graph/autogroup/autogroup_test.go @@ -31,8 +31,7 @@ import ( "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/pgraph" "github.com/purpleidea/mgmt/util" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/engine/graph/autogroup/nonreachability.go b/engine/graph/autogroup/nonreachability.go index 919fa3b5..19e2e654 100644 --- a/engine/graph/autogroup/nonreachability.go +++ b/engine/graph/autogroup/nonreachability.go @@ -19,8 +19,7 @@ package autogroup import ( "github.com/purpleidea/mgmt/pgraph" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // NonReachabilityGrouper is the most straight-forward algorithm for grouping. diff --git a/engine/graph/autogroup/util.go b/engine/graph/autogroup/util.go index b3c5905d..393f39b4 100644 --- a/engine/graph/autogroup/util.go +++ b/engine/graph/autogroup/util.go @@ -19,8 +19,7 @@ package autogroup import ( "github.com/purpleidea/mgmt/pgraph" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // VertexMerge merges v2 into v1 by reattaching the edges where appropriate, diff --git a/engine/graph/engine.go b/engine/graph/engine.go index a3495b6b..1af98a72 100644 --- a/engine/graph/engine.go +++ b/engine/graph/engine.go @@ -26,10 +26,10 @@ import ( "github.com/purpleidea/mgmt/converger" "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/pgraph" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/purpleidea/mgmt/util/semaphore" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) // Engine encapsulates a generic graph and manages its operations. diff --git a/engine/graph/sendrecv.go b/engine/graph/sendrecv.go index a519c609..f3cfe238 100644 --- a/engine/graph/sendrecv.go +++ b/engine/graph/sendrecv.go @@ -23,9 +23,9 @@ import ( "github.com/purpleidea/mgmt/engine" engineUtil "github.com/purpleidea/mgmt/engine/util" + "github.com/purpleidea/mgmt/util/errwrap" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) // SendRecv pulls in the sent values into the receive slots. It is called by the diff --git a/engine/graph/state.go b/engine/graph/state.go index a13d63a4..dd758093 100644 --- a/engine/graph/state.go +++ b/engine/graph/state.go @@ -26,8 +26,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/pgraph" "github.com/purpleidea/mgmt/util" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // State stores some state about the resource it is mapped to. diff --git a/engine/graph/vardir.go b/engine/graph/vardir.go index 9fcd8f21..4206e130 100644 --- a/engine/graph/vardir.go +++ b/engine/graph/vardir.go @@ -22,7 +22,7 @@ import ( "os" "path" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // varDir returns the path to a working directory for the resource. It will try diff --git a/engine/metaparams.go b/engine/metaparams.go index 773cd4bc..68309437 100644 --- a/engine/metaparams.go +++ b/engine/metaparams.go @@ -22,8 +22,8 @@ import ( "strconv" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" "golang.org/x/time/rate" ) diff --git a/engine/resources.go b/engine/resources.go index abb76b05..f68ea6e2 100644 --- a/engine/resources.go +++ b/engine/resources.go @@ -21,7 +21,8 @@ import ( "encoding/gob" "fmt" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" + "gopkg.in/yaml.v2" ) diff --git a/engine/resources/augeas.go b/engine/resources/augeas.go index bb4e3aed..2f5f2508 100644 --- a/engine/resources/augeas.go +++ b/engine/resources/augeas.go @@ -27,8 +27,8 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/recwatch" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" // FIXME: we vendor go/augeas because master requires augeas 1.6.0 // and libaugeas-dev-1.6.0 is not yet available in a PPA. "honnef.co/go/augeas" diff --git a/engine/resources/aws_ec2.go b/engine/resources/aws_ec2.go index 7dbe831e..4ff30119 100644 --- a/engine/resources/aws_ec2.go +++ b/engine/resources/aws_ec2.go @@ -34,6 +34,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" @@ -43,7 +44,6 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/sns" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) func init() { diff --git a/engine/resources/cron.go b/engine/resources/cron.go index 195c3885..5338f966 100644 --- a/engine/resources/cron.go +++ b/engine/resources/cron.go @@ -31,12 +31,12 @@ import ( engineUtil "github.com/purpleidea/mgmt/engine/util" "github.com/purpleidea/mgmt/recwatch" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" sdbus "github.com/coreos/go-systemd/dbus" "github.com/coreos/go-systemd/unit" systemdUtil "github.com/coreos/go-systemd/util" "github.com/godbus/dbus" - errwrap "github.com/pkg/errors" ) const ( diff --git a/engine/resources/docker_container.go b/engine/resources/docker_container.go index ed9acb21..f1416b42 100644 --- a/engine/resources/docker_container.go +++ b/engine/resources/docker_container.go @@ -30,13 +30,13 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/client" "github.com/docker/go-connections/nat" - errwrap "github.com/pkg/errors" ) const ( diff --git a/engine/resources/exec.go b/engine/resources/exec.go index e6923fa9..1ccc5043 100644 --- a/engine/resources/exec.go +++ b/engine/resources/exec.go @@ -32,9 +32,9 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" engineUtil "github.com/purpleidea/mgmt/engine/util" + "github.com/purpleidea/mgmt/util/errwrap" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) func init() { diff --git a/engine/resources/file.go b/engine/resources/file.go index 0d87441e..7db760e2 100644 --- a/engine/resources/file.go +++ b/engine/resources/file.go @@ -36,8 +36,7 @@ import ( engineUtil "github.com/purpleidea/mgmt/engine/util" "github.com/purpleidea/mgmt/recwatch" "github.com/purpleidea/mgmt/util" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/engine/resources/group.go b/engine/resources/group.go index 38cc11cd..4e750e71 100644 --- a/engine/resources/group.go +++ b/engine/resources/group.go @@ -28,8 +28,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/recwatch" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/engine/resources/hostname.go b/engine/resources/hostname.go index 02ec5c0b..648b36e1 100644 --- a/engine/resources/hostname.go +++ b/engine/resources/hostname.go @@ -25,9 +25,9 @@ import ( "github.com/purpleidea/mgmt/engine/traits" engineUtil "github.com/purpleidea/mgmt/engine/util" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/godbus/dbus" - errwrap "github.com/pkg/errors" ) func init() { diff --git a/engine/resources/kv.go b/engine/resources/kv.go index 079ca596..a2a54609 100644 --- a/engine/resources/kv.go +++ b/engine/resources/kv.go @@ -23,8 +23,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/engine/resources/mount.go b/engine/resources/mount.go index 4fe20de3..7ea29128 100644 --- a/engine/resources/mount.go +++ b/engine/resources/mount.go @@ -33,13 +33,13 @@ import ( engineUtil "github.com/purpleidea/mgmt/engine/util" "github.com/purpleidea/mgmt/recwatch" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" sdbus "github.com/coreos/go-systemd/dbus" "github.com/coreos/go-systemd/unit" systemdUtil "github.com/coreos/go-systemd/util" fstab "github.com/deniswernert/go-fstab" "github.com/godbus/dbus" - errwrap "github.com/pkg/errors" "golang.org/x/sys/unix" ) diff --git a/engine/resources/net.go b/engine/resources/net.go index 1ab58f22..8d4566f9 100644 --- a/engine/resources/net.go +++ b/engine/resources/net.go @@ -34,10 +34,10 @@ import ( "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/recwatch" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/purpleidea/mgmt/util/socketset" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" // XXX: Do NOT use subscribe methods from this lib, as they are racey and // do not clean up spawned goroutines. Should be replaced when a suitable // alternative is available. diff --git a/engine/resources/nspawn.go b/engine/resources/nspawn.go index 31b03708..a18e5e3a 100644 --- a/engine/resources/nspawn.go +++ b/engine/resources/nspawn.go @@ -27,12 +27,12 @@ import ( "github.com/purpleidea/mgmt/engine/traits" engineUtil "github.com/purpleidea/mgmt/engine/util" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" systemdDbus "github.com/coreos/go-systemd/dbus" machined "github.com/coreos/go-systemd/machine1" systemdUtil "github.com/coreos/go-systemd/util" "github.com/godbus/dbus" - errwrap "github.com/pkg/errors" ) const ( diff --git a/engine/resources/packagekit/packagekit.go b/engine/resources/packagekit/packagekit.go index 2ec3dfc2..4a7deeb9 100644 --- a/engine/resources/packagekit/packagekit.go +++ b/engine/resources/packagekit/packagekit.go @@ -27,10 +27,10 @@ import ( engineUtil "github.com/purpleidea/mgmt/engine/util" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/godbus/dbus" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) // global tweaks of verbosity and code path diff --git a/engine/resources/password.go b/engine/resources/password.go index 13176fe7..14801e32 100644 --- a/engine/resources/password.go +++ b/engine/resources/password.go @@ -29,8 +29,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/recwatch" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/engine/resources/pkg.go b/engine/resources/pkg.go index c1c84d8a..86fbe0f6 100644 --- a/engine/resources/pkg.go +++ b/engine/resources/pkg.go @@ -26,8 +26,7 @@ import ( "github.com/purpleidea/mgmt/engine/resources/packagekit" "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/util" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/engine/resources/svc.go b/engine/resources/svc.go index 77eedc79..aeef5f5b 100644 --- a/engine/resources/svc.go +++ b/engine/resources/svc.go @@ -28,11 +28,11 @@ import ( "github.com/purpleidea/mgmt/engine/traits" engineUtil "github.com/purpleidea/mgmt/engine/util" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" systemd "github.com/coreos/go-systemd/dbus" // change namespace systemdUtil "github.com/coreos/go-systemd/util" "github.com/godbus/dbus" // namespace collides with systemd wrapper - errwrap "github.com/pkg/errors" ) func init() { diff --git a/engine/resources/user.go b/engine/resources/user.go index 1508bf53..f4c7e80e 100644 --- a/engine/resources/user.go +++ b/engine/resources/user.go @@ -30,8 +30,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/recwatch" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/engine/resources/virt.go b/engine/resources/virt.go index 500166a3..b8d3984e 100644 --- a/engine/resources/virt.go +++ b/engine/resources/virt.go @@ -30,10 +30,10 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/engine/traits" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/libvirt/libvirt-go" libvirtxml "github.com/libvirt/libvirt-go-xml" - errwrap "github.com/pkg/errors" ) func init() { diff --git a/engine/util/util.go b/engine/util/util.go index 273dbdc9..7298a033 100644 --- a/engine/util/util.go +++ b/engine/util/util.go @@ -30,9 +30,9 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/lang/types" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/godbus/dbus" - errwrap "github.com/pkg/errors" ) const ( diff --git a/etcd/client.go b/etcd/client.go index bbd9b353..a27d8183 100644 --- a/etcd/client.go +++ b/etcd/client.go @@ -20,8 +20,9 @@ package etcd import ( "time" + "github.com/purpleidea/mgmt/util/errwrap" + etcd "github.com/coreos/etcd/clientv3" // "clientv3" - errwrap "github.com/pkg/errors" context "golang.org/x/net/context" ) diff --git a/etcd/deploy.go b/etcd/deploy.go index 31cb3e45..11b7061d 100644 --- a/etcd/deploy.go +++ b/etcd/deploy.go @@ -22,8 +22,9 @@ import ( "strconv" "strings" + "github.com/purpleidea/mgmt/util/errwrap" + etcd "github.com/coreos/etcd/clientv3" - errwrap "github.com/pkg/errors" ) const ( diff --git a/etcd/fs/file.go b/etcd/fs/file.go index 3ffe24d4..4b676ae5 100644 --- a/etcd/fs/file.go +++ b/etcd/fs/file.go @@ -29,8 +29,9 @@ import ( "syscall" "time" + "github.com/purpleidea/mgmt/util/errwrap" + etcd "github.com/coreos/etcd/clientv3" // "clientv3" - errwrap "github.com/pkg/errors" ) func init() { diff --git a/etcd/fs/fs.go b/etcd/fs/fs.go index e38e3f55..807a5bef 100644 --- a/etcd/fs/fs.go +++ b/etcd/fs/fs.go @@ -34,9 +34,10 @@ import ( "syscall" "time" + "github.com/purpleidea/mgmt/util/errwrap" + etcd "github.com/coreos/etcd/clientv3" // "clientv3" rpctypes "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" - errwrap "github.com/pkg/errors" "github.com/spf13/afero" context "golang.org/x/net/context" ) diff --git a/etcd/fs/fs_test.go b/etcd/fs/fs_test.go index 2c95f838..95176062 100644 --- a/etcd/fs/fs_test.go +++ b/etcd/fs/fs_test.go @@ -30,8 +30,8 @@ import ( etcdfs "github.com/purpleidea/mgmt/etcd/fs" "github.com/purpleidea/mgmt/integration" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" "github.com/spf13/afero" ) diff --git a/etcd/scheduler/scheduler.go b/etcd/scheduler/scheduler.go index 7ac7ff83..a228a694 100644 --- a/etcd/scheduler/scheduler.go +++ b/etcd/scheduler/scheduler.go @@ -26,9 +26,10 @@ import ( "strings" "sync" + "github.com/purpleidea/mgmt/util/errwrap" + etcd "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/clientv3/concurrency" - errwrap "github.com/pkg/errors" ) const ( diff --git a/etcd/str.go b/etcd/str.go index 2bc4ea9a..18713a83 100644 --- a/etcd/str.go +++ b/etcd/str.go @@ -21,8 +21,9 @@ import ( "errors" "fmt" + "github.com/purpleidea/mgmt/util/errwrap" + etcd "github.com/coreos/etcd/clientv3" - errwrap "github.com/pkg/errors" ) // ErrNotExist is returned when GetStr can not find the requested key. diff --git a/etcd/strmap.go b/etcd/strmap.go index a5d825ad..388e21c2 100644 --- a/etcd/strmap.go +++ b/etcd/strmap.go @@ -22,9 +22,9 @@ import ( "strings" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" etcd "github.com/coreos/etcd/clientv3" - errwrap "github.com/pkg/errors" ) // WatchStrMap returns a channel which spits out events on key activity. diff --git a/examples/lib/libmgmt-subgraph0.go b/examples/lib/libmgmt-subgraph0.go index 8b0395ab..fdd7476f 100644 --- a/examples/lib/libmgmt-subgraph0.go +++ b/examples/lib/libmgmt-subgraph0.go @@ -15,8 +15,8 @@ import ( "github.com/purpleidea/mgmt/gapi" mgmt "github.com/purpleidea/mgmt/lib" "github.com/purpleidea/mgmt/pgraph" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/gapi/deploy.go b/gapi/deploy.go index 98d515bb..5447795b 100644 --- a/gapi/deploy.go +++ b/gapi/deploy.go @@ -22,7 +22,7 @@ import ( "encoding/base64" "encoding/gob" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func init() { diff --git a/gapi/helpers.go b/gapi/helpers.go index 873c2780..17054e56 100644 --- a/gapi/helpers.go +++ b/gapi/helpers.go @@ -22,8 +22,7 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/util" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // Umask is the default to use when none has been specified. diff --git a/integration/cluster.go b/integration/cluster.go index 6819d96d..4f7aea49 100644 --- a/integration/cluster.go +++ b/integration/cluster.go @@ -25,8 +25,9 @@ import ( "path" "time" + "github.com/purpleidea/mgmt/util/errwrap" + multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) // Cluster represents an mgmt cluster. It uses the instance building blocks to diff --git a/integration/instance.go b/integration/instance.go index 5d8d5bdb..d272b89a 100644 --- a/integration/instance.go +++ b/integration/instance.go @@ -29,8 +29,7 @@ import ( "syscall" "github.com/purpleidea/mgmt/recwatch" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) const ( diff --git a/integration/patterns.go b/integration/patterns.go index 6da6b538..e8788911 100644 --- a/integration/patterns.go +++ b/integration/patterns.go @@ -21,7 +21,7 @@ import ( "context" "time" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // SimpleDeployLang is a helper method that takes a struct and runs a sequence diff --git a/integration/util.go b/integration/util.go index 35c22741..8fffcebd 100644 --- a/integration/util.go +++ b/integration/util.go @@ -26,7 +26,7 @@ import ( "runtime" "strconv" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) const ( diff --git a/lang/download.go b/lang/download.go index 5de2a43b..dc68373c 100644 --- a/lang/download.go +++ b/lang/download.go @@ -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" ) diff --git a/lang/funcs/contains_polyfunc.go b/lang/funcs/contains_polyfunc.go index 6c88dc56..94b03514 100644 --- a/lang/funcs/contains_polyfunc.go +++ b/lang/funcs/contains_polyfunc.go @@ -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 ( diff --git a/lang/funcs/core/core_test.go b/lang/funcs/core/core_test.go index 0e41fc85..8555fcd4 100644 --- a/lang/funcs/core/core_test.go +++ b/lang/funcs/core/core_test.go @@ -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) { diff --git a/lang/funcs/core/example/vumeter_func.go b/lang/funcs/core/example/vumeter_func.go index 7032b166..b3696920 100644 --- a/lang/funcs/core/example/vumeter_func.go +++ b/lang/funcs/core/example/vumeter_func.go @@ -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() { diff --git a/lang/funcs/core/fmt/printf_func.go b/lang/funcs/core/fmt/printf_func.go index 71155778..2d0e5075 100644 --- a/lang/funcs/core/fmt/printf_func.go +++ b/lang/funcs/core/fmt/printf_func.go @@ -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() { diff --git a/lang/funcs/core/os/readfile_func.go b/lang/funcs/core/os/readfile_func.go index 77779916..a979ff00 100644 --- a/lang/funcs/core/os/readfile_func.go +++ b/lang/funcs/core/os/readfile_func.go @@ -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() { diff --git a/lang/funcs/core/random1_func.go b/lang/funcs/core/random1_func.go index f5bf47e1..cc4ff515 100644 --- a/lang/funcs/core/random1_func.go +++ b/lang/funcs/core/random1_func.go @@ -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" diff --git a/lang/funcs/core/sys/cpucount_fact.go b/lang/funcs/core/sys/cpucount_fact.go index 48233b2b..6b4e8c6c 100644 --- a/lang/funcs/core/sys/cpucount_fact.go +++ b/lang/funcs/core/sys/cpucount_fact.go @@ -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" ) diff --git a/lang/funcs/core/sys/load_fact.go b/lang/funcs/core/sys/load_fact.go index 1a687df3..cdee9680 100644 --- a/lang/funcs/core/sys/load_fact.go +++ b/lang/funcs/core/sys/load_fact.go @@ -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 ( diff --git a/lang/funcs/core/sys/uptime_fact.go b/lang/funcs/core/sys/uptime_fact.go index d8f328d9..77eb807e 100644 --- a/lang/funcs/core/sys/uptime_fact.go +++ b/lang/funcs/core/sys/uptime_fact.go @@ -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() { diff --git a/lang/funcs/core/template_func.go b/lang/funcs/core/template_func.go index 71ef9fb5..10653df5 100644 --- a/lang/funcs/core/template_func.go +++ b/lang/funcs/core/template_func.go @@ -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 ( diff --git a/lang/funcs/core/world/exchange_func.go b/lang/funcs/core/world/exchange_func.go index 3a232668..b38a9863 100644 --- a/lang/funcs/core/world/exchange_func.go +++ b/lang/funcs/core/world/exchange_func.go @@ -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() { diff --git a/lang/funcs/core/world/kvlookup_func.go b/lang/funcs/core/world/kvlookup_func.go index b7590a8c..73719606 100644 --- a/lang/funcs/core/world/kvlookup_func.go +++ b/lang/funcs/core/world/kvlookup_func.go @@ -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() { diff --git a/lang/funcs/core/world/schedule_func.go b/lang/funcs/core/world/schedule_func.go index d977f6b4..0b604f5a 100644 --- a/lang/funcs/core/world/schedule_func.go +++ b/lang/funcs/core/world/schedule_func.go @@ -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 ( diff --git a/lang/funcs/engine.go b/lang/funcs/engine.go index 26509730..04867793 100644 --- a/lang/funcs/engine.go +++ b/lang/funcs/engine.go @@ -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 diff --git a/lang/funcs/funcs.go b/lang/funcs/funcs.go index 604c247a..1e0a00df 100644 --- a/lang/funcs/funcs.go +++ b/lang/funcs/funcs.go @@ -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 ( diff --git a/lang/funcs/maplookup_polyfunc.go b/lang/funcs/maplookup_polyfunc.go index 8eb6fbee..c13c3011 100644 --- a/lang/funcs/maplookup_polyfunc.go +++ b/lang/funcs/maplookup_polyfunc.go @@ -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 ( diff --git a/lang/funcs/operator_polyfunc.go b/lang/funcs/operator_polyfunc.go index e296567d..fc7f1cd1 100644 --- a/lang/funcs/operator_polyfunc.go +++ b/lang/funcs/operator_polyfunc.go @@ -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 ( diff --git a/lang/funcs/simple/simple.go b/lang/funcs/simple/simple.go index 079e9f96..262c6259 100644 --- a/lang/funcs/simple/simple.go +++ b/lang/funcs/simple/simple.go @@ -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. diff --git a/lang/funcs/simplepoly/simplepoly.go b/lang/funcs/simplepoly/simplepoly.go index cce234ed..f0470d51 100644 --- a/lang/funcs/simplepoly/simplepoly.go +++ b/lang/funcs/simplepoly/simplepoly.go @@ -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. diff --git a/lang/funcs/structlookup_polyfunc.go b/lang/funcs/structlookup_polyfunc.go index 38883f5d..0d5736da 100644 --- a/lang/funcs/structlookup_polyfunc.go +++ b/lang/funcs/structlookup_polyfunc.go @@ -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 ( diff --git a/lang/funcs/structs/composite.go b/lang/funcs/structs/composite.go index ad9ab5b1..2e2e3dc4 100644 --- a/lang/funcs/structs/composite.go +++ b/lang/funcs/structs/composite.go @@ -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 diff --git a/lang/funcs/structs/var.go b/lang/funcs/structs/var.go index a3995892..ffe9e079 100644 --- a/lang/funcs/structs/var.go +++ b/lang/funcs/structs/var.go @@ -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 diff --git a/lang/gapi.go b/lang/gapi.go index d3117e84..f93b70f5 100644 --- a/lang/gapi.go +++ b/lang/gapi.go @@ -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" ) diff --git a/lang/inputs.go b/lang/inputs.go index 3b888545..514b1e3d 100644 --- a/lang/inputs.go +++ b/lang/inputs.go @@ -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 diff --git a/lang/interfaces/metadata.go b/lang/interfaces/metadata.go index 909d46f5..403d9b32 100644 --- a/lang/interfaces/metadata.go +++ b/lang/interfaces/metadata.go @@ -23,7 +23,8 @@ import ( "io/ioutil" "strings" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" + "gopkg.in/yaml.v2" ) diff --git a/lang/interpolate.go b/lang/interpolate.go index 5690fcf2..62676d94 100644 --- a/lang/interpolate.go +++ b/lang/interpolate.go @@ -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. diff --git a/lang/interpret.go b/lang/interpret.go index bbdb8397..40fa8a45 100644 --- a/lang/interpret.go +++ b/lang/interpret.go @@ -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. diff --git a/lang/lang.go b/lang/lang.go index ecef67cb..8be74dee 100644 --- a/lang/lang.go +++ b/lang/lang.go @@ -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 ( diff --git a/lang/lang_test.go b/lang/lang_test.go index fe17c964..dfe22d58 100644 --- a/lang/lang_test.go +++ b/lang/lang_test.go @@ -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" ) diff --git a/lang/lexparse.go b/lang/lexparse.go index 62f6fb12..bd41b2c5 100644 --- a/lang/lexparse.go +++ b/lang/lexparse.go @@ -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 ( diff --git a/lang/structs.go b/lang/structs.go index 89697939..306c2c25 100644 --- a/lang/structs.go +++ b/lang/structs.go @@ -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" ) diff --git a/lang/types/value.go b/lang/types/value.go index 43d60ad2..0ad9fdeb 100644 --- a/lang/types/value.go +++ b/lang/types/value.go @@ -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 diff --git a/lang/unification/simplesolver.go b/lang/unification/simplesolver.go index 3e9b976a..b871b14a 100644 --- a/lang/unification/simplesolver.go +++ b/lang/unification/simplesolver.go @@ -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 ( diff --git a/langpuppet/gapi.go b/langpuppet/gapi.go index e722956f..fc900e60 100644 --- a/langpuppet/gapi.go +++ b/langpuppet/gapi.go @@ -27,9 +27,9 @@ import ( "github.com/purpleidea/mgmt/lang" "github.com/purpleidea/mgmt/pgraph" "github.com/purpleidea/mgmt/puppet" + "github.com/purpleidea/mgmt/util/errwrap" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/lib/deploy.go b/lib/deploy.go index b886e0a8..af3c4558 100644 --- a/lib/deploy.go +++ b/lib/deploy.go @@ -25,9 +25,9 @@ import ( "github.com/purpleidea/mgmt/etcd" etcdfs "github.com/purpleidea/mgmt/etcd/fs" "github.com/purpleidea/mgmt/gapi" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/google/uuid" - errwrap "github.com/pkg/errors" "github.com/urfave/cli" git "gopkg.in/src-d/go-git.v4" ) diff --git a/lib/main.go b/lib/main.go index 233ee8a9..64f9ff54 100644 --- a/lib/main.go +++ b/lib/main.go @@ -39,10 +39,10 @@ import ( "github.com/purpleidea/mgmt/pgraph" "github.com/purpleidea/mgmt/prometheus" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" etcdtypes "github.com/coreos/etcd/pkg/types" multierr "github.com/hashicorp/go-multierror" - errwrap "github.com/pkg/errors" ) // Flags are some constant flags which are used throughout the program. diff --git a/lib/run.go b/lib/run.go index b5ef26ab..75848f05 100644 --- a/lib/run.go +++ b/lib/run.go @@ -27,8 +27,8 @@ import ( "github.com/purpleidea/mgmt/gapi" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" "github.com/spf13/afero" "github.com/urfave/cli" ) diff --git a/pgp/pgp.go b/pgp/pgp.go index 34d41b71..7779675e 100644 --- a/pgp/pgp.go +++ b/pgp/pgp.go @@ -27,7 +27,8 @@ import ( "os" "strings" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" + "golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp/packet" ) diff --git a/pgraph/graphsync.go b/pgraph/graphsync.go index 8a6c553b..34798b62 100644 --- a/pgraph/graphsync.go +++ b/pgraph/graphsync.go @@ -20,7 +20,7 @@ package pgraph import ( "fmt" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) func strVertexCmpFn(v1, v2 Vertex) (bool, error) { diff --git a/pgraph/pgraph.go b/pgraph/pgraph.go index e8217770..e435c7d0 100644 --- a/pgraph/pgraph.go +++ b/pgraph/pgraph.go @@ -23,7 +23,7 @@ import ( "sort" "strings" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // Graph is the graph structure in this library. diff --git a/prometheus/prometheus.go b/prometheus/prometheus.go index 3deaee90..e7d635aa 100644 --- a/prometheus/prometheus.go +++ b/prometheus/prometheus.go @@ -27,8 +27,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" - - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // DefaultPrometheusListen is registered in diff --git a/puppet/gapi.go b/puppet/gapi.go index f011608d..ec9e9488 100644 --- a/puppet/gapi.go +++ b/puppet/gapi.go @@ -28,8 +28,8 @@ import ( "github.com/purpleidea/mgmt/gapi" "github.com/purpleidea/mgmt/pgraph" "github.com/purpleidea/mgmt/util" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/puppet/puppet.go b/puppet/puppet.go index 53413805..26205c73 100644 --- a/puppet/puppet.go +++ b/puppet/puppet.go @@ -26,9 +26,8 @@ import ( "strconv" "strings" + "github.com/purpleidea/mgmt/util/errwrap" "github.com/purpleidea/mgmt/yamlgraph" - - errwrap "github.com/pkg/errors" ) const ( diff --git a/test/test-govet.sh b/test/test-govet.sh index 1f4672bd..6d63d829 100755 --- a/test/test-govet.sh +++ b/test/test-govet.sh @@ -54,7 +54,8 @@ function consistent-imports() { return 0 fi - if grep $'\t"github.com/pkg/errors"' "$1"; then # import as errwrap + # import as github.com/purpleidea/mgmt/util/errwrap + if grep $'\t"github.com/pkg/errors"' "$1"; then return 1 fi if grep $'\t"github.com/hashicorp/go-multierror"' "$1"; then # import as multierr diff --git a/util/home.go b/util/home.go index b9114a4c..0980326b 100644 --- a/util/home.go +++ b/util/home.go @@ -24,7 +24,7 @@ import ( "regexp" "strings" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" ) // ExpandHome does an expansion of ~/ or ~james/ into user's home dir value. diff --git a/util/socketset/socketset.go b/util/socketset/socketset.go index 4e092a13..4910cad0 100644 --- a/util/socketset/socketset.go +++ b/util/socketset/socketset.go @@ -29,7 +29,8 @@ import ( "strings" "syscall" - errwrap "github.com/pkg/errors" + "github.com/purpleidea/mgmt/util/errwrap" + "golang.org/x/sys/unix" ) diff --git a/yamlgraph/gapi.go b/yamlgraph/gapi.go index 1a27a9e8..b59a9a68 100644 --- a/yamlgraph/gapi.go +++ b/yamlgraph/gapi.go @@ -23,8 +23,8 @@ import ( "github.com/purpleidea/mgmt/gapi" "github.com/purpleidea/mgmt/pgraph" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" "github.com/urfave/cli" ) diff --git a/yamlgraph/gconfig.go b/yamlgraph/gconfig.go index 8094a928..0a257cfc 100644 --- a/yamlgraph/gconfig.go +++ b/yamlgraph/gconfig.go @@ -24,8 +24,8 @@ import ( "github.com/purpleidea/mgmt/engine" "github.com/purpleidea/mgmt/pgraph" + "github.com/purpleidea/mgmt/util/errwrap" - errwrap "github.com/pkg/errors" "gopkg.in/yaml.v2" )