Go commands to install various third-party libraries and packages

Release: 2019-11-29 14:53:17
forward
4723 people have browsed it

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 
}
Copy after login

Command line input

protoc --go_out=. ./example/test.proto
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template