Official tutorial: Go fuzzing fuzzy test

prefaceGo 1.18 introduces fuzzy testing in the go tool chain, which can help us find bugs in the go code or inputs that may cause program crash. The official go team has also released an introductory tutorial on fuzzing on the official website to help you get started quickly.On the basis of translation, I have optimized the expression of the of ...

Posted by spighita on Sat, 06 Aug 2022 21:24:47 +0300

Write, append, read, and copy of golang files: examples of using bufio packages

Write, append, read and copy operations of golang files There is an OpenFile function under the os package of the Go language. Its prototype is as follows: func OpenFile(name string, flag int, perm FileMode) (file *File, err error) Where name is the file name of the file. If you are not running under the current path, you need to add the spe ...

Posted by teddmcload on Thu, 30 Jun 2022 16:56:27 +0300

Go language | Are you still getting the file size like this?

In a project, we may need to get the size of a file. In Golang (Go language), there are many ways to get the size of a file to see if you are still using the slowest way. Read byte method The first one is the most intuitive to think of, which is to open the file and read the file again. func main() { file,err:=os.Open("water") if err = ...

Posted by imagenesis on Wed, 25 May 2022 23:51:37 +0300

Still processing JSON with map[string]interface {}? Tell you a more efficient method - jsonvalue

This article introduces jsonvalue Library , this is the first multi-functional and comprehensive Go library I developed on Github. At present, it is mainly used in the development of Tencent's future community to replace map[string]interface {}. Why develop this library? Go is a cutting edge in background development. Go engineers will come int ...

Posted by Darhazer on Tue, 24 May 2022 15:58:27 +0300

go micro server startup analysis

Based on go micro version 2.9.1, Example code: example/greeter, git commit:3b3de68cded8879ca3dde5d81192f2881619aabd The core of a microservice server has only three steps service := micro.NewService() service.Init() service.Run() First look at micro NewService() service := micro.NewService( micro.Name("greeter"), micro.Version("latest") ...

Posted by akimm on Tue, 24 May 2022 10:36:22 +0300

Go language programming viper configuration management tool

catalogue Viper Viper is a third-party library of Golang, Github: https://github.com/spf13/viper . It is used to process the configuration information of Golang program. It can process configuration files in various formats. Viper supports the following features: Set default values for configuration items. Load and parse configuration files ...

Posted by tlenker09 on Mon, 23 May 2022 09:39:54 +0300

Error handling in Go multi process concurrent environment

introduction In Go language, we usually use panic and recover to throw and catch errors. This pair of operations has no problem in a single coprocess, but in a multi coprocess, imagine the following two problems. Suppose we now have two processes: If there is A panic in process A, will process B die because of the panic in process A? If A pani ...

Posted by SUNNY ARSLAN on Sat, 21 May 2022 18:14:01 +0300

Eighteen postures for constructing Go application docker image

Cultivation backgroundI 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.gohello.go code is as follows:package main func main() { println("hell ...

Posted by Jeller on Fri, 20 May 2022 05:47:20 +0300

Golang Time Operation & JSON Serialization and Deserialization

Time operation Time Package Get the current time t := time.Now() fmt.Printf("%T\n", t) //time.Time fmt.Println(t) //2019-07-08 15:23:55.1114609 +0800 DST m=+0.000192401 Gets the specified time t := time.Date(2009, 7, 15, 16, 30, 28, 0, time.Local) fmt.Println(t) //2009-07-15 16:30:28 +0800 DST ...

Posted by dr_overload on Thu, 19 May 2022 20:50:19 +0300

LeetCode algorithm path array part 1

LeetCode algorithm Most bogey, hope to do a series of articles to record the process of brushing algorithm. At present, it is mainly based on LeetCode https://leetcode-cn.com/circle/article/48kq9d/ The module of this post will brush the questions. The content is mainly the summary of the landlord in the post, as well as some personal experience ...

Posted by shak123 on Thu, 19 May 2022 20:46:21 +0300