Category:Golang

  • Quickly build a web application (primary demo) with go + vue.js

    Time:2020-1-21

    As one of the most popular front-end libraries, vue.js has a new thinking mode for rapid construction and development of front-end projects. This article introduces how to build a web application (primary demo) quickly with go + vue.js. Environmental preparation: 1. Install go language and configure go development environment; 2. Install node.js and NPM environment; […]

  • Kubernetes garbage collector source code analysis (1)

    Time:2020-1-19

    Kubernetes version: 1.13.2 background Because of the redis cluster created by the operator, the redis cluster is deleted abnormally (including the redis exporter statefullset and redis statefullset) after the kubernetes APIs server is restarted. After deletion, the operator rebuilds and reorganizes the cluster, and the instance IP changes (middleware containerization, we developed fixed IP, when […]

  • 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 […]

  • 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: […]

  • Go – cycle

    Time:2020-1-16

    Catalog Summary Cyclic array Cyclic slice Cyclic map break continue goto switch Recommended reading Summary The previous articles shared array array, slice slice and map set. This article shared how to get the elements in the loop, and also reviewed the previous articles. The keywords used in this article are for, range, break, continue, goto, […]

  • 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 […]

  • Go basic programming practice (10) – Database

    Time:2020-1-15

    Read data from database Download SQLite3 visualizer at http://sqlitebrowser.org/ and create it in the same directory as main.gopersonal.dbDatabase, create the table as follows: package main import ( “database/sql” “fmt” _ “github.com/mattn/go-sqlite3” ) //Using struct type to map data from SQL database to objects in memory type Profile struct { ProfileId int FirstName string LastName string […]

  • An example of RPC remote call in go language net package

    Time:2020-1-15

    The RPC package provides a method to enter the external method of an object through a network or other I / O connection. A server registers an object and marks it as a service with a visible object type name. Once registered, the object’s external methods can be called remotely. A server can register multiple […]

  • Notes on the use of golang assignment and declaration syntax sugar

    Time:2020-1-14

    Assignment and declaration syntax sugar Basic strategy, just search Matters needing attention Type inference :=Type inference will be performed automatically. Type conversion is required when the desired type is not the one you want //I1 defaults to int type i1 := 1 //When you need to use I2 as Int64, you need to perform type […]

  • On the concurrency mechanism of go language

    Time:2020-1-14

    A big advantage of go language over Java is that it can write concurrent programs conveniently. Goroutine mechanism is built in go language. Using goroutine, concurrent programs can be developed quickly and multi-core processor resources can be better utilized. This paper studies the application and scheduling implementation of goroutine. 1、 Go language’s support for concurrency […]

  • Go – function

    Time:2020-1-13

    Catalog Summary Function definition pass by value Citation transfer MD5 Get current time string Get current timestamp Generate signature Recommended reading Summary After learning some basic grammar, I began to learn how to write functions and share several functions I wrote. MD5 Get current timestamp Get current time string Generate signature Function definition func function_name(input1 […]

  • 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 […]