The Turris Omnia router is an unusual device. Manufacturers tend to abandon their devices after a while, forcing their customers to buy shiny new hardware. The good souls behind the Omnia, the Czech domain registry CZ NIC, have a different strategy. They are constantly improving and enhancing their offering to existing customers.
Syncthing integration The https://syncthing.net/ is an open source file synchronization tool. Simply speaking. It can transfer files from A to B, or from B to A, or to mirror changes between A and B....
Why and how I built the simply server-less @hintjensquotes@botsin.space bot. And my tribute to Pieter.
Recently I setup the Mastodon bot serving quotes of Pieter Hintjens. Pieter was one of the most influential man I ever met. And I do consider his ideas as brilliant, though-provoking, sometimes counter intuitive and typically in a sharp opposition to industry practices. His list of achievements is amazing, he was a president of Foundation for a Free Information Infrastructure fighting the software patents in Europe....
While Go comes with go test and a testing package by default, the experience can be better with testify package. Git hub page introduces it as Go code (golang) set of packages that provide many tools for testifying that your code will behave as you intend.
By the end I found the resulting article as too long (~25 minutes) to read, so I split it into
Part1 introduces assert, talks briefly abot Python and C and shows basics of testify Part2 introduces table driven testing, more helpers like ElementsMatch or JSONeq Part3 gets more advanced with test suited and mocks Test suites While testing documentation encourages table driven tests and subtests, there are many developers outside, who are used to write Smalltalk like unit tests and this style encourages writing test suites....
While Go comes with go test and a testing package by default, the experience can be better with testify package. Git hub page introduces it as Go code (golang) set of packages that provide many tools for testifying that your code will behave as you intend.
By the end I found the resulting article as too long (~25 minutes) to read, so I split it into
Part1 introduces assert, talks briefly abot Python and C and shows basics of testify Part2 introduces table driven testing, more helpers like ElementsMatch or JSONeq Part3 gets more advanced with test suited and mocks Table driven testing Table driven testing is common and usefull go idiom....
While Go comes with go test and a testing package by default, the experience can be better with testify package. Git hub page introduces it as Go code (golang) set of packages that provide many tools for testifying that your code will behave as you intend.
By the end I found the resulting article as too long (~25 minutes) to read, so I split it into
Part1 introduces assert, talks briefly abot Python and C and shows basics of testify Part2 introduces table driven testing, more helpers like ElementsMatch or JSONeq Part3 gets more advanced with test suited and mocks Standard approach Example as it comes with a testing package from the standard library....
The common problem for monorepo and go modules is that the following
It is really easy to miss the go.mod replace directive
In a following text we will learn more about Linux, namespaces and container technologies like Docker or Podman.
The problem While go build is awesome tool, doing a lot of things in the background has sometimes consequences. And the typical consequences is when we build the software from an environment without network access....
Problem Once upon a time I got a task to merge duplicate URLs in our production database. It turned out that there were a lot of same urls like https://example.com?fbclid=1234 and https://example.com?fbclid=5678 we wanted to merge. Code to normalize URL was easy to develop. Code to migrate the database looked easy as weel. Until I turned the transaction on. Then very cryptic message appeared
1 pq: unexpected Parse response 'C' The error message was telling me nothing....
Go database/sql defines interfaces for SQL databases. Actual driver must be implemented in own package. And dependency injection is done as a part of import and build system. Lets go deeper to see how it is actually implemented.
This exercise will result in a simple driver backed up by csv files. Who do not want to SELECT from csv file?
Disclaimer: I wrote it in order to learn database/sql and to learn more about design of APIs for go....
Running go mod download slows down each CI run a lot. More dependencies increases time and it wastes the bandwidth again and again. As we do use special CI containers for the task, then go modules can be downloaded during container build phase and CI build will benefit from it. There are many articles about this topic. However most of them discuss one go module per repository or Docker image. As I wrote recently, we do use monorepo with many go modules....
As a long time Firefox user I was horrified to use web browser with very limited blocking capabilities. However Samsung Browser is very handy tool for some sites. However the number of spam, scam, or porn pages and advertisements makes browsing there very unpleasant experience. Especially if your kids want to browse that way.
However I bought Turris Omnia especially because I wanted to hack around.
Source: turris.cz
Options As router provides Doman Name Service for all devices in local network, the most common way is to block DNS lookups for specified domains....