Go Community Linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Go community here or just enjoy what everyone else has found!


🦄 Monads and popular FP abstractions, powered by Go 1.18+ Generics (Option, Result, Either...)

 Samuel Berthe

Automation tool to deploy and manage Go services using systemd on GNU/Linux machines Topics

github.com/pioz/god

 Enrico

Declarative configuration for Go 🚀

config is an easy-to-use package that supports reading configuration into a struct from files, environment variables and command-line arguments. All you need is to declare a structure that will hold your configuration and call Read method. The library will pool the values from a config file in any well-known format, from env vars that follows simple naming convention, or from command-line arguments

 Denis Palnitsky

Encore.dev - Built a URL Shortener for Golangflow

Hello

I built a URL shortener for this site using Encore.dev for all the backend including hosting the service in Encore Cloud.

Code: Golangflow Urler Hosted in Encore Cloud - Developed using Encore.dev

 Brian Scott

Job Board for #golang Developers and Golang Software Engineers

My Golang Job Board with Jobs for Golang Developers is up since 2019, with its own section for Remote Golang Jobs

 Stefan Wüthrich

truemail-go 🚀 configurable 📨 email validator/verifier

Configurable Golang email validator. Verify email via Regex, DNS, SMTP and even more! Be sure that email address valid and exists: https://github.com/truemail-rb/truemail-go

 Vladislav Trotsenko

Writing maintainable Go code

Writing maintainable code is essential. Clarity, readability, and simplicity are all aspects of maintainability. It should make the process easy for someone to join your project or maintain it after someone leaves. Maintainability is measured by how effortless it is to introduce changes and the amount of risk associated with those changes. To write Go effectively, it is crucial to understand its properties and idioms and apply the established conventions related to naming, program construction, formatting, etc.

Find the full blog here: https://jogendra.dev/writing-maintainable-go-code

 Jogendra

smtpmock - mimic any 📤 SMTP server behaviour for your test environment with fake SMTP server

smtpmock will help you to mimic any SMTP server behaviour for your test environment. It's lightweight configurable multithreaded SMTP fake server. It meets the minimum requirements specified by RFC 2821 & RFC 5321: https://github.com/mocktools/go-smtp-mock

 Vladislav Trotsenko

A no-go fantasy: writing Go in Ruby with Ruby Next

On the Martian blog, Svyatoslav Kryukov enters into a fantasy realm, and is forced to imagine that ✨everything must be written in Go!✨

Read and learn to write Go in Ruby, gaining the ability to modify Ruby exactly as you desire.

In this article, he covers:

  • Replicating Go’s functionality in Ruby.
  • Modifying a lexer and parser – then creating your own!
  • Adding a rewriter with the help of Ruby Next.
  • Plus, other cool techniques to bring everything to life!

👉 Read the tale: https://evilmartians.com/chronicles/a-no-go-fantasy-writing-go-in-ruby-with-ruby-next

 

An Introduction to Go Debugging with Delve

Great video on Delve & Go, Delve is a popular feature-rich debugger for Go. 22 minutes

Go Debugging with Delve

 Brian Scott

Goapp - An opinionated guideline to structure & develop a Go web application/service

Goapp is an opinionated guideline to structure a Go web application/service (or could be extended for any application). These opinions were formed over a span of 5+ years building web applications/services with Go, trying to implement DDD (Domain Driven Development) & Clean Architecture. Even though I've mentioned go.mod and go.sum, this guideline works for 1.4+ (i.e. since introduction of the special 'internal' directory).

 Kamaleshwar

Embarquer des templates avec pkger (fr_FR)

Tant que Go est encore en version 1.15.x et n'a pas encore les embeds de fichier en standard, voici comment utiliser pkger pour embarquer vos templates ou tout autre asset:

https://osinet.fr/go/articles/inclusion-de-templates-avec-pkger/

 Frédéric G. MARAND

Bundling templates with pkger

While Go is still 1.15.x and doesn't yet have standard embeds, here is how to embed templates (or whatever assets you need) in your code with pkger.

https://osinet.fr/go/en/articles/bundling-templates-with-pkger/

 Frédéric G. MARAND

Go: comandos CLI, parte 2 (pt_BR)

Parte 2 de 3 onde esclareço o funcionamento dos comandos presentes na ferramenta CLI go.

http://devdrops.me/posts/go-comandos-cli-parte-2/

 Davi Marcondes Moreira

Go: comandos CLI, parte 1 (pt_BR)

Parte 1 de 3 onde esclareço o funcionamento dos comandos presentes na ferramenta CLI go.

http://devdrops.me/posts/go-comandos-cli-parte-1/

 Davi Marcondes Moreira

Import Cycles in Golang and How to Deal with them

