diff --git a/backend/go.mod b/backend/go.mod index e5f04cc25..7de0fc4ab 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -16,7 +16,6 @@ require github.com/crawlab-team/crawlab/core v0.0.0-20240614095218-7b4ee8399ab0 require ( dario.cat/mergo v1.0.0 // indirect - github.com/crawlab-team/crawlab/trace v0.1.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect diff --git a/trace b/trace deleted file mode 160000 index 188cd58fe..000000000 --- a/trace +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 188cd58fec6e9cbee13060594f065bf811dea212 diff --git a/trace/.gitignore b/trace/.gitignore new file mode 100644 index 000000000..ec5b69a88 --- /dev/null +++ b/trace/.gitignore @@ -0,0 +1,18 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +.idea +.DS_Store \ No newline at end of file diff --git a/trace/LICENSE b/trace/LICENSE new file mode 100644 index 000000000..3c0946b9b --- /dev/null +++ b/trace/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2021, Crawlab Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/trace/README.md b/trace/README.md new file mode 100644 index 000000000..168e0d406 --- /dev/null +++ b/trace/README.md @@ -0,0 +1,2 @@ +# go-trace +Trace stack tools diff --git a/trace/go.mod b/trace/go.mod new file mode 100644 index 000000000..368c0f2bd --- /dev/null +++ b/trace/go.mod @@ -0,0 +1,5 @@ +module github.com/crawlab-team/crawlab/trace + +go 1.22 + +require github.com/ztrue/tracerr v0.4.0 diff --git a/trace/go.sum b/trace/go.sum new file mode 100644 index 000000000..ed0407a42 --- /dev/null +++ b/trace/go.sum @@ -0,0 +1,2 @@ +github.com/ztrue/tracerr v0.4.0 h1:vT5PFxwIGs7rCg9ZgJ/y0NmOpJkPCPFK8x0vVIYzd04= +github.com/ztrue/tracerr v0.4.0/go.mod h1:PaFfYlas0DfmXNpo7Eay4MFhZUONqvXM+T2HyGPpngk= diff --git a/trace/trace.go b/trace/trace.go new file mode 100644 index 000000000..52b595452 --- /dev/null +++ b/trace/trace.go @@ -0,0 +1,22 @@ +package trace + +import "github.com/ztrue/tracerr" + +func PrintError(err error) { + err = tracerr.Wrap(err) + if err != nil { + tracerr.Print(err) + } +} + +func TraceError(err error) error { + err = tracerr.Wrap(err) + if err != nil { + tracerr.Print(err) + } + return err +} + +func Error(err error) error { + return tracerr.Wrap(err) +}