Searching txt.sour.is

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

API 設計的 “Go 境界”:Go 團隊設計 MCP SDK 過程中的取捨與思考
大家好,我是 Tony Bai。作爲開發者,我們每天都在與 API 打交道——調用它們,設計它們,有時也會爲糟糕的 API 設計而頭痛不已。一個優秀的 API,如同一位技藝精湛的嚮導,能清晰、高效地引領我們通往復雜功能的彼岸;而一個蹩腳的 API,則可能像一座佈滿陷阱的迷宮,讓我們步履維艱。那麼,在 Go 語言的世界裏,一個 “好” 的 API 應該是什麼樣子的?它應該如何體現 Go 語言簡潔、高 ⌘ Read more

⤋ Read More

API 設計的 “Go 境界”:Go 團隊設計 MCP SDK 過程中的取捨與思考
大家好,我是 Tony Bai。作爲開發者,我們每天都在與 API 打交道——調用它們,設計它們,有時也會爲糟糕的 API 設計而頭痛不已。一個優秀的 API,如同一位技藝精湛的嚮導,能清晰、高效地引領我們通往復雜功能的彼岸;而一個蹩腳的 API,則可能像一座佈滿陷阱的迷宮,讓我們步履維艱。那麼,在 Go 語言的世界裏,一個 “好” 的 API 應該是什麼樣子的?它應該如何體現 Go 語言簡潔、高 ⌘ Read more

⤋ Read More

自制 ResponseWriter:Go 安全 HTTP
Go 的 http.ResponseWriter 會直接向套接字(socket)寫入數據,這可能會導致一些隱蔽的 bug,例如忘記設置狀態碼,或是在爲時已晚的時候意外修改了響應頭(header)。本文將展示如何通過包裝 ResponseWriter 來強制執行自定義規則,例如要求 WriteHeader() 以及在出錯後阻止寫入操作,從而讓你的處理器(handler)更安全、也更易於梳理邏輯。我用 ⌘ Read more

⤋ Read More

自制 ResponseWriter:Go 安全 HTTP
Go 的 http.ResponseWriter 會直接向套接字(socket)寫入數據,這可能會導致一些隱蔽的 bug,例如忘記設置狀態碼,或是在爲時已晚的時候意外修改了響應頭(header)。本文將展示如何通過包裝 ResponseWriter 來強制執行自定義規則,例如要求 WriteHeader() 以及在出錯後阻止寫入操作,從而讓你的處理器(handler)更安全、也更易於梳理邏輯。我用 ⌘ Read more

⤋ Read More

