Skip to content

Commit

Permalink
fix(buf): set correct prefix for api (backport #4198) (#4200)
Browse files Browse the repository at this point in the history
* fix(buf): set correct prefix for api (#4198)

(cherry picked from commit 1316d69)

# Conflicts:
#	ignite/templates/app/files/proto/buf.gen.pulsar.yaml
#	ignite/templates/app/files/proto/buf.gen.pulsar.yaml.plush
#	ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml
#	ignite/templates/app/proto_test.go
#	integration/app/cmd_proto_path_test.go

* conflicts

* go mod tidy

---------

Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
mergify[bot] and julienrbrt authored Jun 25, 2024
1 parent 8cebfc3 commit e7d9e6a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
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()
}

0 comments on commit e7d9e6a

Please sign in to comment.