Tag:golang

  • Create optimized go image files and stepped pits

    Time:2020-1-21

    It is not difficult to create a go image file on docker, but the created file is very large, close to 1g, which is not convenient to use. One of the main problems of docker image is how to optimize and create a small image. We can create docker image files with multi-level construction method, […]

  • Etcd common operation introduction

    Time:2020-1-18

    install The easiest way to install is to download the pre compiled binary directly from the release page of etcd GitHub. Etcd officially provides different binary files for each system for developers to download according to their own system. Download address: https://github.com/etcd-io/et After the download and decompression, there are two binaries in the directory,etcdas well […]

  • On the principle of golang slice

    Time:2020-1-18

    Slice introduction The length of an array cannot be modified again after it has been defined; an array is a value type and each pass will produce a copy. Obviously, this data structure can not fully meet the real needs of developers. When we initially define an array, we don’t know how large it needs […]

  • Go sync.map implementation

    Time:2020-1-17

    Golang map is non goroutine security. If more than one goroutine uses map, it needs to be locked. However, in the high concurrency scenario, lock contention will cause the performance degradation of the system. To solve this problem, go 1.9 provides thread safety: sync.map. Sync.map introduces two data structures, read and dirty, to store data. […]

  • Addition, deletion and insertion of slices in golang slice operation

    Time:2020-1-17

    This paper introduces the addition, deletion and insertion of slices in the operation of golang slice, and shares the details as follows: 1、 General operation 1. Declare variable, go is automatically initialized to nil, length: 0, address: 0, nil func main(){ var ss []string; fmt.Printf(“length:%v \taddr:%p \tisnil:%v”,len(ss),ss, ss==nil) } — Running… length:0 addr:0x0 isnil:true Success: […]

  • Two minutes for you to understand how to inherit in go

    Time:2020-1-16

    Recently, when refactoring code, a large number of interfaces have been abstracted. We also use these abstract interfaces to do a lot of pseudo inheritance operations, which greatly reduces code redundancy and increases code readability. Then I searched the articles about go inheritance casually, and found that some articles have too much code, and the […]

  • Overview of net / RPC package in golang (summary)

    Time:2020-1-16

    RPC, or remote procedure call, is to call a service on a remote computer as if it were a local service.My project is based on restful microservice architecture. With the communication between microservices becoming more and more frequent, more and more system resources are consumed. So I hope that I can use RPC for internal […]

  • Time series database influxdb (I)

    Time:2020-1-15

    Related articles:Time series database influxdb (I)Time series database influxdb (2)Time series database influxdb (3)Time series database influxdb (4)Time series database influxdb (5)Time series database influxdb (6) There are many kinds of databases, such as traditional RDBMS (such as MySQL), NoSQL (such as mongodb), key value (such as redis), wide column (such as HBase) and so […]

  • Use AWS SQS as buffer queue (go)

    Time:2020-1-13

    background As a newcomer, the first task involved in the project is to add message queues for the storage of operation records. Why should we do this? The reasons are as follows: in the existing system, we directly add the user ‘s operation records to the mongodb database, but when the peak value of our […]

  • Go notes the ides of go

    Time:2020-1-13

    After a series of work, go language environment has been built. We also have a preliminary experience of most of the commands provided by go. But before the official development, there is still work to be done, that is, to choose an IDE that suits you. Why use IDE “Why programmers use ide”, in some […]

  • Depth analysis of interface interface in golang

    Time:2020-1-13

    I. interface introduction If gorountine and channel are the cornerstones to support the concurrency model of go language, and make go language become a beautiful landscape in the era of clustering and multi-core, then interface is the cornerstones of the whole type series of go language, making go language reach an unprecedented height in the […]

  • Time series database influxdb (2)

    Time:2020-1-12

    Related articles:Time series database influxdb (I)Time series database influxdb (2)Time series database influxdb (3)Time series database influxdb (4)Time series database influxdb (5)Time series database influxdb (6) RP Let’s review the RP policy, which consists of three parts: Duration: the retention time of data. Replication: the number of copies of data in cluster mode. Single node […]