'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 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Artur