oh dang. i think thats the go path not the github path.. missing the branch name. here is the pkg one: https://pkg.go.dev/github.com/quic-go/quic-go/http3
Golang 面試題:strings 和 strconv 包
作爲一種基本數據結構,每種語言都有一些對於字符串的預定義處理函數。Go 中使用 strings 包來完成對字符串的主要操作。4.7.1 前綴和後綴———–HasPrefix 判斷字符串 s 是否以 prefix 開頭:strings.HasPrefix(s, prefix string) boolHasSuffix 判斷字符串 s 是否以 suffix 結尾:strings.HasS ⌘ Read more
一款支持自動流水線和客戶端緩存的 Go 語言 Redis 客戶端
Rueidis 是一款高性能的 Go 語言 Redis 客戶端,它支持自動流水線操作和服務端輔助客戶端緩存等功能。Rueidis 的目標是提供一個簡單易用、性能卓越的 Redis 客戶端庫,以滿足 Go 開發者的各種需求。主要功能—-自動流水線操作,提升非阻塞命令的執行效率 服務端輔助客戶端緩存,大幅降低延遲和提高吞吐量 支持泛型對象映射和客戶端緩存 提供緩存策略模式(Cac ⌘ Read more
Viper:強大的 Go 配置解析庫
1 介紹Viper (https://github.com/spf13/viper) 是適用於 Go 應用程序的完整配置解決方案。它被設計用於在應用程序中工作,並且可以處理所有類型的配置需求和格式。目前 Star 26.6k, 它支持以下特性:設置默認值 從 JSON、TOML、YAML、HCL、envfile 和 Java properties 格式的配置文件讀取配置信息 實時監控和 ⌘ Read more
Do you really know where the flowers you buy come from? You might be shocked
A bouquet of flowers is the go-to gift for many special occasions but the world is paying a high price for transporting our out-of-season blooms. ⌘ Read more
你知道 golang 中 sysmon 有什麼作用嗎?
在 Go 語言的運行時 (runtime 包) 中,sysmon 是一個系統監視器 (system monitor) 線程,它在 Go 運行時中扮演着非常重要的角色。sysmon 的主要職責是維護 Go 程序的健壯性和響應性,確保垃圾回收 (Garbage Collection, GC)、搶佔調度 (Preemptive Scheduling)、定時器 (Timers) 和一些其他後臺任務能夠及時 ⌘ Read more
Golang 高併發應用中的數據庫連接死鎖
在構建高併發的 Go 應用時, 數據庫連接池的使用是不可或缺的。然而, 如果使用不當, 連接池也可能成爲性能瓶頸, 甚至導致整個應用陷入死鎖。本文將深入探討 Golang 中數據庫連接死鎖的原因、影響以及解決方案, 幫助開發者構建更加健壯的應用程序。數據庫連接池的工作原理———–在深入討論連接死鎖之前, 我們需要先了解數據庫連接池的工作原理。連接池本質上是一個連接的緩存, 它可以避免 ⌘ Read more
Pinellas County - Long Run: 10.03 miles, 00:09:47 average pace, 01:38:09 duration
felt great today! temp was down to 78F and 80% RH, but there was an ever so slight breeze so it did not feel sticky. carbo loaded the day before so maybe that had something to do with it too, but i really have not been tracking my nutrition at all. kept it easy the first five or so miles and then bumped it up ever so slightly for the remainder. probably could have gone an even two hours but running on new shoes (hoka mach 6) and really have not broken them in yet. lots of hot spots and a lot of troubleshooting on the go.
#running
From my bed, I can hear a noise outside that is most likely a confluence of insects and distant freight trains but sounds eerily like the static-laden cacophany of an old radio. I would go out to see what it is, but a small part of me is worried I might end up walking into an episode of “Are You Afraid of the Dark?” if I do.
for http3 there is
from my understanding.. i don’t know how the multiplexing works when its being proxied through another server. I know go has support for it if you call it out directly. https://pkg.go.dev/golang.org/x/net/http2
Its like old school TV but with youtube videos. Each channel has a subject and the channels play in a sort of realtime. so no going forward or back. Perfect for channel surfing.
Go 語言什麼時候該使用指針?指針使用的分析與講解
什麼是指針 我們都知道,程序運行時的數據是存放在內存中的,每一個存儲在內存中的數據都有一個編號,這個編號就是內存地址。我們可以根據這個內存地址來找到內存中存儲的數據,而內存地址可以被賦值給一個指針。我們也可以簡單的理解爲指針就是內存地址。指針的聲明和定義 在 Go 語言中,獲取一個指針,直接使用取地址符 & 就可以。 示例:func main() { name := ”Go語言圈” na ⌘ Read more
Go 1.23 is Released
1 points posted by John Doak ⌘ Read more
Go: string 和 bytes 四種轉換方式的性能比較
昨天公司羣中同事提到 Go 1.22 中 string 和 bytes 的互轉不需要再用 unsafe 那個包了,直接轉就可以。我翻看了 Go 1.22 的 release notes 沒找到相應的介紹,但是大家提到了 kubernetes 的 issue[1] 中有這個說法: As of go 1.22, for string to bytes conversion, we can repla ⌘ Read more
The benefits of mentoring and the CNCF Mentorship Program
By Nate Waddington, Head of Mentorship & Documentation, CNCF Technical people have a world of opportunities available to them when it comes to boosting career skills. But I’m going to make the case for taking a somewhat old-fashioned… ⌘ Read more
Base: 6.00 miles, 00:09:43 average pace, 00:58:16 duration
i was suppose to go for another 30 minutes. my energy level is off and i may need to reassess some goals.
#running #treadmill
Go-between appointed to help Queensland farmers negotiate supermarket prices
Vegetable grower Carl Walker says farmers are worried the new commissioner’s powers won’t go far enough. He says farmers just want a “fair price for a fair day’s work”. ⌘ Read more
沒有什麼不可能:修改 Go 結構體的私有字段
在 Go 語言中, 結構體 (struct) 中的字段如果是私有的, 只能在定義該結構體的同一個包內訪問。這是爲了實現數據的封裝和信息隱藏, 提高代碼的健壯性和安全性。但是在某些情況下, 我們可能需要在外部包中訪問或修改結構體的私有字段。這時, 我們可以使用 Go 語言提供的反射 (reflect) 機制來實現這一功能。即使我們能夠實現訪問,這些字段你沒有辦法修改,如果嘗試通過反射設置這些私有字段 ⌘ Read more
Go 語言的流式處理特性進行高效的 HTTP 請求
在 Go 語言中,當你發起一個 HTTP 請求時,可以通過多種方式來將數據寫入請求的body部分。如果你要處理大型數據或者需要逐步生成請求體數據而不想一次性加載到內存中,可以使用流式寫入的方式。這裏我們會討論如何使用io.Reader接口來實現 HTTP 請求體的流式寫入。1. 基礎概念在 Go 語言的 HTTP 庫中,HTTP 請求的Body字段是一個io.Reader接口。因此,你可以通過實現 ⌘ Read more
Go 語言構建可擴展的 Worker Pool
在當今數據驅動的世界中,應用程序需要快速高效地處理大量請求。併發處理通過允許程序同時執行多個任務,成爲解決這一需求的關鍵。Go 語言以其強大的併發原語而聞名,爲構建高性能、可擴展的應用程序提供了優雅而有效的方法。本文將深入探討併發處理的概念,並提供使用 Go 語言構建可擴展 Worker Pool 的分步指南。併發處理:性能和效率的強大工具—————併發處理涉及程序內多個任務的 ⌘ Read more
Celestial Event
⌘ Read more
圖解 Go 語言 time-Sleep 的實現原理
我們寫程序的時候,一定遇到過需要讓程序休眠一段時間再執行的場景,這個時候我們一般會想到用 Sleep 方法,Java 語言有Thread.Sleep, PHP 應該是有一個sleep函數,同樣的 Go 語言有內置的 time.Sleep 方法。這篇文章我們來簡單梳理一下,Go 語言的time.Sleep是怎麼實現程序的休眠和喚醒的。在 Go 的程序中,使用time.Sleep(d duration ⌘ Read more
通過 Go 示例理解函數式編程思維
一個孩子要嘗試 10 次、20 次才肯接受一種新的食物,我們接受一種新的範式,大概不會比這個簡單。– 郭曉剛 《函數式編程思維》譯者函數式編程 (Functional Programming, 簡稱 fp) 是一種編程範式,與命令式編程(Imperative Programming)、面向對象編程(OOP)、泛型編程(Generics Programming)、邏輯編程 (logic Pro ⌘ Read more
從源代碼中窺探 Go 的 WaitGroup 實現和應用
sync.WaitGroup OverviewGo 作爲雲原生開發的代表,以其在併發編程中的易用性而聞名。在大多數情況下,人們會在處理併發時使用 WaitGroup。我經常想要了解它是如何工作的,所以本文主要談談我對 WaitGroup 的理解。在 Go 語言中,sync.WaitGroup 允許主程序或其他 goroutines 在繼續執行之前等待多個 goroutines 執行完畢。它主要用於 ⌘ Read more
一文搞定 Golang 反射 -Reflect-
Go (Golang) 中的反射是一項強大的功能,它允許程序在運行時檢查自身的結構和值。這一功能由 reflect 包提供。反射通常用於序列化 / 反序列化、構建泛型庫和測試等任務。本文將概述反射在 Go 中的工作原理,並提供實際示例。基本概念Type: 值的類型,(如 int、string、float、struct)。 Value: 變量的實際數據。 kind: 類型的具體類別(如 ⌘ Read more
Celestial Event
⌘ Read more
Built a Wankel Rotary RC Car… and Gave it a Go! ⌘ Read more
Pinellas County - Long Run: 7.58 miles, 00:11:16 average pace, 01:25:22 duration
not as long as i would have liked. got a late start because, well, i was enjoying the sleep! then i saw at 0500 the rain was not scheduled anymore so i slept in. then it rained!
so this run was hot, no cloud cover, 90% RH and about 90F. it was brutal. but overall had to cut it short due to shivers all over the body. i was not going to push it when i may be overheating.
highlight: raced a youg boy in boca ciega park
#running
Today, after the daily standup (without standup though), I went to pick up my girlfriend’s exam paper. But instead of using car sharing or the bus, I decided to go there by bike. This time with my older city bike. Faster than the bus, cheaper than car sharing. And it was a nice break from work. Hurray for flextime and working from home, which makes this possible for me! ⌘ Read more
Installing multiple helm charts in one go [Approach 3 – using simple bash utility]
Community post originally published on Dev.to by Sunny Bhambhani In this article, we will be talking about Approach 3 i.e. how to get multiple helm charts installed using a simple bash utility. If you haven’t read the previous… ⌘ Read more
在 golang 裏使用 ZooKeeper,如何使用
在 Go 語言中使用 ZooKeeper,可以藉助第三方庫go-zookeeper。下面介紹如何安裝和使用這個庫與 ZooKeeper 進行交互。安裝 go-zookeeper 庫首先,需要安裝go-zookeeper庫。使用go get命令來安裝:go get github.com/samuel/go-zookeeper/zk使用 ZooKeeper 的基本示例以下是一個簡單的示例,包括連接 Z ⌘ Read more
適配器模式在 Go 語言中的應用
前段時間我負責對一個項目進行臨時性的技術方案改造,用到了適配器模式,今天就來跟大家簡單分享下適配器模式在 Go 語言中的應用。適配器模式適配器模式(Adapter Pattern)是 23 種經典設計模式中的一種,屬於行爲型模式,它允許不兼容的接口協同工作。該模式通過創建一個適配器類,封裝不兼容的接口,並對外提供一個兼容的接口。《設計模式:可複用面向對象軟件的基礎》一書中對適配器的意圖定義如下: ⌘ Read more
用 Go 語言構建優雅的事件驅動架構
事件驅動架構(EDA)作爲一種強大的軟件設計模式,在構建現代分佈式系統中扮演着越來越重要的角色。它通過異步事件流將不同的服務和組件解耦,從而提升系統的可擴展性、彈性和響應能力。在 Go 語言中,其簡潔的語法和豐富的併發原語爲實現高效的 EDA 提供了天然的優勢。事件驅動架構的核心概念———–在深入探討如何使用 Go 語言構建 EDA 之前,我們先來回顧一下事件驅動架構的核心概念:事件 ⌘ Read more
witness a once-in-a-lifetime cosmic event! 🌠 T. Corona Borealis is exploding (going nova) ⌘ Read more
Base: 6.21 miles, 00:09:30 average pace, 00:58:59 duration
physically i was worn out and my legs a bit tight, but the run was pretty easy in effort. wanted to go for 8 miles, but was bored to death and cut it off at 10km.
#running #treadmill
患「僵人综合征」的席琳·迪翁再次亮相奥运会开幕式,如何评价她的表演?这种疾病可以被治愈吗?
奥主委选择席琳迪翁在开幕式献唱。
肯定不是因为她目前的嗓音完美无缺。
而是她拥有奥运最需要的。
人类永不言败的精神。
听到“ 僵人综合征”,很多人第一反应:
是不是周杰伦的“ 强直性脊柱炎”?
是不是京东蔡磊的“ 渐冻人“?
都不是。
僵人综合征是发病率百万分之一的罕见病。
即使贵为天后,席琳迪翁也被误诊了多年。
如此脆弱,又如此强大因《泰坦尼克号》主题曲《My heart will go on》而爆红的音乐天后席琳·迪翁。
她不仅是五届格莱美奖得主。
或 JSON 字符串到結構體的反序列化(Unmarshalling)操作。Go 爲我們提供了 encoding/json 庫可以很方便的實現這一需求。在本文中,我們將探索如何使用 Go 的反射機制自己來實現一個簡易版的 encoding/json 庫。這個過程不僅能幫助我們理解序列化和反序列化 ⌘ Read more
Go 還是 TinyGo?
什麼是 TinyGo?TinyGo 與 Go 有何不同? TinyGo 與 Go 相比性能如何?什麼是 TinyGo?———–TinyGo 不是另一種編程語言。它只是 Go 語言的一個編譯器。關鍵區別在於 TinyGo 編譯器創建的二進制文件更小, 主要用於嵌入式系統和 WASM。而 Go 編譯器則用於編譯完整的服務器端應用程序和通用程序。TinyGo 使用 LLVM 作爲後端, 與 ⌘ Read more
你是如何用 Go 語言 配置高性能 sql-DB 的?
配置高性能的 sql.DB 是 Go 應用程序開發中一個重要的環節,特別是在需要處理大量數據庫查詢的情況下。以下是一些最佳實踐和配置建議:1. 數據庫連接池的配置Go 的 database/sql 包提供了連接池的功能,您可以通過設置最大空閒連接、最大打開連接數和連接的最大生命週期來優化連接池。db, err := sql.Open(“mysql”, ”user:password@tcp(127. ⌘ Read more
Python is 71x Slower, Uses 75x More Energy, Than C
Rust, Go, Swift, Dart, Ruby. All slower, & use more electricity, than plain old C. ⌘ Read more
@prologic@twtxt.net Yes I suppose that is true. There is an article on Tailscale’s site that explains it all quite a bit: https://tailscale.com/blog/how-nat-traversal-works
To me, with CGNAT, it’s a small miracle that a direct connection can be made between peers (as opposed to going through a relay constantly) but it does indeed work. I guess to host it at home you would need to have it WAN accessible, and if you’ve already gone to the trouble of port forwarding etc… well 😅
Not that I could personally do that, but for those with static IPs etc.
Lambda-Go:將函數式編程引入 Go
函數式編程是編程範式當中的一種,喜歡的人愛之如命,不喜歡的人嗤之以鼻,以簡單高效著稱的 Go 天然在函數式編程上有自己的優勢。Lambda-Go[1] 是一個旨在將受 Haskell 啓發的函數式編程技術引入 Go 生態系統的庫。在本文中,我們將探討 Lambda-Go 的功能,以及它如何增強你的 Go 編程體驗。Lambda-Go 簡介Lambda-Go 是一個 Go 庫,它通過函數式編程結構擴 ⌘ Read more
Go 異步編程小技巧
我們通過一個簡單的例子看一下 Goroutine 的使用func main() { go func() { fmt.Println(“Goroutine started”) // do some work fmt.Println(“Goroutine finished”) }() // wait for Goroutine to fini ⌘ Read more
watch -n 60 rm -rf /tmp/yarn-avatar-* in a tmux because all of a sudden, without warning, yarnd started throwing hundreds of gigabytes of files with names like yarn-avatar-62582554 into /tmp, which filled up the entire disk and started crashing other services.
@prologic@twtxt.net I’m still getting this crap:
abucci@buc:~/yarnd/yarn$ ls -lh /tmp/yarnd-avatar-*
-rw------- 1 abucci abucci 863M Jul 25 14:19 /tmp/yarnd-avatar-1594499680
-rw------- 1 abucci abucci 7.8G Jul 25 14:19 /tmp/yarnd-avatar-2144295337
-rw------- 1 abucci abucci 9.8G Jul 25 14:19 /tmp/yarnd-avatar-2334738193
-rw------- 1 abucci abucci 10G Jul 25 14:14 /tmp/yarnd-avatar-2494107777
-rw------- 1 abucci abucci 9.5G Jul 25 13:59 /tmp/yarnd-avatar-2619243454
-rw------- 1 abucci abucci 11G Jul 25 14:04 /tmp/yarnd-avatar-2922187513
-rw------- 1 abucci abucci 7.5G Jul 25 14:14 /tmp/yarnd-avatar-349775570
-rw------- 1 abucci abucci 10G Jul 25 14:09 /tmp/yarnd-avatar-3640724243
-rw------- 1 abucci abucci 901M Jul 25 14:19 /tmp/yarnd-avatar-3921595598
-rw------- 1 abucci abucci 9.5G Jul 25 13:59 /tmp/yarnd-avatar-609094539
-rw------- 1 abucci abucci 9.3G Jul 25 14:04 /tmp/yarnd-avatar-755173392
-rw------- 1 abucci abucci 7.9G Jul 25 14:09 /tmp/yarnd-avatar-984061000
Something like 100 Gbytes of this junk has accumulated since I updated and re-started the server. I’m now running the latest version of yarnd, so the update did not fix the problem. Something else is going wrong.
How are temporary files growing to 10 Gbytes in size? The name of the file is “yarn-avatar”, but why would avatars be so large?