
Follow for Golang tips and curated Golang job openings by @msgtonaveen https://teapawt.net/t.co/BHkflux8SA - Simple Go tutorials
Joined April 2017
- Tweets1.2K
- Following32
- Followers8.4K
- Likes610
golangbot retweeted
Ladybird is now in alpha 🐞
Downloads for macOS and Linux available on our website.
ladybird.org/posts/alpha/
We rebuilt our email API to Go.
It took 7 weeks and 140 PRs, and we've been running in production for weeks at roughly half the median latency and one seventh the memory usage per task.
Here's what it took to move our most critical API to Go 👇
“Go Turns 17” by Austin Clements, for the Go team — go.dev/blog/17years
#golang
“A new Go API for JSON” by Michael Pratt, Joe Tsai, Daniel Martí, Johan Brandhorst-Satzkorn, Roger Peppe, Chris Hines, and Damien Neil — go.dev/blog/jsonv2 #golang
“Our Response To The eMudhra Key Disclosure Incident” by Roland Shoemaker, on behalf of the Go Security team — go.dev/blog/emudhra-incident
#golang
I have written an article about using the principle of least privilege to write secure Go code. It covers
*Over privileged DB handles
*Inadvertently logging sensitive data
* Unmarshalling user input using over privileged structs
Tutorial URL: golangbot.com/secure-go-code…
#golang
The preconnect keyword for the rel attribute of the <link> element is a hint to browsers that the user is likely to need resources from the target resource's origin, and therefore the browser can likely improve the user experience by preemptively initiating a connection to that origin.
Preconnecting speeds up future loads from a given origin by preemptively performing part or all of the handshake.
Example code
<link rel="preconnect" href="example.com" />
Read more: developer.mozilla.org/en-US/…
Bulk inserts for Postgres in sqlc without batch queries is possible using Postgres' unnest() function.
For example, unnest(ARRAY[1,2]) is expanded to the rows
1
2
The following is an example of multiple insert query using unnest
INSERT INTO domain (id, domain, port_no, customer_id) VALUES (
unnest(@id_array::uuid[]),
unnest(@domain_array::text[]),
unnest(@port_array::text[]),
unnest(@customer_id_array::uuid[])
) RETURNING *;
#golang #sqlc
I have been hosting my SAAS apps in baremetal servers/virtual machines for quite sometime. Here are some of the basic security measures that should be implemented to secure the server
1. Disable ssh login via password. Enforce ssh using only public/private key authentication.
2. Disable root user login and create a new user with sudo privileges.
3. Setup a jump host and allow ssh access to the baremetal server only from the jump host using IP allow listing.
4. Configure IP tables and only expose ports required by the application.
5. Run applications with the least privileges required. Avoid running services as root.
#linux #security #tips
I have started working on the ssl monitoring and alerting feature for sslnotify.com
This is one of the mockups I came up with for the page that lists all the domains being monitored.
The front end is built using Bootstrap, jQuery and Go templates with most of the pages rendered on the server using Go templates. No fancy SPA, no React, no fancy JavaScript libraries.
I like creating frontends the way they used to be done in the good old days!
Postgres 19 Beta 1 has a new ON CONFLICT DO SELECT statement.
This statement returns rows that conflict during an upsert operation.
INSERT INTO customer (
id, email, password
) VALUES (
'a20bf431-48fc-458fb240-6207676e5099','[email protected]', 'pwd'
)
ON CONFLICT (email) DO SELECT
RETURNING *;
The above query is an atomic insert and select query. If email is a unique key in the table, the above query returns the existing row when the email `[email protected]` already exists in the table.
postgresql.org/docs/19/sql-i…
I am using sqlc for coding sslnotify.com and found it quite useful. Writing queries and getting sqlc to generate the Go code is impressive. It does have a few features missing like
1. Inability to rename the functions sqlc generates
2. Limited support for /lib/pq when compared to jackc/pgx.
These are the types I have overridden in my sqlc.yaml
overrides:
- db_type: "uuid"
go_type:
import: "github.com/google/uuid"
type: "UUID"
- db_type: "timestamptz"
nullable: true
go_type:
type: "*time.Time"
sqlc also has the ability to understand the DB migration format of golang-migrate.
Overall I am impressed!
#golang #sqlc
I have started creating the data model for sslnotify.com to support SSL expiry reminder notifications.
If you have not heard about dbdiagram.io, I recommend you try it. It's a great tool for data model diagrams as code.
I usually read books during my commute in TfL. Some of the gems that I have read in the past few months
"The last house in the street" by Diane Chamberlain
"Hunted" by Roberta Kray
"Richest Man In Babylon" by George S. Clason
"Just After Sunset" by Stephen King
"Stolen focus: why you can't pay attention" by Johann Hari
Let's encrypt has a staging server which can be used for testing certificate issue without hitting production rate limits
letsencrypt.org/docs/staging…
I wrote a tutorial about deploying a Go binary using systemd in Ubuntu.
The tutorial is available at
golangbot.com/golang-systemd…
I hope it helps.
Feedback is appreciated!
#golang #ubuntu #systemd







