Home > Net >  Error go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf&
Error go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf&

Time:02-16

I am facing an error after generating the code in golang from .proto file

enter image description here

I tried this line after searching in stackoverflow :

go get -u github.com/golang/protobuf/protoc-gen-go

and I get :

enter image description here

CodePudding user response:

found it it was a setup issue in the ~/.bashrc file I didn't specify exactly the GOROOT & GOPATH here's the steps to follow

on your command line

nano ~/bashrc

then add this lines to the file

export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

export GOPATH=/home/user/golib
export PATH=$PATH:$GOPATH/bin
export GOPATH=$GOPATH:/home/user/code

save it by clicking ctrl^X

all the dependencies will added as I did understand to the golib folder

then logout your session

by the way I followed the instructions from freecodecamp video on YouTube

CodePudding user response:

I think you should run

go install google.golang.org/protobuf/cmd

and generate your code using it.

P.S. after installation the binary will be put to $GOPATH/bin

  • Related