Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jesselucas on github.
  • I am jesselucas (https://keybase.io/jesselucas) on keybase.
  • I have a public key ASA4NEVxIe1lws4Cq4IkgkazxmGCxQPTwAPHiwN0futaVQo

To claim this, I am signing this object:

@jesselucas
jesselucas / changroup.go
Last active April 17, 2024 14:33
Simple solution for using a WaitGroup with select{}
package main
import (
"fmt"
"sync"
"time"
)
func main() {
// Create a wait group of any size
@jesselucas
jesselucas / protogen.md
Last active January 29, 2019 01:23
Tips for generating gRPC protocol buffers

Tips for generating gRPC protocol buffers

You can use the flag -I or -proto_path to specify the path to your protobuffer. The next flag specifies the language to compile to. The Go command is fairly well documented but the Node.js documents seem to only show how to dynamically load a proto file. This is how you generate a compiled file for use in your Node.js project.

GO

protoc --proto_path=$SRC_PATH --go_out=plugins=grpc:$DEST_PATH $SRC_PATH/service.proto

Node.js

protoc --proto_path=$SRC_PATH --js_out=import_style=commonjs,binary:$DEST_PATH --grpc_out=./ --plugin=protoc-gen-grpc=node_modules/grpc-tools/bin/grpc_node_plugin $SRC_PATH/service.proto