Skip to content

Commit

Permalink
Drop vfs
Browse files Browse the repository at this point in the history
  • Loading branch information
xnox committed Jul 12, 2023
1 parent 315ecc1 commit 13437e9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 236 deletions.
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

export GOCACHE=$(shell mktemp -d /tmp/gocache-XXXX)
export GOFLAGS=-ldflags=-X=github.com/ubuntu/zsys/internal/config.Version=$(shell dpkg-parsechangelog -S Version) --mod=vendor
export DH_GOLANG_INSTALL_ALL=1

# Tell go generate to only install on-the-fly assets
export ZSYS_GENERATE_ONLY_INSTALL_SHARE_PREFIX=$(CURDIR)/debian/zsys/usr/share
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ require (
github.com/godbus/dbus/v5 v5.1.0
github.com/google/go-cmp v0.5.9
github.com/k0kubun/pp v3.0.1+incompatible
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd
github.com/sirupsen/logrus v1.9.3
github.com/snapcore/go-gettext v0.0.0-20201130093759-38740d1bd3d2
github.com/spf13/cobra v0.0.5
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk=
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0=
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/snapcore/go-gettext v0.0.0-20201130093759-38740d1bd3d2 h1:nETXPg0CiJrMAwC2gqkcam9BiBWYGvTsSYRfrjOz2Kg=
Expand Down
25 changes: 7 additions & 18 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ package config
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"os"
"path/filepath"
_ "embed"

"github.com/ubuntu/zsys/internal/i18n"
"github.com/ubuntu/zsys/internal/log"
yaml "gopkg.in/yaml.v2"
)

//go:generate go run generator.go
//go:embed zsys.conf
var internalconf []byte

// TEXTDOMAIN is the message domain used by snappy; see dgettext(3)
// for more information.
Expand Down Expand Up @@ -66,22 +65,12 @@ func SetVerboseMode(level int) {
func Load(ctx context.Context, path string) (ZConfig, error) {

var c ZConfig
var dir http.FileSystem = http.Dir(filepath.Dir(path))
f, err := dir.Open(filepath.Base(path))
if err != nil {
if path != DefaultPath {
return c, fmt.Errorf(i18n.G("failed to load configuration file %s: %v "), path, err)
}
log.Debug(ctx, i18n.G("couldn't find default configuration path, fallback to internal default"))
if f, err = internalAssets.Open(filepath.Base(path)); err != nil {
return c, fmt.Errorf(i18n.G("couldn't read our internal configuration: %v "), path, err)
}
}
defer f.Close()

b, err := ioutil.ReadAll(f)
b, err := os.ReadFile(path)
if err != nil {
return c, fmt.Errorf(i18n.G("failed to read configuration file %s: %v "), path, err)
log.Debug(ctx, i18n.G("failed to read configuration file %s: %v "), path, err)
log.Debug(ctx, i18n.G("couldn't find default configuration path, fallback to internal default"))
b = internalconf
}

err = yaml.Unmarshal(b, &c)
Expand Down
28 changes: 0 additions & 28 deletions internal/config/generator.go

This file was deleted.

184 changes: 0 additions & 184 deletions internal/config/internalassets_vfsdata.go

This file was deleted.

0 comments on commit 13437e9

Please sign in to comment.