go Command Line Parses flag Package View Command Source via Subcommand

Last article Describes how to extend a new type of support in flag.This article describes how to use flag to implement subcommands. Overall, this is the core of this series. The first two articles are just padding. The first two articles are linked as follows: A quick way to parse flag packages from the Go command line New Extended Type for Go ...

Posted by kevinc on Sun, 08 Dec 2019 03:30:21 +0100

Chinese processing of golang calling windows API

Go language has a strong momentum of development, but there are also many disadvantages. Fortunately, there are many fans who provide numerous libraries, which show their advantages too well. They can use whatever they do, basically ignore the pointer, and the performance is good. Recently, there is a problem in using Chinese under windows. Th ...

Posted by broc7 on Sat, 07 Dec 2019 08:56:20 +0100

Practical production environment: 1.13.3 latest k8s cluster deployment Heapster plug-in

This article, any image and yaml I use will send a link to the online disk for you to download and learn!Links: https://pan.baidu.com/s/1inmW... Password: 92uagithub: https://github.com/heyangguangYou can contact me directly if you have any questions: heyangev@cn.ibm.com Heapster is a collector that summarizes the data of C advisor on each Nod ...

Posted by nawal on Wed, 04 Dec 2019 03:18:54 +0100

Go learning note 04 function

Catalog Function definition Example of function Summary Function definition Function definitions are similar to variable definitions, func function_name(var1, var2, var3, ...) (return_type1, return_type1, ...) { //function body } Example of function package main import ( "fmt" "math" ...

Posted by Gath on Tue, 03 Dec 2019 15:48:39 +0100

GORM associated query

A User and Company are defined. Users can contain multiple companies, as follows: type User struct { ID int `gorm:"TYPE:int(11);NOT NULL;PRIMARY_KEY;INDEX"` Name string `gorm:"TYPE: VARCHAR(255); DEFAULT:'';INDEX"` Companies []Company `gorm:"FOREIGNKEY:UserId;ASSOCIATION_FOREIGNKEY:ID"` Cr ...

Posted by Teh Unseen on Mon, 02 Dec 2019 21:01:14 +0100

When golang compiles, it assigns values to variables in the package to print version number and commit

Many command-line programs can output version information, commit, operating system and other information through the version parameter. Here is a method to print the version number of the command line program compiled by golang. Version information printed by docker: $ ~ docker version Client: Docker Engine - Community Version: 18.0 ...

Posted by MitchEvans on Fri, 29 Nov 2019 17:15:07 +0100

Goroutine synchronization / channel, mutex, read / write lock, deadlock / condition variable

1. Goroutine synchronization [data synchronization] Why goroutine synchronization is needed The concept of gorotine synchronization and several ways of synchronization 1.1 why goroutine synchronization is needed package main import ( "fmt" "sync" ) var A = 10 var wg = sync.WaitGroup{} func Add(){ defer wg.Don ...

Posted by stormcloud on Wed, 27 Nov 2019 10:48:41 +0100

golang network programming Middleware

golang_real.jpg Share beforeGorang network programming (5) middleware By learning to write two interceptors by ourselves, output log and simple permission verification. This is what we usually do in middleware. In fact, many times we don't need to do too much by ourselves. Do we still need to grow, bake and grind if we want t ...

Posted by S_henry on Sat, 23 Nov 2019 19:07:21 +0100

Go golang-nsq Series--nsqlookupd Source Parsing

Previous Introduces the code logic and flow chart of nsqd. This paper parses another module nsqlookupd in nsq, which is responsible for maintaining the topology information of nsqd nodes, and achieves the service registration and discovery of de-centralization. 1. nsqlookupd Execution Entry Execution entry files can be found in nsq/apps/nsqlook ...

Posted by Lee on Sat, 23 Nov 2019 14:05:58 +0100

Go language strings package

Catalog The strings package implements simple functions for manipulating characters. func EqualFold Determine whether the two utf-8 encoding strings (unicode uppercase, lowercase, and title characters are regarded as the same) are the same. func EqualFold(s, t string) bool Example: func main() { str1 := "Golang" ...

Posted by lm_a_dope on Thu, 21 Nov 2019 23:03:45 +0100