protoc

Differences between protoc-gen-go and protoc-gen-go-grpc



The old-way is using the github.com/golang/protobuf module. It comes with protoc-gen-go that generates both serialization of the protobuf messages and grpc code (when –go_out=plugins=grpc is used).



The so-called new-way is using the google.golang.org/protobuf module = a major revision of the Go bindings for protocol buffers. It comes with a different protoc-gen-go that no longer supports generating gRPC service definitions. For gRPC code, a new plugin called protoc-gen-go-grpc was developed by Go gRPC project. The plugins flag, which provided a way to invoke the gRPC code generator in the old-way, is deprecated.



protoc -I $protodir –go_out=plugins=grpc:./genproto/ $protodir/v1/foo.proto



https://stackoverflow.com/questions/64828054/differences-between-protoc-gen-go-and-protoc-gen-go-grpc



regex – 如何在Go中执行不区分大小写的正则表达式?
你这样做通过添加 (?i)到正则表达式的开头。



reg, err := regexp.Compile(“(?i)”+strings.Replace(s.Name, “ “, “[ \.-]”, -1))
1
reg, err := regexp.Compile(“(?i)”+strings.Replace(s.Name, “ “, “[ \.
-]”, -1))
对于一个固定的正则表达式它看起来像这样。



r := regexp.MustCompile((?i)CaSe)
1
r := regexp.MustCompile((?i)CaSe)



https://johng.cn/regex-case-insensitive-in-go/


Category golang