golangbot (@bot_golang) header
golangbot (@bot_golang) profile picture

Follow for Golang tips and curated Golang job openings by @msgtonaveen https://teapawt.net/t.co/BHkflux8SA - Simple Go tutorials

Joined April 2017
Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)Photo by golangbot (@bot_golang)
golangbot retweeted
Ladybird is now in alpha 🐞 Downloads for macOS and Linux available on our website. ladybird.org/posts/alpha/
399
1,191
402
9,685
965,042
golangbot retweeted
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 👇
65
93
39
1,635
130,356
golangbot retweeted
“Go Turns 17” by Austin Clements, for the Go team — go.dev/blog/17years #golang
23
149
33
881
51,397
golangbot retweeted
“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
9
125
10
855
60,615
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
3
7
1,148
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/…
1
2
679
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
1
6
848
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
1
2
624
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!
1
3
578
#golang #tip The go mod why command can be used to find out why a particular package is needed. For example, let's stay there is a indirect dependency on a particular package in go.mod. You need to find out the import graph of this particular dependency. This is possible using `go mod why`.
1
7
538
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…
1
11
1,035
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
1
4
733
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.
1
1
2
487
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
1
2
463
The new widgets in Firefox are amazing!
2
2
690
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
1
5
697