GithubHelp home page GithubHelp logo

protoc-gen-fieldmask's People

Contributors

idodod avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

protoc-gen-fieldmask's Issues

unparsable Go source: expected '}', found 'type'

I've built and installed the tool. Then using buf:

# buf.gen.yaml
# Generated by "buf config migrate-v1beta1". Edit as necessary, and
# remove this comment when you're finished.
version: v1
plugins:
  - name: go
    out: .
    opt: paths=source_relative
  - name: go-grpc
    out: .
    opt: paths=source_relative
  - name: fieldmask
    out: .

And running

โœ— buf generate -o pkg/proto
Failure: plugin fieldmask: github.com/<repo>/../<filename>.pb.fieldmask.go: unparsable Go source: 296:1: expected '}', found 'type' (and 9 more errors)

I'm sorry I can't provide a narrower concrete example right now.

Full path generation

Let's add generation full path generator, which will generate path from message name to field name.

Problem: for example in one proto file can be several duplicated field names:

syntax = "proto3";

package casesa;

option go_package = "cases/a;a";

message Foo {
  string bar = 1;
  int32 baz = 2;
}

message Bar {
  string bar = 1;
}

After generation we will receive smth like this:

f := Foo{}
f.FieldMaskPaths().Bar() // will return "bar"
b := Bar{}
b.FieldMaskPaths().Bar() // will also return "bar"

It is a problem due to one proto file can be like namespace. So it can be useful to have absolute path of each field in namespace.

f := Foo{}
f.FullFieldMaskPaths().Bar() // will return "foo.bar"
b := Bar{}
b.FullFieldMaskPaths().Bar() // will return "bar.bar"

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: .github/renovate.json5
Error type: Invalid JSON5 (parsing failed)
Message: JSON5.parse error: JSON5: invalid character '}' at 62:5

There is no check for reserved words in Golang

For example if you will try to generate field mask from such proto file:

syntax = "proto3";

option go_package = "unparsable";

package unparsable;

message Foo {
  string type = 1;
  string switch = 2;
}

You will get an error:
--fieldmask_out: t.pb.fieldmask.go: unparsable Go source: 41:64: expected selector or type assertion, found 'type' (and 4 more errors)

So the problem is that if you use as a field name reserved word in Goland - it will be an error.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • nelonoel/branch-name v1.0.1
.github/workflows/release.yml
  • actions/checkout v4
  • nelonoel/branch-name v1.0.1
  • earthly/actions v1
gomod
go.mod
  • go 1.22
  • github.com/iancoleman/strcase v0.3.0
  • github.com/stretchr/testify v1.9.0
  • google.golang.org/genproto v0.0.0-20240429193739-8cf5692501f6@8cf5692501f6
  • google.golang.org/protobuf v1.34.0
regex
.github/renovate.json5
Earthfile
  • go 1.22
Earthfile
  • alpine 3.19
Earthfile
  • golangci/golangci-lint v1.58.0
Earthfile
  • namely/protoc-all 1.51_2
.github/workflows/ci.yml
  • earthly/earthly v0.8.9
.github/workflows/release.yml
  • earthly/earthly v0.8.9

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.