Golang feature summary and common library development

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

1 Golang Self-development Project Introduction Package

You need to create a project under $GOPATH/SRC, such as interactive, to introduce your own package such as import interactive/notify

2nd Log Library

Beego/logs


3 Golang Development FAQs

3.1 Current working directory for file paths and commands

The file relative path is for the current working directory of the Golang process, the unit test is in a different directory, so the relative working directory of the unit test is not the same, how to ensure the validity of the file path?


4 Golang relationship between the blocking and kernel threads

In addition to the number of threads used by the Golang process (using the Gomaxprocs parameter control), there are additional threads. When the process is blocked in a system call, additional threads are generated and consumed, and these threads do not include gomaxprocs threads that are occupied by the coprocessor.

When the process is blocked in the following system calls will not generate or occupy additional threads, when Ctrip will be swapped out, the co-scheduler will execute other operating Ctrip. Such as

* Socket IO

* Sleeping

* Channel Operations

* Blocking on primitives in the SYSNC package.

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.