Home  >  Article  >  Backend Development  >  Go commands to install various third-party libraries and packages

Go commands to install various third-party libraries and packages

尚
forward
2019-11-29 14:53:174718browse

Go commands to install various third-party libraries and packages

The installation file of Go language contains some packages that can be used directly, namely the standard library. The go language also has many excellent third-party libraries. Let’s take a look at the commands for installing third-party libraries and packages.

Install the Mysql package

In the go command line go get github.com/go-sql-driver/mysql

Install the goconfig package

In the go command line, go get github.com/Unknwon/goconfig

Install the Protocol buffer package

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

Install Redis package

go get github.com /garyburd/redigo/redis

glog package

go get github.com/golang/glog

context

mkdir -p $GOPATH/src/golang.org/x/net

git clone https://github.com/golang/net $GOPATH/src/golang.org/x/net

Download the release version directly on Windows, protoc-3.3.0-win32.zip:

https://github.com/google/protobuf/releases/tag /v3.3.0

Download the compressed package and decompress it, then configure the bin directory with environment variables, enter protoc –version on the command line to see if it is installed correctly

It is recommended to create a new directory specifically Put the protocol file

package example; 
message HelloWorld 
{ 
    required int32     id = 1;  // ID 
    required string    str = 2;  // str 
    optional int32     opt = 3;  //optional field 
}

Command line input

protoc --go_out=. ./example/test.proto

For more go language knowledge, please pay attention to the go language tutorial column.

The above is the detailed content of Go commands to install various third-party libraries and packages. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete