From e86580c36ba6ea478691a8a2dc6195215ad4445f Mon Sep 17 00:00:00 2001 From: Samuele Musiani Date: Mon, 24 Jun 2024 10:22:32 +0200 Subject: [PATCH] config as a go module --- go.mod | 3 +++ main.go | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 go.mod create mode 100644 main.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a64b994 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/csunibo/config + +go 1.22.4 diff --git a/main.go b/main.go new file mode 100644 index 0000000..ab970bf --- /dev/null +++ b/main.go @@ -0,0 +1,17 @@ +package config + +import ( + "embed" + "io/fs" +) + +//go:embed *.json +var content embed.FS + +func Open(path string) (fs.File, error) { + return content.Open(path) +} + +func ReadFile(path string) ([]byte, error) { + return content.ReadFile(path) +}