All Posts |

Posts on the golang category, Browsing Page 1 of 1

  • post image

    Deploying an SQLite Buffalo Application to Fly.io

    Fly.io is a cloud platform for hosting and deploying applications. Its simplicity, performance and affordable pricing make it a no-brainer choice for startups and works very well as a replacement for Heroku. In this post we will show how to deploy a Buffalo application to Fly.io. Initializing the Buffalo application Initializing a Buffalo application implies running the new command on the Buffalo cli. To make things simpler we will create a SQLite application
    Read more
  • post image

    Using Plush with Go

    One of the coolest libraries in the Buffalo framework is Plush, a templating engine that provides ERB-like syntax for writing server side HTML. It is a very powerful templating engine that can be used to render HTML pages for Go applications. Plush makes it easy to iterate over collections, have conditional content, use partials and more. Even though Plush is built within the Buffalo ecosystem and I’ve been able to mostly use it in my buffalo apps, I’ve always wondered how it can be integrated with Go applications written with the standard library.
    Read more
  • post image

    Page layouts in Go

    I recently tried to build a web application using Go and HTML templates. In doing so, I started to miss some cool features that Buffalo and plush have to avoid repeating the layout of your web pages. I thought this was a common enough problem that the Go team should have provided the tools in the standard library, and as usual, they did. That’s when I came across the block and define expressions for templates.
    Read more
  • post image

    Go embed for better SQL query management

    With the Go 1.16 release the Go team added a new way to embed files and folders into Go application binaries. This is a great feature as it facilitates a practice that is common in the community and much likely loved by many gophers: shipping a single binary with embedded assets. In my case it even makes me wonder if there is a need to use Docker to deliver our Go binaries, but that’s another topic.
    Read more
  • post image

    Timezone Data in Go 1.15+

    On a previous post I wrote about Go’s time locations and how to put those in an alpine Docker container. This was achieved by copying the timezone data zip file from the docker builder image into the distributable image. Then using an environment variable to point Go to the location of that file.

    Read more