Search code examples
goprotocol-buffersproto

Error go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf" module instead


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


Solution

  • 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 be 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