Please don't use the pprint printing dictionary anymore

WeChat official account: Python programming time Online blog address: http://python.iswbm.com/en/latest/c02/c02_14.html 1. make complaints about problems You should be familiar with pprint in Python, right? Most people will recommend you to use this product when you search on search engines about how to print beautiful dictionaries or form ...

Posted by hostfreak on Fri, 08 May 2020 18:16:20 -0700

Exploring the functions of Go type parameters

In go language, the definition of a function can be different from the caller of the function. In other words, the lack of runtime type security allows parameters at the call end of a function to be inconsistent with those at the definition end of the function. Go does not support the polymorphic nature of functions, wh ...

Posted by proctk on Tue, 05 May 2020 11:04:33 -0700

Go Language (18) context & Log Items

Context&log items context Method to cancel goroutine in general scenarios var wg sync.WaitGroup var exit bool func worker(exitChan chan struct{}) { LOOP: for { fmt.Printf("work\n") time.Sleep(time.Second) /*if exit { break } */ select { case <- exitChan: break LOOP ...

Posted by loopykd on Mon, 04 May 2020 16:40:51 -0700

Principle and Practice of Golang Context

Let's learn how to use the golang Context and how to implement it in the Standard Library. The golang context package started as a Golang package used internally by Google and was officially introduced into the Standard Library in Golang version 1.7.Start learning below. Brief introduction Before learning about context packages, look at several ...

Posted by varsha on Mon, 04 May 2020 11:07:21 -0700

Go language -- detailed explanation of slice

Go language -- detailed explanation of slice Blog description The information involved in this article comes from Internet collation and personal summary, which means personal learning and experience summary. If there is any infringement, please contact me to delete, thank you! Explain Go language slicing is an abstraction of arrays. The leng ...

Posted by adamjones on Wed, 29 Apr 2020 09:14:34 -0700

golang Gin framework with websocket

Summary golang websocket Library Example back-end Front end conclusion Summary For the web development of golang, I have written two blog s before, which respectively introduced: Under the Gin framework, various http API development methods (including file upload, download, etc.) golang Web solution Use of reverse proxy in the Gin fram ...

Posted by EchoFool on Thu, 16 Apr 2020 09:05:42 -0700

Basic operation of documents

Read entire file Reading the entire file into memory is one of the most basic file operations. This requires the ReadFile function in the ioutil package. package main import ( "flag" "fmt" "io/ioutil" ) func main() { fptr := flag.String("path", "test.txt", "Path to the file to be read") flag.Parse() data, err := ioutil.ReadFile(*fpt ...

Posted by dannymc1983 on Thu, 09 Apr 2020 10:21:26 -0700

go language project customer information relationship system

The best way to learn a language is through a practical example. Through this example, not only can we further consolidate the basic skills of golang, but also can let us strengthen our logic ability, call functions step by step, and master the skills of parameter passing and receiving. Item 2 - customer information relationship system This pro ...

Posted by JamesU2002 on Thu, 09 Apr 2020 05:48:36 -0700

Gin framework series 02: routing and parameters

review In the previous section, we used the Gin framework to quickly build an interface for GET requests. Today, we will learn how to GET routes and parameters. Request verb Students who are familiar with RESTful should know that RESTful is a design style and development mode of network applications. Each URI represents a resource. The client u ...

Posted by endurox on Wed, 08 Apr 2020 00:54:57 -0700

email of Go Language Library Series

Guide reading Hello, I'm pingye. Today I'd like to introduce a Go language library email for sending emails. At present, the star is 1.3k, which is very easy to use. Speed up Preparation Initialize project go get github.com/jordan-wright/email Project structure of this example . ├── go.mod ├── go.sum └── main.go To start the SMTP service of e ...

Posted by Ayon on Sun, 05 Apr 2020 22:05:15 -0700