Go 語言實現優雅關機和重啓的示例很詳細
在生產環境中,服務的更新和維護是不可避免的。粗暴地終止服務會導致:正在處理的請求被中斷 數據庫事務未完成 緩存數據丟失 客戶端連接異常 本文將深入探討如何使用 Go 語言實現:優雅關機 :等待現有請求完成後再關閉服務 優雅重啓 :無縫切換新舊進程,實現零停機更新 優雅關機實現核心機制完整實現代碼package mainimport(” ⌘ Read more

⤋ Read More

Go 語言實現優雅關機和重啓的示例很詳細
在生產環境中,服務的更新和維護是不可避免的。粗暴地終止服務會導致:正在處理的請求被中斷 數據庫事務未完成 緩存數據丟失 客戶端連接異常 本文將深入探討如何使用 Go 語言實現:優雅關機 :等待現有請求完成後再關閉服務 優雅重啓 :無縫切換新舊進程,實現零停機更新 優雅關機實現核心機制完整實現代碼package mainimport(” ⌘ Read more

⤋ Read More

Gin 服務性能提升的最佳實踐
Gin 框架是在 Go 中構建網絡服務的首選。隨着應用程序複雜性和流量的增加,性能成爲不能忽視的因素。本文將介紹一系列使用 Gin 構建服務的有效技巧,涵蓋從路由優化到內存重用、請求和響應優化、異步處理以及性能分析,幫助你創建更穩定高效的 Web 服務。路由註冊優化:避免循環引用————-Gin 的路由器使用基於樹的高效路由實現,可以快速匹配請求路徑。但是,如果路由註冊不當,例如嵌 ⌘ Read more

⤋ Read More

Gin 服務性能提升的最佳實踐
Gin 框架是在 Go 中構建網絡服務的首選。隨着應用程序複雜性和流量的增加,性能成爲不能忽視的因素。本文將介紹一系列使用 Gin 構建服務的有效技巧,涵蓋從路由優化到內存重用、請求和響應優化、異步處理以及性能分析,幫助你創建更穩定高效的 Web 服務。路由註冊優化:避免循環引用————-Gin 的路由器使用基於樹的高效路由實現,可以快速匹配請求路徑。但是,如果路由註冊不當,例如嵌 ⌘ Read more

⤋ Read More

代碼覆蓋率新玩法:Russ Cox 教你用差異化分析加速 Go 調試
大家好,我是 Tony Bai。調試,尤其是調試並非自己編寫的代碼,往往是軟件開發中最耗時的環節之一。面對一個失敗的測試用例和龐大的代碼庫,如何快速有效地縮小問題範圍?Go 團隊的前技術負責人 Russ Cox 近期分享了一個雖然古老但極其有效的調試技術——差異化覆蓋率 (Differential Coverage)。該技術通過比較成功和失敗測試用例的代碼覆蓋率,巧妙地 “高亮” 出最可能包含 B ⌘ Read more

⤋ Read More

代碼覆蓋率新玩法:Russ Cox 教你用差異化分析加速 Go 調試
大家好,我是 Tony Bai。調試,尤其是調試並非自己編寫的代碼,往往是軟件開發中最耗時的環節之一。面對一個失敗的測試用例和龐大的代碼庫,如何快速有效地縮小問題範圍?Go 團隊的前技術負責人 Russ Cox 近期分享了一個雖然古老但極其有效的調試技術——差異化覆蓋率 (Differential Coverage)。該技術通過比較成功和失敗測試用例的代碼覆蓋率,巧妙地 “高亮” 出最可能包含 B ⌘ Read more

⤋ Read More

[$] LWN.net Weekly Edition for May 22, 2025
Inside this week’s LWN.net Weekly Edition:

  • Front: Home Assistant; Setuptools; Debian AI GR; DMA-mapping API; BPF CI; OSPM 2025

  • Briefs: Go audit; Oniux; Asahi progress; Rust in FreeBSD; RHEL 10; Rust 1.87.0; RIP John L. Young; Quote; …

  • Announcements: Newsletters, conferences, security updates, patches, and more. ⌘ Read more

⤋ Read More

Security updates for Wednesday
Security updates have been issued by AlmaLinux (.NET 8.0, avahi, buildah, compat-openssl10, compat-openssl11, expat, firefox, gimp, git, grafana, libsoup, libxslt, mod_auth_openidc, nginx, nodejs:22, osbuild-composer, php, redis, redis:7, skopeo, thunderbird, vim, webkit2gtk3, xterm, and yelp), Arch Linux (dropbear, freetype2, go, nodejs, nodejs-lts-iron, nodejs-lts-jod, python-django, webkit2gtk, webkit2gtk-4.1, webkitgtk-6.0, and wpewebkit), Debian (mongo-c-driver), Fedora (openssh, … ⌘ Read more

⤋ Read More
In-reply-to » @thecanine @movq So I actually agree with you! I think Dustin is taking a bit of a "deep and dark" path here (depression), and there are many parallels to other types of activities that we can all talk to. "AI" or "LLM"(s) here should be no different. Use them, Don't use them. I don't really see how it takes away our creativity or critical thinking.

@bender@twtxt.net @prologic@twtxt.net Jokes aside, I don’t think that’s the right approach either. We had spell checkers, since I can remember, as well as other tools, like the smart image select, used mostly to remove backgrounds. These are tools, that just simplify the process of either opening up a dictionary and looking up a word, you can’t remember the spelling of, or the process of placing a billion little dots around the part of an image you want to select - none of these are creative or enjoyable tasks, we already had tools for them, decades before AI. I don’t think we need to go back to cave paintings, to be free of AIs influence on our creative work.

⤋ Read More

6 Super Useful Continuity Features for Mac, iPhone, & iPad, You Should Be Using
Continuity is a broad set of features for Mac, iPhone, and iPad, that make using all three of the devices together as seamless and easy as possible. Many of the Continuity features also will undoubtedly improve your workflow, making using MacOS, iOS, and iPadOS even better together. We’re going to focus on six of the … [Read More](https://osxdaily.com/2025/05/19/6-super-usefu … ⌘ Read more

⤋ Read More

Go cryptography security audit (The Go Blog)
Roland Shoemaker has published a blog post about a
recent security audit of the cryptography packages shipped as part of
the Go standard library. The audit, performed by the Trail of Bits security firm,
uncovered one low-severity vulnerability in the legacy Go+BoringCrypto
integration, as well as a handful of informational findings.

During the review, there were … ⌘ Read more

⤋ Read More

Go Wails 桌面開發之 Go 與 Preact 如何協作通信?
上一篇文章裏我們簡單的瞭解了 Wails,在本篇文章裏將帶你從 0 開始,藉助 Wails 框架構建一個前後端分離的 Todo 應用,前端用 Preact,後端使用 Go,並講解它們之間的通信機制與數據傳遞方式。閒話少說,開始今天的內容,let’s go!!!Wails 框架如何工作?—————–在 Wails 中,前端通過 WebView 渲染頁面,後端通過 Go 提供邏輯 ⌘ Read more

⤋ Read More

Go Wails 桌面開發之 Go 與 Preact 如何協作通信?
上一篇文章裏我們簡單的瞭解了 Wails,在本篇文章裏將帶你從 0 開始,藉助 Wails 框架構建一個前後端分離的 Todo 應用,前端用 Preact,後端使用 Go,並講解它們之間的通信機制與數據傳遞方式。閒話少說,開始今天的內容,let’s go!!!Wails 框架如何工作?—————–在 Wails 中,前端通過 WebView 渲染頁面,後端通過 Go 提供邏輯 ⌘ Read more

⤋ Read More

Go 語言中字符串四種拼接方式的性能對比,哪個更勝一籌?
在 Go 語言開發中,字符串拼接是最常見的操作之一。不同的拼接方式在性能上可能有數量級的差異,特別是在高頻調用或大數據量處理的場景下。本文將使用標準基準測試,全面對比四種主流字符串拼接方式的性能表現。測試環境與方法測試環境Go 版本:1.20+ 操作系統:macOS/Windows/Linux CPU:8 核 測試方法我們創建了一個完整的基準測試文件echobenchtest.g ⌘ Read more

⤋ Read More

Go 語言中字符串四種拼接方式的性能對比,哪個更勝一籌?
在 Go 語言開發中,字符串拼接是最常見的操作之一。不同的拼接方式在性能上可能有數量級的差異,特別是在高頻調用或大數據量處理的場景下。本文將使用標準基準測試,全面對比四種主流字符串拼接方式的性能表現。測試環境與方法測試環境Go 版本:1.20+ 操作系統:macOS/Windows/Linux CPU:8 核 測試方法我們創建了一個完整的基準測試文件echobenchtest.g ⌘ Read more

⤋ Read More
In-reply-to » i recorded and posted another vlog yesterday :] https://memoria.sayitditto.net/view?m=UNwsVI9yp

@kat@yarn.girlonthemoon.xyz I only listened to you while going through my photos, so I did not pay very close attention. :-)

Since you have a proper server – haha, not just one – and hence are not limited, I suggest you learn a real programming language and don’t waste your time with this PHP mess. It might have improved a wee bit since I was a kid, but it felt like some hacked together shit. The defaults also were questionable at best, it was easier to hold it wrong than right. This stands testament to bad design and is especially terrible from a security point of view.

You’re right, programming is like any other craft. You only truly learn by actually doing it. And this just takes time. Very long time to master it. Or as close to as it gets. The more you know, the more you realize what else you don’t know (yet). It’s a never ending process. So, take it easy, don’t get discouraged, happy hacking and enjoy the endeavor! :-)

⤋ Read More

We had sun, clouds, wind, rain and a whole lot of fun on our trip to the Wasserberg. We’ve been out seven hours in total, not bad at all for all those kilometers. We added on some detours to check out a pond I’ve been introduced by a mate a few years back.

After some (expensive) tucker at the Wasserberghaus, we tried to actually visit the summit this time. However, there’s nothing to see, just a rough logging trail (46-49). That was a dead end, so we had to turn around. It was some nice exploring, but I reckon this was my first and last time up there. :-)

