#install _go
install version (v1.16.4 or above)
To find and download latest version available version go to official: https://go.dev/dl/
download file go with prefix ……linux-amd64.tar.gz
extract: sudo tar -xvf go1.19.linux-amd64.tar.gz
move file extact: sudo mv go /usr/local
GOROOT is the location where Go package is installed on your system:
export GOROOT=/usr/local/go
GOPATH is the location of your work directory. For example my project directory is ~/go
export GOPATH=$HOME/go
Now set the PATH variable to access go binary system wide:
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
detail $PATH
#install_protoc
install version (v3.17.3 or above)
download binary from https://github.com/protocolbuffers/protobuf/releases/tag/v3.17.3
extract file download, sudo unzip protoc-3.17.3-linux-x86_64.zip
masuk ke folder extract
pindah file hasil extract ke path yang sudah diarahkan, kita bisa check dengan cara
which protoc
usr/local/bin/protocmove to this directory, sudo cp protoc /usr/local/bin/protoc
check version protoc: protoc —version
#issue_protoc
2023/02/21 09:56:19 protoc-gen-go: error:inconsistent package import paths: "google.golang.org/genproto/googleapis/api/annotations", "google.golang.org/genproto/googleapis/api/httpbody" 2023/02/21 09:56:19 protoc-gen-go: error:inconsistent package import paths: "google.golang.org/protobuf/types/known/anypb", "google.golang.org/protobuf/types/descriptorpb" Failure: plugin go: exit status 1; context canceled; exit status 1; context canceled; signal: killed; signal: killed; signal: killed; context canceled
- This issue is because the system has protobuf-compiler installed, it must be removed first
sudo apt remove protobuf-compiler
#install_buf
install version (recommended 1.4.0)
create file name_file.sh and enter the following data:
BIN="/usr/local/bin" && \ VERSION="1.4.0" && \ curl -sSL \ "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" \ -o "${BIN}/buf" && \ chmod +x "${BIN}/buf"
run: sudo sh name_file.sh
reference: https://docs.buf.build/installation
#install_mockery
install version (v2.10.6 or above)
go install github.com/vektra/mockery/v2@v2.20.0
reference: https://vektra.github.io/mockery/installation/
