mwitkow / go-proto-validators

Generate message validators from .proto annotations.
Apache License 2.0
1.08k stars 164 forks source link

sorry, why I can't run example #79

Closed beebaseboy closed 4 years ago

beebaseboy commented 4 years ago

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.

Helcaraxan commented 4 years ago

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. :)

beebaseboy commented 4 years ago

thx, work that out.