Image

Unfortunately, we didn’t go to the neighboring Fuchseck this time, only the Wasserberg with some extras.

https://lyse.isobeef.org/wanderung-auf-den-wasserberg-2025-05-18/

⤋ Read More

Buying a TV these days, means trying to avoid endless enshitification:
-Spyware and adware
-Shitty AI upscaling/ frame interpolation
-HW that breaks after 2 - 3 years
-One off OS, dead on arrival
-Android OS, that starts lagging after the third update
-8 buttons worth of ads, on your remote

You probably have to make some kind of a compromise. I thought that was buying from some other brand like Hyundai, but that one also felt into some of those categories and just broke, after less than 3 years of use. At this point I’ll probably go back to LG and hope their HW is still reliable and the rest manageable… It has AI bullshit and knowing LG, probably some spyware you have to try your best to get rid of, can buy a remote with “only” 2 ads on it, some web-based OS shared between all their TVs, that usually gets 4 - 5 years worth of updates and works decently enough afterwards.

At this point, I’ll probably settle for anything that doesn’t literally fall apart, not even 3 years in, like the Hyundai did.

⤋ Read More

Go 指針還能這麼玩?結構體方法調用竟然不用解引用!
Go 語言中的指針詳解包含字段與方法的簡化寫法————在 Go 語言中,指針是高效操作數據、避免大對象拷貝的重要工具。本文將詳細講解 Go 中指針相關的幾個關鍵概念:&:取地址 T:聲明指針類型 p:解引用指針 結構體指針可以使用 ptr.Field 和 ptr.Method() 的簡化寫法 是否支持多級指針如 *T 一、基本操作符解釋——– ⌘ Read more

⤋ Read More

Go 指針還能這麼玩?結構體方法調用竟然不用解引用!
Go 語言中的指針詳解包含字段與方法的簡化寫法————在 Go 語言中,指針是高效操作數據、避免大對象拷貝的重要工具。本文將詳細講解 Go 中指針相關的幾個關鍵概念:&:取地址 T:聲明指針類型 p:解引用指針 結構體指針可以使用 ptr.Field 和 ptr.Method() 的簡化寫法 是否支持多級指針如 *T 一、基本操作符解釋——– ⌘ Read more

⤋ Read More

