MSP-8292 Up deps
This commit is contained in:
1 parent
3a66223a89
commit
5daaea50a1
186 files changed
+7092
-1579
No files matched your search
+1
-1
@@ -36,8 +36,8 @@ package app
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/config"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/bgjob"
|
||||
"github.com/txix-open/isp-kit/dbx"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"github.com/txix-open/isp-kit/metrics"
|
||||
"github.com/txix-open/isp-kit/metrics/bgjob_metrics"
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ package handler
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
// Result defines the outcome of job processing.
|
||||
|
||||
+5
-5
@@ -17,13 +17,13 @@
|
||||
|
||||
Обработать критические ошибки с уведомлением в Sentry
|
||||
|
||||
#### `New(moduleVersion string, remoteConfig any, endpoints []cluster.EndpointDescriptor, transport string) *Bootstrap`
|
||||
#### `New(moduleVersion string, remoteConfig any, endpointsResolver cluster.EndpointsResolver, transport string) *Bootstrap`
|
||||
|
||||
Конструктор с параметрами:
|
||||
|
||||
- `moduleVersion` - версия модуля
|
||||
- `remoteConfig` - структура для динамической конфигурации
|
||||
- `endpoints` - список эндпоинтов модуля, для транспорта `http` у каждого `endpoint`'а должен быть указан `HttpMethod`
|
||||
- `endpointsResolver` - резолвер эндпоинтов модуля; используйте `cluster.Endpoints(...)` для статического списка или реализуйте интерфейс `cluster.EndpointsResolver` для динамического; для транспорта `http` у каждого `endpoint`'а должен быть указан `HttpMethod`
|
||||
- `transport` - тип сервера, `grpc`, `http` или `empty`
|
||||
|
||||
#### `NewStandalone(moduleVersion string) *StandaloneBootstrap`
|
||||
@@ -82,7 +82,7 @@ type remoteConfig struct {
|
||||
func noopHandler() {}
|
||||
|
||||
func main() {
|
||||
endpoints := []cluster.EndpointDescriptor{{
|
||||
endpointsResolver := cluster.Endpoints([]cluster.EndpointDescriptor{{
|
||||
Path: "/api/service/private",
|
||||
Inner: true,
|
||||
Handler: noopHandler,
|
||||
@@ -90,8 +90,8 @@ func main() {
|
||||
Path: "/api/service/public",
|
||||
Inner: false,
|
||||
Handler: noopHandler,
|
||||
}}
|
||||
boot := bootstrap.New("1.0.0", remoteConfig{}, endpoints, cluster.GrpcTransport)
|
||||
}})
|
||||
boot := bootstrap.New("1.0.0", remoteConfig{}, endpointsResolver, cluster.GrpcTransport)
|
||||
|
||||
shutdown.On(func() { /* waiting for SIGINT & SIGTERM signals */
|
||||
log.Println("shutting down...")
|
||||
|
||||
+1
-1
@@ -8,9 +8,9 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/app"
|
||||
"github.com/txix-open/isp-kit/config"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/healthcheck"
|
||||
"github.com/txix-open/isp-kit/infra"
|
||||
"github.com/txix-open/isp-kit/infra/pprof"
|
||||
|
||||
+13
-13
@@ -11,7 +11,7 @@
|
||||
// boot := bootstrap.New(
|
||||
// "1.0.0", // module version
|
||||
// &RemoteConfig{}, // remote config struct
|
||||
// []cluster.EndpointDescriptor{}, // service endpoints
|
||||
// cluster.Endpoints([]cluster.EndpointDescriptor{}), // service endpoints
|
||||
// cluster.HttpTransport, // transport type
|
||||
// )
|
||||
//
|
||||
@@ -50,9 +50,9 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/app"
|
||||
"github.com/txix-open/isp-kit/cluster"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"github.com/txix-open/isp-kit/observability/sentry"
|
||||
@@ -88,7 +88,7 @@ type Bootstrap struct {
|
||||
// Parameters:
|
||||
// - moduleVersion: Version string of the module (e.g., "1.0.0")
|
||||
// - remoteConfig: Pointer to a struct defining the remote configuration schema
|
||||
// - endpoints: List of service endpoint descriptors for cluster discovery
|
||||
// - endpointsResolver: Resolver providing service endpoint descriptors for cluster discovery
|
||||
// - transport: Transport type (e.g., cluster.HttpTransport or cluster.GrpcTransport)
|
||||
//
|
||||
// Returns a fully initialized Bootstrap instance with:
|
||||
@@ -107,15 +107,15 @@ type Bootstrap struct {
|
||||
// boot := bootstrap.New(
|
||||
// "1.2.3",
|
||||
// &MyRemoteConfig{},
|
||||
// []cluster.EndpointDescriptor{
|
||||
// cluster.Endpoints([]cluster.EndpointDescriptor{
|
||||
// {Path: "/api/v1", HttpMethod: "GET"},
|
||||
// },
|
||||
// }),
|
||||
// cluster.HttpTransport,
|
||||
// )
|
||||
func New(
|
||||
moduleVersion string,
|
||||
remoteConfig any,
|
||||
endpoints []cluster.EndpointDescriptor,
|
||||
endpointsResolver cluster.EndpointsResolver,
|
||||
transport string,
|
||||
) *Bootstrap {
|
||||
isDev := isOnDevMode()
|
||||
@@ -124,8 +124,8 @@ func New(
|
||||
stdlog.Fatal(err)
|
||||
}
|
||||
|
||||
if transport == cluster.HttpTransport {
|
||||
for _, endpoint := range endpoints {
|
||||
if transport == cluster.HttpTransport && endpointsResolver != nil {
|
||||
for _, endpoint := range endpointsResolver.Endpoints() {
|
||||
if endpoint.HttpMethod == "" {
|
||||
app.Logger().Fatal(
|
||||
app.Context(),
|
||||
@@ -178,7 +178,7 @@ func New(
|
||||
transport,
|
||||
remoteConfig,
|
||||
moduleVersion,
|
||||
endpoints,
|
||||
endpointsResolver,
|
||||
)
|
||||
if err != nil {
|
||||
err = errors.WithMessage(err, "create bootstrap")
|
||||
@@ -196,7 +196,7 @@ func newClustered(
|
||||
transport string,
|
||||
remoteConfig any,
|
||||
moduleVersion string,
|
||||
endpoints []cluster.EndpointDescriptor,
|
||||
endpointsResolver cluster.EndpointsResolver,
|
||||
) (*Bootstrap, error) {
|
||||
broadcastHost, err := resolveBroadcastHost(localConfig)
|
||||
if err != nil {
|
||||
@@ -223,7 +223,7 @@ func newClustered(
|
||||
moduleVersion,
|
||||
transport,
|
||||
broadcastHost,
|
||||
endpoints,
|
||||
endpointsResolver,
|
||||
wrappedLogger,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -294,7 +294,7 @@ func initClusterClient(
|
||||
moduleVersion string,
|
||||
transport string,
|
||||
broadcastHost string,
|
||||
endpoints []cluster.EndpointDescriptor,
|
||||
endpointsResolver cluster.EndpointsResolver,
|
||||
logger log.Logger,
|
||||
) (*cluster.Client, error) {
|
||||
moduleInfo := cluster.ModuleInfo{
|
||||
@@ -306,7 +306,7 @@ func initClusterClient(
|
||||
IP: broadcastHost,
|
||||
Port: strconv.Itoa(localConfig.GrpcOuterAddress.Port),
|
||||
},
|
||||
Endpoints: endpoints,
|
||||
EndpointsResolver: endpointsResolver,
|
||||
MetricsAutodiscovery: metricsServiceDiscovery(localConfig, broadcastHost),
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
stdlog "log"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"github.com/txix-open/isp-kit/observability/sentry"
|
||||
|
||||
+1
-1
@@ -7,8 +7,8 @@ import (
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/config"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
func isOnDevMode() bool {
|
||||
|
||||
+2
-2
@@ -103,11 +103,11 @@ func main() {
|
||||
moduleInfo := cluster.ModuleInfo{
|
||||
ModuleName: "noop-service",
|
||||
Version: "1.0.0",
|
||||
Endpoints: []cluster.EndpointDescriptor{{
|
||||
EndpointsResolver: cluster.Endpoints([]cluster.EndpointDescriptor{{
|
||||
Path: "/api/foo",
|
||||
Inner: false,
|
||||
Handler: noopHandler,
|
||||
}},
|
||||
}}),
|
||||
}
|
||||
defaultRemoteConfig := []byte{...}
|
||||
configData := cluster.ConfigData{
|
||||
|
||||
+31
-2
@@ -23,8 +23,8 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/etp/v4"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
"github.com/txix-open/isp-kit/lb"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
@@ -135,6 +135,29 @@ func (c *Client) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendModuleReady sends a ModuleReady event to the isp-config-service,
|
||||
// announcing the module's availability and its dependencies.
|
||||
func (c *Client) SendModuleReady(ctx context.Context) error {
|
||||
cli := c.cli.Load()
|
||||
if cli == nil {
|
||||
return errors.New("client not connected")
|
||||
}
|
||||
if c.eventHandler == nil {
|
||||
return errors.New("event handler not initialized")
|
||||
}
|
||||
|
||||
requiredModules := make([]string, 0, len(c.eventHandler.requiredModules))
|
||||
for moduleName := range c.eventHandler.requiredModules {
|
||||
requiredModules = append(requiredModules, moduleName)
|
||||
}
|
||||
requirements := ModuleRequirements{
|
||||
RequiredModules: requiredModules,
|
||||
RequireRoutes: c.eventHandler.routesReceiver != nil,
|
||||
}
|
||||
|
||||
return c.notifyModuleReady(ctx, cli, requirements)
|
||||
}
|
||||
|
||||
// Healthcheck returns an error if the session is inactive, otherwise returns nil.
|
||||
func (c *Client) Healthcheck(ctx context.Context) error {
|
||||
if c.sessionIsActive.Load() {
|
||||
@@ -310,11 +333,17 @@ func (c *Client) notifyModuleReady(ctx context.Context, cli *clientWrapper, requ
|
||||
}
|
||||
moduleDependencies = append(moduleDependencies, dep)
|
||||
}
|
||||
|
||||
endpoints := make([]EndpointDescriptor, 0)
|
||||
if c.moduleInfo.EndpointsResolver != nil {
|
||||
endpoints = c.moduleInfo.EndpointsResolver.Endpoints()
|
||||
}
|
||||
|
||||
declaration := BackendDeclaration{
|
||||
ModuleName: c.moduleInfo.ModuleName,
|
||||
Version: c.moduleInfo.ModuleVersion,
|
||||
LibVersion: c.moduleInfo.LibVersion,
|
||||
Endpoints: c.moduleInfo.Endpoints,
|
||||
Endpoints: endpoints,
|
||||
Transport: c.moduleInfo.Transport,
|
||||
RequiredModules: moduleDependencies,
|
||||
Address: c.moduleInfo.GrpcOuterAddress,
|
||||
|
||||
+2
-2
@@ -27,14 +27,14 @@ type ConfigData struct {
|
||||
}
|
||||
|
||||
// ModuleInfo describes a module's metadata, including its name, version, transport
|
||||
// configuration, exposed endpoints, and metrics autodiscovery settings.
|
||||
// configuration, endpoint resolver, and metrics autodiscovery settings.
|
||||
type ModuleInfo struct {
|
||||
ModuleName string
|
||||
ModuleVersion string
|
||||
LibVersion string
|
||||
Transport string
|
||||
GrpcOuterAddress AddressConfiguration
|
||||
Endpoints []EndpointDescriptor
|
||||
EndpointsResolver EndpointsResolver
|
||||
MetricsAutodiscovery *MetricsAutodiscovery
|
||||
}
|
||||
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package cluster
|
||||
|
||||
// EndpointsResolver provides the list of endpoints for a module.
|
||||
// Implement this interface when endpoints must be resolved dynamically at runtime.
|
||||
// Use the Endpoints helper for static endpoint lists.
|
||||
type EndpointsResolver interface {
|
||||
Endpoints() []EndpointDescriptor
|
||||
}
|
||||
|
||||
// StaticEndpointResolver wraps a fixed slice of EndpointDescriptors.
|
||||
// It implements EndpointsResolver for cases where the endpoint list is known at startup
|
||||
// and does not change.
|
||||
type StaticEndpointResolver []EndpointDescriptor
|
||||
|
||||
// Endpoints returns the underlying slice of EndpointDescriptors.
|
||||
func (s StaticEndpointResolver) Endpoints() []EndpointDescriptor {
|
||||
return s
|
||||
}
|
||||
|
||||
// Endpoints wraps a slice of EndpointDescriptors into a StaticEndpointResolver.
|
||||
// Use this helper when constructing ModuleInfo or calling bootstrap.New with a known
|
||||
// set of endpoints:
|
||||
//
|
||||
// bootstrap.New(
|
||||
// "1.0.0",
|
||||
// &config{},
|
||||
// cluster.Endpoints([]cluster.EndpointDescriptor{{Path: "/api", HttpMethod: "GET"}}),
|
||||
// cluster.HttpTransport,
|
||||
// )
|
||||
func Endpoints(arr []EndpointDescriptor) StaticEndpointResolver {
|
||||
return StaticEndpointResolver(arr)
|
||||
}
|
||||
+1
-1
@@ -3,8 +3,8 @@ package cluster
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/bellows"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
// OfflineClient provides configuration loading from a local file instead of a remote
|
||||
|
||||
+1
-1
@@ -5,9 +5,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/etp/v4"
|
||||
"github.com/txix-open/etp/v4/msg"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"github.com/txix-open/isp-kit/requestid"
|
||||
|
||||
+1
-1
@@ -36,8 +36,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/bellows"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
// Validator defines an interface for validating configuration values.
|
||||
|
||||
+1
-1
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/bellows"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"github.com/jackc/pgx/v5/stdlib"
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/metrics/sql_metrics"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -13,9 +13,9 @@ import (
|
||||
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/db"
|
||||
"github.com/txix-open/isp-kit/dbx"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/metrics"
|
||||
"github.com/txix-open/isp-kit/metrics/pgx_metrics"
|
||||
"github.com/txix-open/isp-kit/metrics/sql_metrics"
|
||||
|
||||
+1
-1
@@ -11,9 +11,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pressly/goose/v3"
|
||||
"github.com/txix-open/isp-kit/db"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
// nolint:gochecknoglobals
|
||||
|
||||
+1
-1
@@ -12,8 +12,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pressly/goose/v3"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
)
|
||||
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
# Package `errors`
|
||||
|
||||
Пакет `errors` предоставляет функции для создания, оборачивания и проверки ошибок, используя стандартные пакеты Go
|
||||
`errors` и `fmt`.
|
||||
|
||||
Пакет заменяет привычные вызовы из `github.com/pkg/errors`.
|
||||
|
||||
## Functions
|
||||
|
||||
#### `New(text string) error`
|
||||
|
||||
Создает новую ошибку с переданным текстом.
|
||||
|
||||
#### `Errorf(format string, args ...any) error`
|
||||
|
||||
Создает новую ошибку с форматированием. Если формат содержит `%w`, ошибка будет обернута стандартным механизмом Go.
|
||||
|
||||
#### `WithMessage(err error, message string) error`
|
||||
|
||||
Добавляет сообщение к ошибке через стандартное оборачивание `%w`.
|
||||
|
||||
#### `WithMessagef(err error, format string, args ...any) error`
|
||||
|
||||
Добавляет форматированное сообщение к ошибке через стандартное оборачивание `%w`.
|
||||
|
||||
#### `Is(err, target error) bool`
|
||||
|
||||
Проверяет, содержит ли цепочка ошибок `target`.
|
||||
|
||||
#### `As(err error, target any) bool`
|
||||
|
||||
Находит в цепочке ошибок ошибку подходящего типа и записывает ее в `target`.
|
||||
|
||||
#### `AsType[E error](err error) (E, bool)`
|
||||
|
||||
Generic-версия `As`, возвращающая найденную ошибку и признак успешного поиска.
|
||||
|
||||
#### `Unwrap(err error) error`
|
||||
|
||||
Возвращает ошибку, обернутую внутри `err`.
|
||||
|
||||
#### `Join(errs ...error) error`
|
||||
|
||||
Объединяет несколько ошибок в одну.
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
func getUser(userId string) error {
|
||||
err := sql.ErrNoRows
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "get user %s", userId)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
```
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
// Package errors provides helpers for creating, wrapping, and inspecting errors
|
||||
// using the standard library errors and fmt packages.
|
||||
package errors
|
||||
|
||||
import (
|
||||
stderrors "errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ErrUnsupported indicates that an operation is not supported.
|
||||
var ErrUnsupported = stderrors.ErrUnsupported
|
||||
|
||||
// New returns an error with the supplied text.
|
||||
func New(text string) error {
|
||||
return stderrors.New(text) //nolint:err113
|
||||
}
|
||||
|
||||
// Errorf formats according to a format specifier and returns an error.
|
||||
func Errorf(format string, args ...any) error {
|
||||
return fmt.Errorf(format, args...) //nolint:err113
|
||||
}
|
||||
|
||||
// WithMessage wraps err with message using standard error wrapping.
|
||||
func WithMessage(err error, message string) error {
|
||||
return Errorf("%s: %w", message, err)
|
||||
}
|
||||
|
||||
// WithMessagef wraps err with a formatted message using standard error wrapping.
|
||||
func WithMessagef(err error, format string, args ...any) error {
|
||||
return Errorf("%s: %w", fmt.Sprintf(format, args...), err)
|
||||
}
|
||||
|
||||
// Is reports whether err's tree contains target.
|
||||
func Is(err, target error) bool {
|
||||
return stderrors.Is(err, target)
|
||||
}
|
||||
|
||||
// As finds the first error in err's tree that matches target.
|
||||
func As(err error, target any) bool {
|
||||
return stderrors.As(err, target)
|
||||
}
|
||||
|
||||
// AsType finds the first error in err's tree that matches E.
|
||||
func AsType[E error](err error) (E, bool) {
|
||||
return stderrors.AsType[E](err)
|
||||
}
|
||||
|
||||
// Unwrap returns the result of calling err's Unwrap method.
|
||||
func Unwrap(err error) error {
|
||||
return stderrors.Unwrap(err)
|
||||
}
|
||||
|
||||
// Join returns an error that wraps the given errors.
|
||||
func Join(errs ...error) error {
|
||||
return stderrors.Join(errs...)
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@ package apierrors
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package grpc
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -10,8 +10,8 @@ import (
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/codec"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
grpc2 "github.com/txix-open/isp-kit/grpc"
|
||||
"github.com/txix-open/isp-kit/grpc/client/request"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"reflect"
|
||||
"unicode"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package endpoint
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
)
|
||||
|
||||
+1
-1
@@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/codec"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package grpc
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import (
|
||||
"net"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/isp"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/http/httpcli"
|
||||
"github.com/txix-open/isp-kit/lb"
|
||||
)
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
// Server is a wrapper around http.Server that simplifies HTTP server setup
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"go.uber.org/zap"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
+1
-1
@@ -17,11 +17,11 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/collectors"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
io_prometheus_client "github.com/prometheus/client_model/go"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"github.com/txix-open/isp-kit/requestid"
|
||||
)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/go-logr/stdr"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/metrics/sql_metrics"
|
||||
"github.com/txix-open/isp-kit/observability/tracing"
|
||||
"github.com/txix-open/isp-kit/requestid"
|
||||
|
||||
+1
-2
@@ -20,7 +20,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/panic_recovery"
|
||||
)
|
||||
|
||||
@@ -38,4 +38,3 @@ func testPanic() {
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ package panic_recovery
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+1
-1
@@ -7,8 +7,8 @@ import (
|
||||
"maps"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/bellows"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
)
|
||||
|
||||
|
||||
+5
-2
@@ -10,10 +10,10 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/txix-open/isp-kit/db"
|
||||
"github.com/txix-open/isp-kit/dbx"
|
||||
"github.com/txix-open/isp-kit/errors"
|
||||
"github.com/txix-open/isp-kit/test"
|
||||
)
|
||||
|
||||
@@ -81,7 +81,10 @@ func (db *TestDb) Close() error {
|
||||
return errors.WithMessage(err, "drop schema")
|
||||
}
|
||||
err = db.Client.Close()
|
||||
return errors.WithMessage(err, "close db")
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "close db")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// must provides database operations that automatically assert no errors.
|
||||
|
||||
Reference in new issue
Block a user