Read configuration files using Go
brief introduction
Read the configuration using viper
Creating command-line tools using Cobra
Thermal overload
summary
The current part of the code
brief introduction
In the last practice, a basic restful api server was launched.
There were many hard-coded attributes in the code at that time, so this time we would try to read them from the co ...
Posted by Sealr0x on Thu, 12 Sep 2019 04:06:25 -0700
Message Queue Source Code Interpretation of NSQ Landing Disk
The original address of this article https://blog.lpflpf.cn/passages/nsqd-study-2/
NSQ message queue implements message landing using FIFO queue.The implementation is diskqueue, using the package github.com/nsqio/go-diskqueue. This paper mainly introduces the implementation of diskqueue.The code in this article comes from github.com/nsqio/go-di ...
Posted by bukuru on Tue, 10 Sep 2019 20:38:40 -0700
Construction of Go 1.13 Private Agent Service
Original address: Construction of Go 1.13 Private Agent Service.
Setting GOPROXY can only specify one proxy service address prior to the release of Go version 1.13.After entering Go 1.13, GOPROXY supports multi-proxy settings, which can be separated.The following:
export GOPROXY=https://proxy.golang.org,direct
According to the official document ...
Posted by webpoet on Mon, 09 Sep 2019 18:23:23 -0700
How does Go implement protobuf encoding and decoding: source code
Links to the original text: https://mp.weixin.qq.com/s/oY...
This is a companion article to analyze how Go implements protobuf encoding and decoding:
How to Realize the Coding and Decoding of protobuf by Go (1): Principle
How Go implements protobuf encoding and decoding (2): source code
This edition is the second one.
Preface
Last article Ho ...
Posted by adt2007 on Mon, 09 Sep 2019 06:27:51 -0700
Deeply Understanding the Principle of Go-sync.Map
Map is like a Go map[interface{}]interface{} but is safe for concurrent useby multiple goroutines without additional locking or coordination.
Loads, stores, and deletes run in amortized constant time.
The above paragraph is the official description of sync.Map. From the description, sync.Map is very similar to map. The underlying implementatio ...
Posted by xardas on Sun, 08 Sep 2019 04:04:54 -0700
[Series] go-gin-api planning catalogue and parameter verification
Catalog
Summary
Planning catalogue structure
Model binding and validation
Custom Verifier
Develop API return structure
Source address
go-gin-api series of articles
Summary
Firstly, the project overview is synchronized:
As we shared in the last article, we used go mod ...
Posted by WhiteHawksan on Tue, 27 Aug 2019 22:45:58 -0700
Summary of go concurrent programming
1. Concurrent using sync:
package main
import (
"fmt"
"sync"
)
func main() {
testSlice := []string{"test1", "test2", "test3"}
wg := sync.WaitGroup{}
for _, t := range testSlice {
wg.Add(1)
go printSlice(t, &wg)
}
wg.Wait()
}
func printSlice(s string, wg * ...
Posted by kendhal on Sun, 18 Aug 2019 07:27:04 -0700
Goldang-nsq Series--First Understanding
nsq is a simple and easy-to-use distributed message middleware originally developed by bitly company. It can be used for real-time message service in large-scale systems and can process hundreds of millions of messages every day.
It has the following characteristics:
Distributed. It provides a distributed, decentralized and single-point fault- ...
Posted by wheeler08 on Sun, 18 Aug 2019 06:16:24 -0700
Channel Summary of Go Learning
Channel is a core type of Go, and you can think of it as a pipeline through which data can be sent or received to communicate through concurrent core units.
type
T represents an arbitrary type
Two-way: chan T
One-way only send:chan<-
One-way acceptance only: <-chan
One-way channel s can be created not only by declaring make (chan < - ...
Posted by patriklko on Thu, 15 Aug 2019 06:48:45 -0700
Go debugging tool: gdb vs dlv
Although the GoLand editor is very powerful, it is still relatively weak in displaying memory and stack information. Maybe my posture is wrong. So, I started to debug the gdb, but the GDB stepped into the pit and did not solve it, which triggered the comparison between GDB and dlv.
gdb
install
yum install ncures-devel
wget http://ftp.gnu.org/gn ...
Posted by el_quijote on Thu, 15 Aug 2019 06:45:26 -0700