Searching We.Love.Privacy.Club

Twts matching #Golang
Sort by: Newest, Oldest, Most Relevant

基於 Go-Kit 的 Golang 整潔架構實踐
如何用 Golang 實現簡潔架構?本文介紹了基於 Go-Kit 實現簡潔架構的嘗試,通過示例介紹了簡潔架構的具體實現。原文: Why is Go-Kit Perfect For Clean Architecture in Golang?[1]簡介Go 是整潔架構 (Clean Architecture) 的完美選擇。整潔架構本身只是一種方法,並沒有告訴我們如何構建源代碼,在嘗試用新語言實現時 ⌘ Read more

⤋ Read More

基於 FX 構建大型 Golang 應用
Uber 開源的 FX 可以幫助 Go 應用解耦依賴,實現更好的代碼複用。原文: How to build large Golang applications using FX[1] 構建複雜的 Go 應用程序可能會引入很多耦合Golang 是一種流行編程語言,功能強大,但人們還是會發現在處理依賴關係的同時組織大型代碼庫很複雜。Go 開發人員有時必須將依賴項的引用傳遞給其他人,從而造成重用代碼 ⌘ Read more

⤋ Read More

在 golang 中如何實現 WebSocket 的雙向通信
在 Go 語言中實現 WebSocket 的雙向通信通常需要使用第三方庫,其中 gorilla/websocket 是一個非常流行和廣泛使用的庫。以下是實現 WebSocket 雙向通信的步驟和簡單示例代碼:1 安裝 gorilla/websocket 庫:go get github.com/gorilla/websocket2 編寫 WebSocket 服務器:package mainimpor ⌘ Read more

⤋ Read More

將 go 代碼打包成 docker 鏡像
概述–在本教程中,你將生成一個容器映像。該映像包括運行應用程序所需的一切:編譯的應用程序二進制文件、運行時、庫以及應用程序所需的所有其他資源。前置條件—-若要完成本教程,需要滿足以下條件:golang 1.19+ 本地安裝了 docker Git 客戶端 程序–該應用程序提供兩個 HTTP endpoint:/ 返回符號 < 3 /health 返回 {“Statu ⌘ Read more

⤋ Read More

使用 Go 構建高性能的事件管理器
事件驅動編程是一種編程範式,在這種範式下,程序的執行流由外部事件(如用戶操作、傳感器輸出或消息傳遞)來決定。在 Go 語言中,構建一個事件管理器可以幫助我們更好地組織和處理這些事件。本文將詳細探討如何在 Go 語言中創建和使用事件管理器,包括事件的定義、監聽和觸發,提供豐富的示例來指導你構建自己的事件驅動應用。Golang 事件管理器概述————–事件驅動編程的優勢解耦:減少組件 ⌘ Read more

⤋ Read More

Go 工具鏈詳解之升級版本不用愁的 go tool fix
go tool fix 作用go tool fix 是 Go 工具鏈中的一個命令,作用是把指定 Go 程序代碼包中的的所有舊版本代碼修正爲新版本的代碼(這裏所說的版本是 Golang 的版本)。升級 Go 版本之後,使用這個命令可以自動對程序進行必要的更改。Golang 的演進過程中,對一些函數和標準庫進行改進是難免的,改進過程中有可能會出現兼容問題,一旦出現了兼容問題,從舊版本升級到新版本的代價 ⌘ Read more

⤋ Read More

17 個開源的 Go 語言博客和 CMS 解決方案
Go 語言,也稱爲 Golang,是一種爲構建高效、可靠和可擴展軟件而設計的開源編程語言。它於 2007 年在 Google 開發,現在廣泛用於開發 Web 應用程序、網絡工具和系統軟件。爲什麼使用基於 Go 的 CMS 解決方案?———————-這些優勢使 Go 成爲開發可擴展、高性能應用程序的熱門選擇。在使用 Go 構建基於 Web 的解決方案時,其速度是其中一個主 ⌘ Read more

⤋ Read More

從 Discord 的做法中學習 — 使用 Golang 進行請求合併
正如你可能之前看到的,Discord 去年發佈了一篇有價值的文章,討論了他們成功存儲了數萬億條消息。雖然有很多關於這篇文章的 YouTube 視頻和文章,但我認爲這篇文章中一個名爲 “數據服務爲數據服務” 的部分沒有得到足夠的關注。在這篇文章中,我們將討論 Discord 對數據服務的方法,並探討如何利用 Golang 的併發特性來減少特定情況下的數據庫負載。數據服務拯救熱分區如你所知,消息和頻道 ⌘ Read more

⤋ Read More

#golang
A handy and powerful library to deal with unstructured data

The below piece of code shows an example of usage

type Person struct {<br/>    Firstname string   `structs:"firstname"`<br/>    Age       int      `structs:"age"`<br/>    Siblings  []Person `structs:"siblings,omitempty"`<br/>}

func main(){

k := knoa.Map().Set(“firstname”, “John”, “age”, 20)

k.Set(“siblings”, []Person{

{

Firstname: “Tim”,

Age: 29,

},

{

Firstname: “Bob”,

Age: 40,

},

})

k.Set(“age”, 23, “siblings[1].age”, 39)

var person Person … ⌘ Read more

⤋ Read More

GoCoverStats v0.0.5 is a security release #test #testing href=”https://we.loveprivacy.club/search?q=%23security”>#security**
The gocoverstats package just got a v0.0.5 security release on its golang.org dependencies and a minor change:

  • golang.org/x/tools upgraded from v0.1.10 to v0.2 (security release on tools/crypto)
  • github.com/google/go-cmp upgraded from 0.5.8 to 0.5.9 (test dependency non-security release)

One clarification about the default build is that, since it requires at least Go 1.18, paths and symbols are trimmed in the compiled output.

1 points poste … ⌘ Read more

⤋ Read More

Find quick solutions to common String problems
Strings are a fundamental building block of programming. Go string is a sequence of variable-width characters where each character is represented by one or more bytes, normally using the UTF-8 encoding. You can find quick solutions to common string problems that arise during writing golang programs from this valuable resource. 1 points posted by Ayeree ⌘ Read more

⤋ Read More