ci: upstream dep-assert and nomenclature from server/v2 (#19703)

This commit is contained in:
Julien Robert
2024-03-08 17:00:09 +00:00
committed by GitHub
parent 2bfc037a07
commit 0f5314c031
6 changed files with 29 additions and 16 deletions
+7 -7
View File
@@ -2,7 +2,7 @@
sidebar_position: 1
---
# Overview of `app_v2.go`
# Overview of `app_di.go`
:::note Synopsis
@@ -19,7 +19,7 @@ Learn more about the rationale of App Wiring in [ADR-057](../architecture/adr-05
:::
This section is intended to provide an overview of the `SimApp` `app_v2.go` file with App Wiring.
This section is intended to provide an overview of the `SimApp` `app_di.go` file with App Wiring.
## `app_config.go`
@@ -57,7 +57,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/simapp/app_config.go
:::tip
The example above shows how to create an `AppConfig` using Go. However, it is also possible to create an `AppConfig` using YAML, or JSON.
The configuration can then be embed with `go:embed` and read with [`appconfig.LoadYAML`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadYAML), or [`appconfig.LoadJSON`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadJSON), in `app_v2.go`.
The configuration can then be embed with `go:embed` and read with [`appconfig.LoadYAML`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadYAML), or [`appconfig.LoadJSON`](https://pkg.go.dev/cosmossdk.io/core/appconfig#LoadJSON), in `app_di.go`.
```go
//go:embed app_config.yaml
@@ -95,9 +95,9 @@ modules:
A more complete example of `app.yaml` can be found [here](https://github.com/cosmos/cosmos-sdk/blob/91b1d83f1339e235a1dfa929ecc00084101a19e3/simapp/app.yaml).
## `app_v2.go`
## `app_di.go`
`app_v2.go` is the place where `SimApp` is constructed. `depinject.Inject` facilitates that by automatically wiring the app modules and keepers, provided an application configuration `AppConfig` is provided. `SimApp` is constructed, when calling the injected `*runtime.AppBuilder`, with `appBuilder.Build(...)`.
`app_di.go` is the place where `SimApp` is constructed. `depinject.Inject` facilitates that by automatically wiring the app modules and keepers, provided an application configuration `AppConfig` is provided. `SimApp` is constructed, when calling the injected `*runtime.AppBuilder`, with `appBuilder.Build(...)`.
In short `depinject` and the [`runtime` package](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/runtime) abstract the wiring of the app, and the `AppBuilder` is the place where the app is constructed. [`runtime`](https://pkg.go.dev/github.com/cosmos/cosmos-sdk/runtime) takes care of registering the codecs, KV store, subspaces and instantiating `baseapp`.
```go reference
@@ -143,10 +143,10 @@ When using AutoCLI and combining app wiring and non app wiring modules. The Auto
Otherwise it will miss the non depinject modules and not register their CLI.
:::
### Complete `app_v2.go`
### Complete `app_di.go`
:::tip
Note that in the complete `SimApp` `app_v2.go` file, testing utilities are also defined, but they could as well be defined in a separate file.
Note that in the complete `SimApp` `app_di.go` file, testing utilities are also defined, but they could as well be defined in a separate file.
:::
```go reference