Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(buf): set correct prefix for api (backport #4198) #4200

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions integration/app/proto_test.go
Original file line number Diff line number Diff line change
@@ -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()
}
Loading