What is the preferred way to package static files (html/css/js) along with your standalone binary in 2020?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/golang

Our great sponsors
  • Scout APM - Truly a developer’s best friend
  • Zigi - Close all those tabs. Zigi will handle your updates.
  • SonarQube - Static code analysis for 29 languages.
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • parcello

    Golang Resource Bundler [deprecated]

    parcello and go-vfs-gen. while at work we use go-vfsgen, i'm using parcello binary in a personal project and it seems to be less of a headache to use.

  • go.rice

    go.rice is a Go package that makes working with resources such as html,js,css,images,templates, etc very easy.

    go.rice - https://github.com/GeertJohan/go.rice

  • Scout APM

    Truly a developer’s best friend. Scout APM is great for developers who want to find and fix performance issues in their applications. With Scout, we'll take care of the bugs so you can focus on building great things 🚀.

  • fileb0x

    a better customizable tool to embed files in go; also update embedded files remotely without restarting the server

    fileb0x - https://github.com/UnnoTed/fileb0x

  • gobundle

    DEPRECATED: I recommend https://github.com/GeertJohan/go.rice

    gobundle - https://github.com/alecthomas/gobundle

  • rules_go

    Go rules for Bazel

    Bazel go_embed_data

  • go-bindata

    A small utility that generates Go code from any file. Useful for embedding binary data in a Go program. (by gnoso)

    gnoso/go-bindata - https://github.com/gnoso/go-bindata

  • statics

    :file_folder: Embeds static resources into go files for single binary compilation + works with http.FileSystem + symlinks

    statics - https://github.com/go-playground/statics

  • Zigi

    Close all those tabs. Zigi will handle your updates.. Zigi monitors Jira and GitHub updates, pings you when PRs need approval and lets you take fast actions - all directly from Slack! Plus it reduces cycle time by up to 75%.

  • go

    The Go programming language

    There are no preferred way to pack static files just yet before package "embed" is released. https://github.com/golang/go/issues/35950#issue-532341192

  • esc

    A simple file embedder for Go

    esc - https://github.com/mjibson/esc

  • go-resources

    Unfancy resources embedding for Go with out of box http.FileSystem support.

    go-resources - https://github.com/omeid/go-resources

  • go-embed

    Generates go code to embed resource files into your library or executable

    go-embed - https://github.com/pyros2097/go-embed

  • statik

    Embed files into a Go executable

    statik - https://github.com/rakyll/statik

  • httpfs

    Collection of Go packages for working with the http.FileSystem interface.

    I wanted to be able to have my own gen.go for regenerating the embedded assets, without having to install another executable. I also appreciated the related https://github.com/shurcooL/httpfs package which gave me helpers I needed to integrate with other packages.

  • go-bindata

    A small utility which generates Go code from any file. Useful for embedding binary data in a Go program. (by shuLhan)

    shuLhan/go-bindata - https://github.com/shuLhan/go-bindata

  • vfsgen

    Takes an input http.FileSystem (likely at go generate time) and generates Go code that statically implements it.

    vfsgen - https://github.com/shurcooL/vfsgen

  • templify

    A tool to be used with 'go generate' to embed external template files into Go code.

    templify - https://github.com/wlbr/templify

  • dog

    Dog is a debug tool that serves a web page that opens a websocket back to itself for sharing real-time logs, as well as for arbitrary two-way communication. (by danbrakeley)

    My solution involved a generator whose source is here, and a shell script for building that ensures the generator is up to date, then runs the generator via `go generate`, then finally runs `go build`.

  • go-bindata

    https://github.com/jteeuwen/go-bindata is the original go-bindata, but it is unmaintained, so there are several forks of it; IMO shuLhan/go-bindata is the best maintained, but go-bindata/go-bindata has the most stars because it has the best SEO-foo.

  • pcopy

    pcopy is a temporary file host, nopaste and clipboard across machines. It can be used from the Web UI, via a CLI or without a client by using curl.

    Absolutely try the embed package. You don't have to wait for go 1.16 to come out in two months. You can download the beta now. It works great. Here's an example from a side project of mine. I haven't converted everything to embed yet, but I'll do that soon: https://github.com/binwiederhier/pcopy/blob/cf45e8fcb5b2ea6526a969c5dd259c8934c0e430/server.go#L428

  • go-bindata

    Turn data file into go code.

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts