Comments (7)
I have also encountered this problem. I have been trapped for two days. How can I solve it, brother
from go-proto-validators.
I have also encountered this problem. I have been trapped for two days. How can I solve it, brother
Here are the steps I took to solve the problem.
- First make sure your environment version is consistent with the documentation
- Modify the import
syntax = "proto3";
package validator.examples;
import "validator.proto";
option go_package="./YiuProto";
message InnerMessage {
// some_integer can only be in range (0, 100).
int32 some_integer = 1 [(validator.field) = {int_gt: 0, int_lt: 100}];
// some_float can only be in range (0;1).
double some_float = 2 [(validator.field) = {float_gte: 0, float_lte: 1}];
}
message OuterMessage {
// important_string must be a lowercase alpha-numeric of 5 to 30 characters (RE2 syntax).
string important_string = 1 [(validator.field) = {regex: "^[a-z0-9]{5,30}$"}];
// proto3 doesn't have `required`, the `msg_exist` enforces presence of InnerMessage.
InnerMessage inner = 2 [(validator.field) = {msg_exists : true}];
}
- Execute the correct command line
protoc \
-I=F:/GoCode/pkg/mod/github.com/mwitkow/[email protected]/ \
-I=. \
--go_out=. \
--go_opt=paths=source_relative \
--govalidators_out=. \
--govalidators_opt=paths=source_relative \
*.proto
Use the -I
argument to identify where import needs to be found for protoc compilation.
from go-proto-validators.
Actually this error happened on go version: 1.12 too, I just upgraded it to 1.13. So for both of this version this error happens.
from go-proto-validators.
I also encountered, how to solve this problem
from go-proto-validators.
Hello @payalord and @liuxuisme.
Thank you for raising the issue!
Would it be possible to get a bit more information about the manner in which you are both invoking the protoc
compile? With the information that you currently provide I can't narrow down the list of potential causes of the error that you are seeing. And these potential causes cover a too vast area to explicitly list them up front.
Ideally I would have:
- The folder structure that contains the proto files you are compiling.
- The exact
protoc
command you are invoking. - The output of
go env
when run at the location where you calledgo get -u github.com/golang/protobuf/protoc-gen-go
from go-proto-validators.
Hello @payalord and @liuxuisme.
Thank you for raising the issue!
Would it be possible to get a bit more information about the manner in which you are both invoking the
protoc
compile? With the information that you currently provide I can't narrow down the list of potential causes of the error that you are seeing. And these potential causes cover a too vast area to explicitly list them up front.Ideally I would have:
- The folder structure that contains the proto files you are compiling.
- The exact
protoc
command you are invoking.- The output of
go env
when run at the location where you calledgo get -u github.com/golang/protobuf/protoc-gen-go
My own problem. This tool is great, my bro
from go-proto-validators.
That's good to hear @liuxuisme. Great that you got solved the issue. 👍
from go-proto-validators.
Related Issues (20)
- Does this work with APIv2? HOT 1
- go get report error, thanks for help
- could error message FieldName be json tag?
- import order changed
- Mask sensitive fields
- Support for multibyte strings
- is_in_enum combined with int_gt doesn't work
- Support for optional field HOT 4
- How to build this for NodeJS?
- nice, continue to update and iterate plase
- panic: interface conversion: interface {} is []uint8, not *validator.FieldValidator
- Error when building with bazel
- How to build this for python?
- Publish to buf schema register HOT 2
- is this repo still maintained? HOT 1
- How to specify path for generated validator.go ? HOT 2
- protoc command error
- optional fields are not supported
- compiles files that dont have any validator notation
- generate code can not support option 'module' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-proto-validators.