Go Language Combat skills (3)

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

1. Go command (build, install, test, quick skip)

2. CGO (call C code)

Import "C" before storing the annotated C code. Refer to https://golang.org/cmd/cgo/for details. Use the CGO command to add c compile options, such as//#cgo ldflags:-l/go/src/foo/libs-lfoo.

3. Vendor (Vendor directory)

The third-party libraries used by the project are placed in the vendor directory to prevent conflicts between different versions of the project. Solve multi-project multi-version conflicts of third-party libraries. Does not address third-party library versioning and automatic update issues, using the Govendor library.

4. configuration file (JSON config)


Configuration file definition

Configuration files, such as server.conf:


JSON configuration file

When used:


Parsing the configuration file

5. Log library (Seelog)

Third-party library Seelog: Support synchronous/asynchronous (Get frequency: loop, timing, adaptive), support rich output level, format, terminal and color, support file filtering of different level log, support log file rollback, support dynamic update logger settings.

Implements the custom format Log:runtime. Caller (1) Returns the full file pathname and line number where the calling function is located, and adds a prefix log. Setprefix (); Os. Getpid () Get PID and so on.

6. Web Framework (Beego, Iris,martini, etc.)

Beego uses mvc+orm+restful, complete components, easy to use, suitable for simple small and medium Web server, the framework is bloated, performance is not high.

MVC: The main web interface, not a small talk. M:model, data Model, general Mapping database table; V:view, view, generally generated by template, placeholder on the page, back-end code only need to fill data to placeholder, C:controller, controller, connect page View and backend database Model, Implement the control logic.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.