Document operation of GO basis
I. Basic API for file operation
func main() {
//Absolute path
fileInfo , err := os.Stat("E:/a.txt")
fileInfo , err = os.Stat("E:/")
if err !=nil {
fmt.Println("err:" , err.Error())
} else {
fmt.Printf("%T \n" , fileInfo)
fmt.Printf("%v \n" , fileInfo)
//file name
fmt.Print ...
Posted by kujtim on Fri, 15 Nov 2019 09:00:29 -0800
Go Gin source learning
Start
In the previous article, I learned the overall process of the Gin framework, but I looked at the research of the main process in the source code which was affected by many scattered and small functions. So I think I can imitate the Gin framework and write a demo with only the main process. We can learn more about the source code in the pr ...
Posted by onegative on Fri, 15 Nov 2019 07:47:11 -0800
The use of golang rabbitmq
golang can use the library github.com/streadway/amqp to operate rabbitmq
install
go get github.com/streadway/amqp
Connect
conn, err := amqp.Dial(amqp://guest:guest@172.17.84.205:5672/)
Establishing channels
ch, err := conn.Channel()
Statement Queue
q, err := ch.QueueDeclare(
"testqueue", //Queue name
true, //dura ...
Posted by black.horizons on Fri, 15 Nov 2019 06:12:49 -0800
Design cache scheme based on Repository
Compared with using a middleware to "brutally" cache interface response and improve interface query speed, Repository cache can better control cache granularity and update time Lu Xun.
Articles are updated in my Know about columns and Blog
scene
Tester-A: why is the getInfo interface so slow? 5+s? QPS is only 10!!!!
RD-B: This is bec ...
Posted by snapbackz on Thu, 14 Nov 2019 22:10:25 -0800
logrus: a log framework of go
summary
Logrus is a log system developed for go language. In this article, we will make a record of some problems encountered in the process of starting logrus. This record refers to This article . Let's start!
Upper hand
package main
import (
log "github.com/sirupsen/logrus"
)
func main() {
log.WithFields(log.Fields{
"animal": "wal ...
Posted by JamieinNH on Wed, 13 Nov 2019 09:44:26 -0800
[daily] gocron source reading - use go mod to manage and start gocron depending on source code
Starting from Go1.11, golang officially supports the new dependency management tool, go modgo mod download: download the dependent module s to the local cachego mod edit: edit go.modgo mod graph: print module dependency graphgo mod init: initialize go.mod in the current directory (that is, a new go.mod file will be created)Go module tidy: reorg ...
Posted by dineshthakur on Wed, 13 Nov 2019 06:44:41 -0800
Understanding of P in Blog.8 runtime
P is a concept introduced in Go1.1, initially equal to the number of CPU cores by default. P is just a logical concept and has nothing to do with CPU.
The notes to P in source code go/1.13.4/libexec/src/runtime/proc.go are as follows:
// P - processor, a resource that is required to execute Go code.
// M must have an associated P to execute Go ...
Posted by Nay on Tue, 12 Nov 2019 13:16:44 -0800
How to handle Promise errors gracefully
Pay attention to the front of the public, Chinese cabbage, more front-end small dry goods waiting for you! The public number will share the front-end technology from time to time, making progress every day and growing with everyone.
With the emergence of Promise, the majority of front-end developers have been successfully saved from the abyss o ...
Posted by shaitand on Tue, 12 Nov 2019 02:14:23 -0800
Deep analysis of source code for building native network model with go netpol I / O multiplexing
introduction
Go builds a simple and high-performance native network model (I/O multiplexing netpoll based on go) based on I/O multiplexing and goroutine, which provides a simple network programming mode such as goroutine per connection. In this mode, developers use the synchronous mode to write asynchronous logic, which greatly reduces the ment ...
Posted by robertvideo on Sat, 09 Nov 2019 07:14:14 -0800
Go in API routing middleware signature verification
overviewFirst, synchronize the following project overview:The last article shared the routing Middleware - Jaeger link tracking (actual combat). The response is really unexpected. The "Go China" public number has also been forwarded. Many friends have exchanged with my friends, calling me a big God. Actually, I am a big God, but I hav ...
Posted by bigwatercar on Sat, 09 Nov 2019 05:41:11 -0800