diff --git a/changelog.md b/changelog.md index 025b27fb6f..5a8bd95e8d 100644 --- a/changelog.md +++ b/changelog.md @@ -26,6 +26,7 @@ ### Fixes - [#4184](https://github.com/ignite/cli/pull/4184) Set custom `InitChainer` because of manually registered modules +- [#4198](https://github.com/ignite/cli/pull/4198) Set correct prefix overwriting in `buf.gen.pulsar.yaml` ## [`v28.4.0`](https://github.com/ignite/cli/releases/tag/v28.4.0) diff --git a/go.mod b/go.mod index 7d85cb5733..8ef603f130 100644 --- a/go.mod +++ b/go.mod @@ -44,6 +44,7 @@ require ( github.com/goccy/go-yaml v1.11.2 github.com/golangci/golangci-lint v1.55.2 github.com/google/go-github/v48 v48.2.0 + github.com/google/go-querystring v1.1.0 github.com/gookit/color v1.5.4 github.com/gorilla/mux v1.8.1 github.com/gorilla/rpc v1.2.1 @@ -256,7 +257,6 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-containerregistry v0.14.0 // indirect github.com/google/go-dap v0.9.1 // indirect - github.com/google/go-querystring v1.1.0 // indirect github.com/google/pprof v0.0.0-20240117000934-35fc243c5815 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect diff --git a/ignite/templates/app/files/proto/buf.gen.pulsar.yaml b/ignite/templates/app/files/proto/buf.gen.pulsar.yaml.plush similarity index 84% rename from ignite/templates/app/files/proto/buf.gen.pulsar.yaml rename to ignite/templates/app/files/proto/buf.gen.pulsar.yaml.plush index e8fffdb284..b128e9403f 100644 --- a/ignite/templates/app/files/proto/buf.gen.pulsar.yaml +++ b/ignite/templates/app/files/proto/buf.gen.pulsar.yaml.plush @@ -7,12 +7,13 @@ version: v1 managed: enabled: true go_package_prefix: - default: cosmossdk.io/api + default: <%= ModulePath %>/api except: - buf.build/googleapis/googleapis - buf.build/cosmos/gogo-proto - buf.build/cosmos/cosmos-proto override: + buf.build/cosmos/cosmos-sdk: cosmossdk.io/api plugins: - name: go-pulsar out: ./api diff --git a/integration/app/proto_test.go b/integration/app/proto_test.go new file mode 100644 index 0000000000..5c0eb04b44 --- /dev/null +++ b/integration/app/proto_test.go @@ -0,0 +1,32 @@ +//go:build !relayer + +package app_test + +import ( + "os" + "path/filepath" + "strings" + "testing" + + envtest "github.com/ignite/cli/v28/integration" + "github.com/stretchr/testify/require" +) + +// TestGenerateAppCheckBufPulsarPath tests scaffolding a new chain and checks if the buf.gen.pulsar.yaml file is correct +func TestGenerateAppCheckBufPulsarPath(t *testing.T) { + var ( + env = envtest.New(t) + app = env.Scaffold("github.com/test/blog") + ) + + bufGenPulsarPath := filepath.Join(app.SourcePath(), "proto", "buf.gen.pulsar.yaml") + _, statErr := os.Stat(bufGenPulsarPath) + require.False(t, os.IsNotExist(statErr), "buf.gen.pulsar.yaml should be scaffolded") + + result, err := os.ReadFile(bufGenPulsarPath) + require.NoError(t, err) + + require.True(t, strings.Contains(string(result), "default: github.com/test/blog/api"), "buf.gen.pulsar.yaml should contain the correct api override") + + app.EnsureSteady() +}