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!


Why Rubyists Should Consider Learning Go

These days fewer and fewer web developers get to specialize in a single language like Ruby. We use different tools for different jobs. In this article, Ayooluwa Isaiah argues that Go is the perfect complement to Ruby. The developer who knows both is in a great position to handle almost any back-end challenge. https://www.honeybadger.io/blog/rubyist-learn-go/

 Ben Findley

Debugging Go Applications using Delve

 

Logging in Go: Choosing a System and Using it

Go has built-in features to make it easier for programmers to implement logging. Third parties have also built additional tools to make logging easier. What's the difference between them? Which should you choose? In this article Ayooluwa Isaiah describes both of these and discusses when you'd prefer one over the other. https://www.honeybadger.io/blog/golang-logging/

 Ben Findley

Using Prometheus to collect metrics from Golang applications

In this post, I will talk about a very important feature in the complex projects we work with daily: metrics. Among the various solutions on the market for this purpose, one that has gained more prominence is the duo Prometheus + Grafana.

https://dev.to/codenation/using-prometheus-to-collect-metrics-from-golang-applications-35gc

 Elton Minetto

Golangflow.io - ANNOUNCEMENT

Hello Everyone!

Thank you for contributing to Golangflow.io, all the amazing content. Over the next few weeks, I will be migrating this site to Google Cloud Run in GCP and deploying a few new features. Hopefully, you won't notice the migration :)

 Brian Scott

Go Packages Tutorial for Go Modules

 

How To Check File Exists Using Golang

This golang tutorial help to check the file name is exist or not into the folders.We can pass pattern that will match filename into the target folders.

https://www.golanglearn.com/how-to-check-file-exists-using-golang/

 Adam

https://www.golanglearn.com/golang-maps-uses-and-example/

In this tutorial, we’ll learn how to use Golang’s built-in map type. map.The map is an unordered collection of key-value pairs.The keys are unique within a map while the values may not be.

https://www.golanglearn.com/golang-maps-uses-and-example/

 Adam

Beyond v1.0.0

Hey guys,

I would like to share with you that Beyond v1.0.0 is out.

Beyond is a Go tool that will drive you to the AOP world!

http://wesovilabs.com/beyond AOP http://wesovilabs.github.io/beyond

Hope you enjoy it!

 Iván Corrales Solera

Go for the REST @jsTamer21k @gobuffalo_io

Buffalo comes with a uniform and consistent structure for web applications in Go, follows best practives of Go web development and covers the full lifecycle from development to production. Learn how to build a RESTful web application in Go using the buffalo framework. https://dev.to/remast/go-for-the-rest-1jp9

 Jan Stamer

Deploy a Buffalo App to Heroku

Deploy a Buffalo App to Heroku from Antonio Pagano.

A lot of things have changed in the Buffalo ecosystem since my last post on how to deploy to Heroku from Gitlab.

Indeed, everything has changed since I posted how to deploy from gitlab repo into Heroku with the birth of the buffalo-heroku plugin. In this post I will try and describe how to use it to deploy your buffalo app to Heroku.

 Brian Scott



API gateway examples with Traefik, Ambassador and Envoy

API gateway acts as a reverse proxy, routing API requests from clients to services. Usually it also performs authentication and rate limiting, so the services behind the gate don't have to. Check out short tutorials of Ambassador and Traefik that aim to tackle the problem, also there is Envoy example in https://github.com/marselester/apigate.

 Marsel Mavletkulov

Error handling example in DDD-style project with Go kit

Ben Johnson wrote Failure is your Domain post that explores the purpose of errors for app developers (error code), operators (stack trace), end users (human-readable message). https://github.com/marselester/ddd-err is an attempt to implement those ideas using Go kit.

 Marsel Mavletkulov

How to structure Go projects

New developers who come with Python/Ruby experience look for familiar framework concepts that fit their mental picture of how a web application should be structured. For some reason the same concepts do not resonate with Go. How to structure Go projects blog post shows that DDD (Domain-Driven Design) flavored approach is endorsed according to talks given at GopherCons.

 Marsel Mavletkulov

Kafka for Gophers slides

Kafka for Gophers presentation provides an overview of how to achieve reliable data delivery with Apache Kafka in Go. If you've ever felt uneasy about what might happen with your service when a message is lost or written more than once, you should read "Kafka: The Definitive Guide" book. When it comes to choose a Go library to work with Kafka, the decision could be tough. I would recommend to check out https://github.com/segmentio/kafka-go.

 Marsel Mavletkulov

