Some exercises for beginner go (topic source: Microsoft Learning)

Write FizzBuzz program First, write a program for outputting numbers (1 to 100), with the following changes: If the number can be divided by 3, Fizz is output.If the number can be divided by 5, Buzz is output.If the number can be divided by 3 and 5 at the same time, FizzBuzz is output.If the previous conditions are not met, the number is outp ...

Posted by neville on Sun, 03 Apr 2022 11:06:27 +0300

I want to learn the Go language secretly and surprise everyone (the third day)

The title is no offense, but I think this advertisement is very interesting Take the mind map above if you like catalogue Basic program structure The well-known basic program structures are sequence, branch and loop. The sequence will not be repeated. Next, we will explain the basic common writing and common patterns of branches ...

Posted by zeeshan_haider000 on Sun, 03 Apr 2022 01:24:27 +0300

1091 calculates the shortest path length from the origin to a specific point in the grid

subject Give you a binary matrix grid of n x n, and return the length of the shortest unblocked path in the matrix. If no such path exists, - 1 is returned. The unblocked path in the binary matrix is a path from the upper left cell (i.e., (0,0)) to the lower right cell (i.e., (n - 1, n - 1)), which meets the following requirements at the sa ...

Posted by outatime88 on Sat, 02 Apr 2022 17:05:51 +0300

Eighteen postures for constructing Go application docker image

Cultivation background I worked overtime day and night to develop the simplest Go Hello world application. Although I just quit after printing, my boss also asked me to go online, the only application I can write. The project structure is as follows: . ├── go.mod └── hello.go hello.go code is as follows: package main func main() { printl ...

Posted by patrickng on Fri, 01 Apr 2022 05:07:34 +0300

Go xmas2020 English course 00-03 learning notes

Course address go-class-slides/xmas-2020 at trunk · matt4biz/go-class-slides (github.com) Keynote teacher Matt Holiday 00-02-Hello Example directory structure L:. │ main.go │ └───hello hello.go hello_test.go main.go is the main program entry hello.go is the Hello module hello_test.go is used to unit test Hello module Diffe ...

Posted by andylyon87 on Fri, 01 Apr 2022 03:32:04 +0300

go-based network programming

TCP Protocol TCP/IP(Transmission Control Protocol/Internet Protocol), a transport control protocol/inter-network protocol, is a connection-oriented, reliable, byte-stream-based Transport layer communication protocol. Because it is a connection-oriented protocol, data travels like water and there is sticky packet problem. TCP Server A TCP serve ...

Posted by joebWI on Thu, 31 Mar 2022 20:26:40 +0300

go language gin framework route splitting and registration

gin framework route splitting and registration April 16, 2020 | Golang's article has been read 9334 times in total This paper summarizes some methods of route splitting and registration of gin framework that I have accumulated in my projects. gin framework route splitting and registration Basic route registration The following basic gin route ...

Posted by beebum on Thu, 31 Mar 2022 09:58:27 +0300

go performance test Benchmark

Transferred from: https://my.oschina.net/solate/blog/3034188 For personal backup only, please see the original text   catalogue Benchmark test Writing benchmarks Performance comparison Combined with pprof Flame diagram Testing flags Testing attention and tuning Benchmark test Benchmarking is mainly to evaluate the performance of th ...

Posted by Omzy on Thu, 31 Mar 2022 09:19:47 +0300

golang gin backend development framework

1. hello world First, pull the gin development framework go get -u github.com/gin-gonic/gin   Let's start with hello world and see how gin builds an http server package main import "github.com/gin-gonic/gin" func main() { engine := gin.Default() engine.GET("/ping", func(ctx *gin.Context) { ctx.JSON(200, gin.H{ ...

Posted by pedrolopes10 on Wed, 30 Mar 2022 10:14:23 +0300

Take you ten days to easily handle the Go micro service series

prefaceWe will show you a go zero micro service example in detail through a series of articles. The whole series is divided into ten articles, and the directory structure is as follows:Environment constructionService splittingUser servicesProducts and services (this article)Order servicePayment servicesRPC service Auth authenticationService mon ...

Posted by sabien on Wed, 30 Mar 2022 04:45:09 +0300