Overlay file system
Go to file
jolheiser eefdce7b03
continuous-integration/woodpecker the build was successful Details
Add cache purge (#7)
Reviewed-on: #7
Co-authored-by: jolheiser <john.olheiser@gmail.com>
Co-committed-by: jolheiser <john.olheiser@gmail.com>
2021-10-08 21:26:02 +00:00
_test Initial Commit 2021-02-16 22:57:59 -06:00
.gitignore Initial Commit 2021-02-16 22:57:59 -06:00
.woodpecker.yml Move to woodpecker (#6) 2021-10-08 20:55:54 +00:00
LICENSE Initial Commit 2021-02-16 22:57:59 -06:00
README.md Replace build badge with docs badge (#3) 2021-05-09 04:06:23 +00:00
go.mod Rebrand overlay 2021-02-17 22:39:52 -06:00
overlay.go Add cache purge (#7) 2021-10-08 21:26:02 +00:00
overlay_test.go Add ReadFile, interface guard, and drone CI (#2) 2021-05-09 04:02:16 +00:00

README.md

Overlay

Go Reference

Overlay File System

Overlay is an easy way to implement a file system in such a way that production assets can be overridden by assets on disk.

Usage

package main

import (
	"embed"
	
	"go.jolheiser.com/overlay"
)

//go:embed assets
var assets embed.FS

func main() {
	ofs, err := overlay.New("/var/lib/myapp/custom", assets)
	if err != nil {
		panic(err)
    }
    ...
}

If /var/lib/myapp/custom has an assets sub-directory, this implementation works.

However, if /var/lib/myapp/custom matches the assets directory layout, you can use WithSub like so...

package main

import (
	"embed"
	
	"go.jolheiser.com/overlay"
)

//go:embed assets
var assets embed.FS

func main() {
	ofs, err := overlay.New("/var/lib/myapp/custom", assets, overlay.WithSub("assets"))
	if err != nil {
		panic(err)
    }
    ...
}

License

MIT