[daily] Go language Bible -- JSON exercise 2

Exercise 4.12: the popular web comic service xkcd also provides a JSON interface. For example, an https://xkcd.com/571/info.0.json request will return a detailed description of the 571 number that many people love. Download each link (only once) and create an offline index. Write an xkcd tool that uses these offline indexes to print the URL ...

Posted by vigour on Wed, 01 Apr 2020 07:44:17 -0700

Implementing Http server in Golang and parsing header parameters and form parameters

In HTTP service, header parameters and form parameters are often used. This article is mainly to practice how to parse the parameters and form parameters in the header of HTTP request in Go language. The specific code is as follows: package server import ( "net/http" "strconv" "fmt" ) func HttpStart(port int) { http.HandleFunc(" ...

Posted by KCAstroTech on Wed, 01 Apr 2020 05:54:39 -0700

[daily] Go language Bible -- example: concurrent Clock service exercises

Exercise 8.1: modify clock2 to support the incoming parameter as the port number, and then write a clockwall program. This program can communicate with multiple clock servers at the same time, read the time from multiple servers, and display the results of all services in one table, similar to the clock wall you see in some offices. If you have ...

Posted by jb60606 on Mon, 30 Mar 2020 11:47:23 -0700

Methods in Go language

1.1 method statement The declaration of the method is similar to that of a normal function, except that a parameter is added before the function name. This parameter binds this method to the type corresponding to this parameter import ( "fmt" ) type Point struct { x, y int } func fun() { ...

Posted by ngoweb on Sat, 28 Mar 2020 09:22:16 -0700

Go language introduction structure & Practice

Structure & Practice structural morphology Definition The object-oriented in Go is realized by struct, which is a user-defined type //Define structure /Define structure type User struct { Name string Gender string Age int AvatarUrl string } func useStruct() { //Initialize structure 1 var user1 User u ...

Posted by godwisam on Thu, 26 Mar 2020 09:09:21 -0700

Go golang Quick Start [8.3] - Deep understanding of IEEE754 floating point numbers

Previous Introduction to Goang Quick Start [1]-go Language golang Quick Start [2.1]-go Language Development Environment Configuration-windows golang Quick Start [2.2]-go Language Development Environment Configuration-macOS golang Quick Start [2.3]-go Language Development Environment Configuration-linux golang Quick Start [3]-go helloworld How ...

Posted by gvp16 on Tue, 24 Mar 2020 11:12:45 -0700

Source Interpretation of Golang's sync.Map Implementation Principle

brief introduction Gos built-in maps do not support concurrent write operations, because map write operations are not concurrently secure. When you try multiple Goroutine operations on the same map, an error occurs: fatal error: concurrent map writes. So sync.Map has been officially introduced to accommodate concurrent programming applications. ...

Posted by skeener on Sun, 22 Mar 2020 22:56:00 -0700

Message Queue NSQ with You to Get Started

I've seen NSQ before and haven't seen it yet.Just when I have time today, I set up a simple try to get the message queue NSQ in this Go Language, which I'll briefly record here. In fact, NSQ is used relatively little in China. I think I know such a thing here. Just look at the source code a little and learn something. Introduction to NSQ NSQ i ...

Posted by CentralOGN on Sun, 22 Mar 2020 10:30:03 -0700

json operation for Golang

JavaScript Object Representation (JSON) is a standard Protocol for sending and receiving structured information.JSON is not the only standard Protocol among similar protocols.XML (7.14), ASN.1, and Google's Proocol Buffers are similar protocols and have their own features, but JSON is the most widely used because of its simplicity, readability ...

Posted by GregArtemides on Sun, 22 Mar 2020 00:00:01 -0700

Quick start to golang [8.2] - Secrets of automatic type inference

Preceding text Quick introduction to golang [1] - Introduction to go golang quick start [2.1]-go language development environment configuration windows golang quick start [2.2]-go language development environment configuration - macOS golang quick start [2.3]-go language development environment configuration linux Get started with golang [3]- ...

Posted by KILOGRAM on Sat, 21 Mar 2020 08:26:47 -0700