diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 415d01e5..9902dc82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: CI -on: pull_request +on: [push] jobs: golangci-lint: @@ -27,10 +27,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: reviewdog/action-hadolint@v1 + - uses: hadolint/hadolint-action@v3.1.0 with: - fail_on_error: true - reporter: github-pr-review + recursive: true + dockerfile: Dockerfile dotenv-linter: name: runner / dotenv-linter @@ -41,18 +41,6 @@ jobs: with: reporter: github-pr-review - check-dependencies: - name: runner / check-dependencies - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 - - name: WriteGoList - run: go list -json -m all > go.list - - name: Nancy - uses: sonatype-nexus-community/nancy-github-action@main - continue-on-error: true - tests: name: runner / tests runs-on: ubuntu-latest @@ -60,20 +48,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v2 with: - go-version: 1.17 - + go-version: "1.19.4" - name: Unit Tests - run: "go test \ - -v \ - -race \ - -covermode atomic \ - -coverprofile=coverage.txt \ - ./internal/..." + run: "make test" - name: Upload coverage report run: bash <(curl -s https://codecov.io/bash) - - name: Integration tests - run: "docker-compose up \ - --build \ - --abort-on-container-exit \ - --exit-code-from integration" diff --git a/.gitignore b/.gitignore index 582d572a..73876fe3 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,7 @@ bin/ *.out # Dependency directories (remove the comment below to include it) -vendor/ \ No newline at end of file +vendor/ + +# coverage files +coverage.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5fda718f..0413e017 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,4 @@ COPY --from=builder /app/config /config COPY --from=builder /app/migrations /migrations COPY --from=builder /bin/app /app COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -CMD ["/app"] \ No newline at end of file +CMD ["/app"] diff --git a/Makefile b/Makefile index 4fffa4e9..453919b8 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,6 @@ compose-up: ### Run docker-compose docker-compose up --build -d postgres rabbitmq && docker-compose logs -f .PHONY: compose-up -compose-up-integration-test: ### Run docker-compose with integration test - docker-compose up --build --abort-on-container-exit --exit-code-from integration -.PHONY: compose-up-integration-test - compose-down: ### Down docker-compose docker-compose down --remove-orphans .PHONY: compose-down @@ -42,20 +38,20 @@ linter-golangci: ### check by golangci linter .PHONY: linter-golangci linter-hadolint: ### check by hadolint linter - git ls-files --exclude='Dockerfile*' --ignored | xargs hadolint + find . -name 'Dockerfile' | xargs hadolint .PHONY: linter-hadolint linter-dotenv: ### check by dotenv linter dotenv-linter .PHONY: linter-dotenv -test: ### run test - go test -v -cover -race ./internal/... +test: ### run all tests including slow running system (e.g. system-tests) + go test --tags=system -v -cover -covermode atomic -coverprofile=coverage.txt ./internal/... ./pkg/... .PHONY: test -integration-test: ### run integration-test - go clean -testcache && go test -v ./integration-test/... -.PHONY: integration-test +test-fast: ### run fast tests only + go test -v -cover ./internal/... ./pkg/... +.PHONY: test-fast mock: ### run mockgen mockgen -source ./internal/usecase/interfaces.go -package usecase_test > ./internal/usecase/mocks_test.go diff --git a/README.md b/README.md index 56a55fc7..ef836038 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,11 @@ -![Go Clean Template](docs/img/logo.svg) +![Go DDD Template](docs/img/logo_ddd.png) -# Go Clean template -[🇨🇳中文](README_CN.md) - -Clean Architecture template for Golang services +Domain Driven Design (DDD) Architecture template for Golang services [![Go Report Card](https://goreportcard.com/badge/github.com/evrone/go-clean-template)](https://goreportcard.com/report/github.com/evrone/go-clean-template) [![License](https://img.shields.io/github/license/evrone/go-clean-template.svg)](https://github.com/evrone/go-clean-template/blob/master/LICENSE) [![Release](https://img.shields.io/github/v/release/evrone/go-clean-template.svg)](https://github.com/evrone/go-clean-template/releases/) -[![codecov](https://codecov.io/gh/evrone/go-clean-template/branch/master/graph/badge.svg?token=XE3E0X3EVQ)](https://codecov.io/gh/evrone/go-clean-template) +[![codecov](https://codecov.io/gh/sesigl/go-project-ddd-template/branch/master/graph/badge.svg?token=RLK70TCXU1)](https://codecov.io/gh/sesigl/go-project-ddd-template) ## Overview The purpose of the template is to show: @@ -16,15 +13,21 @@ The purpose of the template is to show: - where to store business logic so that it remains independent, clean, and extensible - how not to lose control when a microservice grows -Using the principles of Robert Martin (aka Uncle Bob). +Using the principles of the DDD community highlighting contributes +from [Eric Evans](https://twitter.com/ericevans0) +and [Vaughn Vernon](https://twitter.com/VaughnVernon). +Their work has had a significant impact on the way that many software developers approach building +complex systems using DDD. -[Go-clean-template](https://evrone.com/go-clean-template?utm_source=github&utm_campaign=go-clean-template) is created & supported by [Evrone](https://evrone.com/?utm_source=github&utm_campaign=go-clean-template). +[Go-ddd-template](https://sebastiansigl.com) is created & supported +by [Sebastian Sigl](https://twitter.com/sesigl). ## Content - [Quick start](#quick-start) +- [Libraries](#libraries) - [Project structure](#project-structure) - [Dependency Injection](#dependency-injection) -- [Clean Architecture](#clean-architecture) +- [DDD Architecture](#clean-architecture) ## Quick start Local development: @@ -36,43 +39,109 @@ $ make run ``` Integration tests (can be run in CI): + ```sh # DB, app + migrations, integration tests $ make compose-up-integration-test ``` +## Libraries + +This template comes with a set of libraries to quickly get up to speed. + +### GoLang httptest + +[Httptest](https://pkg.go.dev/net/http/httptest) is a package within the Go programming language +that enables +developers to test HTTP clients and servers more effectively. It provides utilities to create mock +HTTP servers and clients, simulating real-world scenarios for thorough testing. + +The httptest package is leveraged to execute system-tests efficiently, which are close to +the main entry point, which is `app_test.go`. + +### Testcontainers + +[Testcontainers](https://golang.testcontainers.org/) is a library for Golang that provides a friendly API to run Docker containers for +integration testing (system-tests). It allows developers to spin up required services like +databases, web servers, +or any other application that can run in a Docker container as part of their test setup. This +provides a consistent, reproducible, and isolated environment for tests, making it a powerful tool +for modern test-driven development in Golang. + +The system tests are located in `internal/app_test.go` and provide a high level coverage starting +RabbitMQ and Postgres to run main use cases. Hence, `makefile` contains 2 tasks: + +- `test`, running all tests +- `test-fast`, running all tests excluding slow running tests like system-tests + +> +> **Test-Driven-Development and testcontainers** +> +>Testcontainers work seamlessly when they boot up swiftly. For containers that require more time, +> like the RabbitMQ testcontainer in this instance, you can utilize the `reuse` feature already +> activated in this template. +> +>1. Initiate a test that employs the necessary container, set a breakpoint, and maintain its + operation as long as required. +>2. Begin code testing and implementation. Since containers are already operational, you'll use the + running containers, accelerating the testing process. +> +>To enhance convenience, a GitHub issue has been +> raised: https://github.com/testcontainers/testcontainers-go/issues/1191 + ## Project structure -### `cmd/app/main.go` -Configuration and logger initialization. Then the main function "continues" in -`internal/app/app.go`. + +### `cmd` + +The `cmd` directory is used to structure the application's executable +binaries and their associated main functions. In the context of Domain-Driven Design (DDD), this +directory aids in maintaining a clear separation of concerns, ensuring that the business logic, +domain models, and infrastructure components remain decoupled from the application's entry points. ### `config` -Configuration. First, `config.yml` is read, then environment variables overwrite the yaml config if they match. -The config structure is in the `config.go`. -The `env-required: true` tag obliges you to specify a value (either in yaml, or in environment variables). + +The `config` directory stores environment-specific settings and non-sensitive data. Avoid storing +sensitive information like API keys or passwords within the source code or version control systems. +The `config` directory facilitates a clean architecture by decoupling configuration details +from domain logic. This approach allows developers to focus on the core business requirements. + +First, `config.yml` is read, then environment variables overwrite the yaml config if they match. + +The config structure is in the `config.go`. The `env-required: true` tag obliges you to specify a +value (either in yaml, or in environment +variables). For configuration, we chose the [cleanenv](https://github.com/ilyakaznacheev/cleanenv) library. It does not have many stars on GitHub, but is simple and meets all the requirements. -Reading the config from yaml contradicts the ideology of 12 factors, but in practice, it is more convenient than +Reading the config from yaml contradicts the ideology of 12 factors, but in practice, it is more +convenient than reading the entire config from ENV. It is assumed that default values are in yaml, and security-sensitive variables are defined in ENV. ### `docs` -Swagger documentation. Auto-generated by [swag](https://github.com/swaggo/swag) library. -You don't need to correct anything by yourself. + +The `docs` folder serves as a dedicated storage location for Swagger +documentation generated by [swag](https://github.com/swaggo/swag). It contains auto-generated API +documentation files created by the Swag library, streamlining the development process and +eliminating the need for manual updates. ### `integration-test` -Integration tests. -They are launched as a separate container, next to the application container. -It is convenient to test the Rest API using [go-hit](https://github.com/Eun/go-hit). + +The `integration-test` folder is dedicated to housing integration tests, which +are executed in an isolated container alongside the application container. This setup facilitates +thorough testing of REST APIs through the use of the [go-hit](https://github.com/Eun/go-hit) +library, a powerful and user-friendly +testing tool. ### `internal/app` + There is always one _Run_ function in the `app.go` file, which "continues" the _main_ function. This is where all the main objects are created. Dependency injection occurs through the "New ..." constructors (see Dependency Injection). -This technique allows us to layer the application using the [Dependency Injection](#dependency-injection) principle. +This technique allows us to layer the application using +the [Dependency Injection](#dependency-injection) principle. This makes the business logic independent from other layers. Next, we start the server and wait for signals in _select_ for graceful completion. @@ -88,61 +157,71 @@ For example: $ go run -tags migrate ./cmd/app ``` -### `internal/controller` +### `internal/interfaces` Server handler layer (MVC controllers). The template shows 2 servers: -- RPC (RabbitMQ as transport) -- REST http (Gin framework) +- RPC (RabbitMQ as transport, located in `internal/interfaces/rpc`) +- REST http (Gin framework, located in `internal/interfaces/rest`) Server routers are written in the same style: - Handlers are grouped by area of application (by a common basis) - For each group, its own router structure is created, the methods of which process paths - The structure of the business logic is injected into the router structure, which will be called by the handlers -#### `internal/controller/http` -Simple REST versioning. -For v2, we will need to add the `http/v2` folder with the same content. -And in the file `internal/app` add the line: -```go -handler := gin.New() -v1.NewRouter(handler, t) -v2.NewRouter(handler, t) -``` - Instead of Gin, you can use any other http framework or even the standard `net/http` library. -In `v1/router.go` and above the handler methods, there are comments for generating swagger documentation using [swag](https://github.com/swaggo/swag). +In `router.go` and its handler methods, there are comments for generating swagger documentation using [swag](https://github.com/swaggo/swag). + +### `internal` + +The `internal` folder houses non-sharable code, safeguarding critical components of an application. +It encompasses essential DDD (Domain-Driven Design) folders such as application, domain, and +interfaces, tailored to each specific application. This structure ensures both optimal organization +and robust security within high-scale software projects. + +#### `internal/domain` -### `internal/entity` -Entities of business logic (models) can be used in any layer. -There can also be methods, for example, for validation. +The `internal/domain` folder houses the crucial core domain code, serving as the foundation of our +application's logic. This isolated directory ensures minimal external dependencies, promoting code +integrity and maintainability. It is vital to the application, as it encompasses the essential logic +that drives core functionalities. -### `internal/usecase` -Business logic. -- Methods are grouped by area of application (on a common basis) -- Each group has its own structure -- One file - one structure +#### `internal/interfaces` -Repositories, webapi, rpc, and other business logic structures are injected into business logic structures -(see [Dependency Injection](#dependency-injection)). +The `internal/interfaces` folder houses crucial code for processing various input sources, such as +CLI, REST APIs, and message-based systems. It standardizes data handling and streamlines integration +across different communication channels. In Hexagonal Architecture terms, these files serve +as incoming adapters, bridging external systems with the core application. -#### `internal/usecase/repo` -A repository is an abstract storage (database) that business logic works with. +#### `internal/application` -#### `internal/usecase/webapi` -It is an abstract web API that business logic works with. -For example, it could be another microservice that business logic accesses via the REST API. -The package name changes depending on the purpose. +The `internal/application` folder serves as a crucial bridge between external interfaces and +internal +domain and infrastructure components. It houses glue code that seamlessly integrates disparate +elements to streamline application functionality. This organization allows for efficient grouping of +related use cases within a single application service, enhancing maintainability and scalability -### `pkg/rabbitmq` -RabbitMQ RPC pattern: -- There is no routing inside RabbitMQ -- Exchange fanout is used, to which 1 exclusive queue is bound, this is the most productive config -- Reconnect on the loss of connection +### `migrations` + +The `migrations` folder in Golang projects houses essential database migration files, facilitating +schema updates and version control. These files contain SQL statements for creating, altering, or +dropping tables and columns, allowing developers to synchronize database structure across +environments. The migration process ensures consistent application behavior while reducing the risk +of data corruption and enhancing collaboration among team members. + +### `pkg` + +The `pkg` folder in Golang projects is a common convention for organizing shared code, often +implementing +to interfaces from the core domain. This structure promotes clean separation of concerns and +facilitates code reusability across multiple services or applications. ## Dependency Injection -In order to remove the dependence of business logic on external packages, dependency injection is used. -For example, through the New constructor, we inject the dependency into the structure of the business logic. +In order to remove the dependence of business logic on external packages, dependency injection is +used. + +For example, through the New constructor, we inject the dependency into the structure of the +business logic. This makes the business logic independent (and portable). We can override the implementation of the interface without making changes to the `usecase` package. @@ -150,138 +229,186 @@ We can override the implementation of the interface without making changes to th package usecase import ( - // Nothing! +// Nothing! ) type Repository interface { - Get() + Get() } type UseCase struct { - repo Repository + repo Repository } -func New(r Repository) *UseCase{ - return &UseCase{ - repo: r, - } +func New(r Repository) *UseCase { + return &UseCase{ + repo: r, + } } -func (uc *UseCase) Do() { - uc.repo.Get() +func (uc *UseCase) Do() { + uc.repo.Get() } ``` -It will also allow us to do auto-generation of mocks (for example with [mockery](https://github.com/vektra/mockery)) and easily write unit tests. +It will also allow us to do auto-generation of mocks (for example +with [mockery](https://github.com/vektra/mockery)) and easily write unit tests. -> We are not tied to specific implementations in order to always be able to change one component to another. +> We are not tied to specific implementations in order to always be able to change one component to +> another. > If the new component implements the interface, nothing needs to be changed in the business logic. -## Clean Architecture +To manage the effort and complexity to instantiate and inject +dependencies, [wire](https://github.com/google/wire) is used to generate factories +at build-time. + +## DDD Architecture + ### Key idea -Programmers realize the optimal architecture for an application after most of the code has been written. + +Programmers realize the optimal architecture for an application after most of the code has been +written. > A good architecture allows decisions to be delayed to as late as possible. ### The main principle + Dependency Inversion (the same one from SOLID) is the principle of dependency inversion. -The direction of dependencies goes from the outer layer to the inner layer. +The direction of dependencies goes from the outer non-domain layers to the inner domain layer. Due to this, business logic and entities remain independent from other parts of the system. -So, the application is divided into 2 layers, internal and external: -1. **Business logic** (Go standard library). -2. **Tools** (databases, servers, message brokers, any other packages and frameworks). +You might know this from clean architecture or onion-architecture already. + +![Onion Architecture](docs/img/domain-driven-design-clean-architecture.png) + +The foundation of onion architecture and ddd is similar: both manage dependencies to put the domain +logic in the center. Domain-driven-design contains much more guidance but on a package level, it's +only about 4 layers: + +![DDD Architecture](docs/img/ddd-layers-v2.png) + +We put business logic into the Domain layer, and wrap it with an Application layer, each with +distinct functions: + +1. Domain Layer: Executes the fundamental, use-case agnostic business logic within the + domain/system. +2. Application Layer: Carries out application-specific use cases and contains IO heavy operations + like fetching and storing data. It should contain as less logic as possible and acts as the glue + between incoming access and the actual domain code to avoid domain leakage to outer layers. +3. Interfaces Layer: Comprises UI components, REST-Controller, message-receivers and others incoming + sources for the application. +4. Infrastructure Layer: Bolsters other layers by implementing abstractions and integrating + third-party libraries and systems. -![Clean Architecture](docs/img/layers-1.png) +Access flow starts from interfaces (e.g. REST), which access application services that are a facade +for a specific group of use cases. The application service is a great place to handle transactions, +logging, and other pure technical requirements. To keep it as free from domain logic as possible, a +typical method fetches an entity, calls an operation on it, or via another service, and stores it. -**The inner layer** with business logic should be clean. It should: -- Not have package imports from the outer layer. -- Use only the capabilities of the standard library. -- Make calls to the outer layer through the interface (!). +The infrastructure layer does its work behind the scenes. If there is a repository that gets the +data, the interface for the repository is located in the domain package because the domain requires +it to operate. The implementation is located in infrastructure because from a domain point of view, +it's not important how the data is fetched or stored. It's a detail that is abstracted away, which +comes with a lot of benefits like testability and portability. -The business logic doesn't know anything about Postgres or a specific web API. -Business logic has an interface for working with an _abstract_ database or _abstract_ web API. +It's not always beneficial to create an interface in the domain and implement it in infrastructure. +Sometimes, you just don't want to pollute the domain with something specific like monitoring. Hence, +you may want to put the interface in the application layer. -**The outer layer** has other limitations: -- All components of this layer are unaware of each other's existence. How to call another from one tool? Not directly, only through the inner layer of business logic. -- All calls to the inner layer are made through the interface (!). -- Data is transferred in a format that is convenient for business logic (`internal/entity`). +For example, let's go through an example for access to the database from a REST controller. -For example, you need to access the database from HTTP (controller). -Both HTTP and database are in the outer layer, which means they know nothing about each other. -The communication between them is carried out through `usecase` (business logic): +The REST-Controller is part of the outer incoming interfaces layer. The database is part of +infrastructure, which means they know nothing about each other. + +The communication between them is carried out through use-case specific methods of the application +service: ``` - HTTP > usecase - usecase > repository (Postgres) - usecase < repository (Postgres) - HTTP < usecase + REST > ApplicationService + ApplicationService > repository (Postgres) + ApplicationService < repository (Postgres) + REST < ApplicationService ``` -The symbols > and < show the intersection of layer boundaries through Interfaces. -The same is shown in the picture: -![Example](docs/img/example-http-db.png) +The symbols > and < show the intersection of layer boundaries through Interfaces. Or more complex business logic: + ``` - HTTP > usecase - usecase > repository - usecase < repository - usecase > webapi - usecase < webapi - usecase > RPC - usecase < RPC - usecase > repository - usecase < repository - HTTP < usecase + REST > ApplicationService + ApplicationService > repository + ApplicationService < repository + ApplicationService > webapi + ApplicationService < webapi + ApplicationService > RPC + ApplicationService < RPC + ApplicationService > repository + ApplicationService < repository + REST < ApplicationService ``` ### Layers -![Example](docs/img/layers-2.png) -### Clean Architecture Terminology -- **Entities** are structures that business logic operates on. - They are located in the `internal/entity` folder. - In MVC terms, entities are models. - -- **Use Cases** is business logic located in `internal/usecase`. +### DDD Architecture Terminology + +- **Domain**: A sphere of knowledge or activity that represents the business or system being + modeled. It includes core concepts, business rules, and policies. Domain services and entities are + located in the `internal/domain` folder. + +- **Bounded Context**: A well-defined boundary within the domain, encapsulating a specific area of + concern and its related elements, helping to avoid ambiguity and maintain consistency. + +- **Ubiquitous Language**: A common language used by both technical and non-technical stakeholders + to ensure clear communication and shared understanding of the domain concepts and requirements. -The layer with which business logic directly interacts is usually called the _infrastructure_ layer. -These can be repositories `internal/usecase/repo`, external webapi `internal/usecase/webapi`, any pkg, and other microservices. -In the template, the _infrastructure_ packages are located inside `internal/usecase`. +- **Entity**: A domain object with a unique identity that represents a business concept and persists + over time, encapsulating both state and behavior. -You can choose how to call the entry points as you wish. The options are: -- controller (in our case) -- delivery -- transport -- gateways -- entrypoints -- primary -- input +- **Value Object**: An immutable domain object that represents a specific value or attribute, rather + than a unique entity, and is defined by its properties. -### Additional layers -The classic version of [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) was designed for building large monolithic applications and has 4 layers. +- **Aggregate**: A cluster of domain objects (entities and value objects) that are treated as a + single unit, ensuring consistency and enforcing business rules. -In the original version, the outer layer is divided into two more, which also have an inversion of dependencies -to each other (directed inward) and communicate through interfaces. +- **Aggregate Root**: The main entity within an aggregate that acts as a gateway for all + interactions with the aggregate, managing its consistency and state. -The inner layer is also divided into two (with separation of interfaces), in the case of complex logic. +- **Repository**: An abstraction that provides methods for retrieving, storing, and updating + aggregates, decoupling the domain from the underlying data storage mechanism. -_______________________________ +- **Domain Event**: A message or event that represents a significant occurrence within the domain, + allowing for decoupled and reactive system design. -Complex tools can be divided into additional layers. -However, you should add layers only if really necessary. +- **Domain Service**: A stateless service that encapsulates domain logic that doesn't naturally fit + within an entity or value object, coordinating interactions between domain objects. + +- **Application Service**: A service that coordinates the use of domain objects, repositories, and + domain services to implement business use cases, acting as a bridge between the domain and the + external world. Application Services are located in `internal/application`. + +- **Infrastructure**: The technical components and services that support the domain, such as + databases, messaging systems, and external API integrations. Implementations are located + in `internal/infrastructure`. + +### Interface-Type + +Maintaining interface-types between the domain layer and infrastructure is crucial for inverting +dependencies, which is especially beneficial in GoLang for preventing circular dependencies. +Interface-types also enhance extensibility, adhering to the Open-Close principle, and improve testability +by simplifying dependency stubbing. While interface-types between all layers add value, they also +introduce additional code to maintain and increase complexity to comprehend. ### Alternative approaches -In addition to Clean architecture, _Onion architecture_ and _Hexagonal_ (_Ports and adapters_) are similar to it. -Both are based on the principle of Dependency Inversion. -_Ports and adapters_ are very close to _Clean Architecture_, the differences are mainly in terminology. +In addition to DDD architecture, _Onion architecture_, _Hexagonal_ (_Ports and adapters_) or _Clean_ architecture are +similar to it. All are based on the principle of Dependency Inversion and separating and avoid dependencies to the business logic. ## Similar projects + - [https://github.com/bxcodec/go-clean-arch](https://github.com/bxcodec/go-clean-arch) - [https://github.com/zhashkevych/courses-backend](https://github.com/zhashkevych/courses-backend) +- [https://github.com/evrone/go-clean-template](https://github.com/evrone/go-clean-template) ## Useful links -- [The Clean Architecture article](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) -- [Twelve factors](https://12factor.net/ru/) + +- [Twelve factors](https://12factor.net/) diff --git a/README_CN.md b/README_CN.md deleted file mode 100644 index 48c945d6..00000000 --- a/README_CN.md +++ /dev/null @@ -1,275 +0,0 @@ -![Go Clean Template](docs/img/logo.svg) - -# Go 整洁模板 - -golang服务的整洁架构模板 - -[![Go Report Card](https://goreportcard.com/badge/github.com/evrone/go-clean-template)](https://goreportcard.com/report/github.com/evrone/go-clean-template) -[![License](https://img.shields.io/github/license/evrone/go-clean-template.svg)](https://github.com/evrone/go-clean-template/blob/master/LICENSE) -[![Release](https://img.shields.io/github/v/release/evrone/go-clean-template.svg)](https://github.com/evrone/go-clean-template/releases/) -[![codecov](https://codecov.io/gh/evrone/go-clean-template/branch/master/graph/badge.svg?token=XE3E0X3EVQ)](https://codecov.io/gh/evrone/go-clean-template) - -## 综述 -模板的目的为了展示: -- 如何组织项目,以防止项目演化成难以维护的代码 -- 在哪里处理业务逻辑,以维护代码的独立、清晰和可扩展 -- 当微服务增长时,不要失去控制 - -使用了 Robert Martin 的原则 - -[Go 整洁模板](https://evrone.com/go-clean-template?utm_source=github&utm_campaign=go-clean-template) 由 创建和提供支持[Evrone](https://evrone.com/?utm_source=github&utm_campaign=go-clean-template). - -## 内容 -- [快速开始](#快速开始) -- [工程架构](#工程架构) -- [依赖注入](#依赖注入) -- [整洁架构](#整洁架构) - -## 快速开始 -本地开发 -```sh -# Postgres, RabbitMQ -$ make compose-up -# Run app with migrations -$ make run -``` - -集成测试(可以在CI中运行) -```sh -# DB, app + migrations, integration tests -$ make compose-up-integration-test -``` -## Quick start -Local development: -```sh -# Postgres, RabbitMQ -$ make compose-up -# Run app with migrations -$ make run -``` - - -## 工程架构 -### `cmd/app/main.go` -配置和日志能力初始化。主要的功能在 `internal/app/app.go` - -### `config` -配置,首先读取 `config.yml`中的内容,如果环境变量里面有符合的变量,将其覆盖yml中的配置 -配置的结构在 `config.go`中 -`env-required:true` 标签强制你指定值(在yml文件或者环境变量中) - -对于配置,我们选择[cleanenv](https://github.com/ilyakaznacheev/cleanenv) 库 -cleanenv没有很多的starts数,但是它简单并能满足我们的需求 -从yaml配置文件中读取配置违背了12种原则。但是比起从环境变量种读取所有的配置,它确实是更加方便的。 -这种模式假设配置默认值在yaml文件种,对安全敏感的配置在环境变量种 - -### `docs` -Swagger 文档。由 [swag](https://github.com/swaggo/swag) 库自动生成 -你不需要自己修改任何内容 - -### `integration-test` -集成测试 -它会在应用容器旁启动独立的容器 -使用[go-hit](https://github.com/Eun/go-hit) 会很方便的测试Rest API - -## `internal/app` -这里只有通常只有一个 _Run_ 函数在 `app.go` 文件种。它是 _main_ 函数的延续 - -主要的对象在这里生成 -依赖注入通过 "New ..." 构造 (阅读依赖注入),这个技术允许使用[依赖注入](#依赖注入)的原则进行分层,使得业务逻辑独立于其他层。 - -接下来,我们启动服务器并阻塞等待_select_ 中的信号正常完成。 - -如果 `app.go`的规模增长了,你可以将它拆分为多个文件. - -对于大量的依赖,可以使用[wire](https://github.com/google/wire) - -`migrate.go` 文件用于是数据库自动构建 -它显示的包扣了 _migrate_ 标签 -```sh -$ go run -tags migrate ./cmd/app -``` - -### `internal/controller` -服务器处理层(MVC 控制层),这个模块展示两个服务 -- RPC -- REST http - -服务的路由用同样的风格进行编写 -- handler 按照应用领域进行分组(又共同的基础) -- 对于每一个分组,创建自己的路由结构体和请求path路径 -- 业务逻辑的结构被注入到路由器结构中,它将被处理程序调用 - -#### `internal/controller/http` -简单的 REST 版本控制 -对于v2版本,我们需要添加`http/v2`文件夹,内容相同 -在文件 `internal/app` 中添加以下行: -```go -handler := gin.New() -v1.NewRouter(handler, t) -v2.NewRouter(handler, t) -``` -除了 Gin,您可以使用任何其他 http 框架,甚至是标准的 `net/http` 库。 -在 `v1/router.go` 及以上的处理程序方法中,可以使用[swag](https://github.com/swaggo/swag) swagger 通过注释生成swagger文档. - -### `internal/entity` -业务逻辑实体(模型)可用于任何层. -这里包括一些方法,例如:参数检验. - -### `internal/usecase` -业务逻辑. -- 方法按应用领域分组(在共同的基础上) -- 每个组都有自己的结构 -- 一个文件对应一个结构 -Repositories、webapi、rpc等业务逻辑结构被注入到业务逻辑结构中 -(阅读 [依赖注入](#dependency-injection)). - -#### `internal/usecase/repo` -是持久化存储的业务逻辑逻辑抽象,如数据库. - -#### `internal/usecase/webapi` -是webapi业务逻辑使用的抽象. -例如,它可能是业务逻辑通过 REST API 访问的另一个微服务。 -包名称根据业务的实际用途进行命名 - -### `pkg/rabbitmq` -RabbitMQ RPC 模式: -- RabbitMQ 中没有路由 -- 使用Exchange fanout出并绑定 1 个独占队列,这么配置是最高效的 -- 在连接丢失时重新连接 - -## 依赖注入 -为了去除业务逻辑对外部包的依赖,使用了依赖注入. -例如,通过New构造函数,我们将依赖注入到业务逻辑的结构中. -这使得业务逻辑独立(且可移植) -我们可以覆盖接口的实现,而无需更改 `usecase` 包. - -它还将允许我们自动生成相关mock(例如使用 [mockery](https://github.com/vektra/mockery)),以便进行单元测试. -> 我们不依赖于特定的实现,以便始终能够将一个组件更改为另一个组件 -> 如果新组件实现了接口,则业务逻辑无需更改。 -```go -package usecase - -import ( - // Nothing! -) - -type Repository interface { - Get() -} - -type UseCase struct { - repo Repository -} - -func New(r Repository) *UseCase{ - return &UseCase{ - repo: r, - } -} - -func (uc *UseCase) Do() { - uc.repo.Get() -} -``` - -## 整洁架构 -## 关键的观点 -在编写完大部分代码后,程序员会意识到应用程序的最佳架构 - -> 一个好的架构允许尽可能晚地做出决策 - -### 主要原则 -依赖倒置的原理(与 SOLID 相同) -依赖的方向是从外层到内层。 -因此,业务逻辑和实体可以保持独立于系统的其他部分。 -因此,应用程序分为 2 层,内部和外部: -1. **业务逻辑**(Go标准库) -2. **工具**(数据库、服务器、消息代理、任何其他包和框架) - -![Clean Architecture](docs/img/layers-1.png) - -**带有业务逻辑的内层**应该是干净的,它应该有如下特征: -- 没有从外层导入的包 -- 仅使用标准库的功能 -- 通过接口调用外层(!) - -业务逻辑对 数据存储 或特定的 Web API 是无感知的. -业务逻辑用抽象接口处理 数据库或 web API。 -**外层**有其他限制: -- 该层的所有组件都不知道彼此的存在。如何进行组件间的调用呢? 只能通过业务逻辑的内层间接调用 -- 所有对内层的调用都是通过接口进行的(!) -- 为了便捷地进行业务数据传输,数据格式得进行标标准化(`internal/entity`)。 - -例如,您需要从 HTTP(控制器)访问数据库 -HTTP 和数据库都在外层,这意味着他们彼此无法感知 -它们之间的通信是通过`usecase`(业务逻辑)进行的: -``` - HTTP > usecase - usecase > repository (repo) - usecase < repository (repo) - HTTP < usecase -``` -符号 > 和 < 通过接口显示层边界的交集 -如图所示 -![Example](docs/img/example-http-db.png) - -更加复杂的业务逻辑 -``` - HTTP > usecase - usecase > repository - usecase < repository - usecase > webapi - usecase < webapi - usecase > RPC - usecase < RPC - usecase > repository - usecase < repository - HTTP < usecase -``` - -### 层 -![Example](docs/img/layers-2.png) - -### 整洁的架构相关术语 -- **ENTITY**是业务逻辑运行的结构。 -它们位于`internal/entity`文件夹中。 -在 MVC 术语中,实体是models - -- **Use Cases** 业务逻辑位于 `internal/usecase` 中 -与业务逻辑直接交互的层通常称为_infrastructure_ 层 -这些可以是存储库 `internal/usecase/repo`、外部 webapi `internal/usecase/webapi`、任何包和其他微服务。 -在模板中,_infrastructure_ 包位于 `internal/usecase` 中 - -您可以根据需要决定你要调用的入口点,包括: -- controller -- delivery -- transport -- gateways -- entrypoints -- primary -- input - - -### 附加层 - -[整洁架构](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) 的经典版本是为构建大型单体应用程序而设计的,有 4 层 - -原版中,外层多分为两层,也使用依赖倒置原理 -彼此(向内)通过接口进行通信 - -在复杂逻辑的情况下,内层也分为两层(通过接口进行分层) -_______________________________ -复杂的工具可以通过分层设计。切记只有在你有需要的时候菜进行分层 - -### 替代品 -除了整洁的架构, _Onion architecture_ 和 _Hexagonal_ (接口适配层) 一样能达到目的,他们都符合依赖倒置的原则 -这三种模式都非常接近,不同的知识术语不同 - -## 相似的工程 -- [https://github.com/bxcodec/go-clean-arch](https://github.com/bxcodec/go-clean-arch) -- [https://github.com/zhashkevych/courses-backend](https://github.com/zhashkevych/courses-backend) - -## 可能有用的链接 -- [The Clean Architecture article](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) -- [Twelve factors](https://12factor.net/ru/) diff --git a/cmd/app/main.go b/cmd/app/main.go index eb6f52a4..198a54f5 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -1,10 +1,10 @@ package main import ( + "github.com/evrone/go-clean-template/internal/app" "log" "github.com/evrone/go-clean-template/config" - "github.com/evrone/go-clean-template/internal/app" ) func main() { diff --git a/config/config.go b/config/config.go index 9c66295b..368b0373 100644 --- a/config/config.go +++ b/config/config.go @@ -2,6 +2,8 @@ package config import ( "fmt" + "path/filepath" + "runtime" "github.com/ilyakaznacheev/cleanenv" ) @@ -35,14 +37,14 @@ type ( // PG -. PG struct { PoolMax int `env-required:"true" yaml:"pool_max" env:"PG_POOL_MAX"` - URL string `env-required:"true" env:"PG_URL"` + URL string `env-required:"true" yaml:"url" env:"PG_URL"` } // RMQ -. RMQ struct { ServerExchange string `env-required:"true" yaml:"rpc_server_exchange" env:"RMQ_RPC_SERVER"` ClientExchange string `env-required:"true" yaml:"rpc_client_exchange" env:"RMQ_RPC_CLIENT"` - URL string `env-required:"true" env:"RMQ_URL"` + URL string `env-required:"true" yaml:"url" env:"RMQ_URL"` } ) @@ -50,7 +52,9 @@ type ( func NewConfig() (*Config, error) { cfg := &Config{} - err := cleanenv.ReadConfig("./config/config.yml", cfg) + cwd := projectRoot() + + err := cleanenv.ReadConfig(cwd+"./config/config.yml", cfg) if err != nil { return nil, fmt.Errorf("config error: %w", err) } @@ -62,3 +66,10 @@ func NewConfig() (*Config, error) { return cfg, nil } + +func projectRoot() string { + _, b, _, _ := runtime.Caller(0) + projectRoot := filepath.Dir(b) + + return projectRoot + "/../" +} diff --git a/config/config.yml b/config/config.yml index 3644f3b8..e5d4666f 100644 --- a/config/config.yml +++ b/config/config.yml @@ -11,7 +11,9 @@ logger: postgres: pool_max: 2 + url: 'postgres://user:pass@localhost:5432/postgres' rabbitmq: rpc_server_exchange: 'rpc_server' rpc_client_exchange: 'rpc_client' + url: 'amqp://guest:guest@localhost:5672' diff --git a/docker-compose.yml b/docker-compose.yml index 04bbfc73..19663330 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,14 +33,5 @@ services: - postgres - rabbitmq - integration: - build: - context: . - dockerfile: integration-test/Dockerfile - container_name: integration - image: integration - depends_on: - - app - volumes: pg-data: diff --git a/docs/img/ddd-layers-v2.png b/docs/img/ddd-layers-v2.png new file mode 100644 index 00000000..df668f55 Binary files /dev/null and b/docs/img/ddd-layers-v2.png differ diff --git a/docs/img/domain-driven-design-clean-architecture.png b/docs/img/domain-driven-design-clean-architecture.png new file mode 100644 index 00000000..4ab6d2c9 Binary files /dev/null and b/docs/img/domain-driven-design-clean-architecture.png differ diff --git a/docs/img/logo.svg.png b/docs/img/logo.svg.png new file mode 100644 index 00000000..d0678589 Binary files /dev/null and b/docs/img/logo.svg.png differ diff --git a/docs/img/logo_ddd.png b/docs/img/logo_ddd.png new file mode 100644 index 00000000..f6e0d3a5 Binary files /dev/null and b/docs/img/logo_ddd.png differ diff --git a/go.mod b/go.mod index 723e57e9..731b8392 100644 --- a/go.mod +++ b/go.mod @@ -1,37 +1,46 @@ module github.com/evrone/go-clean-template -go 1.17 +go 1.19 require ( github.com/Conight/go-googletrans v0.0.0-20200929083318-176776d061cb - github.com/Eun/go-hit v0.5.23 github.com/Masterminds/squirrel v1.5.2 + github.com/docker/go-connections v0.4.0 github.com/gin-gonic/gin v1.7.7 github.com/golang-migrate/migrate/v4 v4.15.1 github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/ilyakaznacheev/cleanenv v1.2.6 github.com/jackc/pgx/v4 v4.14.1 - github.com/prometheus/client_golang v1.11.0 + github.com/lib/pq v1.10.9 + github.com/mattes/migrate v3.0.1+incompatible + github.com/prometheus/client_golang v1.11.1 github.com/rs/zerolog v1.26.1 github.com/streadway/amqp v1.0.0 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.8.2 github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 github.com/swaggo/gin-swagger v1.3.3 github.com/swaggo/swag v1.7.6 + github.com/testcontainers/testcontainers-go v0.20.0 + github.com/testcontainers/testcontainers-go/modules/postgres v0.20.0 ) require ( + github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/BurntSushi/toml v0.4.1 // indirect - github.com/Eun/go-convert v1.2.12 // indirect - github.com/Eun/go-doppelgangerreader v0.0.0-20190911075941-30f1527f16b2 // indirect github.com/KyleBanks/depth v1.2.1 // indirect + github.com/Microsoft/go-winio v0.5.2 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect - github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/containerd/containerd v1.6.19 // indirect + github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/docker v23.0.5+incompatible // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.19.6 // indirect @@ -40,13 +49,11 @@ require ( github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-playground/validator/v10 v10.9.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.6 // indirect - github.com/gookit/color v1.4.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/itchyny/gojq v0.12.5 // indirect - github.com/itchyny/timefmt-go v0.1.3 // indirect + github.com/imdario/mergo v0.3.12 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.10.1 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -58,34 +65,40 @@ require ( github.com/joho/godotenv v1.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/k0kubun/pp v3.0.1+incompatible // indirect + github.com/klauspost/compress v1.15.9 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/leodido/go-urn v1.2.1 // indirect - github.com/lib/pq v1.10.2 // indirect - github.com/lunixbochs/vtclean v1.0.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-colorable v0.1.10 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/moby/patternmatcher v0.5.0 // indirect + github.com/moby/sys/sequential v0.5.0 // indirect + github.com/moby/term v0.0.0-20221128092401-c43b287e0e0f // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc2 // indirect + github.com/opencontainers/runc v1.1.5 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.26.0 // indirect - github.com/prometheus/procfs v0.6.0 // indirect - github.com/tidwall/pretty v1.2.0 // indirect + github.com/prometheus/common v0.30.0 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect github.com/ugorji/go/codec v1.2.6 // indirect - github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect go.uber.org/atomic v1.9.0 // indirect - golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e // indirect - golang.org/x/net v0.0.0-20211013171255-e13a2654a71e // indirect - golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/tools v0.1.7 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/protobuf v1.27.1 // indirect + golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.7.0 // indirect + golang.org/x/text v0.7.0 // indirect + golang.org/x/tools v0.1.12 // indirect + google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad // indirect + google.golang.org/grpc v1.47.0 // indirect + google.golang.org/protobuf v1.28.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect ) diff --git a/go.sum b/go.sum index cf539df5..c169c8e7 100644 --- a/go.sum +++ b/go.sum @@ -69,16 +69,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= github.com/Conight/go-googletrans v0.0.0-20200929083318-176776d061cb h1:MwdqXipO1SFnK2k1iIL8xlUkZC63KdZR6QB/DSIlYBk= github.com/Conight/go-googletrans v0.0.0-20200929083318-176776d061cb/go.mod h1:J9k1GS4/KUFdJgWCp8Od4J3XXalm3pUPm8YYrMFzYTk= -github.com/Eun/go-convert v0.0.0-20200421145326-bef6c56666ee/go.mod h1:cMqWKb0SQrV+L1Zve08CI1NQGPeRAjXuYTxYE/y6gcU= -github.com/Eun/go-convert v1.2.12 h1:D41UCahfL6GVlFgmA1NnS9Rd8btaW/7yf3Hu5Jq8i48= -github.com/Eun/go-convert v1.2.12/go.mod h1:1OhNyVVubZfPnhPY6jVik7mI3r2iEsAWKi9TO4Cfoyc= -github.com/Eun/go-doppelgangerreader v0.0.0-20190911075941-30f1527f16b2 h1:RfkLLL7sQdxTMWRLo//6CZcAN3j5/laO8BooS9ctG2g= -github.com/Eun/go-doppelgangerreader v0.0.0-20190911075941-30f1527f16b2/go.mod h1:+o+i8cYK1XYOQo4ocUKNV4R9D5Y7MIAPJk2l5SEh93M= -github.com/Eun/go-hit v0.5.23 h1:ezifQcvEh4qW/1/NdG59h0H7vTVJWVZWkXILaJBav4c= -github.com/Eun/go-hit v0.5.23/go.mod h1:LCHZ6WSPFDXlTQkFUSLe0VsrOhzzEEzbPzCGc6FYTXQ= -github.com/Eun/go-testdoc v0.0.1/go.mod h1:uT+GeDi7TpqQx6MBkcfXD9nF15Q8IX+kTNEnUUPbuUo= -github.com/Eun/yaegi-template v1.5.16/go.mod h1:eyFQ1QHbKLNHKpUvdjt8+99ZR1ji7lVVbduSK1M5N/U= -github.com/Eun/yaegi-template v1.5.18/go.mod h1:iVHjge496SWL7hLf1euBZIO40Bk0R38g6lu8iyvpc30= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= @@ -92,8 +82,9 @@ github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugX github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= @@ -102,6 +93,7 @@ github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2 github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= +github.com/Microsoft/hcsshim v0.9.7 h1:mKNHW/Xvv1aFH87Jb6ERDzXTJTLPlmzfZ28VBFD/bfg= github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -111,8 +103,6 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= -github.com/aaw/maybe_tls v0.0.0-20160803104303-89c499bcc6aa h1:6yJyU8MlPBB2enGJdPciPlr8P+PC0nhCFHnSHYMirZI= -github.com/aaw/maybe_tls v0.0.0-20160803104303-89c499bcc6aa/go.mod h1:I0wzMZvViQzmJjxK+AtfFAnqDCkQV/+r17PO1CCSYnU= github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs= github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -125,10 +115,6 @@ github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:C github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20210818145353-234c94e4ce64/go.mod h1:2qMFB56yOP3KzkB3PbYZ4AlUFg3a88F67TIx5lB/WwY= github.com/apache/arrow/go/arrow v0.0.0-20211013220434-5962184e7a30/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs= -github.com/araddon/dateparse v0.0.0-20190622164848-0fb0a474d195/go.mod h1:SLqhdZcd+dF3TEVL2RMoob5bBP5R1P1qkox+HtCBgGI= -github.com/araddon/dateparse v0.0.0-20200409225146-d820a6159ab1/go.mod h1:SLqhdZcd+dF3TEVL2RMoob5bBP5R1P1qkox+HtCBgGI= -github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA= -github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= @@ -179,13 +165,16 @@ github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8n github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -194,13 +183,18 @@ github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLI github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go/v2 v2.1.1/go.mod h1:7NtUnP6eK+l6k483WSYNrq3Kb23bWV10IRV1TyeSpwM= @@ -224,6 +218,7 @@ github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= +github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/containerd v1.2.10/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= @@ -237,8 +232,9 @@ github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= -github.com/containerd/containerd v1.5.7 h1:rQyoYtj4KddB3bxG6SAqd4+08gePNyJjRqvOIfV3rkM= github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= +github.com/containerd/containerd v1.6.19 h1:F0qgQPrG0P2JPgwpxWxYavrVeXAG0ezUIB9Z/4FTUAU= +github.com/containerd/containerd v1.6.19/go.mod h1:HZCDMn4v/Xl2579/MvtOC2M206i+JJ6VxFWU/NetrGY= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -246,6 +242,7 @@ github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cE github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= @@ -304,18 +301,21 @@ github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= +github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= +github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= -github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -329,18 +329,21 @@ github.com/dhui/dktest v0.3.7/go.mod h1:nYMOkafiA07WchSwKnKFUSbGMb2hMm5DrCGiXYG6 github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.9+incompatible h1:JlsVnETOjM2RLQa0Cc1XCIspUdXW3Zenq9P54uXBm6k= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v23.0.5+incompatible h1:DaxtlTJjFSnLOXVNUBU1+6kXGz2lpDoEAH6QoxaSg8k= +github.com/docker/docker v23.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= @@ -358,6 +361,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -463,6 +467,7 @@ github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblf github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= @@ -532,8 +537,8 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-github/v35 v35.2.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -566,16 +571,12 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= -github.com/gookit/color v1.4.2 h1:tXy44JFSFkKnELV6WaMo/lLfu/meqITX3iAV52do7lk= -github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -608,15 +609,10 @@ github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/itchyny/go-flags v1.5.0/go.mod h1:lenkYuCobuxLBAd/HGFE4LRoW8D3B6iXRQfWYJ+MNbA= -github.com/itchyny/gojq v0.12.5 h1:6SJ1BQ1VAwJAlIvLSIZmqHP/RUEq3qfVWvsRxrqhsD0= -github.com/itchyny/gojq v0.12.5/go.mod h1:3e1hZXv+Kwvdp6V9HXpVrvddiHVApi5EDZwS+zLFeiE= -github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= -github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -641,7 +637,6 @@ github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5W github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= @@ -713,11 +708,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/k0kubun/pp v2.3.0+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= -github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40= -github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= @@ -732,6 +724,8 @@ github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdY github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -761,11 +755,12 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lunixbochs/vtclean v1.0.0 h1:xu2sLAri4lGiovBDQKxl5mrXyESr3gUr5m5SM5+LVb8= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= @@ -776,13 +771,12 @@ github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsI github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= +github.com/mattes/migrate v3.0.1+incompatible h1:PhAZP82Vqejw8JZLF4U5UkLGzEVaCnbtJpB6DONcDow= +github.com/mattes/migrate v3.0.1+incompatible/go.mod h1:LJcqgpj1jQoxv3m2VXd3drv0suK5CbN/RCX7MXwgnVI= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.10 h1:KWqbp83oZ6YOEgIbNW3BM1Jbe2tz4jgmWA9FOuAF8bw= -github.com/mattn/go-colorable v0.1.10/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -791,18 +785,16 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -810,12 +802,18 @@ github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= +github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= +github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= +github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= +github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= -github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= +github.com/moby/term v0.0.0-20221128092401-c43b287e0e0f h1:J/7hjLaHLD7epG0m6TBMGmp4NQ+ibBYLfeyJWdAIFLA= +github.com/moby/term v0.0.0-20221128092401-c43b287e0e0f/go.mod h1:15ce4BGCFxt7I5NQKT+HV0yEDxmf6fSysfEDiVo3zFM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -861,14 +859,17 @@ github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go. github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= +github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -879,6 +880,7 @@ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mo github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= +github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -910,8 +912,9 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.11.1 h1:+4eQaD7vAZ6DsfsxB15hbE0odUjGI5ARs9yskGu1v4s= +github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -924,8 +927,9 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.30.0 h1:JEkYlQnpzrzQFxi6gnukFPdQ+ac82oRhzMcIduJu/Ug= +github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= @@ -936,20 +940,20 @@ github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= @@ -960,8 +964,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= +github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= @@ -975,8 +979,9 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +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/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= @@ -1003,14 +1008,19 @@ github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2 h1:+iNTcqQJy0OZ5jk6a5NLib47eqXK8uYcPX+O4+cBpEM= github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= @@ -1023,16 +1033,15 @@ github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= +github.com/testcontainers/testcontainers-go v0.20.0 h1:ASrcJee7vcWNw43yUgL2n8KA5IOywrF031GawlrkVkE= +github.com/testcontainers/testcontainers-go v0.20.0/go.mod h1:zb+NOlCQBkZ7RQp4QI+YMIHyO2CQ/qsXzNF5eLJ24SY= +github.com/testcontainers/testcontainers-go/modules/postgres v0.20.0 h1:skGd0Tv6USw6c9aJwea+Mb2WonLqf6N5npbS5WxbGQ0= +github.com/testcontainers/testcontainers-go/modules/postgres v0.20.0/go.mod h1:wtdaiIzG+DlZ/0DbNvrJ89TT7RUer8ZnRcv4y+xHcU8= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/traefik/yaegi v0.9.8/go.mod h1:FAYnRlZyuVlEkvnkHq3bvJ1lW5be6XuwgLdkYgYG6Lk= -github.com/traefik/yaegi v0.9.10/go.mod h1:FAYnRlZyuVlEkvnkHq3bvJ1lW5be6XuwgLdkYgYG6Lk= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E= github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ= @@ -1058,8 +1067,6 @@ github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2 github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8= -github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1091,11 +1098,8 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= -go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -1128,8 +1132,9 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e h1:1SzTfNOXwIS2oWiMF+6qu0OUDKb0dauo6MoDUQyu+yU= golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38= +golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1175,8 +1180,8 @@ 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.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1230,11 +1235,13 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211013171255-e13a2654a71e h1:Xj+JO91noE97IN6F/7WZxzC5QE6yENAQPrwIYhW3bsA= golang.org/x/net v0.0.0-20211013171255-e13a2654a71e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1361,9 +1368,14 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/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-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211013075003-97ac67df715c h1:taxlMj0D/1sOAuv/CbSD+MMDof2vbyPTqz5FNYKpXt8= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1374,13 +1386,15 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1452,14 +1466,14 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= @@ -1557,8 +1571,9 @@ google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= google.golang.org/genproto v0.0.0-20210721163202-f1cecdd8b78a/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= google.golang.org/genproto v0.0.0-20210726143408-b02e89920bf0/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4 h1:NBxB1XxiWpGqkPUiJ9PoBXkHV5A9+GohMOA+EmWoPbU= google.golang.org/genproto v0.0.0-20211013025323-ce878158c4d4/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad h1:kqrS+lhvaMHCxul6sKQvKJ8nAAhlVItmZV822hYFH/U= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1587,8 +1602,9 @@ google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1602,8 +1618,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1638,14 +1655,17 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= gorm.io/gorm v1.20.12/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/integration-test/Dockerfile b/integration-test/Dockerfile deleted file mode 100644 index 28dc1eac..00000000 --- a/integration-test/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Step 1: Modules caching -FROM golang:1.17.1-alpine3.14 as modules -COPY go.mod go.sum /modules/ -WORKDIR /modules -RUN go mod download - -# Step 2: Tests -FROM golang:1.17.1-alpine3.14 -COPY --from=modules /go/pkg /go/pkg -COPY . /app -WORKDIR /app - -RUN go env -w CGO_ENABLED=0 -RUN go env -w GOOS=linux -RUN go env -w GOARCH=amd64 - -CMD ["go", "test", "-v", "./integration-test/..."] \ No newline at end of file diff --git a/integration-test/integration_test.go b/integration-test/integration_test.go deleted file mode 100644 index 40b8c521..00000000 --- a/integration-test/integration_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package integration_test - -import ( - "log" - "net/http" - "os" - "testing" - "time" - - . "github.com/Eun/go-hit" - - "github.com/evrone/go-clean-template/pkg/rabbitmq/rmq_rpc/client" -) - -const ( - // Attempts connection - host = "app:8080" - healthPath = "http://" + host + "/healthz" - attempts = 20 - - // HTTP REST - basePath = "http://" + host + "/v1" - - // RabbitMQ RPC - rmqURL = "amqp://guest:guest@rabbitmq:5672/" - rpcServerExchange = "rpc_server" - rpcClientExchange = "rpc_client" - requests = 10 -) - -func TestMain(m *testing.M) { - err := healthCheck(attempts) - if err != nil { - log.Fatalf("Integration tests: host %s is not available: %s", host, err) - } - - log.Printf("Integration tests: host %s is available", host) - - code := m.Run() - os.Exit(code) -} - -func healthCheck(attempts int) error { - var err error - - for attempts > 0 { - err = Do(Get(healthPath), Expect().Status().Equal(http.StatusOK)) - if err == nil { - return nil - } - - log.Printf("Integration tests: url %s is not available, attempts left: %d", healthPath, attempts) - - time.Sleep(time.Second) - - attempts-- - } - - return err -} - -// HTTP POST: /translation/do-translate. -func TestHTTPDoTranslate(t *testing.T) { - body := `{ - "destination": "en", - "original": "текст для перевода", - "source": "auto" - }` - Test(t, - Description("DoTranslate Success"), - Post(basePath+"/translation/do-translate"), - Send().Headers("Content-Type").Add("application/json"), - Send().Body().String(body), - Expect().Status().Equal(http.StatusOK), - Expect().Body().JSON().JQ(".translation").Equal("text for translation"), - ) - - body = `{ - "destination": "en", - "original": "текст для перевода" - }` - Test(t, - Description("DoTranslate Fail"), - Post(basePath+"/translation/do-translate"), - Send().Headers("Content-Type").Add("application/json"), - Send().Body().String(body), - Expect().Status().Equal(http.StatusBadRequest), - Expect().Body().JSON().JQ(".error").Equal("invalid request body"), - ) -} - -// HTTP GET: /translation/history. -func TestHTTPHistory(t *testing.T) { - Test(t, - Description("History Success"), - Get(basePath+"/translation/history"), - Expect().Status().Equal(http.StatusOK), - Expect().Body().String().Contains(`{"history":[{`), - ) -} - -// RabbitMQ RPC Client: getHistory. -func TestRMQClientRPC(t *testing.T) { - rmqClient, err := client.New(rmqURL, rpcServerExchange, rpcClientExchange) - if err != nil { - t.Fatal("RabbitMQ RPC Client - init error - client.New") - } - - defer func() { - err = rmqClient.Shutdown() - if err != nil { - t.Fatal("RabbitMQ RPC Client - shutdown error - rmqClient.RemoteCall", err) - } - }() - - type Translation struct { - Source string `json:"source"` - Destination string `json:"destination"` - Original string `json:"original"` - Translation string `json:"translation"` - } - - type historyResponse struct { - History []Translation `json:"history"` - } - - for i := 0; i < requests; i++ { - var history historyResponse - - err = rmqClient.RemoteCall("getHistory", nil, &history) - if err != nil { - t.Fatal("RabbitMQ RPC Client - remote call error - rmqClient.RemoteCall", err) - } - - if history.History[0].Original != "текст для перевода" { - t.Fatal("Original != текст для перевода") - } - } -} diff --git a/internal/app/app.go b/internal/app/app.go index 5f570ade..8ea17ac9 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -23,55 +23,72 @@ import ( // Run creates objects via constructors. func Run(cfg *config.Config) { - l := logger.New(cfg.Log.Level) + log := logger.New(cfg.Log.Level) // Repository - pg, err := postgres.New(cfg.PG.URL, postgres.MaxPoolSize(cfg.PG.PoolMax)) - if err != nil { - l.Fatal(fmt.Errorf("app - Run - postgres.New: %w", err)) - } + pg := setupPostgresClient(cfg) defer pg.Close() - // Use case - translationUseCase := usecase.New( - repo.New(pg), - webapi.New(), - ) - - // RabbitMQ RPC Server - rmqRouter := amqprpc.NewRouter(translationUseCase) - - rmqServer, err := server.New(cfg.RMQ.URL, cfg.RMQ.ServerExchange, rmqRouter, l) - if err != nil { - l.Fatal(fmt.Errorf("app - Run - rmqServer - server.New: %w", err)) - } - - // HTTP Server - handler := gin.New() - v1.NewRouter(handler, l, translationUseCase) - httpServer := httpserver.New(handler, httpserver.Port(cfg.HTTP.Port)) + rmqServer, httpEngine := setupHttpEngine(cfg, pg, log) + httpServer := httpserver.New(httpEngine, httpserver.Port(cfg.HTTP.Port)) // Waiting signal interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM) + var err error select { case s := <-interrupt: - l.Info("app - Run - signal: " + s.String()) + log.Info("app - Run - signal: " + s.String()) case err = <-httpServer.Notify(): - l.Error(fmt.Errorf("app - Run - httpServer.Notify: %w", err)) + log.Error(fmt.Errorf("app - Run - httpServer.Notify: %w", err)) case err = <-rmqServer.Notify(): - l.Error(fmt.Errorf("app - Run - rmqServer.Notify: %w", err)) + log.Error(fmt.Errorf("app - Run - rmqServer.Notify: %w", err)) } // Shutdown err = httpServer.Shutdown() if err != nil { - l.Error(fmt.Errorf("app - Run - httpServer.Shutdown: %w", err)) + log.Error(fmt.Errorf("app - Run - httpServer.Shutdown: %w", err)) } err = rmqServer.Shutdown() if err != nil { - l.Error(fmt.Errorf("app - Run - rmqServer.Shutdown: %w", err)) + log.Error(fmt.Errorf("app - Run - rmqServer.Shutdown: %w", err)) } } + +func setupHttpEngine(cfg *config.Config, pg *postgres.Postgres, log *logger.Logger) (*server.Server, *gin.Engine) { + translationUseCase, rmqRouter := setupRabbitMqRouter(pg) + + rmqServer, err := server.New(cfg.RMQ.URL, cfg.RMQ.ServerExchange, rmqRouter, log) + if err != nil { + panic(fmt.Errorf("app - Run - rmqServer - server.New: %w", err)) + } + + // HTTP Server + httpEngine := gin.New() + v1.NewRouter(httpEngine, log, translationUseCase) + + return rmqServer, httpEngine +} + +func setupPostgresClient(cfg *config.Config) *postgres.Postgres { + pg, err := postgres.New(cfg.PG.URL, postgres.MaxPoolSize(cfg.PG.PoolMax)) + if err != nil { + panic(fmt.Errorf("app - Run - postgres.New: %w", err)) + } + return pg +} + +func setupRabbitMqRouter(pg *postgres.Postgres) (*usecase.TranslationUseCase, map[string]server.CallHandler) { + // Use case + translationUseCase := usecase.New( + repo.New(pg), + webapi.New(), + ) + + // RabbitMQ RPC Server + rmqRouter := amqprpc.NewRouter(translationUseCase) + return translationUseCase, rmqRouter +} diff --git a/internal/app/app_test.go b/internal/app/app_test.go new file mode 100644 index 00000000..65d56171 --- /dev/null +++ b/internal/app/app_test.go @@ -0,0 +1,151 @@ +//go:build system +// +build system + +package app + +import ( + "context" + "github.com/evrone/go-clean-template/config" + "github.com/evrone/go-clean-template/internal/test/db" + "github.com/evrone/go-clean-template/pkg/logger" + "github.com/evrone/go-clean-template/pkg/postgres" + "github.com/evrone/go-clean-template/pkg/rabbitmq/rmq_rpc/client" + "github.com/gin-gonic/gin" + "github.com/stretchr/testify/require" + "io" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +var httpEngine *gin.Engine +var cfg *config.Config + +func init() { + httpEngine, cfg = given() +} + +func TestApp(t *testing.T) { + + t.Run("When calling the health endpoint, Then return 200", func(t *testing.T) { + w := sendRequest("GET", "/healthz", httpEngine, nil) + + require.Equal(t, 200, w.Code) + require.Equal(t, "", w.Body.String()) + }) + + t.Run("When calling the do-translate endpoint providing all required information, Then return 200", func(t *testing.T) { + body := `{ + "destination": "en", + "original": "текст для перевода", + "source": "auto" + }` + + w := sendRequest("POST", "/v1/translation/do-translate", httpEngine, strings.NewReader(body)) + + require.Equal(t, 200, w.Code) + require.JSONEq(t, `{ + "source":"auto", + "destination":"en", + "original":"текст для перевода", + "translation":"text to translate" + }`, w.Body.String()) + require.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type")) + }) + + t.Run("When calling the do-translate endpoint missing source, Then return 400", func(t *testing.T) { + body := `{ + "destination": "en", + "original": "текст для перевода", + }` + + w := sendRequest("POST", "/v1/translation/do-translate", httpEngine, strings.NewReader(body)) + + require.Equal(t, 400, w.Code) + require.JSONEq(t, `{"error":"invalid request body"}`, w.Body.String()) + require.Equal(t, "application/json; charset=utf-8", w.Header().Get("Content-Type")) + }) + + t.Run("When calling the history endpoint, Then return 200 containing history entries", func(t *testing.T) { + + w := sendRequest("GET", "/v1/translation/history", httpEngine, nil) + + require.Equal(t, 200, w.Code) + require.Contains(t, w.Body.String(), `{"history":[{`) + }) + + t.Run("When calling the history endpoint using RabbitMQ RPC Client, Then returns history entries", func(t *testing.T) { + + rmqClient, err := client.New(cfg.RMQ.URL, cfg.RMQ.ServerExchange, cfg.RMQ.ClientExchange) + if err != nil { + panic(err) + } + if err != nil { + t.Fatal("RabbitMQ RPC Client - init error - client.New") + } + + defer func() { + err = rmqClient.Shutdown() + if err != nil { + t.Fatal("RabbitMQ RPC Client - shutdown error - rmqClient.RemoteCall", err) + } + }() + + type Translation struct { + Source string `json:"source"` + Destination string `json:"destination"` + Original string `json:"original"` + Translation string `json:"translation"` + } + + type historyResponse struct { + History []Translation `json:"history"` + } + + for i := 0; i < 10; i++ { + var history historyResponse + + err = rmqClient.RemoteCall("getHistory", nil, &history) + if err != nil { + t.Fatal("RabbitMQ RPC Client - remote call error - rmqClient.RemoteCall", err) + } + + if history.History[0].Original != "текст для перевода" { + t.Fatal("Original != текст для перевода") + } + } + }) +} + +func given() (*gin.Engine, *config.Config) { + ctx := context.Background() + + cfg, err := config.NewConfig() + if err != nil { + panic(err) + } + log := logger.New(cfg.Log.Level) + + db.MustStartPostgresContainer(err, ctx, cfg) + db.MustStartRMQContainer(ctx, cfg) + + pg := setupPostgresClient(cfg) + db.ExecuteMigrate(cfg.PG.URL, log) + + httpEngine := mustSetupHttpEngine(cfg, pg, log) + + return httpEngine, cfg +} + +func mustSetupHttpEngine(config *config.Config, pg *postgres.Postgres, logger *logger.Logger) *gin.Engine { + _, httpEngine := setupHttpEngine(config, pg, logger) + return httpEngine +} + +func sendRequest(method string, url string, httpEngine *gin.Engine, body io.Reader) *httptest.ResponseRecorder { + w := httptest.NewRecorder() + req, _ := http.NewRequest(method, url, body) + httpEngine.ServeHTTP(w, req) + return w +} diff --git a/internal/test/db/postgres.go b/internal/test/db/postgres.go new file mode 100644 index 00000000..b7c42617 --- /dev/null +++ b/internal/test/db/postgres.go @@ -0,0 +1,71 @@ +package db + +import ( + "context" + "fmt" + "github.com/evrone/go-clean-template/config" + "github.com/evrone/go-clean-template/pkg/logger" + "github.com/golang-migrate/migrate/v4" + "github.com/testcontainers/testcontainers-go" + postgres2 "github.com/testcontainers/testcontainers-go/modules/postgres" + "github.com/testcontainers/testcontainers-go/wait" + "path/filepath" + "runtime" + "time" + + _ "github.com/golang-migrate/migrate/v4/database/postgres" + _ "github.com/golang-migrate/migrate/v4/source/file" + _ "github.com/lib/pq" + _ "github.com/mattes/migrate/database/postgres" + _ "github.com/mattes/migrate/source/file" +) + +func MustStartPostgresContainer(err error, ctx context.Context, cfg *config.Config) { + container, err := postgres2.RunContainer(ctx, + testcontainers.WithImage("postgres:15.2"), + postgres2.WithDatabase("postgres"), + postgres2.WithUsername("user"), + postgres2.WithPassword("pass"), + testcontainers.WithWaitStrategy(wait.ForLog("database system is ready to accept connections").WithOccurrence(2).WithStartupTimeout(5*time.Second)), + testcontainers.CustomizeRequest(testcontainers.GenericContainerRequest{ + ContainerRequest: testcontainers.ContainerRequest{ + Name: "postgres-container", + }, + Reuse: true, + }), + ) + + if err != nil { + panic(err) + } + + host, err := container.Host(ctx) + realPort, err := container.MappedPort(ctx, "5432") + + cfg.PG.URL = fmt.Sprintf("postgres://user:pass@%v:%v/postgres?sslmode=disable", host, realPort.Port()) +} + +func ExecuteMigrate(pgConnectionUrl string, log *logger.Logger) { + projectRoot := projectRoot() + + migrationDirectoryUri := fmt.Sprintf("file://%s/migrations", projectRoot) + m, err := migrate.New( + migrationDirectoryUri, + pgConnectionUrl, + ) + + if err != nil { + panic(err) + } + if err := m.Up(); err != nil { + // errors if no migration need to be executed + log.Info(fmt.Sprintf("MIGRATE: %s", err)) + } +} + +func projectRoot() string { + _, b, _, _ := runtime.Caller(0) + projectRoot := filepath.Dir(b) + + return projectRoot + "/../../../" +} diff --git a/internal/test/db/rabbitmq.go b/internal/test/db/rabbitmq.go new file mode 100644 index 00000000..74da4e12 --- /dev/null +++ b/internal/test/db/rabbitmq.go @@ -0,0 +1,50 @@ +package db + +import ( + "context" + "fmt" + "github.com/docker/go-connections/nat" + "github.com/evrone/go-clean-template/config" + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/wait" + "time" +) + +func MustStartRMQContainer(ctx context.Context, cfg *config.Config) { + + port, err := nat.NewPort("", "5672") + if err != nil { + panic(fmt.Errorf("failed to build port: %v", err)) + } + + timeout := 5 * time.Minute // Default timeout + tag := "3.11.15-alpine" + + req := testcontainers.ContainerRequest{ + Image: fmt.Sprintf("rabbitmq:%s", tag), + ExposedPorts: []string{string(port)}, + WaitingFor: wait.ForListeningPort(port).WithStartupTimeout(timeout), + Name: "rmq-container", + } + + rmqContainer, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ + ContainerRequest: req, + Started: true, + Reuse: true, + }) + if err != nil { + panic(fmt.Errorf("failed to start container: %v", err)) + } + + host, err := rmqContainer.Host(ctx) + if err != nil { + panic(fmt.Errorf("failed to get container host: %v", err)) + } + + realPort, err := rmqContainer.MappedPort(ctx, port) + if err != nil { + panic(fmt.Errorf("failed to get exposed container port: %v", err)) + } + + cfg.RMQ.URL = fmt.Sprintf("amqp://%s:%s", host, realPort.Port()) +}