How to Deploy GoBuffalo on Google's App Engine

Hey there,

If you use Buffalo and would like to deploy it to Google's App Engine, please visit this tutorial to find out more:

Deploy GoBuffalo on Google's App Engine

 Tomislav Biscan

ANNOUNCEMENT: Golangflow

Hello,

Just a friendly reminder as the maintainer of this site, that our twitter integration is offline as Google recently discontinued the Google link service. We are transitioning to Firebase Dynamic links later this week. Also, posts will start to be moderated to ensure we deliver relevant and useful content to our Golang readers.

Thank you

Any questions email: feedback @ golangflow.io

 Brian Scott

Generis, a versatile code generator adding generics, free-form macros, conditional compilation, HTML templating and Allman style conversion to the Go language

Just to inform you that I’ve just released a first version of Generis, a lightweight code preprocessor adding the following features to the Go language :

  • Generics.
  • Free-form macros.
  • Conditional compilation.
  • HTML templating.
  • Allman style conversion.

https://github.com/senselogic/GENERIS

It’s similar in function to both Ego and Genny, but implemented as a free-form C++ like preprocessor.

Sample :

package main;

// -- IMPORTS

import (
    "html"
    "io"
    "log"
    "net/http"
    "strconv"
    );

// -- DEFINITIONS

#define DebugMode
#as true

// ~~

#define HttpPort
#as 8080

// ~~

#define WriteLine( {{text}} )
#as log.Println( {{text}} )

// ~~

#define local {{variable}} : {{type}};
#as var {{variable}} {{type}};

// ~~

#define DeclareStack( {{type}}, {{name}} )
#as
    // -- TYPES

    type {{name}}Stack struct
    {
        ElementArray []{{type}};
    }

    // -- INQUIRIES

    func ( stack * {{name}}Stack ) IsEmpty(
        ) bool
    {
        return len( stack.ElementArray ) == 0;
    }

    // -- OPERATIONS

    func ( stack * {{name}}Stack ) Push(
        element {{type}}
        )
    {
        stack.ElementArray = append( stack.ElementArray, element );
    }

    // ~~

    func ( stack * {{name}}Stack ) Pop(
        ) {{type}}
    {
        local
            element : {{type}};

        element = stack.ElementArray[ len( stack.ElementArray ) - 1 ];

        stack.ElementArray = stack.ElementArray[ : len( stack.ElementArray ) - 1 ];

        return element;
    }
#end

// ~~

#define DeclareStack( {{type}} )
#as DeclareStack( {{type}}, {{type:PascalCase}} )

// -- TYPES

DeclareStack( string )
DeclareStack( int32 )

// -- FUNCTIONS

func HandleRootPage(
    response_writer http.ResponseWriter,
    request * http.Request
    )
{
    local
        boolean : bool;
    local
        natural : uint;
    local
        integer : int;
    local
        real : float64;
    local
        escaped_text,
        text : string;
    local
        integer_stack : Int32Stack;

    boolean = true;
    natural = 10;
    integer = 20;
    real = 30.0;
    text = "text";
    escaped_text = "<escaped text/>";

    integer_stack.Push( 10 );
    integer_stack.Push( 20 );
    integer_stack.Push( 30 );

    #write response_writer
        <!DOCTYPE html>
        <html lang="en">
            <head>
                <meta charset="utf-8">
                <title><%= request.URL.Path %></title>
            </head>
            <body>
                <% if ( boolean ) { %>
                    <%= "URL : " + request.URL.Path %>
                    <br/>
                    <%@ natural %>
                    <%# integer %>
                    <%& real %>
                    <br/>
                    <%~ text %>
                    <%= escaped_text %>
                    <%= "<%% ignored %%>" %>
                    <%% ignored %%>
                <% } %>
                <br/>
                Stack :
                <br/>
                <% for !integer_stack.IsEmpty() { %>
                    <%# integer_stack.Pop() %>
                <% } %>
            </body>
        </html>
    #end
}

// ~~

func main()
{
    http.HandleFunc( "/", HandleRootPage );

    #if DebugMode
        WriteLine( "Listening on http://localhost:HttpPort" );
    #end

    log.Fatal(
        http.ListenAndServe( ":HttpPort", nil )
        );
}
 SenseLogic