Skip to content
Ricky
English

Search

Searching… No matching pages. Matching pages are listed below. Search is unavailable. Please try again.

Go

All posts

Golang Tips

Go Programming Patterns: Slices, Interfaces, Time, and Performance Go is a high-performance language, but that does not mean we can ignore performance. Here are some tips related to programming and …

2 minutes

Pitfalls When Parsing Binary Data in Go for { buf := make([]byte, bufSize) n, err := r.Read(buf) if err == io.EOF { return } else if err != nil { aerr.Store(err) return } ch <- buf[:n] } The code returns …

1 minute

Take Screenshots with Selenium in Go package main import ( "fmt" log "github.com/sirupsen/logrus" "github.com/tebeka/selenium" "io/ioutil" ) const ( chromeDriverPath = "/usr/local/bin/chromedriver" port = 9515 …

Go string format

Go string format Go 语言 fmt.Printf 使用指南 The verb at the end defines the type and the interpretation of its corresponding argument. d - decimal integer o - octal integer O - octal integer with 0o prefix b - …

2 minutes

[Golang] Use build tags for different build configs Go build -ldflags package main import ( "fmt" ) var flagString string func main() { fmt.Println("This build with ldflag:", flagString) } $ go build -ldflags …

1 minute

A Concise Go embed Tutorial Embedding For a single file, you can embed it as string or []byte For multiple files and directories, you can embed them as a new filesystem (FS) Import the “embed” package even if …

2 minutes

Go pprof in Practice Bomb program package main import ( // omitted _ "net/http/pprof" // auto-register handlers to the HTTP server for profiling via HTTP // omitted ) func main() { // omitted …

3 minutes