To avoid getting errors when calling make proto-gen, some commands must be run before.
First step is to modify your scripts/protocgen.sh file, setting the correct path to copy your files. The path is set in the .proto file using the option go_package.
For example, if your project is called test, your protocgen.sh file should look like this:
# move proto files to the right places
cp -r github.com/username/test/* ./
rm -rf github.com
Shell
Now that we have our script correctly configured, let’s install the proto dependencies in our system:
make tools
make proto-update-deps
Shell
Now we can run the make proto-gen command without errors.
Possible errors:
When running make tools if npm owner is root it will fail:
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
Shell
Change the npm ownership to fix this problem:
sudo chown -R whoami ~/.npm
sudo chown -R whoami /usr/local/lib/node_modules
Shell
When running make proto-gen docker throws permissions errors, to fix this run this lines:
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp dockersudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
sudo chmod 666 /var/run/docker.sock
sudo systemctl restart docker
su ${USER}
Shell