diff --git a/README.md b/README.md index 9e8fbdcdda876afe1a7754e8b8e7f85e38e0169d..1a5455e4972399f59416e9039ba975ae4c43e5e4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A set of utilities used by our Golang projects ## Creating a new release When making changes, a new release needs to be made in order to use the updated library in your project. -1. First, make sure your `uafrica-tools` repository is up to date (minimum at commit `442f62f0`): +1. First, make sure your `bob-tools` (https://gitlab.bob.co.za/bob-tools/bobgroup-tools) repository is up to date (minimum at commit `442f62f0`): ``` git pull make install @@ -13,13 +13,13 @@ make install 2. After your changes have been merged to the `main` branch of `go-utils`, run the following command which will automatically create a new tag: ``` -ua release +bob release ``` -and select project `uafrica/go-utils` +and select project `bob-public-utils/bobgroup-go-utils` -3. For your project, upgrade to the new version by running the `go get` command and specifying the new tab: +3. For your project, upgrade to the new version by running the `go get` command and specifying the new tag: ``` -go get gitlab.com/uafrica/go-utils@v1.6.0 +go get gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils@v1.6.0 ``` -**Note:** The release documentation can be found in GitLab, by navigating to the new tag. For example: https://gitlab.com/uafrica/go-utils/-/tags/v1.6.0 +**Note:** The release documentation can be found in GitLab, by navigating to the new tag. For example: https://gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/-/tags/v1.6.0 diff --git a/errors/README.md b/errors/README.md index 39be72b24bf0f1464c62081225b1162586410219..3c8dcb860b2aeda0e4c71082704996ff1bb7ad19 100644 --- a/errors/README.md +++ b/errors/README.md @@ -29,7 +29,7 @@ For lots of detail on this, see comments in error_formats_test.go and run that t ## Usage Get the package into your project: ``` -go get gitlab.com/uafrica/go-utils +go get gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils ``` ## func New() @@ -87,7 +87,7 @@ An error with HTTP code will also print the code in the stack, e.g.: Replace all other errors package imports with this package: ``` import ( - "gitlab.com/uafrica/go-utils/errors" + "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors" ) ``` @@ -139,7 +139,7 @@ Call ```err.Description()``` to get a struct that can marshal to JSON for a comp { "error": "login failed", "source": { - "package": "gitlab.com/uafrica/go-utils/errors/errors_test", + "package": "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors/errors_test", "file": "errors_test.go", "line": 18, "function": "TestErrorFormatting" @@ -147,7 +147,7 @@ Call ```err.Description()``` to get a struct that can marshal to JSON for a comp "cause": { "error": "failed to find account", "source": { - "package": "gitlab.com/uafrica/go-utils/errors/errors_test", + "package": "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors/errors_test", "file": "errors_test.go", "line": 17, "function": "TestErrorFormatting" @@ -155,7 +155,7 @@ Call ```err.Description()``` to get a struct that can marshal to JSON for a comp "cause": { "error": "query failed", "source": { - "package": "gitlab.com/uafrica/go-utils/errors/errors_test", + "package": "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors/errors_test", "file": "errors_test.go", "line": 16, "function": "TestErrorFormatting" diff --git a/errors/errors_test.go b/errors/errors_test.go index a94762daffc6be566e28594a5b8fc99fc4f9224a..68627c7003c90724d1436d6ede4b27648cb6e5c0 100644 --- a/errors/errors_test.go +++ b/errors/errors_test.go @@ -29,7 +29,7 @@ func TestErrorFormatting(t *testing.T) { t.Logf("%%v: %v", e4) // use %+v for complete error with stack: - // -> "gitlab.com/uafrica/go-utils/errors_test/TestErrorFormatting():errors_test.go(17): login failed, because gitlab.com/uafrica/go-utils/errors_test/TestErrorFormatting():errors_test.go(16): failed to find account, because gitlab.com/uafrica/go-utils/errors_test/TestErrorFormatting():errors_test.go(15): query failed, because you have problem in your SQL near xxx + // -> "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors_test/TestErrorFormatting():errors_test.go(17): login failed, because gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors_test/TestErrorFormatting():errors_test.go(16): failed to find account, because gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors_test/TestErrorFormatting():errors_test.go(15): query failed, because you have problem in your SQL near xxx t.Logf("%%+v: %+v", e4) // you may also JSON marshal the error diff --git a/logs/stack.go b/logs/stack.go index ec66655ef36c60d50f354dcb514997235c435eb1..c64b584b8223759cc537b8772310730bccf161e7 100644 --- a/logs/stack.go +++ b/logs/stack.go @@ -22,17 +22,17 @@ func CallStack() Stack { // get the call stack s := bufio.NewScanner(strings.NewReader(string(debug.Stack()))) // expect stack to look like this: - // "goroutine 14 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x88\ngitlab.com/uafrica/go-utils/api.Api.Handler.func3.1(0x1400009ff60)\n\t/Users/jansemmelink/uafrica/go-utils/api/lambda.go:210 +0x48\npanic({0x100780d20, 0x100b98a50})\n\t/usr/local/go/src/runtime/panic.go:1038 +0x21c\ngitlab.com/uafrica/go-utils/examples/core/api/users.Crash({{{0x1008237e0, 0x1400040af30}, {0x4, {0x1008186e0, 0x14000010020}, 0x1400040af90, 0x25, 0x2f}, {0xc04f2cb513fbdc28, 0x103ccb5b4c, ...}}, ...}, ...)\n\t/Users/jansemmelink/uafrica/go-utils/examples/core/api/users/users.go:115 +0x20\nreflect.Value.call({0x10076bba0, 0x10080cdc8, 0x13}, {0x10059bb1c, 0x4}, {0x140000a0730, 0x2, 0x2})\n\t/usr/local/go/src/reflect/value.go:543 +0x584\nreflect.Value.Call({0x10076bba0, 0x10080cdc8, 0x13}, {0x140000a0730, 0x2, 0x2})\n\t/usr/local/go/src/reflect/value.go:339 +0x8c\ngitlab.com/uafrica/go-utils/api.Api.Handler.func3({{0x10082f730, 0x100780960}, {0x0, 0x0}, {0x0, 0x0}, {0x10076bba0, 0x10080cdc8, 0x13}}, {0x140000a0730, ...})\n\t/Users/jansemmelink/uafrica/go-utils/api/lambda.go:214 +0x84\ngitlab.com/uafrica/go-utils/api.Api.Handler({{0x10082b3f0, 0x140003b6480}, {0x10059b80a, 0x3}, {0x140003b6360}, {0x1005a3606, 0x12}, 0x10080cf98, {0x1008190e0, 0x100bdd308}, ...}, ...)\n\t/Users/jansemmelink/uafrica/go-utils/api/lambda.go:216 +0x1238\ngitlab.com/uafrica/go-utils/api.Api.ServeHTTP({{0x10082b3f0, 0x140003b6480}, {0x10059b80a, 0x3}, {0x140003b6360}, {0x1005a3606, 0x12}, 0x10080cf98, {0x1008190e0, 0x100bdd308}, ...}, ...)\n\t/Users/jansemmelink/uafrica/go-utils/api/local.go:81 +0x6ac\nnet/http.serverHandler.ServeHTTP({0x1400015a620}, {0x1008200e8, 0x1400015aa80}, 0x140003c6900)\n\t/usr/local/go/src/net/http/server.go:2878 +0x444\nnet/http.(*conn).serve(0x14000279220, {0x1008237e0, 0x140003b6780})\n\t/usr/local/go/src/net/http/server.go:1929 +0xb6c\ncreated by net/http.(*Server).Serve\n\t/usr/local/go/src/net/http/server.go:3033 +0x4b8\n" + // "goroutine 14 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x88\ngitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/api.Api.Handler.func3.1(0x1400009ff60)\n\t/Users/jansemmelink/uafrica/go-utils/api/lambda.go:210 +0x48\npanic({0x100780d20, 0x100b98a50})\n\t/usr/local/go/src/runtime/panic.go:1038 +0x21c\ngitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/examples/core/api/users.Crash({{{0x1008237e0, 0x1400040af30}, {0x4, {0x1008186e0, 0x14000010020}, 0x1400040af90, 0x25, 0x2f}, {0xc04f2cb513fbdc28, 0x103ccb5b4c, ...}}, ...}, ...)\n\t/Users/jansemmelink/uafrica/go-utils/examples/core/api/users/users.go:115 +0x20\nreflect.Value.call({0x10076bba0, 0x10080cdc8, 0x13}, {0x10059bb1c, 0x4}, {0x140000a0730, 0x2, 0x2})\n\t/usr/local/go/src/reflect/value.go:543 +0x584\nreflect.Value.Call({0x10076bba0, 0x10080cdc8, 0x13}, {0x140000a0730, 0x2, 0x2})\n\t/usr/local/go/src/reflect/value.go:339 +0x8c\ngitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/api.Api.Handler.func3({{0x10082f730, 0x100780960}, {0x0, 0x0}, {0x0, 0x0}, {0x10076bba0, 0x10080cdc8, 0x13}}, {0x140000a0730, ...})\n\t/Users/jansemmelink/uafrica/go-utils/api/lambda.go:214 +0x84\ngitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/api.Api.Handler({{0x10082b3f0, 0x140003b6480}, {0x10059b80a, 0x3}, {0x140003b6360}, {0x1005a3606, 0x12}, 0x10080cf98, {0x1008190e0, 0x100bdd308}, ...}, ...)\n\t/Users/jansemmelink/uafrica/go-utils/api/lambda.go:216 +0x1238\ngitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/api.Api.ServeHTTP({{0x10082b3f0, 0x140003b6480}, {0x10059b80a, 0x3}, {0x140003b6360}, {0x1005a3606, 0x12}, 0x10080cf98, {0x1008190e0, 0x100bdd308}, ...}, ...)\n\t/Users/jansemmelink/uafrica/go-utils/api/local.go:81 +0x6ac\nnet/http.serverHandler.ServeHTTP({0x1400015a620}, {0x1008200e8, 0x1400015aa80}, 0x140003c6900)\n\t/usr/local/go/src/net/http/server.go:2878 +0x444\nnet/http.(*conn).serve(0x14000279220, {0x1008237e0, 0x140003b6780})\n\t/usr/local/go/src/net/http/server.go:1929 +0xb6c\ncreated by net/http.(*Server).Serve\n\t/usr/local/go/src/net/http/server.go:3033 +0x4b8\n" // i.e. multiple lines ending with "\n" each, e.g.: // ------------------------------------------------------------------------------------------------------------ // goroutine 37 [running]: // runtime/debug.Stack() // /usr/local/go/src/runtime/debug/stack.go:24 +0x88 - // gitlab.com/uafrica/go-utils/api.Api.Handler.func3.1(0x1400042cb00, 0x14000095f68) + // gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/api.Api.Handler.func3.1(0x1400042cb00, 0x14000095f68) // /Users/jansemmelink/uafrica/go-utils/api/lambda.go:216 +0x50 // panic({0x100c08d20, 0x101020a70}) // /usr/local/go/src/runtime/panic.go:1038 +0x21c - // gitlab.com/uafrica/go-utils/examples/core/api/users.Crash({{{0x100cab7c0, 0x140004843c0}, {0x4, {0x100ca06c0, 0x14000138010}, 0x14000484420, 0x20, 0x28}, {0xc04f2d6c3023b330, 0x227861e6a, ...}}, ...}, ...) + // gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/examples/core/api/users.Crash({{{0x100cab7c0, 0x140004843c0}, {0x4, {0x100ca06c0, 0x14000138010}, 0x14000484420, 0x20, 0x28}, {0xc04f2d6c3023b330, 0x227861e6a, ...}}, ...}, ...) // /Users/jansemmelink/uafrica/go-utils/examples/core/api/users/users.go:115 +0x20 // ... // ------------------------------------------------------------------------------------------------------------ @@ -76,8 +76,8 @@ func CallStack() Stack { ci := caller.Info() if len(stack.Callers) == 0 { if ci.Package == "runtime/debug" || - ci.Package == "gitlab.com/uafrica/go-utils/logs" || - ci.Package == "gitlab.com/uafrica/go-utils/errors" || + ci.Package == "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/logs" || + ci.Package == "gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors" || ci.Package == "" { continue }