As a Golang developer, you probably have encountered import cycles. Golang do not allow import cycles. Go throws a compile-time error if it detects the import cycle in code. In this post, let’s understand how the import cycle occurs and how you can deal with them.

Find full blog here:

https://jogendra.dev/import-cycles-in-golang-and-how-to-deal-with-them

 Jogendra

Web Development in Go: Middleware, Templating, Databases & Beyond

This is the next installment of our series by Ayooluwa Isaiah that explains features in Go so developers can compare them to Ruby or whatever other language.

In the previous article in this series, we had an extensive discussion on the Go net/http package and how it can be used for production-ready web applications. We focused mostly on the routing aspect and other quirks and features of the http.ServeMux type.

This article will close out the discussion on ServeMux by demonstrating how middleware functions can be implemented with the default router and introducing other standard library packages that are sure to come in handy when developing web services with Go. https://www.honeybadger.io/blog/ruby-to-go-4/

 Ben Findley

Faker: random fake data and struct generator for Go. #faker @pioz

Random fake data and struct generator for Go.

https://github.com/pioz/faker

  • More than 100 generator functions
  • Struct generator
  • Unique data generator
  • Builtin types support
  • Easily customizable
  • Zero dependencies
  • Recursive infinite loop detector
  • Benchmarks (coming soon)

Struct Builder Example

faker.SetSeed(622)

// Define a new builder
colorBuilder := func(params ...string) (interface{}, error) {
  return faker.Pick("Red", "Yellow", "Blue", "Black", "White"), nil
}

// Register a new builder named "color" for string type
err := faker.RegisterBuilder("color", "string", colorBuilder)
if err != nil {
  panic(err)
}

type Animal struct {
  Name  string `faker:"username"`
  Color string `faker:"color"` // Use custom color builder
}

type Person struct {
  FirstName string            `faker:"firstName"`         // Any available function case insensitive
  LastName  *string           `faker:"lastName"`          // Pointer are also supported
  Age       int               `faker:"intinrange(0,120)"` // Can call with parameters
  UUID      string            `faker:"uuid;unique"`       // Guarantees a unique value
  Number    int               `faker:"-"`                 // Skip this field
  Code      string            // No tag to use default builder for this field type
  Pet       Animal            // Recursively fill this struct
  Nicknames []string          `faker:"username;len=3"`          // Build an array of size 3 using faker.Username function
  Extra     map[string]string `faker:"stringWithSize(3);len=2"` // map are supported
}

p := Person{}
err = faker.Build(&p)
if err != nil {
  panic(err)
}
fmt.Println(p.FirstName)
fmt.Println(*p.LastName)
fmt.Println(p.Age)
fmt.Println(p.UUID)
fmt.Println(p.Number)
fmt.Println(p.Code)
fmt.Println(p.Pet.Name)
fmt.Println(p.Pet.Color)
fmt.Println(len(p.Nicknames))
fmt.Println(p.Nicknames[0])
fmt.Println(p.Nicknames[1])
fmt.Println(p.Nicknames[2])
fmt.Println(p.Extra)
// Output: Wilber
// Gutkowski
// 25
// ff8d6917-b920-46e6-b1be-dc2d48becfcb
// 0
// z
// honegger
// Red
// 3
// teagan
// polypeptide
// chinfest
// map[70w:3F6 gQS:isq]

Factory

One of the nice things about Faker is that it can also be used as a factory library. In fact when we call the faker.Build function if a value is not zero then it is not modified, leaving the original value. This allows you to create factory functions very easily:

faker.SetSeed(623)

type User struct {
    Username string `faker:"username"`
    Email    string `faker:"email"`
    Country  string `faker:"CountryAlpha2"`
}

italianUserFactory := func() *User {
    u := &User{Country: "IT"}
    faker.Build(u)
    return u
}

italianUser := italianUserFactory()
fmt.Println(italianUser)
// Output: &{spicule [email protected] IT}
 Enrico

A Gentle Introduction to Web Services With Go

When you're deciding on a technology to use for your project, it helps to have a broad understanding of your options. You may be tempted to build a web service in Go for performance reasons - but what would that code actually look like? How would it compare to languages like Ruby or JS? In this article, Ayooluwa Isaiah gives us a guided tour through the building blocks of go web services so you'll be well-informed. https://www.honeybadger.io/blog/go-web-services/

 Ben Findley

Evaluating Go's Package Management and Module Systems

When you're evaluating a language for your next project, few things are more important than available third-party libraries and the package manager that ties them together. While early versions of Go lacked a package manager, they've made up for lost time. In this article, Ayooluwa Isaiah introduces us to Go's module ecosystem to help us decide if Go is "a go" for our next project. https://www.honeybadger.io/blog/golang-go-package-management/

 Ben Findley