Here is a record of Go language-related content worth sharing every week, released on Sunday. This week's journal is open source (GitHub: polaris1119/golangweekly [1] ). Contributions are welcome. Recommend or self-recommended articles/software/resources, etc. Please submit issue [2] .

In view of the fact that some people may not be able to insist on reading the English articles, the weekly will recommend high-quality Chinese articles as much as possible. Excellent English articles, translated by our GCTT organization.

Since the WeChat official account does not support external links, a large number of links in the article can be viewed through " Read the original text " at the end of the article .

picture

Title map: GoLand 2022.3 Roadmap

first sentence

Let’s look at last week’s topic first. What does the following code output?

package main

import "fmt"

func main() {
 a := []int{789}
 fmt.Println(a[real(2)])
}

A: 0; B: 7; C: 9; D: cannot compile

Correct Answer: C. The correct rate was 42%, and nearly half of them chose D.

Simple analysis.

real is a built-in function, although the return type is FloatType, but here it returns a constant (see the Go specification [3] ). Here to remind everyone, not the index of the slice can be of type float. The following situations are compilation errors:

// 以下编译错误:invalid argument: index b (variable of type float32) must be integer
var b float32 = 2
fmt.Println(a[b])

// 以下编译错误:invalid argument: index real(b) (value of type float32) must be integer
var b complex64 = 2
fmt.Println(a[real(b)])

This issue is a topic about context. What does the following code output?

package main

import (
 "context"
 "fmt"
)

func main() {
 ctx, _ := context.WithTimeout(context.Background(), 0)
 <-ctx.Done()
 fmt.Println("timed out")
}

News

1. Go1.19 was released as scheduled

Five months after the release of Go1.18, Go1.19 was released on schedule.

2. Yaegi 0.14.0 released [4]

An elegant Go interpreter. Can be used for scripting, interactive shell or rapid prototyping in other applications. You can use it as a REPL or embed it in your own application.

3. Progressbar 3.9 released [5]

A very basic thread-safe progress bar for Golang applications.

4. Muffet 2.6 released [6]

A fast website link checker implemented in Go.

5. Add a standard iterator interface [7]

Many languages ​​have this capability, and this issue discusses adding an iterator to Go.

6. GoLand 2022.3 Roadmap [8]

Introducing the next version of GoLand.

article

1. Regarding Go concurrent programming, you have to know the "right-hand man" - concurrency and channels!

This article mainly introduces the implementation of Goroutine and channel.

2. After 7 years, I found that implementing CockroachDB in Go was the right choice

Share the experience of the CockroachDB team using Go.

3. Practical exploration of functional programming under Go generics

Explore the strengths and weaknesses of Go generics by trying to implement some common functional features step-by-step with Go's generics.

4. 2022 Go ecosystem rpc framework Benchmark [9]

When actually using the microservice framework, most of the performance bottlenecks lie in the business code, not the framework itself, so it is also very important to focus on optimizing the business code.

open source project

1. maths [10]

Math functions not included in the standard library math package.

2. dig [11]

A reflection-based dependency injection toolkit.

3. nano [12]

A private cloud IaaS platform fully implemented in Go. Recommended by the author.

4. go-cryptobin [13]

Go commonly used encryption and decryption library. Recommended by the author.

5. dbpack [14]

A database agent, the goal is to solve the distributed transaction problems encountered in business development, and provide solutions for separation of read and write, database and table division.

Resources && Tools

1. govim [15]

Vim8 plugin developed in Go.

2. iftree [16]

A command-line tool for visualizing k8s network device relationships.

3. veinmind-tools [17]

A container security open source toolset that supports the detection of container image security risks. Recommended by the author.

4. lakeFS [18]

Convert object storage to a Git-like repository.

5. grm [19]

Redis web administration tool.

subscription

This weekly is published every Sunday, and is updated simultaneously on the Go language Chinese website [20] and the WeChat public account [21] .

Search "Go Language Chinese Network" on WeChat or scan the QR code to subscribe.

picture

wechat

References

[1]

polaris1119/golangweekly: https://github.com/polaris1119/golangweekly

[2]

File an issue: https://github.com/polaris1119/golangweekly/issues

[3]

Go Specification: https://docs.studygolang.com/ref/spec#Constants

[4]

Yaegi 0.14.0 released: https://github.com/traefik/yaegi

[5]

progressbar 3.9 release: https://github.com/schollz/progressbar

[6]

muffet 2.6 release: https://github.com/raviqqe/muffet

[7]

Add a standard iterator interface: https://github.com/golang/go/discussions/54245

[8]

GoLand 2022.3 Roadmap: https://blog.jetbrains.com/go/2022/08/04/goland-roadmap-2022-3/

[9]

2022 Go Ecosystem rpc Framework Benchmark: https://colobu.com/2022/07/31/2022-rpc-frameworks-benchmarks/

[10]

maths: https://github.com/theriault/maths

[11]

dig: https://github.com/uber-go/dig

[12]

nano: https://nanos.cloud/

[13]

go-cryptobin: https://github.com/deatil/go-cryptobin

[14]

dbpack: https://github.com/cectc/dbpack

[15]

govim: https://github.com/govim/govim

[16]

iftree: https://github.com/t1anz0ng/iftree

[17]

veinmind-tools: https://github.com/chaitin/veinmind-tools

[18]

lakeFS: https://github.com/treeverse/lakeFS

[19]

grm: https://studygolang.com/p/1123

[20]

Go language Chinese website: https://studygolang.com/go/weekly

[twenty one]

WeChat Official Account: https://weixin.sogou.com/weixin?query=Go%E8%AF%AD%E8%A8%80%E4%B8%AD%E6%96%87%E7%BD%91