mirror of https://github.com/agola-io/agola
*: use github.com/sorintlab/errors
This commit is contained in:
parent
019a043b4d
commit
cb61b5583c
|
@ -21,10 +21,10 @@ import (
|
|||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/cmd"
|
||||
"agola.io/agola/internal/errors"
|
||||
)
|
||||
|
||||
var token string
|
||||
|
|
|
@ -17,9 +17,8 @@ package cmd
|
|||
import (
|
||||
"os"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
)
|
||||
|
||||
var cmdCompletion = &cobra.Command{
|
||||
|
|
|
@ -26,9 +26,9 @@ import (
|
|||
"github.com/ghodss/yaml"
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gitsave "agola.io/agola/internal/git-save"
|
||||
"agola.io/agola/internal/util"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
|
|
|
@ -21,9 +21,9 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gatewayclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gatewayclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -21,9 +21,9 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gatewayclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gatewayclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/migration"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -20,9 +20,9 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -21,9 +21,9 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -21,10 +21,10 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
config "agola.io/agola/internal/config"
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -21,9 +21,9 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/gitsources/github"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -20,9 +20,9 @@ import (
|
|||
"sort"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -19,10 +19,10 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/cmd"
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/services/config"
|
||||
"agola.io/agola/internal/services/configstore"
|
||||
"agola.io/agola/internal/services/executor"
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwapitypes "agola.io/agola/services/gateway/api/types"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gwclient "agola.io/agola/services/gateway/client"
|
||||
)
|
||||
|
||||
|
|
|
@ -20,9 +20,8 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
)
|
||||
|
||||
var cmdCreateFile = &cobra.Command{
|
||||
|
|
|
@ -26,9 +26,8 @@ import (
|
|||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
)
|
||||
|
||||
var cmdTemplate = &cobra.Command{
|
||||
|
|
1
go.mod
1
go.mod
|
@ -30,6 +30,7 @@ require (
|
|||
github.com/rs/zerolog v1.29.0
|
||||
github.com/sanity-io/litter v1.5.5
|
||||
github.com/sgotti/gexpect v0.0.0-20210315095146-1ec64e69809b
|
||||
github.com/sorintlab/errors v0.0.0-20220601101606-37744c1b59fb
|
||||
github.com/spf13/cobra v1.6.1
|
||||
github.com/xanzy/go-gitlab v0.81.0
|
||||
go.starlark.net v0.0.0-20230302034142-4b1e35fe2254
|
||||
|
|
11
go.sum
11
go.sum
|
@ -297,7 +297,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
|
|||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc=
|
||||
github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w=
|
||||
github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
|
@ -320,6 +322,8 @@ github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0
|
|||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/sorintlab/errors v0.0.0-20220601101606-37744c1b59fb h1:4XpVoS8XhGV8kHlQB4XFmbp7Gl+vBEBirCo1tD1M3pg=
|
||||
github.com/sorintlab/errors v0.0.0-20220601101606-37744c1b59fb/go.mod h1:y6BMSfuxo7hQ7iJCppECcFn2jg5PKhkWvF5TMC6Q+3U=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
||||
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
|
||||
|
@ -357,6 +361,7 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ
|
|||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||
go.starlark.net v0.0.0-20230302034142-4b1e35fe2254 h1:Ss6D3hLXTM0KobyBYEAygXzFfGcjnmfEJOBgSbemCtg=
|
||||
go.starlark.net v0.0.0-20230302034142-4b1e35fe2254/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds=
|
||||
|
@ -366,6 +371,7 @@ golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
|
@ -375,6 +381,7 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx
|
|||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
|
||||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -391,6 +398,7 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL
|
|||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
|
@ -406,6 +414,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -431,6 +440,7 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
@ -466,6 +476,7 @@ golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWc
|
|||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
|
||||
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
|
||||
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
@ -20,7 +20,8 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/objectstorage"
|
||||
"agola.io/agola/internal/services/config"
|
||||
)
|
||||
|
|
|
@ -21,9 +21,9 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/sorintlab/errors"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
itypes "agola.io/agola/internal/services/types"
|
||||
"agola.io/agola/internal/util"
|
||||
"agola.io/agola/services/types"
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/sorintlab/errors"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/util"
|
||||
"agola.io/agola/services/types"
|
||||
)
|
||||
|
|
|
@ -18,8 +18,7 @@ import (
|
|||
"encoding/json"
|
||||
|
||||
"github.com/google/go-jsonnet"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
func execJsonnet(configData []byte, configContext *ConfigContext) ([]byte, error) {
|
||||
|
|
|
@ -19,9 +19,8 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
"go.starlark.net/starlark"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
)
|
||||
|
||||
func starlarkArgs(cc *ConfigContext) (starlark.Tuple, error) {
|
||||
|
|
|
@ -20,9 +20,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/sorintlab/errors"
|
||||
"go.starlark.net/starlark"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
)
|
||||
|
||||
func TestStarlarkJSON(t *testing.T) {
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"io"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/lock"
|
||||
"agola.io/agola/internal/sql"
|
||||
stypes "agola.io/agola/services/types"
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
type werror struct {
|
||||
cause error
|
||||
msg string
|
||||
*Stack
|
||||
}
|
||||
|
||||
func (w *werror) Error() string {
|
||||
if w.cause == nil {
|
||||
return w.msg
|
||||
}
|
||||
if w.msg != "" {
|
||||
return w.msg + ": " + w.cause.Error()
|
||||
} else {
|
||||
return w.cause.Error()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *werror) Format(s fmt.State, verb rune) {
|
||||
_, _ = io.WriteString(s, w.Error())
|
||||
}
|
||||
|
||||
func (w *werror) Unwrap() error { return w.cause }
|
||||
|
||||
// New returns an error with the supplied message.
|
||||
// New also records the stack trace at the point it was called.
|
||||
func New(message string) error {
|
||||
return &werror{
|
||||
msg: message,
|
||||
Stack: Callers(0),
|
||||
}
|
||||
}
|
||||
|
||||
// Errorf formats according to a format specifier and returns the string
|
||||
// as a value that satisfies error.
|
||||
// Errorf also records the stack trace at the point it was called.
|
||||
func Errorf(format string, args ...interface{}) error {
|
||||
return &werror{
|
||||
msg: fmt.Sprintf(format, args...),
|
||||
Stack: Callers(0),
|
||||
}
|
||||
}
|
||||
|
||||
// WithStack annotates err with a stack trace at the point WithStack was called.
|
||||
// If err is nil, WithStack returns nil.
|
||||
func WithStack(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &werror{
|
||||
err,
|
||||
"",
|
||||
Callers(0),
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap returns an error annotating err with a stack trace
|
||||
// at the point Wrap is called, and the supplied message.
|
||||
// If err is nil, Wrap returns nil.
|
||||
func Wrap(err error, message string) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &werror{
|
||||
err,
|
||||
message,
|
||||
Callers(0),
|
||||
}
|
||||
}
|
||||
|
||||
// Wrapf returns an error annotating err with a stack trace
|
||||
// at the point Wrapf is called, and the format specifier.
|
||||
// If err is nil, Wrapf returns nil.
|
||||
func Wrapf(err error, format string, args ...interface{}) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &werror{
|
||||
err,
|
||||
fmt.Sprintf(format, args...),
|
||||
Callers(0),
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func PrintErrorDetails(err error) []string {
|
||||
type stackTracer interface {
|
||||
StackTrace() StackTrace
|
||||
}
|
||||
type errWithStack struct {
|
||||
err error
|
||||
msg string
|
||||
stack StackTrace
|
||||
}
|
||||
|
||||
var stackErrs []errWithStack
|
||||
errCause := err
|
||||
for errCause != nil {
|
||||
stackErr := errWithStack{
|
||||
err: errCause,
|
||||
msg: errCause.Error(),
|
||||
}
|
||||
//nolint:errorlint
|
||||
if s, ok := errCause.(stackTracer); ok {
|
||||
stackErr.stack = s.StackTrace()
|
||||
}
|
||||
stackErrs = append(stackErrs, stackErr)
|
||||
errCause = errors.Unwrap(errCause)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var lines []string
|
||||
for _, stackErr := range stackErrs {
|
||||
if len(stackErr.stack) > 0 {
|
||||
frame := stackErr.stack[0]
|
||||
lines = append(lines, fmt.Sprintf("(%T) %+v: %s", stackErr.err, frame, stackErr.msg))
|
||||
} else {
|
||||
lines = append(lines, fmt.Sprintf("(%T) %s", stackErr.err, stackErr.msg))
|
||||
}
|
||||
}
|
||||
|
||||
return lines
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
// +build go1.13
|
||||
|
||||
package errors
|
||||
|
||||
import (
|
||||
stderrors "errors"
|
||||
)
|
||||
|
||||
// Is reports whether any error in err's chain matches target.
|
||||
//
|
||||
// The chain consists of err itself followed by the sequence of errors obtained by
|
||||
// repeatedly calling Unwrap.
|
||||
//
|
||||
// An error is considered to match a target if it is equal to that target or if
|
||||
// it implements a method Is(error) bool such that Is(target) returns true.
|
||||
func Is(err, target error) bool { return stderrors.Is(err, target) }
|
||||
|
||||
// As finds the first error in err's chain that matches target, and if so, sets
|
||||
// target to that error value and returns true.
|
||||
//
|
||||
// The chain consists of err itself followed by the sequence of errors obtained by
|
||||
// repeatedly calling Unwrap.
|
||||
//
|
||||
// An error matches target if the error's concrete value is assignable to the value
|
||||
// pointed to by target, or if the error has a method As(interface{}) bool such that
|
||||
// As(target) returns true. In the latter case, the As method is responsible for
|
||||
// setting target.
|
||||
//
|
||||
// As will panic if target is not a non-nil pointer to either a type that implements
|
||||
// error, or to any interface type. As returns false if err is nil.
|
||||
func As(err error, target interface{}) bool { return stderrors.As(err, target) }
|
||||
|
||||
// Unwrap returns the result of calling the Unwrap method on err, if err's
|
||||
// type contains an Unwrap method returning error.
|
||||
// Otherwise, Unwrap returns nil.
|
||||
func Unwrap(err error) error {
|
||||
return stderrors.Unwrap(err)
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"path"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultSkip = 3
|
||||
)
|
||||
|
||||
// Frame represents a program counter inside a stack frame.
|
||||
// For historical reasons if Frame is interpreted as a uintptr
|
||||
// its value represents the program counter + 1.
|
||||
type Frame uintptr
|
||||
|
||||
// pc returns the program counter for this frame;
|
||||
// multiple frames may have the same PC value.
|
||||
func (f Frame) pc() uintptr { return uintptr(f) - 1 }
|
||||
|
||||
// file returns the full path to the file that contains the
|
||||
// function for this Frame's pc.
|
||||
func (f Frame) file() string {
|
||||
fn := runtime.FuncForPC(f.pc())
|
||||
if fn == nil {
|
||||
return "unknown"
|
||||
}
|
||||
file, _ := fn.FileLine(f.pc())
|
||||
return file
|
||||
}
|
||||
|
||||
// line returns the line number of source code of the
|
||||
// function for this Frame's pc.
|
||||
func (f Frame) line() int {
|
||||
fn := runtime.FuncForPC(f.pc())
|
||||
if fn == nil {
|
||||
return 0
|
||||
}
|
||||
_, line := fn.FileLine(f.pc())
|
||||
return line
|
||||
}
|
||||
|
||||
// name returns the name of this function, if known.
|
||||
func (f Frame) name() string {
|
||||
fn := runtime.FuncForPC(f.pc())
|
||||
if fn == nil {
|
||||
return "unknown"
|
||||
}
|
||||
return fn.Name()
|
||||
}
|
||||
|
||||
// Format formats the frame according to the fmt.Formatter interface.
|
||||
//
|
||||
// %s source file
|
||||
// %d source line
|
||||
// %n function name
|
||||
// %v equivalent to %s:%d
|
||||
//
|
||||
// Format accepts flags that alter the printing of some verbs, as follows:
|
||||
//
|
||||
// %+s function name and path of source file relative to the compile time
|
||||
// GOPATH separated by \n\t (<funcname>\n\t<path>)
|
||||
// %+v equivalent to %+s:%d
|
||||
func (f Frame) Format(s fmt.State, verb rune) {
|
||||
switch verb {
|
||||
case 's':
|
||||
switch {
|
||||
case s.Flag('+'):
|
||||
_, _ = io.WriteString(s, f.name())
|
||||
_, _ = io.WriteString(s, "\n\t")
|
||||
_, _ = io.WriteString(s, f.file())
|
||||
default:
|
||||
_, _ = io.WriteString(s, path.Base(f.file()))
|
||||
}
|
||||
case 'd':
|
||||
_, _ = io.WriteString(s, strconv.Itoa(f.line()))
|
||||
case 'n':
|
||||
_, _ = io.WriteString(s, funcname(f.name()))
|
||||
case 'v':
|
||||
f.Format(s, 's')
|
||||
_, _ = io.WriteString(s, ":")
|
||||
f.Format(s, 'd')
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText formats a stacktrace Frame as a text string. The output is the
|
||||
// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.
|
||||
func (f Frame) MarshalText() ([]byte, error) {
|
||||
name := f.name()
|
||||
if name == "unknown" {
|
||||
return []byte(name), nil
|
||||
}
|
||||
return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), nil
|
||||
}
|
||||
|
||||
// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
|
||||
type StackTrace []Frame
|
||||
|
||||
// Format formats the stack of Frames according to the fmt.Formatter interface.
|
||||
//
|
||||
// %s lists source files for each Frame in the stack
|
||||
// %v lists the source file and line number for each Frame in the stack
|
||||
//
|
||||
// Format accepts flags that alter the printing of some verbs, as follows:
|
||||
//
|
||||
// %+v Prints filename, function, and line number for each Frame in the stack.
|
||||
func (st StackTrace) Format(s fmt.State, verb rune) {
|
||||
switch verb {
|
||||
case 'v':
|
||||
switch {
|
||||
case s.Flag('+'):
|
||||
for _, f := range st {
|
||||
_, _ = io.WriteString(s, "\n")
|
||||
f.Format(s, verb)
|
||||
}
|
||||
case s.Flag('#'):
|
||||
fmt.Fprintf(s, "%#v", []Frame(st))
|
||||
default:
|
||||
st.formatSlice(s, verb)
|
||||
}
|
||||
case 's':
|
||||
st.formatSlice(s, verb)
|
||||
}
|
||||
}
|
||||
|
||||
// formatSlice will format this StackTrace into the given buffer as a slice of
|
||||
// Frame, only valid when called with '%s' or '%v'.
|
||||
func (st StackTrace) formatSlice(s fmt.State, verb rune) {
|
||||
_, _ = io.WriteString(s, "[")
|
||||
for i, f := range st {
|
||||
if i > 0 {
|
||||
_, _ = io.WriteString(s, " ")
|
||||
}
|
||||
f.Format(s, verb)
|
||||
}
|
||||
_, _ = io.WriteString(s, "]")
|
||||
}
|
||||
|
||||
// Stack represents a Stack of program counters.
|
||||
type Stack []uintptr
|
||||
|
||||
func (s *Stack) Format(st fmt.State, verb rune) {
|
||||
switch verb {
|
||||
case 'v':
|
||||
switch {
|
||||
case st.Flag('+'):
|
||||
for _, pc := range *s {
|
||||
f := Frame(pc)
|
||||
fmt.Fprintf(st, "\n%+v", f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Stack) StackTrace() StackTrace {
|
||||
f := make([]Frame, len(*s))
|
||||
for i := 0; i < len(f); i++ {
|
||||
f[i] = Frame((*s)[i])
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func Callers(additionalSkip int) *Stack {
|
||||
const depth = 32
|
||||
var pcs [depth]uintptr
|
||||
n := runtime.Callers(defaultSkip+additionalSkip, pcs[:])
|
||||
var st Stack = pcs[0:n]
|
||||
return &st
|
||||
}
|
||||
|
||||
// funcname removes the path prefix component of a function's name reported by func.Name().
|
||||
func funcname(name string) string {
|
||||
i := strings.LastIndex(name, "/")
|
||||
name = name[i+1:]
|
||||
i = strings.Index(name, ".")
|
||||
return name[i+1:]
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package errors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// copied from zerolog console writer since they aren't exported
|
||||
// nolint
|
||||
const (
|
||||
colorBlack = iota + 30
|
||||
colorRed
|
||||
colorGreen
|
||||
colorYellow
|
||||
colorBlue
|
||||
colorMagenta
|
||||
colorCyan
|
||||
colorWhite
|
||||
)
|
||||
|
||||
// colorize returns the string s wrapped in ANSI code c, unless disabled is true.
|
||||
func colorize(s interface{}, c int, disabled bool) string {
|
||||
if disabled {
|
||||
return fmt.Sprintf("%s", s)
|
||||
}
|
||||
return fmt.Sprintf("\x1b[%dm%v\x1b[0m", c, s)
|
||||
}
|
||||
|
||||
type errorFormat = struct {
|
||||
Error string
|
||||
Details []string
|
||||
}
|
||||
|
||||
func FormatErrFieldValue(i interface{}) string {
|
||||
switch d := i.(type) {
|
||||
case []byte:
|
||||
var ed errorFormat
|
||||
if err := json.Unmarshal(d, &ed); err != nil {
|
||||
return fmt.Sprintf("error: %v", err)
|
||||
}
|
||||
var sb strings.Builder
|
||||
sb.WriteString(fmt.Sprintf("%s\n", ed.Error))
|
||||
if len(ed.Details) > 0 {
|
||||
sb.WriteString("error details:\n")
|
||||
for _, l := range ed.Details {
|
||||
sb.WriteString(fmt.Sprintf("%s\n", l))
|
||||
}
|
||||
}
|
||||
return colorize(sb.String(), colorRed, false)
|
||||
|
||||
default:
|
||||
return colorize(fmt.Sprintf("%s", d), colorRed, false)
|
||||
}
|
||||
}
|
||||
|
||||
func ErrorMarshalFunc(err error) interface{} {
|
||||
ef := errorFormat{
|
||||
Error: err.Error(),
|
||||
Details: PrintErrorDetails(err),
|
||||
}
|
||||
return ef
|
||||
}
|
|
@ -47,9 +47,9 @@ import (
|
|||
stdsql "database/sql"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
"{{ .TypesPath }}"
|
||||
)
|
||||
|
|
|
@ -47,10 +47,10 @@ import (
|
|||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
|
||||
idb "agola.io/agola/internal/db"
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
"{{ .TypesPath }}"
|
||||
)
|
||||
|
|
|
@ -25,8 +25,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
gitsource "agola.io/agola/internal/gitsources"
|
||||
"agola.io/agola/internal/services/types"
|
||||
"agola.io/agola/internal/util"
|
||||
|
|
|
@ -27,9 +27,9 @@ import (
|
|||
"time"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"github.com/sorintlab/errors"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gitsource "agola.io/agola/internal/gitsources"
|
||||
)
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/services/types"
|
||||
)
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/google/go-github/v50/github"
|
||||
"github.com/sorintlab/errors"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gitsource "agola.io/agola/internal/gitsources"
|
||||
)
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/google/go-github/v50/github"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/services/types"
|
||||
)
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
gitlab "github.com/xanzy/go-gitlab"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
gitsource "agola.io/agola/internal/gitsources"
|
||||
)
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/services/types"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ package gitsource
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/services/types"
|
||||
)
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@ import (
|
|||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
"golang.org/x/sync/semaphore"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
)
|
||||
|
||||
type LocalLocks struct {
|
||||
|
|
|
@ -5,7 +5,8 @@ import (
|
|||
stdsql "database/sql"
|
||||
"hash/fnv"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/sql"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
idb "agola.io/agola/internal/db"
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/lock"
|
||||
oldcstypes "agola.io/agola/internal/migration/configstore/types"
|
||||
ndb "agola.io/agola/internal/services/configstore/db"
|
||||
|
|
|
@ -18,7 +18,8 @@ import (
|
|||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/services/types"
|
||||
"agola.io/agola/util"
|
||||
)
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
idb "agola.io/agola/internal/db"
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/lock"
|
||||
oldrstypes "agola.io/agola/internal/migration/runservice/types"
|
||||
ndb "agola.io/agola/internal/services/runservice/db"
|
||||
|
|
|
@ -21,8 +21,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/mitchellh/copystructure"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/services/types"
|
||||
"agola.io/agola/util"
|
||||
)
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
// writeFileAtomicFunc atomically writes a file, it achieves this by creating a
|
||||
|
|
|
@ -18,7 +18,8 @@ import (
|
|||
"io"
|
||||
"time"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
func TestEscapeUnescape(t *testing.T) {
|
||||
|
|
|
@ -21,8 +21,7 @@ import (
|
|||
"strings"
|
||||
|
||||
minio "github.com/minio/minio-go/v6"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
type S3Storage struct {
|
||||
|
|
|
@ -18,8 +18,9 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/config"
|
||||
"agola.io/agola/internal/errors"
|
||||
itypes "agola.io/agola/internal/services/types"
|
||||
"agola.io/agola/internal/util"
|
||||
rstypes "agola.io/agola/services/runservice/types"
|
||||
|
|
|
@ -21,10 +21,10 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/sorintlab/errors"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
|
||||
"agola.io/agola/internal/config"
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/util"
|
||||
rstypes "agola.io/agola/services/runservice/types"
|
||||
"agola.io/agola/services/types"
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
gitsource "agola.io/agola/internal/gitsources"
|
||||
"agola.io/agola/internal/gitsources/gitea"
|
||||
"agola.io/agola/internal/gitsources/github"
|
||||
|
|
|
@ -20,8 +20,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
type TokenSigningData struct {
|
||||
|
|
|
@ -18,7 +18,8 @@ import (
|
|||
"net/url"
|
||||
"path"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/services/types"
|
||||
"agola.io/agola/internal/util"
|
||||
)
|
||||
|
|
|
@ -18,9 +18,9 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/sorintlab/errors"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
"agola.io/agola/internal/util"
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"path"
|
||||
"testing"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
)
|
||||
|
||||
func TestParseConfig(t *testing.T) {
|
||||
|
|
|
@ -16,8 +16,8 @@ package action
|
|||
|
||||
import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/lock"
|
||||
"agola.io/agola/internal/services/configstore/db"
|
||||
"agola.io/agola/internal/sql"
|
||||
|
|
|
@ -22,9 +22,9 @@ import (
|
|||
"time"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
idb "agola.io/agola/internal/db"
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
"agola.io/agola/internal/util"
|
||||
)
|
||||
|
|
|
@ -17,7 +17,8 @@ package action
|
|||
import (
|
||||
"context"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/services/configstore/db"
|
||||
"agola.io/agola/internal/sql"
|
||||
"agola.io/agola/internal/util"
|
||||
|
|
|
@ -19,8 +19,8 @@ import (
|
|||
"path"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"agola.io/agola/internal/sql"
|
||||
"agola.io/agola/internal/util"
|
||||
"agola.io/agola/services/configstore/types"
|
||||
|
|
|
@ -19,7 +19,8 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"agola.io/agola/internal/errors"
|
||||
"github.com/sorintlab/errors"
|
||||
|
||||
"agola.io/agola/internal/sql"
|
||||
"agola.io/agola/internal/util"
|
||||
"agola.io/agola/services/configstore/types"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue