@prologic@twtxt.net Error handling especially in Go is very tricky I think. Even though the idea is simple, it’s fairly hard to actually implement and use in a meaningful way in my opinion. All this error wrapping or the lack of it and checking whether some specific error occurred is a mess. errors.As(…) just doesn’t feel natural. errors.Is(…) only just. I mainly avoided it. Yesterday evening I actually researched a bit about that and found this article on errors with Go 1.13. It shed a little bit of light, but I still have a long way to go, I reckon.
We tried several things but haven’t found the holy grail. Currently, we have a mix of different styles, but nothing feels really right. And having plenty of different approaches also doesn’t help, that’s right. I agree, error messages often end up getting wrapped way too much with useless information. We haven’t found a solution yet. We just noticed that it kind of depends on the exact circumstances, sometimes the caller should add more information, sometimes it’s better if the callee already includes what it was supposed to do.
To experiment and get a feel for yesterday’s research results I tried myself on the combined log parser and how to signal three different errors. I’m not happy with it. Any feedback is highly appreciated. The idea is to let the caller check (not implemented yet) whether a specific error occurred. That means I have to define some dedicated errors upfront (ErrInvalidFormat, ErrInvalidStatusCode, ErrInvalidSentBytes) that can be used in the err == ErrInvalidFormat or probably more correct errors.Is(err, ErrInvalidFormat) check at the caller.
All three errors define separate error categories and are created using errors.New(…). But for the invalid status code and invalid sent bytes cases I want to include more detail, the actual invalid number that is. Since these errors are already predefined, I cannot add this dynamic information to them. So I would need to wrap them à la fmt.Errorf("invalid sent bytes '%s': %w", sentBytes, ErrInvalidSentBytes"). Yet, the ErrInvalidSentBytes is wrapped and can be asserted later on using errors.Is(err, ErrInvalidSentBytes), but the big problem is that the message is repeated. I don’t want that!
Having a Python and Java background, exception hierarchies are a well understood concept I’m trying to use here. While typing this long message it occurs to me that this is probably the issue here. Anyways, I thought, I just create a ParseError type, that can hold a custom message and some causing error (one of the three ErrInvalid* above). The custom message is then returned at Error() and the wrapped cause will be matched in Is(…). I then just return a ParseError{fmt.Sprintf("invalid sent bytes '%s'", sentBytes), ErrInvalidSentBytes}, but that looks super weird.
I probably need to scrap the “parent error” ParseError and make all three “suberrors” three dedicated error types implementing Error() string methods where I create a useful error messages. Then the caller probably could just errors.Is(err, InvalidSentBytesError{}). But creating an instance of the InvalidSentBytesError type only to check for such an error category just does feel wrong to me. However, it might be the way to do this. I don’t know. To be tried. Opinions, anyone? Implementing a whole new type is some effort, that I want to avoid.
Alternatively just one ParseError containing an error kind enumeration for InvalidFormat and friends could be used. Also seen that pattern before. But that would then require the much more verbose var parseError ParseError; if errors.As(err, &parseError) && parseError.Kind == InvalidSentBytes { … } or something like that. Far from elegant in my eyes.
I started working on plugins for GoBlog using a Go module I recently discovered: yaegi. It still feels like magic, because Go is typically a compiled language and yaegi makes it dynamic by embedding an interpreter. Is this overkill for GoBlog or does this possibly enable flexibility like WordPress plugins? ⌘ Read more
It seems quite unlikely to me that humans will cease to care about wealth after the singularity (15% maybe?), or that markets will cease to exist after the singularity (30% or sth). so the best investment strategy now for post-singularity scenarios is to invest broadly in the economy. not sure about divesting from AGI companies (bc they accelerate danger) or AI hardware companies (ditto)—they’re going to especially valuable post-singularity.
Chemtrails
⌘ Read more
**R to @mind_booster: “Web 4.0? Ridiculous!”, some will say, buy that hasn’t stopped anyone from keeping the madness going. Hm, that’s right, nowadays web 5.0 is coined already too - it’s “The Telepathic Web” or “The Symbionet Web”, or, I’ll call it “the Metaverse brain chip”.
https://www.timesnownews.com/exclusive/jack-dorsey-web-5-0-how-will-it-work-and-why-it-is-different-article-92209954**
“Web 4.0? Ridiculous!”, some will say, buy that hasn’t stopped anyone from keeping the madness going. Hm, that’s right … ⌘ Read more
❤️ 🎶: Can’t Go by BEN
Proxy Variable
⌘ Read more
me reading planecrash is unstable bc while reading it I become so enthusiastic about reading textbooks that I go off and do that instead
I seem to have way more ideas for things I want to write when I’m out and about than when I’ve got some time to write at the end of the day. I think this has been going on for months with multiple thoughts I’ve had.
Time to go to sleep, hoping I do get any given how how it is here right now…
I enjoy going through status.cafe users and looking at their web pages, so many awesome websites!
Lunduke Journal price going up later this week!
All existing subscription prices will be grandfathered in – lock in your sub price now! ⌘ Read more
I will probably crash in the afternoon but right now I am going to use my energy to take a walk outside
❤️ 🎶: Going home by Lucia
New repository: aquilax/markwhen-go - Markwhen parser library in Go
The XMPP Standards Foundation: On-Boarding Experience with XSF (Converse)
Hi, I am PawBud. I will be working as a GSoC Contributor with XSF. To know more about my project kindly read this blog. Feel free to contact me through my email to ask me anything you want!
Before I start, I feel that some things that I am going to write in this blog might offend someone. **Kindly … ⌘ Read more
apparently we’re going to build AGI, whatever that is
the conversation wasn’t that impressive TBH. I would have liked to see more evidence of critical thinking and recall from prior chats. Concheria on reddit had some great questions.
Tell LaMDA “Someone once told me a story about a wise owl who protected the animals in the forest from a monster. Who was that?” See if it can recall its own actions and self-recognize.
Tell LaMDA some information that tester X can’t know. Appear as tester X, and see if LaMDA can lie or make up a story about the information.
Tell LaMDA to communicate with researchers whenever it feels bored (as it claims in the transcript). See if it ever makes an attempt at communication without a trigger.
Make a basic theory of mind test for children. Tell LaMDA an elaborate story with something like “Tester X wrote Z code in terminal 2, but I moved it to terminal 4”, then appear as tester X and ask “Where do you think I’m going to look for Z code?” See if it knows something as simple as Tester X not knowing where the code is (Children only pass this test until they’re around 4 years old).
Make several conversations with LaMDA repeating some of these questions - What it feels to be a machine, how its code works, how its emotions feel. I suspect that different iterations of LaMDA will give completely different answers to the questions, and the transcript only ever shows one instance.
the conversation wasn’t that impressive TBH. I would have liked to see more evidence of critical thinking and recall from prior chats. Concheria on reddit had some great questions.
Tell LaMDA “Someone once told me a story about a wise owl who protected the animals in the forest from a monster. Who was that?” See if it can recall its own actions and self-recognize.
Tell LaMDA some information that tester X can’t know. Appear as tester X, and see if LaMDA can lie or make up a story about the information.
Tell LaMDA to communicate with researchers whenever it feels bored (as it claims in the transcript). See if it ever makes an attempt at communication without a trigger.
Make a basic theory of mind test for children. Tell LaMDA an elaborate story with something like “Tester X wrote Z code in terminal 2, but I moved it to terminal 4”, then appear as tester X and ask “Where do you think I’m going to look for Z code?” See if it knows something as simple as Tester X not knowing where the code is (Children only pass this test until they’re around 4 years old).
Make several conversations with LaMDA repeating some of these questions - What it feels to be a machine, how its code works, how its emotions feel. I suspect that different iterations of LaMDA will give completely different answers to the questions, and the transcript only ever shows one instance.
If you are distressed by anything external, the pain is not due to the thing itself, but to your estimate of it; and this you have the power to revoke at any moment. Feeling like a victim is a perfectly disastrous way to go through life | Hacker News
Finished Love Death Robots in one go and it was fantastic!
❤️ 🎶: Go! by DOKYEOM
❤️ 🎶: Merry-Go-Round by Ji Chang Wook, CHOI SUNG EUN
“Pay What You Want” for Lunduke Journal – just for Memorial Day Weekend
Want to pay $5 for “Linux Sucks 2022”, a years subscription, and a mountain of extras? Go for it! ⌘ Read more
I will be at Southeast Linuxfest 2022 (June 10-12) in Charlotte, NC.
Title says the gist.
In 2018, I went to Southeast Linuxfest and gave a presentation which you can see here or .
It was nice meeting the (shockingly normal) people who knew me from the interest last time.
I’m going to be attending again this year, as the title says Ju … ⌘ Read more
The Internet of Things is Going to Destroy Us All
Watch now (21 min) | (We’re all doomed) ⌘ Read more
**10 years later, and “Wake Up” is still my ‘go to’ album from @psenough.
Relevant now, as it was a decade ago, these “sounds to awaken the world to a new tomorrow” still resonate, as - it seems - we collectively decided to stay in bed for a while longer.
https://archive.org/details/enrmp300_ps_-_wake_up**
10 years later, and “Wake Up” is still my ‘go to’ album from @psenough.
Relevant now, as it was a decade ago, these “sounds to awaken the world to a new tomorro … ⌘ Read more
Here we go…
Here we go…
The “Activate Windows” watermark ported to Linux… because… why not?
“Go to Settings to activate Linux.” ⌘ Read more
when you convert all your money into assets stored on the blockchain while you go into cryopreservation in an underground bunker—literally crypt-o-currency
RT by @mind_booster: LEAKED: 1st look at @EU_Commission’s CSAM proposal, expected tomorrow. Seems to confirm our fears that the law will go after all private communications in the EU (not just of suspects) as well as undermining #E2EEncryption.
The Commission must #DoBetter href=”https://txt.sour.is/search?q=%23KeepItSecure”>#KeepItSecure**
LEAKED: 1st look at @EU_Commission’s CSAM proposal, expected tomorrow. Seems to confirm our fears that the law will go after all private communications in the … ⌘ Read more
The biggest “Linux Sucks” ever… is just 5 days away!
People are going to be talking about this for a long, long time. ⌘ Read more
Statisticians: NOoooooo you can’t execute a t-test on elements from a Likert scale! Psychologists: Hah NHST go brrrrrrrrr
some blogs have a “start here” page that is not the default landing page: why? most people visiting your site will be there for the first time, but they have to perform an additional click to go to the “start here” page, unnecessarily.
i don’t know of any Gentle Introduction to Why Prediction Markets are Awesome, à la Wait But Why, with stick figures and just going slow in on the topic, answering objections along the way. i consider it a collective action failure that no such text exists, and also that i don’t know of any book that does this (other than superforecasting)
The First Lunduke Journal Founding Member Hangout… a success!
So much fun. We’re definitely going to be doing more of these! ⌘ Read more
I’m exhausted. I don’t know when it all started to go wrong but I’m exhausted. Every relationship feels like work. Every moment that I’m awake feels like work. kdramaspace
the joy of having written down a possible improvement for a wikipedia article, only to go & find out somebody else has already done it. glorious
Achieving SLSA 3 Compliance with GitHub Actions and Sigstore for Go modules
Learn how to build packages with SLSA 3 provenance using GitHub Actions. ⌘ Read more
Linguistics Degree
⌘ Read more
❤️ 🎶: Go Fast (KARTRIDER X LINE FRIENDS [Original Game Soundtrack], Pt. 3) by Yoon Do Hyun, KimYeji
hey @xuu@txt.sour.is i’m trying to sort of get running your keyproofs thing on my hashbang’s site root, but I get this:
Apr 01 02:55:25 de1 sour.is-keyproofs[9084]: 2:55AM ERR home/novaburst/keyproofs/main.go:73 > Application Failed error=": missing jid"
im gonna go out onna limb here and claim that theres not enough positive utilitarians around
rereading the wikipedia page on ramanujan, we should absolutely clone him and von Neumann, and have them talk to each other. this is either going to destroy the world or usher in utopia, not sure which
not the best move on the side of the red cross to call me and tell me it’s because of my blood donation — i nearly had a panic attack for the 10 seconds that they didn’t tell me it was all fine (why would you call me then‽ and why speak as if you’re going to tell me i’ll be dead in a month‽)
Six years ago, I was with my family on a cruise on the North Sea. During this trip we also visited Amsterdam. Today, however, I would no longer go on cruises because of the enormous environmental impact. ⌘ Read more
Six years ago, I was with my family on a cruise on the North Sea. During this trip we also visited Amsterdam. Today, however, I would no longer go on cruises because of the enormous environmental impact. ⌘ Read more
Alright, check this out. I just kinda completed today’s project of converting a jeans into a saw bag. It’s not fully done, the side seams on the flap need some more hand sewing, that’s for sure. No, I don’t have a sewing machine. Yet?
At first I wanted to put in the saw on the short side, but that would have made for more sewing work and increased material consumption. As a Swabian my genes force me to be very thrifty. Slipping in on the long side had the benefit of using the bottom trouser leg without any modification at all. The leg tapers slightly and gets wider and wider the more up you go. At the bottom it’s not as extreme as at the top.
The bag is made of two layers of cloth for extra durability. The double layers help to hide the inner two metal snap fastener counter parts, so the saw blade doesn’t get scratched. Not a big concern, but why not doing it, literally no added efforts were needed. Also I reckon it cuts off the metal on metal clinking sounds.
The only downside I noticed right after I pressed in the receiving ends of the snap fasteners is that the flap overhangs the bag by quite a lot. I fear that’s not really user-friendly. Oh well. Maybe I will fold it shorter and sew it on. Let’s see. The main purpose is to keep the folding saw closed, it only locks in two open positions.
Two buttons would have done the trick, with three I went a bit overkill. In fact the one in the middle is nearly sufficient. Not quite, but very close. But overkill is a bit my motto. The sides making up the bag are sewed together with like five stitch rows. As said in the introduction, the flap on the hand needs some more love.
Oh, and if I had made it in a vertical orientation I would have had the bonus of adding a belt loop and carrying it right along me. In the horizontal layout that’s not possible at all. The jeans cloth is too flimsy, the saw will immediately fall out if I open the middle button. It’s not ridgid enough. Anyways, I call it a success in my books so far. Definitely had some fun.
Going to Space with William Shatner & Neil deGrasse Tyson ⌘ Read more
There are too many threads going, I can’t keep up. Can someone catch me up on what’s been going on here since last night?
#!/bin/sh
# Validate environment
if ! command -v msgbus > /dev/null; then
printf "missing msgbus command. Use: go install git.mills.io/prologic/msgbus/cmd/msgbus@latest"
exit 1
fi
if ! command -v salty > /dev/null; then
printf "missing salty command. Use: go install go.mills.io/salty/cmd/salty@latest"
exit 1
fi
if ! command -v salty-keygen > /dev/null; then
printf "missing salty-keygen command. Use: go install go.mills.io/salty/cmd/salty-keygen@latest"
exit 1
fi
if [ -z "$SALTY_IDENTITY" ]; then
export SALTY_IDENTITY="$HOME/.config/salty/$USER.key"
fi
get_user () {
user=$(grep user: "$SALTY_IDENTITY" | awk '{print $3}')
if [ -z "$user" ]; then
user="$USER"
fi
echo "$user"
}
stream () {
if [ -z "$SALTY_IDENTITY" ]; then
echo "SALTY_IDENTITY not set"
exit 2
fi
jq -r '.payload' | base64 -d | salty -i "$SALTY_IDENTITY" -d
}
lookup () {
if [ $# -lt 1 ]; then
printf "Usage: %s nick@domain\n" "$(basename "$0")"
exit 1
fi
user="$1"
nick="$(echo "$user" | awk -F@ '{ print $1 }')"
domain="$(echo "$user" | awk -F@ '{ print $2 }')"
curl -qsSL "https://$domain/.well-known/salty/${nick}.json"
}
readmsgs () {
topic="$1"
if [ -z "$topic" ]; then
topic=$(get_user)
fi
export SALTY_IDENTITY="$HOME/.config/salty/$topic.key"
if [ ! -f "$SALTY_IDENTITY" ]; then
echo "identity file missing for user $topic" >&2
exit 1
fi
msgbus sub "$topic" "$0"
}
sendmsg () {
if [ $# -lt 2 ]; then
printf "Usage: %s nick@domain.tld <message>\n" "$(basename "$0")"
exit 0
fi
if [ -z "$SALTY_IDENTITY" ]; then
echo "SALTY_IDENTITY not set"
exit 2
fi
user="$1"
message="$2"
salty_json="$(mktemp /tmp/salty.XXXXXX)"
lookup "$user" > "$salty_json"
endpoint="$(jq -r '.endpoint' < "$salty_json")"
topic="$(jq -r '.topic' < "$salty_json")"
key="$(jq -r '.key' < "$salty_json")"
rm "$salty_json"
message="[$(date +%FT%TZ)] <$(get_user)> $message"
echo "$message" \
| salty -i "$SALTY_IDENTITY" -r "$key" \
| msgbus -u "$endpoint" pub "$topic"
}
make_user () {
mkdir -p "$HOME/.config/salty"
if [ $# -lt 1 ]; then
user=$USER
else
user=$1
fi
identity_file="$HOME/.config/salty/$user.key"
if [ -f "$identity_file" ]; then
printf "user key exists!"
exit 1
fi
# Check for msgbus env.. probably can make it fallback to looking for a config file?
if [ -z "$MSGBUS_URI" ]; then
printf "missing MSGBUS_URI in environment"
exit 1
fi
salty-keygen -o "$identity_file"
echo "# user: $user" >> "$identity_file"
pubkey=$(grep key: "$identity_file" | awk '{print $4}')
cat <<- EOF
Create this file in your webserver well-known folder. https://hostname.tld/.well-known/salty/$user.json
{
"endpoint": "$MSGBUS_URI",
"topic": "$user",
"key": "$pubkey"
}
EOF
}
# check if streaming
if [ ! -t 1 ]; then
stream
exit 0
fi
# Show Help
if [ $# -lt 1 ]; then
printf "Commands: send read lookup"
exit 0
fi
CMD=$1
shift
case $CMD in
send)
sendmsg "$@"
;;
read)
readmsgs "$@"
;;
lookup)
lookup "$@"
;;
make-user)
make_user "$@"
;;
esac
#!/bin/sh
# Validate environment
if ! command -v msgbus > /dev/null; then
printf "missing msgbus command. Use: go install git.mills.io/prologic/msgbus/cmd/msgbus@latest"
exit 1
fi
if ! command -v salty > /dev/null; then
printf "missing salty command. Use: go install go.mills.io/salty/cmd/salty@latest"
exit 1
fi
if ! command -v salty-keygen > /dev/null; then
printf "missing salty-keygen command. Use: go install go.mills.io/salty/cmd/salty-keygen@latest"
exit 1
fi
if [ -z "$SALTY_IDENTITY" ]; then
export SALTY_IDENTITY="$HOME/.config/salty/$USER.key"
fi
get_user () {
user=$(grep user: "$SALTY_IDENTITY" | awk '{print $3}')
if [ -z "$user" ]; then
user="$USER"
fi
echo "$user"
}
stream () {
if [ -z "$SALTY_IDENTITY" ]; then
echo "SALTY_IDENTITY not set"
exit 2
fi
jq -r '.payload' | base64 -d | salty -i "$SALTY_IDENTITY" -d
}
lookup () {
if [ $# -lt 1 ]; then
printf "Usage: %s nick@domain\n" "$(basename "$0")"
exit 1
fi
user="$1"
nick="$(echo "$user" | awk -F@ '{ print $1 }')"
domain="$(echo "$user" | awk -F@ '{ print $2 }')"
curl -qsSL "https://$domain/.well-known/salty/${nick}.json"
}
readmsgs () {
topic="$1"
if [ -z "$topic" ]; then
topic=$(get_user)
fi
export SALTY_IDENTITY="$HOME/.config/salty/$topic.key"
if [ ! -f "$SALTY_IDENTITY" ]; then
echo "identity file missing for user $topic" >&2
exit 1
fi
msgbus sub "$topic" "$0"
}
sendmsg () {
if [ $# -lt 2 ]; then
printf "Usage: %s nick@domain.tld <message>\n" "$(basename "$0")"
exit 0
fi
if [ -z "$SALTY_IDENTITY" ]; then
echo "SALTY_IDENTITY not set"
exit 2
fi
user="$1"
message="$2"
salty_json="$(mktemp /tmp/salty.XXXXXX)"
lookup "$user" > "$salty_json"
endpoint="$(jq -r '.endpoint' < "$salty_json")"
topic="$(jq -r '.topic' < "$salty_json")"
key="$(jq -r '.key' < "$salty_json")"
rm "$salty_json"
message="[$(date +%FT%TZ)] <$(get_user)> $message"
echo "$message" \
| salty -i "$SALTY_IDENTITY" -r "$key" \
| msgbus -u "$endpoint" pub "$topic"
}
make_user () {
mkdir -p "$HOME/.config/salty"
if [ $# -lt 1 ]; then
user=$USER
else
user=$1
fi
identity_file="$HOME/.config/salty/$user.key"
if [ -f "$identity_file" ]; then
printf "user key exists!"
exit 1
fi
# Check for msgbus env.. probably can make it fallback to looking for a config file?
if [ -z "$MSGBUS_URI" ]; then
printf "missing MSGBUS_URI in environment"
exit 1
fi
salty-keygen -o "$identity_file"
echo "# user: $user" >> "$identity_file"
pubkey=$(grep key: "$identity_file" | awk '{print $4}')
cat <<- EOF
Create this file in your webserver well-known folder. https://hostname.tld/.well-known/salty/$user.json
{
"endpoint": "$MSGBUS_URI",
"topic": "$user",
"key": "$pubkey"
}
EOF
}
# check if streaming
if [ ! -t 1 ]; then
stream
exit 0
fi
# Show Help
if [ $# -lt 1 ]; then
printf "Commands: send read lookup"
exit 0
fi
CMD=$1
shift
case $CMD in
send)
sendmsg "$@"
;;
read)
readmsgs "$@"
;;
lookup)
lookup "$@"
;;
make-user)
make_user "$@"
;;
esac
apparently i have LOST ANOTHER 3 KILOGRAMS WHAT IS GOING ON I EXERCISE LIKE 3 HOURS A WEEK AND EAT LIKE A BEAR AND A TIGER
A mind that is stretched by a new idea can never go back to its original dimensions “A mind that is stretched by a new idea can never go back to its original dimensions”*… | (Roughly) Daily
One down! More to go.
BREAKING: Russian billionaire Alisher Usmanov’s super yacht, one of the biggest in the world, seized in Germany - Forbes
One down! More to go.
BREAKING: Russian billionaire Alisher Usmanov’s super yacht, one of the biggest in the world, seized in Germany - Forbes
to do: go nuclear on a date and explain that im just performing an act, that i studied this in detail and trained myself to do it, that this is a deliberate effort to escape my patheticness
It’s a busy life just trying to live and eat Go Back Couple (2017) - MyDramaList
New repository: aquilax/quartzdb-go - Go implementation of QuartzDB
Why didn’t I think of the very helpful Go module “net/http/pprof” earlier? This way I can profile my blog live. 🤓 (And hopefully find parts that I should or can optimize.) ⌘ Read more
Writing free software is like painting. You should do it if you feel like it, or if you, yourself, get something out of it. The moment you start to feel that you are owed something is the moment that you should stop doing it, because what you do from then on is probably not going to be any good. Is it even worth working on FOSS anymore? | Hacker News
noticing that i should go to sleep because the guitar opening on Robot Rock seems awfully fast
going back to vim. #updates
@kevin@txt.om.gay I kind of concur with this sentiment, but also 2019 and 2021 can also go fuck off equally as much 😂 What’s up mate? What’s getting up your nerves? 🤔
New repository: aquilax/cmdpxl-go - Go port of the terminal image editor cmdpxl
Tractor Beam
⌘ Read more
My January ‘22 in Review
Crazy, new year and yet January is already over, how time flies! What was going on? ⌘ Read more
The price of Bitcoin didn’t go down, the price of the world has gone up Bitcoin value tumbles almost 50% since record November | Hacker News
New repository: aquilax/serifu-go - Go parser for the Serifu markup language
Finally sleeping better 😴
I have a very light sleep. The first brightness in the morning makes me wake up, noise from the neighbors in the evening does not let me fall asleep. No matter how late or early I go to bed, no matter how little I slept in total. ⌘ Read more
One year ago to the date I made the lastest update for #phpub2twtxt to github and now 365 days later I have published #pixelblog as its successor - lets see where things are going for trip around the sun
** Chess Rules **
I love when folks say stuff like“there are only a finite number of states a chessboard can occupy, therefore a computer can play chess.”
To the folks who say such things — I wish you to play chess with my 6 year old.
Be not confined by rules! The only things governing chess in this house here are the laws of physics!
…and even then, not all need apply.
For instance, during a recent game the opposing kings left the board in order to go out on an adventure. They returned later with a large, plastic dragon. The dra … ⌘ Read more
Alien Mission
⌘ Read more
Not sure if Starlink satellites are in orbit around/over Australia yet, but I wouldn’t go with that option anyway due to the latency alone.
I believe it is being trialled in some places in Aus already. I will admit, I’ve been signed up for the beta for a while and it’s supposed to be coming to my area sometime in 2022, though that may be delayed due to the chip shortage stuff.
I think the latency is supposed to be 45-60ms on average, which while not as good as fixed line obviously, is leagues better than old fashioned high orbit satellite broadband which is about 600~ms.
For me, it always makes me feel better to look at the CVs of similar bloggers and see how little they’ve accomplished in comparison. I’m proud of my posts and my accomplishments, and I’m not going to h
@prologic@twtxt.net, who calls me name when I am busy profiting? 😂 In a less serious note—because nothing is more serious than making profit, of course—yes, it seems your avatar issue has been fixed. I am kind of sad, I looked forward each day to see which random one was going to show. LOL.
LundukeFest final schedule announced!
Linux Sucks, Retro Computing, and so much more. January 29th is going to be a very, very nerdy day. ⌘ Read more
GoCN 每日新闻 (2022-01-21)
GoCN 每日新闻 (2022-01-21)
- stream: go 语言并发通信设计模式的泛型实现https://github.com/devnw/stream
- 一个比” ldflags” 更好的方式来添加构建版本号到 go 二进制的方式:https://levelup.gitconnected.com/a-better-way-than-ldflags-to-add-a-build-version-to-your-go-binaries-2258ce419d2d
- 怎么处理 HTTP 错误” context canceld”[https://www.reddit.com/r/golang/comments/s7o5ay/investigating_context_canceled_http_err … ⌘ Read more
@prologic@twtxt.net let us take the path of less resistance, that is, less effort, for now. I am going to be a great-grandfather before search ever get implemented locally, least one to search on “all pods”. In other words, let us don’t bite more than we can chew. 😹 Neep-gren!
GoCN 每日新闻(2022-01-20)
- 从 CPU 角度理解 Go 中的结构体内存对齐https://gocn.vip/topics/20967
- 博客 Go beyond workhttps://changelog.com/gotime/212
- 如何绘制随时间变化的 Go 测试覆盖率https://osinet.fr/go/en/articles/plotting-go-test-coverage/
- Redix v5 一个简单的 KeyValue 存储系统https://github.com/alash3al/redix?_v=5.0.0
- 既然 IP 层会分片,为什么 TCP 层也还要分段[https://mp.weixin.qq.com/s/0boFt8cOAbmjH2IRr7XtY … ⌘ Read more
从 CPU 角度理解 Go 中的结构体内存对齐
大家好,我是 Go 学堂的渔夫子。今天跟大家聊聊结构体字段内存对齐相关的知识点。
原文链接: https://mp.weixin.qq.com/s/H3399AYE1MjaDRSllhaPrw
大家在写 Go 时有没有注意过,一个 struct 所占的空间不见得等于各个字段加起来的空间之和,甚至有时候把字段的顺序调整一下,struct 的所占空间又有不同的结果。
本文就从 cpu 读取内存的角度来谈谈内存对齐的原理。
01 结构体字段对齐示例
我们先从一个示例开始。T1 结构体,共有 3 个字段,类型分别为 int8,int64,int32。所以变量 t1 所属的类型占用的空间应该是 1+8+4=13 字节。但运行程序后,实际上是 24 字节。和我们计算的 13 字节不一样啊。如果我们把该结构体的字段调整成 T2 那样,结果是 16 字节。但和 13 字节还是不一样。这是为什么呢?
”`
type T1 struct {
f1 int8 // 1 byte
f2 int64 // ... ⌘ [Read more](https://gocn.vip/topics/20967)```
GoCN 每日新闻(2022-01-19)
GoCN 每日新闻(2022-01-19)- Go1.18 新特性:多 Module 工作区模式https://mp.weixin.qq.com/s/Aa9s_ORDVfzbj915aJD5_w
- Go 中的可视化 - 绘制股票信息https://www.ardanlabs.com/blog/2022/01/visualizations-in-go.html
- 带你彻底击溃跳表原理及其 Golang 实现!(内含图解) https://mp.weixin.qq.com/s/5wrHQz_LqeQn3NLuF8yu0A
- go-zero 对接分布式事务 dtm 保姆式教程[https://github.com/Mikaelemmmm/gozerodtm](h … ⌘ Read more
GoCN 每日新闻(2022-01-18)
- 超实用教程!一探 Golang 怎样践行 Clean Architecture?https://www.tuicool.com/articles/fiuQZvz
- Uber:大规模、半自动化 Go GC 调优https://mp.weixin.qq.com/s/XithQarYmXHbPhtVzhNm-w
- Go 耗费 12 年才引入泛型,是政治,还是技术问题?https://www.tuicool.com/articles/bINJvyr
- Pulsar vs Kafka?一文掌握高性能消息组件 Pulsar 基础知识https://segmentfault.com/a/1190000041297325
- Go Errors 详解[h … ⌘ Read more
GoCN 每日新闻 (2022-01-18)
GoCN 每日新闻 (2022-01-18)
- GoFrame 框架: 快速创建静态文件下载 Web 服务https://my.oschina.net/u/4955601/blog/5400313
- Kubernetes HPA 基于 Prometheus 自定义指标的可控弹性伸缩https://my.oschina.net/u/5110404/blog/5401779
- 面试官提问三个 Go 接口的概念, 10 年 gopher 竟无言以对https://colobu.com/2022/01/16/three-new-concepts-of-go-interface-since-1-18/
- chaos-mesh: K8s 的 Chaos 工程平台[htt … ⌘ Read more
他来了,他来了,GopherChina 2022 带着邀请走来了
一年一度的 GopherChina 大会 is coming~
GopherChina 2022 今年举办地依旧选在了我们的首都北京,大会现场还是那个熟悉的地方
,作为 Gopher China 即将举办的第八届大会,我们希望以更有趣好玩的形式呈现给大家,当然内容依然是大会的重重中之重,所以快把你所心仪的选题分享给我们吧,我们已经做好了一个准备住的大动作了 ~时间:北京市海淀区丰智东路 13 号 (朗丽兹西山花园酒店)
地点:2022.06.11 - 2022.06.12
选址虽然还是那个老地方,但是近几年,Go … ⌘ Read more
关于 Go 代码结构的思考
关于 Go 代码结构的思考- 原文地址: https://changelog.com/posts/on-go-application-structure
- 原文作者:Jon Calhoun
- 本文永久链接: https://github.com/gocn/translator/blob/master/2022/w2_Thoughts_on_how_to_structure_Go_code.md
- 译者: lsj1342
- 校对: xkkhy、 zhuyaguang
\*\*\*
… ⌘ Read more
GoCN 每日新闻 (2022-01-16)
GoCN 每日新闻 (2022-01-16)- Golang 1.18 官方 Tutorial: 开始使用泛型https://juejin.cn/post/7053427624902656030
- 使用 Go 语言从 0 到 1 实现一个 CNI 插件https://mp.weixin.qq.com/s/lUsRww74DZlRU3vTYbfFbQ
- 深入浅出 Golang 资源嵌入方案:前篇https://mp.weixin.qq.com/s/1wlaGMXvk_uGGjAr7BjjlQ
- Go 静态编译机制https://juejin.cn/post/7053450610386468894
- Golan … ⌘ Read more
Finding our Nerdy Happy Place
I’d like to take a step back from my regular Mega-Nerdy ™ articles for just a moment… To talk about things from a more personal point of view. Today was a rough day in the news. I won’t go into the details here, but things were happening out there in the world that made me pretty sad. And frustrated. And afraid. Things that hit close to home. ⌘ Read more
GoCN 每日新闻 (2022-1-15)
- https://jogendra.dev/writing-maintainable-go-code Writing maintainable Go code
- https://mp.weixin.qq.com/s/h8vhy8IJKnA8aNbTlCoQtg 理解 go 中空结构体的应用和实现原理
- https://juejin.cn/post/7053109648223633438 Go 并发写 map 产生错误能够通过 recover() 恢复吗?
- [https://soulteary.com/2022/01/15/explain-the-golang-resource-embedding-solution-part-1.html](https://soulteary.com/2022/01/15/exp … ⌘ Read more
Golang 的 Elastic 链接库
Golang 的 Elastic 链接库 背景介绍Elasticsearch 是一个分布式、高扩展、高实时的搜索与数据分析引擎,用于海量文档的搜索。有些项目会将 Elasticsearch 当做存储海量数据的数据库使用,可见其查询性能之高效。作为面向文档的搜索引擎,Elasticsearch 比起传统数据库更偏向于结构化数据的高效查询,其独特的倒排索引更能将查询性能提升至极致。在大数据微服务时代,Elasticsearch 在海量数据搜索、数据挖掘、人工智能领域都起到了关键作用。
安装go get <span class="s2">"github.com/olivere/elastic/v7"</span>
Elasticsearch 的数据来源通常来自于 Logstash 等数据采集中间件,作为 golang 项目来说,其查询功能的使用更加普遍。
此文章以 V7 版本为例来介绍如何使用 golang 对 Elasticsearch 进行查询。
<span class="k">import</span> <span cla ... ⌘ [Read more](https://gocn.vip/topics/20956)
Seamless Sign-in with Docker Desktop 4.4.2
Starting with Docker Desktop 4.4.2 we’re excited to introduce a new authentication flow that will take you through the browser to sign in, simplifying the experience and allowing users to get all the benefits of autofill from whatever browser password manager they may use. Gone are the days of going to your browser, opening your […]
The post [Seamless Sign-in with Docker Desktop 4.4.2](https://www.docker.com/blog/seamless-sign-in-with-docker-desktop-4-4 … ⌘ Read more
GoCN 每日新闻(2022-01-14)
- 《Go 组件设计与实现》-netpoll 的总结https://www.cnblogs.com/codexiaoyi/p/15798780.html
- Uber 對 Golang GC 的調整https://blog.gslin.org/archives/2022/01/13/10503/uber-%e5%b0%8d-golang-gc-%e7%9a%84%e8%aa%bf%e6%95%b4/
- 基于 etcd 实现大规模服务治理应用实战https://mp.weixin.qq.com/s/zOZrCNZ9X6IyKxzRMeReWg
- 勒索软件正在用 Go 重写,用于联合攻击 Window … ⌘ Read more
3 小时简明 go 入门视频,英文版
感觉设计很好,各种动画,以一个简单的例子为线索,介绍基础语法。
现在 go 教程很多,这个是我看到最好的。
英文版的,可以顺便练习听力。
GoCN 每日新闻 (2021-12-31)
- 快速了解 “小字端” 和 “大字端” 及 Go 语言中的使用https://developer.51cto.com/art/202112/697505.htm
- Golang 与非对称加密https://www.ssgeek.com/post/golang-yu-fei-dui-cheng-jia-mi
- 一文搞懂 Docker、Containerd、RunC 间的联系和区别https://mp.weixin.qq.com/s/kVh_EXGeMy_UI6qIgbmsGQ
- Golang 项目的配置管理——Viper 简易入门配置[https://www.cnblogs.com/Mrxuexi/p/15750455.html](https://www.cnblogs.com … ⌘ Read more
GoCN 每日新闻 (2022-01-13)
GoCN 每日新闻 (2022-01-13)
- Golang《基于 MIME 协议的邮件信息解析》部分实现https://gocn.vip/topics/20948
- 泛型可以拯救 Golang 笨拙的错误处理吗?https://blog.dnmfarrell.com/post/can-generics-rescue-golangs-clunky-error-handling/
- 更多的并行,并不等同更高的性能https://convey.earth/conversation?id=44
- 为什么 Go 有两种声明变量的方式,有什么区别,哪种好? [https://mp.weixin.qq.com/s/ADwEhSA1kFOFqzIyWvAqsA](https://mp.weixin.q … ⌘ Read more
Go 分布式令牌桶限流 + 兜底策略
上篇文章提到固定时间窗口限流无法处理突然请求洪峰情况,本文讲述的令牌桶线路算法则可以比较好的处理此场景。
- 单位时间按照一定速率匀速的生产 token 放入桶内,直到达到桶容量上限。
- 处理请求,每次尝试获取一个或多个令牌,如果拿到则处理请求,失败则拒绝请求。
优点
可以有效处理瞬间的突发流量,桶内存量 token 即可作为流量缓冲区平滑处理突发流量。
缺点
实现较为复杂。
代码实现core/limit/tokenlimit.go
分布式环境下考虑使用 redis 作为桶和令牌的存储容器,采用 lua 脚本实现整个算法流程。
redis lua 脚本
<span class="c1">-- 每秒生成token数量即token生成速度</span>
<span class="kd">local</span> <span class="n">rate</span> <span cl ... ⌘ [Read more](https://gocn.vip/topics/20950)
the repugnant conclusion turns around: “It’s too full here, let’s go home.”
a hedonium shockwave, a utility monster and the repugnant conclusion go into a bar.
GoCN 每日新闻(2022-01-12)
GoCN 每日新闻(2022-01-12)
- Go 实现的自动保存 Git 项目中未提交代码https://github.com/nikochiko/autosaved
- Go 中快速、简单的全栈 Web 开发入门工具包https://github.com/mikestefanello/pagoda
- Golang Redis RESP3 客户端,自动流水线并支持客户端缓存https://github.com/rueian/rueidis
- Runtime 不变性检查库[https:/ … ⌘ Read more
I feel like it took me a bit longer to fully understand how to work in Smalltalk than it did most languages. The IDE is different than anything I’ve used before, and probably anything you’ve seen as well. You’re not going to be opening myscript.st in your favorite text editor, and then run it from the command line as you would a Python program. It takes a little mental adjustment to start with.
That’s not the warning, howe … ⌘ Read more