從 Go 路由選擇看 “標準庫優先”:何時堅守?何時拓展?
大家好,我是 Tony Bai。最近,知名 Go 博主 Alex Edwards 更新了他那篇廣受歡迎的文章——“Which Go router should I use?1]”,特別提到了 [Go 1.22 版本對標準庫 http.ServeMux 的顯著增強。這篇文章再次引發了我們對 Go Web 開發中一個經典問題的思考:在選擇路由庫時,我們應該堅守標準庫,還是擁抱功能更豐富的第三方庫?這個 ⌘ Read more

⤋ Read More

從 Go 路由選擇看 “標準庫優先”:何時堅守?何時拓展?
大家好,我是 Tony Bai。最近,知名 Go 博主 Alex Edwards 更新了他那篇廣受歡迎的文章——“Which Go router should I use?1]”,特別提到了 [Go 1.22 版本對標準庫 http.ServeMux 的顯著增強。這篇文章再次引發了我們對 Go Web 開發中一個經典問題的思考:在選擇路由庫時,我們應該堅守標準庫,還是擁抱功能更豐富的第三方庫?這個 ⌘ Read more

⤋ Read More

Go 語言 從設計到優化全流程 構建高併發權重抽獎系統
在現代互聯網應用中,抽獎系統被廣泛用於營銷活動、用戶激勵等場景。一個好的抽獎系統需要滿足:公平性:確保概率分佈準確高性能:支持高併發抽獎請求安全性:防止作弊和重複中獎可擴展:支持多種抽獎活動配置本文將基於 Go 語言實現一個完整的權重抽獎系統,涵蓋核心算法、併發控制、安全防護等關鍵設計。一、系統架構設計1. 整體架構圖2. 核心組件說明二、核心算法實現1. 權重區間算法type Prize str ⌘ Read more

⤋ Read More

Go 語言 從設計到優化全流程 構建高併發權重抽獎系統
在現代互聯網應用中,抽獎系統被廣泛用於營銷活動、用戶激勵等場景。一個好的抽獎系統需要滿足:公平性:確保概率分佈準確高性能:支持高併發抽獎請求安全性:防止作弊和重複中獎可擴展:支持多種抽獎活動配置本文將基於 Go 語言實現一個完整的權重抽獎系統,涵蓋核心算法、併發控制、安全防護等關鍵設計。一、系統架構設計1. 整體架構圖2. 核心組件說明二、核心算法實現1. 權重區間算法type Prize str ⌘ Read more

⤋ Read More

在 Go 中應該何時使用 panic?
如果你使用 Go 有一段時間了,可能聽說過 Go 的諺語 “don’t panic”。這句話的核心意思是:“優雅地處理錯誤,或者將錯誤返回給調用方去處理,而不是直接傳遞給內置的 panic() 函數。”儘管 “不要 panic” 是一個值得遵循的優秀準則,但有時候它被理解成“你絕對不能、絕不應該調用 panic()”。我並不這麼認爲,在某些少數情況下, panic() 是更合適的行爲。「爲什麼 p ⌘ Read more

⤋ Read More

在 Go 中應該何時使用 panic?
如果你使用 Go 有一段時間了,可能聽說過 Go 的諺語 “don’t panic”。這句話的核心意思是:“優雅地處理錯誤,或者將錯誤返回給調用方去處理,而不是直接傳遞給內置的 panic() 函數。”儘管 “不要 panic” 是一個值得遵循的優秀準則,但有時候它被理解成“你絕對不能、絕不應該調用 panic()”。我並不這麼認爲,在某些少數情況下, panic() 是更合適的行爲。「爲什麼 p ⌘ Read more

⤋ Read More
In-reply-to » "Forgive me for the harm I have caused this world. None may atone for my actions but me and only in me shall their stain live on. I am thankful to have been caught, my fall cut short by those with wizened hands. All I can be is sorry, and that is all I am."

@bender@twtxt.net Ahh I see. That reminds me, I was going to start watching something someone recommended here hmmm 🧐

⤋ Read More

Kernel prepatch 6.15-rc6
Linus has released 6.15-rc6 for testing.

Everything still looks fairly normal - we’ve got a bit more commits
than we did in rc5, which isn’t the trend I want to see as the
release progresses, but the difference isn’t all that big and it
feels more like just the normal noise in timing fluctuation in pull
requests of fixes than any real signal.

So I won’t worry about it. We’ve got another two weeks to go in the
normal release schedule, and it still feels … ⌘ Read more

⤋ Read More

Also spent the morning continuing to think about a new design for EdgeGuard’s WAF. I’m basically going to build an entirely new pluggable WAF that will be designed to only consider Rate Limiting, IP/ASN-based filtering, JavaScript challenge handling, Basic behavioral analysis and Anomaly detection.

The only part of this design I’m not 100% sure about is the Javascript-based challenge handling? 🤔 I’m also considering making this into a “proof of work” requirement too, but I also don’t want to falsely block folks that a) turn Javascript™ off or b) Use a browser like links, elinks or lynx for example.

Hmmm 🧐

⤋ Read More

golang 每日一庫之依賴注入庫 samber-do
do 是 Go 語言中一個輕量級的依賴注入(Dependency Injection, DI)容器,由 samber 開發。它基於 Go 1.18+ 泛型實現,爲 Go 提供了一個類型安全的 DI 方案。do 庫的設計理念是簡化服務組件之間的依賴管理,取代手工創建依賴關係的繁瑣工作,使不同組件之間鬆散耦合、更易測試與維護。與反射型 DI 框架不同,do 在註冊和解析依賴時不使用反射,因此性能開銷很 ⌘ Read more

