sorry, why I can't run example
beebaseboy opened this issue · 2 comments
shell:
go get github.com/mwitkow/go-proto-validators/protoc-gen-govalidators
protobuf file:
syntax = "proto3";
package validatorFromGithub;
import "github.com/mwitkow/go-proto-validators/validator.proto";
message Msg {
string someImportantString = 1 [(validator.field) = {regex: "^[a-z]{2,5}$"}];
int32 age = 2 [(validator.field) = {regex:"int_gt: 0, int_lt: 100"}];
}
shell to gen:
protoc
--proto_path=${GOPATH}/src
--proto_path=${GOPATH}/src/github.com/google/protobuf/src
--proto_path=.
--go_out=.
--govalidators_out=.
*.proto
err:
warning: directory does not exist.
protoc-gen-govalidators: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--govalidators_out: protoc-gen-govalidators: Plugin failed with status code 1.
Hello @AaronLux. Apologies for the delay in the response but I have been away and offline for the past few weeks.
From what I get it appears that you might be running into issues with Go modules. Could you confirm the environment that you are using.
Ideally the output of go version
and go env
would be helpful. :)
thx, work that out.