mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2026-02-02 17:35:09 +01:00
test: jsonnetfile marshalling
This commit is contained in:
parent
1caefa556e
commit
6e283c5310
4 changed files with 137 additions and 15 deletions
|
|
@ -18,7 +18,6 @@ import (
|
|||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
|
|
@ -32,9 +31,9 @@ const (
|
|||
|
||||
var ErrNoFile = errors.New("no jsonnetfile")
|
||||
|
||||
|
||||
// Load reads a jsonnetfile.(lock).json from disk
|
||||
func Load(filepath string) (spec.JsonnetFile, error) {
|
||||
m := spec.JsonnetFile{}
|
||||
m := spec.New()
|
||||
|
||||
bytes, err := ioutil.ReadFile(filepath)
|
||||
if err != nil {
|
||||
|
|
@ -51,6 +50,7 @@ func Load(filepath string) (spec.JsonnetFile, error) {
|
|||
return m, nil
|
||||
}
|
||||
|
||||
// Exists returns whether the file at the given path exists
|
||||
func Exists(path string) (bool, error) {
|
||||
_, err := os.Stat(path)
|
||||
if os.IsNotExist(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue