ALL


  Connect to SQLite using Go on Windows

In software development, it's often necessary to test and validate logic using a lightweight and easily manageable database system. SQLite, with its minimal setup and zero configuration requirements, is an excellent choice for such scenarios. Leveraging the simplicity and efficiency of SQLite for testing purposes can significantly streamline the development process. In this guide, we'll explore how to seamlessly connect to SQLite using Go on Windows, empowering developers to efficiently test their code with a reliable and straightforward database solution.Install SQLIte3 PackagesGo has built-i...

781 0       WINDOWS TUTORIAL GOLANG SQLITE3


  Break down defer statements in GoLang

Basic ConceptsWhat are the characteristics of the deferred statement defer in Go language? When is it usually used?The deferred statement(defer statement) in Go language has the following characteristics:Deferred Execution: Deferred statements are executed before the function containing them exits, regardless of whether the function returns normally or encounters an exception.Last In, First Out (LIFO): If there are multiple deferred statements, they are executed in the order of last in, first out (LIFO). In other words, the last deferred statement is executed first, and the first deferred stat...

822 0       DEFER GOLANG


  Rust vs Go: how to choose the best programming language for your project?

Rust and Go, these two modern programming languages, with their unique advantages, are becoming hot topics in the developer community. Their competition in performance, security, simplicity, feature set, and concurrency not only influences developers' choices but also foretells future trends in software development.Battle of Performance: Rust's Precision vs. Go's EfficiencyRust, developed by Mozilla Research, has become the preferred choice for performance-sensitive applications due to its zero-cost abstractions and memory safety features. It ensures memory safety through concepts like ownersh...

1,898 0       COMPARISON GO GOLANG RUST


  Create tweet without explicitly showing the link URL

When crafting a tweet, there are instances where we may wish to include a link, but we prefer the preview to be shown without displaying the URL explicitly after the tweet is published. How can we accomplish this? This article outlines the steps to achieve it.To begin, copy and paste the link you want to share into the tweet box.After clicking Post, the tweet will be published without displaying the link; instead, it will showcase the page preview, and clicking on the preview image will open the page.What if you want to add your own description about the linked page while still concealing the ...

2,327 0       TWEET LINK URL X PREVIEW


  What is goroutine?

Casual TalkGolang is quite enjoyable to write, aside from the tedious if err != nil checks. One of the fundamental reasons for the joy is goroutine, a core feature of Golang. Understanding goroutines in detail is worthwhile, as they contribute significantly to the pleasure of working with Golang. So, let's talk about goroutines, hoping to provide some insights to the readers.TL;DR: We'll start by talking about assembling a computer, then delve into some concepts of the operating system, such as processes and threads, before exploring goroutines themselves.Assembling a ComputerLet's focus on de...

996 0       EXPLANATION GOLANG GOROUTINE


  The details and analysis of capturing gRPC packets

IntroductionIf you're only using gRPC at the application layer, I believe studying the examples on the gRPC official website is sufficient. However, when planning to extensively use gRPC within a team, you will face many challenges, such as authentication schemes between services, routing solutions for multi-region services, and compatibility solutions with existing RESTful services.I recently realized that applying a technology stack requires mastering a wealth of information about that stack to ensure its stability in production use. This article starts with the most basic packet capturing a...

1,120 0       GOOGLE GRPC


  Deep Dive into Spin Locks in Golang

In concurrent programming, a Mutex is a commonly used synchronization mechanism to protect critical resources and prevent data races. However, in certain specific scenarios, especially when the lock-holding time is short and the number of threads is limited, a more lightweight lock known as a Spin Lock can provide higher performance.What is a Spin LockA Spin Lock is a form of busy-wait lock. When a thread attempts to acquire a lock held by another thread, it continuously checks the lock's status (i.e., "spins") until the lock is released, at which point it takes ownership. This waiting method ...

1,052 0       SPINLOCK MUTEX GOLANG


  How to Understand and Use nil in Golang Correctly?

In Golang, nil is a predefined identifier that carries different meanings in various contexts, but typically represents "none", "empty" or "zero value". It can be assigned to variables of pointer, slice, map, channel, function, and interface types. Understanding the significance of nil is crucial for writing robust Go programs, as mishandling nil can lead to unexpected issues.nil in PointersIn Go, pointers are a fundamental type that stores the memory address of a variable. When a pointer is declared but not initialized, its value is nil. The following example code illustrates this:package mai...

1,421 0       FUNCTION MAP GOLANG SLICE NIL CHANNEL