Skip to content

Commit

Permalink
fix buf files
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Dec 20, 2024
1 parent ee17d14 commit b8432b6
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 37 deletions.
3 changes: 0 additions & 3 deletions buf.work.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: v2
modules:
- path: proto
name: buf.build/ignitehq/cli
lint:
use:
- DEFAULT
- FILE_LOWER_SNAKE_CASE
except:
- COMMENT_FIELD
- FIELD_NOT_REQUIRED
- PACKAGE_NO_IMPORT_CYCLE
- PACKAGE_VERSION_SUFFIX
- RPC_REQUEST_STANDARD_NAME
- SERVICE_SUFFIX
- UNARY_RPC
disallow_comment_ignores: true
breaking:
use:
- FILE
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT
1 change: 0 additions & 1 deletion ignite/internal/plugin/testdata/execute_fail/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ require (
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.27.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.68.0 // indirect
Expand Down
1 change: 0 additions & 1 deletion ignite/internal/plugin/testdata/execute_ok/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ require (
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.27.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.68.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions ignite/pkg/cosmosbuf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"gopkg.in/yaml.v3"
)

const workFilename = "buf.work.yaml"
const bufConfig = "buf.yaml"

// BufWork represents the buf.work.yaml file.
type BufWork struct {
Expand All @@ -17,9 +17,9 @@ type BufWork struct {
Directories []string `yaml:"directories"`
}

// ParseBufWork parse the buf.work.yaml file at app path.
func ParseBufWork(appPath string) (BufWork, error) {
path := filepath.Join(appPath, workFilename)
// ParseBufConfig parse the buf.yaml file at app path.
func ParseBufConfig(appPath string) (BufWork, error) {
path := filepath.Join(appPath, bufConfig)

f, err := os.Open(path)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions ignite/services/chain/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ import (

// CheckBufProtoDir check if the proto path exist into the directory list in the buf.work.yaml file.
func CheckBufProtoDir(appPath, protoDir string) (bool, []string, error) {
workFile, err := cosmosbuf.ParseBufWork(appPath)
bufCfg, err := cosmosbuf.ParseBufConfig(appPath)
if err != nil {
return false, nil, err
}

missing, err := workFile.MissingDirectories()
missing, err := bufCfg.MissingDirectories()
if err != nil {
return false, nil, err
}

return workFile.HasProtoDir(protoDir), missing, nil
return bufCfg.HasProtoDir(protoDir), missing, nil
}

// AddBufProtoDir add the proto path into the directory list in the buf.work.yaml file.
func AddBufProtoDir(appPath, protoDir string) error {
workFile, err := cosmosbuf.ParseBufWork(appPath)
workFile, err := cosmosbuf.ParseBufConfig(appPath)
if err != nil {
return err
}
Expand All @@ -36,7 +36,7 @@ func AddBufProtoDir(appPath, protoDir string) error {

// RemoveBufProtoDirs add the proto path into the directory list in the buf.work.yaml file.
func RemoveBufProtoDirs(appPath string, protoDirs ...string) error {
workFile, err := cosmosbuf.ParseBufWork(appPath)
workFile, err := cosmosbuf.ParseBufConfig(appPath)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/app/proto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestBufFiles(t *testing.T) {
want := []string{"buf.work.yaml"}
want := []string{"buf.lock", "buf.yaml"}
protoDir, err := os.ReadDir("files/{{protoDir}}")
require.NoError(t, err)
for _, e := range protoDir {
Expand Down
14 changes: 7 additions & 7 deletions proto/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: v1
version: v2
plugins:
- plugin: buf.build/protocolbuffers/go
out: .
opt: paths=source_relative
- plugin: buf.build/grpc/go
out: .
opt: paths=source_relative
- remote: buf.build/protocolbuffers/go
out: .
opt: paths=source_relative
- remote: buf.build/grpc/go
out: .
opt: paths=source_relative
15 changes: 0 additions & 15 deletions proto/buf.yaml

This file was deleted.

0 comments on commit b8432b6

Please sign in to comment.