⤋ Read More

golang 每日一庫之依賴注入庫 samber-do
do 是 Go 語言中一個輕量級的依賴注入(Dependency Injection, DI)容器,由 samber 開發。它基於 Go 1.18+ 泛型實現,爲 Go 提供了一個類型安全的 DI 方案。do 庫的設計理念是簡化服務組件之間的依賴管理,取代手工創建依賴關係的繁瑣工作,使不同組件之間鬆散耦合、更易測試與維護。與反射型 DI 框架不同,do 在註冊和解析依賴時不使用反射,因此性能開銷很 ⌘ Read more

⤋ Read More

Go 1-24 震撼發佈!這些新特性你必須知道!
一、工具鏈重大升級 🛠️————-更智能的模塊校驗機制 新版本引入了 verify 命令go mod verify -json通過結構化輸出模塊校驗結果,完美解決了開發者在持續集成(CI)流程中解析校驗結果的痛點。舊版本只能獲得簡單提示$ go mod verifyall modules verified新版本結構化輸出$ go mod verify -json{  ”Pat ⌘ Read more

⤋ Read More

Go 1-24 震撼發佈!這些新特性你必須知道!
一、工具鏈重大升級 🛠️————-更智能的模塊校驗機制 新版本引入了 verify 命令go mod verify -json通過結構化輸出模塊校驗結果,完美解決了開發者在持續集成(CI)流程中解析校驗結果的痛點。舊版本只能獲得簡單提示$ go mod verifyall modules verified新版本結構化輸出$ go mod verify -json{  ”Pat ⌘ Read more

⤋ Read More

精通 SOLID 原則在 Go 中的應用:編寫乾淨且可維護的代碼
在軟件開發中,構建可維護、可擴展和健壯的代碼是最終目標。SOLID 原則由 Robert C. Martin(也稱爲 Uncle Bob)提出,爲實現這一目標提供了基礎。這些原則如何應用於 Go 語言呢?Go 以其簡潔和務實著稱,讓我們來探討 Go 的慣用風格如何與 SOLID 原則對齊,從而生成乾淨、高效的軟件。單一職責原則(SRP)———–“一個類應該只有一個改變的原因。”在 G ⌘ Read more

⤋ Read More

精通 SOLID 原則在 Go 中的應用:編寫乾淨且可維護的代碼
在軟件開發中,構建可維護、可擴展和健壯的代碼是最終目標。SOLID 原則由 Robert C. Martin(也稱爲 Uncle Bob)提出,爲實現這一目標提供了基礎。這些原則如何應用於 Go 語言呢?Go 以其簡潔和務實著稱,讓我們來探討 Go 的慣用風格如何與 SOLID 原則對齊,從而生成乾淨、高效的軟件。單一職責原則(SRP)———–“一個類應該只有一個改變的原因。”在 G ⌘ Read more

⤋ Read More

Which AI “arena” is the one we can actually trust?
I’m getting deeper and deeper into the AI space, and I’m discovering the different AI “arenas” and benchmarking. I have no idea what to trust or leverage to help me learn about the different models out there. Does the lobste.rs community have one that they go to by default? ⌘ Read more

⤋ Read More

Sometimes things go wrong when buying CDs second-hand. I bought an album quite cheap – but as it turned out, they only checked the cover, not the content, so I got something else instead which is actually much more expensive. 🤣

⤋ Read More

告別 JMeter!這款 Go 語言神器讓性能測試輕量 10 倍,還支持分佈式壓測
k6 簡介:爲何選擇它———–k6 由 Go 語言編寫,相較於傳統工具 JMeter,具有輕量高效、語法簡潔、擴展性強等優勢。其特點包括:開發者友好:基於 JavaScript/TypeScript 腳本,無縫銜接現代開發流程 雲原生支持:內置分佈式測試能力,輕鬆模擬萬級併發 豐富可視化:提供 HTML/JSON 格式報告,支持自定義儀表板 擴展生態:通過 npm ⌘ Read more

⤋ Read More
In-reply-to » one of my servers (the one that hosts yarn!) crashed while i was asleep and i woke up to several discord pings telling me it's down T__T AND my terminal stopped working and i had to install new drivers! i am half asleep!!!!

@lyse@lyse.isobeef.org it’s thankfully sorted out now but i literally turned on my PC and was like WTF IS GOING ON

⤋ Read More

如何在 Go 中設計並公開接口
Go 語言中的接口(interface)是其最具特色的功能之一。與許多其他語言不同,在 Go 中,類型不需要顯式聲明實現某個接口。只要一個類型定義了接口所需的方法,它就自動實現了該接口。然而,編寫良好的接口並不容易。不恰當地暴露寬泛或不必要的接口,容易污染包的 API。本文將解釋現有接口設計準則背後的邏輯,並結合標準庫中的示例進行說明。「接口越大,抽象越弱」大型接口往往難以找到多個實現類型。因此, ⌘ Read more

⤋ Read More

如何在 Go 中設計並公開接口
Go 語言中的接口(interface)是其最具特色的功能之一。與許多其他語言不同,在 Go 中,類型不需要顯式聲明實現某個接口。只要一個類型定義了接口所需的方法,它就自動實現了該接口。然而,編寫良好的接口並不容易。不恰當地暴露寬泛或不必要的接口,容易污染包的 API。本文將解釋現有接口設計準則背後的邏輯,並結合標準庫中的示例進行說明。「接口越大,抽象越弱」大型接口往往難以找到多個實現類型。因此, ⌘ Read more

⤋ Read More

Go 開發者必知:五大緩存策略詳解與選型指南
大家好,我是 Tony Bai。世界讀書日贈書活動火熱進行中,快快參與,也許你就是那個幸運兒。在構建高性能、高可用的後端服務時,緩存幾乎是繞不開的話題。無論是爲了加速數據訪問,還是爲了減輕數據庫等主數據源的壓力,緩存都扮演着至關重要的角色。對於我們 Go 開發者來說,選擇並正確地實施緩存策略,是提升應用性能的關鍵技能之一。目前業界主流的緩存策略有多種,每種都有其獨特的適用場景和優缺點。今天,我們就 ⌘ Read more

⤋ Read More

Go 開發者必知:五大緩存策略詳解與選型指南
大家好,我是 Tony Bai。世界讀書日贈書活動火熱進行中,快快參與,也許你就是那個幸運兒。在構建高性能、高可用的後端服務時,緩存幾乎是繞不開的話題。無論是爲了加速數據訪問,還是爲了減輕數據庫等主數據源的壓力,緩存都扮演着至關重要的角色。對於我們 Go 開發者來說,選擇並正確地實施緩存策略,是提升應用性能的關鍵技能之一。目前業界主流的緩存策略有多種,每種都有其獨特的適用場景和優缺點。今天,我們就 ⌘ Read more

⤋ Read More
In-reply-to » So, Monday, we meet again. I mean, it is not a complain per se. I am glad to meet Monday! I am just not-so-glad to meet the working-from-office Monday. But, so it is.

@prologic@twtxt.net hahahahaha! Don’t you go watering that seed, mate 😅. I mean, we all dream about it, ain’t that right?

⤋ Read More
In-reply-to » How do you stop a dog from barking? 🧐

@kat@yarn.girlonthemoon.xyz No no, it’s just barks at the slightest thing going on around the neighborhod 😃 like it just goes a bit nuts often 🤣 it was a rescue dog, two years old, and it wasn’t treated very well, a street dog. I think it’s just basically afraid of every human in the world 😢

⤋ Read More
In-reply-to » Nobody want to be a shitty programmer. The question is: Do you do anything not to not be one? Reading blogs or social media and watching YouTube videos is fun. After them, your code may be a little better, of course. But you need a lot. You need to study! Read good books and study the code of other programmers, for example. Maybe work with a new language, architectures and paradigms. You need break the routine.

@andros@twtxt.andros.dev

You need break the routine.

I haven’t really done that lately. 🤔 Maybe have another go at Rust (given its increasing importance in the Linux kernel)? Or Elixir, yes, I only had some very, very brief contact with it. 🤔

I just came across an old forum posting of mine about Prolog. That brought up some memories. Prolog is pretty alien, but I do miss stuff like that because it’s so different.

Just thinking out loud here. 😅

⤋ Read More

Nobody want to be a shitty programmer. The question is: Do you do anything not to not be one?
Reading blogs or social media and watching YouTube videos is fun. After them, your code may be a little better, of course. But you need a lot. You need to study! Read good books and study the code of other programmers, for example. Maybe work with a new language, architectures and paradigms. You need break the routine.

If you know Object-oriented programming, you learn functional programming.
If you know Model-View-Controller, you learn Model-View-ViewModel.
If you don’t know anything about architectures, you learn Clean Architecture, Hexagonal Architecture, etc.
If you know Python, you learn Ruby or Go.
If you know Clojure or Lisp… you don’t need to learn anything else. You are already a good programmer. Just kidding. You can learn Elixir or Scala.

Be a good programmer my friend.

⤋ Read More

[$] Flexible data placement
At
the 2025 Linux Storage, Filesystem, Memory
Management, and BPF Summit (LSFMM+BPF) Kanchan Joshi and Keith Busch led a
combined storage and filesystem session on data placement, which concerns
how the data on a storage device is actually written. In a discussion
that hearkened back to previous summits, the idea is to give hints to enterprise-class
SSDs to help them make better choices on where the data should go; hinting
was most recently [discussed at the summit in 2023](https://lwn.net/Articles/932900/ … ⌘ Read more

⤋ Read More
In-reply-to » Confession:

@movq@www.uninformativ.de this is so real… i think we need to bring back topic focused groups but like with a little off topic side of things just in case people wanna go off topic. so the option’s there but the intent is the topic! microblogging isn’t best for this yeah. i think this is part of why IRC still goes strong for many tech people

⤋ Read More

iPhone 17: What’s New With the Cameras
We’ve still got months to go before the new iPhone 17 models come out, but a combination of dummy models and leaks have given us some insight into what we can expect in terms of camera changes.

Image

Apple is adding new camera features, and changing the design of the camera bump for some models. You might be skeptical of dummy m … ⌘ Read more

⤋ Read More
In-reply-to » @movq Oooooohhhhhh, I see. Hmmmm.

@lyse@lyse.isobeef.org there are times that it works out to reply to the “flat” conversation, if it fully relates, or the participants are few, or if the strict topic is kept. When there are too many people, or too many topics being spit out, then forking constantly is the way to go. I am a strong proponent of forking. It’s like telling the rest, “you debate that there, I will take this one aside”.

⤋ Read More
In-reply-to » @prologic not me. I hate monosyllabic replies, specifically on the written medium, so I am just typing this to make it longer. But that doesn't change the truth, and that is, I don't want, nor care, about twtxt, and Activity Pub integration. 😅

@bender@twtxt.net I knew you wouldn’t be interested in a Twtxt+ActivityPub 😂 Now I have to go figure out what “monosyllabic replies” means 🤣

⤋ Read More
In-reply-to » Finally I propose that we increase the Twt Hash length from 7 to 12 and use the first 12 characters of the base32 encoded blake2b hash. This will solve two problems, the fact that all hashes today either end in q or a (oops) 😅 And increasing the Twt Hash size will ensure that we never run into the chance of collision for ions to come. Chances of a 50% collision with 64 bits / 12 characters is roughly ~12.44B Twts. That ought to be enough! -- I also propose that we modify all our clients and make this change from the 1st July 2025, which will be Yarn.social's 5th birthday and 5 years since I started this whole project and endeavour! 😱 #Twtxt #Update

@andros@twtxt.andros.dev @eapl.me@eapl.me @sorenpeter@darch.dk Sad to see you go. 🫤

⤋ Read More
In-reply-to » Finally I propose that we increase the Twt Hash length from 7 to 12 and use the first 12 characters of the base32 encoded blake2b hash. This will solve two problems, the fact that all hashes today either end in q or a (oops) 😅 And increasing the Twt Hash size will ensure that we never run into the chance of collision for ions to come. Chances of a 50% collision with 64 bits / 12 characters is roughly ~12.44B Twts. That ought to be enough! -- I also propose that we modify all our clients and make this change from the 1st July 2025, which will be Yarn.social's 5th birthday and 5 years since I started this whole project and endeavour! 😱 #Twtxt #Update

@eapl.me@eapl.me I honestly believe you are overreacting here a little bit 🤣 I completely emphasize with you, it can be pretty tough to feel part of a community at times and run a project with a kind of “democracy” or “vote by committee”. But one thing that life has taught me about open source projects and especially decentralised ecosystems is that this doesn’t really work.

It isn’t that I’ve not considered all the other options on the table (which can still be), it’s just that I’ve made a decision as the project lead that largely helped trigger a rebirth of the use of Twtxt back in July 1 2020. There are good reasons not to change the threading model right now, as the changes being proposed are quite disruptive and don’t consider all the possible things that could go wrong.

⤋ Read More

We havet an AI assistant at work, new version came out today “nearby restaurant recommendations” mentioned. Gotta try that!

Ask it where I can get a burger, knowing there’s 3 spots that had it on the menu, AI says there’s none. Ask it to list all the restaurants nearby it can check… it knows 3, of the 10 or so around, but 1/3, even has a burger, on the menu.

Ask it to list the whole menu at restaurant 1: it hallucinates random meals, none of which they had (I ate there).

Restaurant 2 (the one most people go to, so they must have at least tested it with this one): it lists the soup of the day and ¾ meals available. Incomplete, but better than false.

Restaurant 3: it says “food” and gives a general description of food. You have to be fucking kidding me!

“BuT cAnInE, tHe A(G)i ReVoLuTiOn Is NoW”

⤋ Read More

Signing key change for Kali Linux
The Kali Linux distribution has announced
that software updates will soon start failing for all users:

This is not only you, this is for everyone, and this is entirely
our fault. We lost access to the signing key of the repository, so
we had to create a new one. At the same time, we froze the
repository (you might have noticed that there was no update since
Friday 18th), so nobody was impacted yet. But we’re going to
unfreez … ⌘ Read more

⤋ Read More

『八股文™』詳解 Go 中的深拷貝與淺拷貝
大家好,我是 moooofly。今天我們來聊一聊:Go 語言中關於深拷貝和淺拷貝的問題。0x01 基礎概念在 Go 語言中,針對如下結構體,如何對其進行淺拷貝和深拷貝?代碼示例如下上述問題的核心在於:需要理解 Go 語言中的值類型和引用類型   需要知道 Go 語言中哪些類型可以直接通過賦值完成安全拷貝,哪些類型需要做深拷貝處理 需要知道如何手動處理嵌套結構中的指針類型,以及需要通過 ⌘ Read more

⤋ Read More

『八股文™』詳解 Go 中的深拷貝與淺拷貝
大家好,我是 moooofly。今天我們來聊一聊:Go 語言中關於深拷貝和淺拷貝的問題。0x01 基礎概念在 Go 語言中,針對如下結構體,如何對其進行淺拷貝和深拷貝?代碼示例如下上述問題的核心在於:需要理解 Go 語言中的值類型和引用類型   需要知道 Go 語言中哪些類型可以直接通過賦值完成安全拷貝,哪些類型需要做深拷貝處理 需要知道如何手動處理嵌套結構中的指針類型,以及需要通過 ⌘ Read more

⤋ Read More
In-reply-to » @prologic Can you please draft up a specification for that proposed change with all the details? Such as which date do you actually refer to? Is it now() or the message's creation timestamp? I reckon the latter is the case, but it's undefined right now. Then we can discuss and potentially tweak the proposal.

@lyse@lyse.isobeef.org LOLed in RL, my office mates were, “what’s going on, where, what?!”. 😂

⤋ Read More

Nothing like being paged at 00:30 (midnight) for a P2 incident that is now resolved at 02:10 🤯 Obviously I’m not going to work tomorrow (I mean today lol 😂) at the usual start time 🤦‍♂️

⤋ Read More
In-reply-to » @prologic In few weeks for sure, I have a couple of features in mind that I would like to implement (DM extension for example but I'll ask for permission to @arne to use his PoC or ask him to contribute to twtxtory directly)

@javivf@adn.org.es Go for it! You’re free to use it.
It’s been a community adventure to explore the whole DM/encryption thing. So the community can do with it whatever they want. 😎

⤋ Read More

使用 Go 構建一個高性能鍵值存儲
我們知道 Redis 是一個高性能的鍵值存儲,如果我們要實現一個高性能的鍵值存儲,嵌入在我們的 Go 應用程序中,那麼這個庫可能會幫助到你。Bolt 是一個由 Go 語言編寫的嵌入式鍵值對數據庫引擎,其核心設計目標是提供簡單、快速且可靠的數據存儲能力。目前,作爲 BoltDB 的優化分支(etcd-io/bbolt), 它尤其適用於需要事務支持和高併發讀寫的應用場景,如配置文件存儲、緩存系統和小型 ⌘ Read more

⤋ Read More

使用 Go 構建一個高性能鍵值存儲
我們知道 Redis 是一個高性能的鍵值存儲,如果我們要實現一個高性能的鍵值存儲,嵌入在我們的 Go 應用程序中,那麼這個庫可能會幫助到你。Bolt 是一個由 Go 語言編寫的嵌入式鍵值對數據庫引擎,其核心設計目標是提供簡單、快速且可靠的數據存儲能力。目前,作爲 BoltDB 的優化分支(etcd-io/bbolt), 它尤其適用於需要事務支持和高併發讀寫的應用場景,如配置文件存儲、緩存系統和小型 ⌘ Read more

⤋ Read More

簡潔架構設計:如何設計一個合理的軟件架構?
提示:本文摘自: 「雲原生 AI 實戰營」 知識星球「Go 項目開發中級實戰課」的第 04 | 簡潔架構設計:如何設計一個合理的軟件架構?[1] 節課。 本文介紹的實戰項目 GitHub 地址爲:https://github.com/onexstack/miniblog 在開發項目之前,需要先設計一個合理的軟件架構。一個好的軟件架構不僅可以大大提高項目的迭代速度,還可以降低項目的閱讀和 ⌘ Read more

⤋ Read More
In-reply-to » To the parents or teachers: How do you teach kids to program these days? 🤔

@movq@www.uninformativ.de I started with Delphi in school, the book (that we never ever used even once and I also never looked at) taught Pascal. The UI part felt easy at first but prevented me from understanding fundamental stuff like procedures or functions or even begin and end blocks for ifs or loops. For example I always thought that I needed to have a button somewhere, even if hidden. That gave me a handler procedure where I could put code and somehow call it. Two or three years later, a new mate from the parallel class finally told me that this wasn’t necessary and how to do thing better.

You know all too well that back in the day there was not a whole lot of information out there. And the bits that did exist were well hidden. At least from me. Eventually discovering planet-quellcodes.de (I don’t remember if that was the original forum or if that got split off from some other board) via my best schoolmate was like finding the Amber Room. Yeah, reading the ITG book would have been a very good idea for sure. :-)

In hindsight, a console program without the UI overhead might have been better. At least for the very start. Much less things to worry about or get lost.

Hence, I’d recommend to start programming with a console program. As for the language, not sure. But Python is probably a good choice, it doesn’t require a lot of surrounding boilerplate like, say Java or Go. It also does exceptionally well in the principle of least surprise.

⤋ Read More

使用 Go 進行 HTTP 流量重放測試
在 Web 安全測試、API 調試、流量回歸測試中,HTTP 流量重放(HTTP Traffic Replay)是一項重要的技術。它可以幫助我們復現問題、測試系統兼容性、進行安全研究等。在這篇文章中,我們將簡單探討 HTTP 流量重放的原理,並通過 Go 語言實現不同的流量重放方案,同時介紹常見的開源工具。(身爲一個在小公司裏的網安牛馬,總得幹些雜活🐂🐎)HTTP 流量重放的原理HTTP 流量重放 ⌘ Read more

⤋ Read More