Skip to content

Latest commit

 

History

History
90 lines (63 loc) · 2.54 KB

notes.md

File metadata and controls

90 lines (63 loc) · 2.54 KB

Install PROTOC on mac

PROTOC_ZIP=protoc-3.3.0-osx-x86_64.zip
curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
rm -f $PROTOC_ZIP

reference

Run

protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/addressbook.proto

e.g.

protoc -I=. --java_out=test test/test.proto`

Issues:

  1. error-using-import-in-proto-file

  2. cannot build ts

  • go build -> [folder].exe -> rename to protoc-gen-[anything].exe
  • protoc --[anything]_out=lang=ts:$DST_DIR $SRC_DIR/protofile
  1. The Go code generator does not produce output for services by default:

  2. git add remote url:

    • create bitbucket repo from side menu
    • git init
    • git remote add origin https://[email protected]/yoozoosg/protoapi.git
  3. soft link:

ln [-Ffhinsv] source_file [target_file]
ln [-Ffhinsv] source_file ... target_dir
link source_file target_file

link generated protoapi with protoc-gen-ts in $GOBIN ln -s /Users/zhuqinglei/go/src/protoapi/protoapi protoc-gen-ts then rebuild go build

  1. see hidden file in mac: shift + command + .

  2. how to use vi:

    • i: insert
    • esc: quit insertion
    • :w: write/save
    • :q: quit editor
    • :wq: write and quit
    • :q!: force quit
  3. webpack issue

  • when run webpack, you may encounter the issue that even though webpack and webpack-cli are downloaded, the npm could not allocate them and continue to prompt you to download webpack-cli.
  • to solve this, we need to go to C:\Users\<User>\AppData\Roaming\npm, see if webpack.exe is there, then we install webpack-cli from there

spring

  • complex data type support

    • support object data type: it is to be declared in the message.proto. Example:
    syntax = "proto3";
    
    message HelloRequest {
        Greeting greeting = 1;
    }
    
    message HelloResponse {
        string reply = 1;
    }
    
    message Greeting {
        string greetingMsg = 1;
    }
  • java package name

    • user can declare java package name as options in the service.proto file. and the java classes will be generated in the specific packages. If no java_package_options is declared, files will be generate to the package in proto file.
    option java_package = "com.yoozoo.spring";
  • service name options