From 38aff307bfa909c161abffc25b4a8779035282bf Mon Sep 17 00:00:00 2001 From: Julian Date: Tue, 2 May 2023 21:34:16 +0200 Subject: [PATCH] :hammer: Refactor interface and default implementation (#10) :lipstick: Bump version and fix code example in README.md --- README.md | 6 +- main.go | 34 +++---- main_test.go | 56 +++++------ mock_afero_fs_test.go | 223 ------------------------------------------ model.go | 12 +-- 5 files changed, 53 insertions(+), 278 deletions(-) delete mode 100644 mock_afero_fs_test.go diff --git a/README.md b/README.md index 5c3a633..1cd90e0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Go Version](https://img.shields.io/github/go-mod/go-version/core49/gonfig)](https://go.dev/doc/devel/release#go1.20) -[![Project status](https://img.shields.io/badge/version-0.2.0-green.svg)](https://github.com/core49/gonfig/releases) +[![Project status](https://img.shields.io/badge/version-0.3.0-green.svg)](https://github.com/core49/gonfig/releases) [![Last commit](https://img.shields.io/github/last-commit/core49/gonfig/main)](https://github.com/core49/gonfig/commits/main) [![Go Report Card](https://goreportcard.com/badge/github.com/core49/gonfig)](https://goreportcard.com/report/github.com/core49/gonfig) [![codecov](https://img.shields.io/codecov/c/github/core49/gonfig?token=AO6U2S2I91)](https://codecov.io/gh/core49/gonfig) @@ -48,12 +48,12 @@ func main() { var config YourConfigStruct // Check if the file exists or if the file is empty - if exists, err := conf.IsEmpty(config); err != nil || exists { + if exists, err := conf.IsEmpty(&config); err != nil || exists { // handle error or what you want to do if the file exists } // Write an empty JSON skeleton of the struct/model to the file - if err := conf.WriteSkeleton(config); err != nil { + if err := conf.WriteSkeleton(&config); err != nil { // Handle error } diff --git a/main.go b/main.go index a88652a..c68aa16 100644 --- a/main.go +++ b/main.go @@ -11,10 +11,10 @@ import ( "time" ) -// New creates a new repository with the given options. -// It applies the flag configuration, generates a default file path if not disabled, and returns the repository -func New(options ...OptionFunc) (Repository, error) { - r := &repository{osArgs: os.Args, fileSystem: afero.NewOsFs()} +// New creates a new Repository with the given options. +// It applies the flag configuration, generates a default file path if not disabled, and returns the Repository +func New(options ...OptionFunc) (Gonfig, error) { + r := &Repository{osArgs: os.Args, fileSystem: afero.NewOsFs()} for _, optionFunc := range options { optionFunc(r) @@ -34,49 +34,49 @@ func New(options ...OptionFunc) (Repository, error) { // OptionSetOsArgs sets the os arguments. func OptionSetOsArgs(osArgs []string) OptionFunc { - return func(r *repository) { + return func(r *Repository) { r.osArgs = osArgs } } // OptionSetFileSystem sets the file system. func OptionSetFileSystem(fs afero.Fs) OptionFunc { - return func(r *repository) { + return func(r *Repository) { r.fileSystem = fs } } // OptionAppendFlagConfig appends the given `flagConfig` to the flag configuration. func OptionAppendFlagConfig(fc flagConfig) OptionFunc { - return func(r *repository) { + return func(r *Repository) { r.flagConfiguration = append(r.flagConfiguration, fc) } } // OptionSetFlagConfiguration sets the flag configuration to the given `flagConfiguration`. func OptionSetFlagConfiguration(fc flagConfiguration) OptionFunc { - return func(r *repository) { + return func(r *Repository) { r.flagConfiguration = fc } } // OptionDisableDefaultFlagConfiguration disables the default flag configuration. func OptionDisableDefaultFlagConfiguration(v bool) OptionFunc { - return func(r *repository) { + return func(r *Repository) { r.disableDefaultFlagConfiguration = v } } // OptionSetConfigFilePathVariable sets the file path and disables default path generation. func OptionSetConfigFilePathVariable(path string) OptionFunc { - return func(r *repository) { + return func(r *Repository) { r.filePath = path r.disableDefaultFilePathGeneration = true } } // applyFlagConfiguration applies flag configurations to command line arguments. -func (r *repository) applyFlagConfiguration() error { +func (r *Repository) applyFlagConfiguration() error { fmt.Println(r.osArgs) if len(r.osArgs) == 0 { return errors.New("os args should not be empty") @@ -105,7 +105,7 @@ func (r *repository) applyFlagConfiguration() error { } // checkModel verifies that the provided model is a non-nil pointer to a struct type. -func (r *repository) checkModel(model interface{}) error { +func (r *Repository) checkModel(model interface{}) error { if model == nil || reflect.ValueOf(model).Kind() != reflect.Ptr || reflect.TypeOf(model).Elem().Kind() != reflect.Struct { return ErrInvalidConfigModel } @@ -113,8 +113,8 @@ func (r *repository) checkModel(model interface{}) error { return nil } -// openFile opens the repository's designated file using the file system. -func (r *repository) openFile() (afero.File, closeFileFunc, error) { +// openFile opens the Repository's designated file using the file system. +func (r *Repository) openFile() (afero.File, closeFileFunc, error) { if len(r.filePath) == 0 { return nil, nil, ErrEmptyConfigFilePath } @@ -128,7 +128,7 @@ func (r *repository) openFile() (afero.File, closeFileFunc, error) { } // Load loads configuration data from the file at the file path into the given model. -func (r *repository) Load(model interface{}) error { +func (r *Repository) Load(model interface{}) error { if err := r.checkModel(model); err != nil { return err } @@ -145,7 +145,7 @@ func (r *repository) Load(model interface{}) error { } // WriteSkeleton writes a JSON skeleton of the model to the file path. -func (r *repository) WriteSkeleton(model interface{}) error { +func (r *Repository) WriteSkeleton(model interface{}) error { if err := r.checkModel(model); err != nil { return err } @@ -179,7 +179,7 @@ func (r *repository) WriteSkeleton(model interface{}) error { } // IsEmpty checks if the config file is empty. Returns `true` if the file does not exist or is empty. -func (r *repository) IsEmpty(model interface{}) (bool, error) { +func (r *Repository) IsEmpty(model interface{}) (bool, error) { if err := r.checkModel(model); err != nil { return false, err } diff --git a/main_test.go b/main_test.go index 082ffe8..1f4177c 100644 --- a/main_test.go +++ b/main_test.go @@ -10,8 +10,6 @@ import ( "time" ) -//go:generate mockgen --build_flags=--mod=mod -destination mock_afero_fs_test.go -package gonfig github.com/spf13/afero Fs - type configModel struct { Name string `json:"name"` Version int `json:"version"` @@ -113,7 +111,7 @@ func TestNew(t *testing.T) { func TestOptionSetFileSystem(t *testing.T) { t.Run("Ok", func(t *testing.T) { - r := &repository{} + r := &Repository{} require.Empty(t, r.fileSystem) afs := afero.NewMemMapFs() @@ -127,7 +125,7 @@ func TestOptionSetFileSystem(t *testing.T) { func TestOptionAppendFlagConfig(t *testing.T) { t.Run("Ok", func(t *testing.T) { - r := &repository{} + r := &Repository{} fc := flagConfig{ Type: "string", Name: "test", @@ -145,7 +143,7 @@ func TestOptionAppendFlagConfig(t *testing.T) { func TestOptionSetFlagConfiguration(t *testing.T) { t.Run("Ok", func(t *testing.T) { - r := &repository{} + r := &Repository{} optionFunc := OptionSetFlagConfiguration(defaultFlagConfig) optionFunc(r) @@ -156,7 +154,7 @@ func TestOptionSetFlagConfiguration(t *testing.T) { func TestOptionDisableDefaultFlagConfiguration(t *testing.T) { t.Run("Ok", func(t *testing.T) { - r := &repository{} + r := &Repository{} optionFunc := OptionDisableDefaultFlagConfiguration(true) optionFunc(r) @@ -167,7 +165,7 @@ func TestOptionDisableDefaultFlagConfiguration(t *testing.T) { func TestOptionSetConfigFilePathVariable(t *testing.T) { t.Run("Ok", func(t *testing.T) { - r := &repository{} + r := &Repository{} optionFunc := OptionSetConfigFilePathVariable("/tmp/test.json") optionFunc(r) @@ -194,7 +192,7 @@ func TestRepository_Load(t *testing.T) { _, err = file.Write(j) require.NoError(t, err) - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -208,26 +206,26 @@ func TestRepository_Load(t *testing.T) { t.Run("Fail", func(t *testing.T) { t.Run("InvalidConfigModel", func(t *testing.T) { t.Run("Nil", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.Load(nil) assert.EqualError(t, err, ErrInvalidConfigModel.Error()) }) t.Run("NoneStruct", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.Load("string") assert.EqualError(t, err, ErrInvalidConfigModel.Error()) }) t.Run("NonePointerStruct", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.Load(configModel{}) assert.EqualError(t, err, ErrInvalidConfigModel.Error()) }) }) t.Run("EmptyFilePath", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.Load(&configModel{}) assert.EqualError(t, err, ErrEmptyConfigFilePath.Error()) @@ -235,7 +233,7 @@ func TestRepository_Load(t *testing.T) { t.Run("InvalidFilePath", func(t *testing.T) { afs := afero.NewMemMapFs() - r := &repository{ + r := &Repository{ filePath: "not.existing", fileSystem: afs, } @@ -250,7 +248,7 @@ func TestRepository_WriteSkeleton(t *testing.T) { t.Run("Ok", func(t *testing.T) { afs := afero.NewMemMapFs() - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -276,7 +274,7 @@ func TestRepository_WriteSkeleton(t *testing.T) { require.NoError(t, err) require.NoError(t, file.Close()) - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -286,26 +284,26 @@ func TestRepository_WriteSkeleton(t *testing.T) { }) t.Run("InvalidConfigModel", func(t *testing.T) { t.Run("Nil", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.WriteSkeleton(nil) assert.EqualError(t, err, ErrInvalidConfigModel.Error()) }) t.Run("NoneStruct", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.WriteSkeleton("string") assert.EqualError(t, err, ErrInvalidConfigModel.Error()) }) t.Run("NonePointerStruct", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.WriteSkeleton(configModel{}) assert.EqualError(t, err, ErrInvalidConfigModel.Error()) }) }) t.Run("MarshalIndent", func(t *testing.T) { - r := &repository{} + r := &Repository{} m := struct { X chan int @@ -315,7 +313,7 @@ func TestRepository_WriteSkeleton(t *testing.T) { assert.Error(t, err) }) t.Run("EmptyFilePath", func(t *testing.T) { - r := &repository{} + r := &Repository{} err := r.WriteSkeleton(&configModel{}) assert.EqualError(t, err, ErrEmptyConfigFilePath.Error()) @@ -323,7 +321,7 @@ func TestRepository_WriteSkeleton(t *testing.T) { t.Run("InvalidFilePath", func(t *testing.T) { afs := afero.NewReadOnlyFs(afero.NewMemMapFs()) - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -340,7 +338,7 @@ func TestRepository_IsEmptyConfig(t *testing.T) { t.Run("FileDoesNotExist", func(t *testing.T) { afs := afero.NewMemMapFs() - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -354,7 +352,7 @@ func TestRepository_IsEmptyConfig(t *testing.T) { t.Run("Empty", func(t *testing.T) { afs := afero.NewMemMapFs() - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -374,7 +372,7 @@ func TestRepository_IsEmptyConfig(t *testing.T) { t.Run("ContainsEmptyJSON", func(t *testing.T) { afs := afero.NewMemMapFs() - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -397,7 +395,7 @@ func TestRepository_IsEmptyConfig(t *testing.T) { t.Run("ContainsValidContent", func(t *testing.T) { afs := afero.NewMemMapFs() - r := &repository{ + r := &Repository{ filePath: "test.json", fileSystem: afs, } @@ -425,21 +423,21 @@ func TestRepository_IsEmptyConfig(t *testing.T) { t.Run("Fail", func(t *testing.T) { t.Run("InvalidConfigModel", func(t *testing.T) { t.Run("Nil", func(t *testing.T) { - r := &repository{} + r := &Repository{} exists, err := r.IsEmpty(nil) assert.EqualError(t, err, ErrInvalidConfigModel.Error()) assert.False(t, exists) }) t.Run("NoneStruct", func(t *testing.T) { - r := &repository{} + r := &Repository{} exists, err := r.IsEmpty("string") assert.EqualError(t, err, ErrInvalidConfigModel.Error()) assert.False(t, exists) }) t.Run("NonePointerStruct", func(t *testing.T) { - r := &repository{} + r := &Repository{} exists, err := r.IsEmpty(configModel{}) assert.EqualError(t, err, ErrInvalidConfigModel.Error()) @@ -447,7 +445,7 @@ func TestRepository_IsEmptyConfig(t *testing.T) { }) }) t.Run("EmptyFilePath", func(t *testing.T) { - r := &repository{} + r := &Repository{} exists, err := r.IsEmpty(&configModel{}) assert.EqualError(t, err, ErrEmptyConfigFilePath.Error()) diff --git a/mock_afero_fs_test.go b/mock_afero_fs_test.go deleted file mode 100644 index 03ef9d7..0000000 --- a/mock_afero_fs_test.go +++ /dev/null @@ -1,223 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/spf13/afero (interfaces: Fs) - -// Package gonfig is a generated GoMock package. -package gonfig - -import ( - fs "io/fs" - reflect "reflect" - time "time" - - gomock "github.com/golang/mock/gomock" - afero "github.com/spf13/afero" -) - -// MockFs is a mock of Fs interface. -type MockFs struct { - ctrl *gomock.Controller - recorder *MockFsMockRecorder -} - -// MockFsMockRecorder is the mock recorder for MockFs. -type MockFsMockRecorder struct { - mock *MockFs -} - -// NewMockFs creates a new mock instance. -func NewMockFs(ctrl *gomock.Controller) *MockFs { - mock := &MockFs{ctrl: ctrl} - mock.recorder = &MockFsMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockFs) EXPECT() *MockFsMockRecorder { - return m.recorder -} - -// Chmod mocks base method. -func (m *MockFs) Chmod(arg0 string, arg1 fs.FileMode) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Chmod", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Chmod indicates an expected call of Chmod. -func (mr *MockFsMockRecorder) Chmod(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Chmod", reflect.TypeOf((*MockFs)(nil).Chmod), arg0, arg1) -} - -// Chown mocks base method. -func (m *MockFs) Chown(arg0 string, arg1, arg2 int) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Chown", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// Chown indicates an expected call of Chown. -func (mr *MockFsMockRecorder) Chown(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Chown", reflect.TypeOf((*MockFs)(nil).Chown), arg0, arg1, arg2) -} - -// Chtimes mocks base method. -func (m *MockFs) Chtimes(arg0 string, arg1, arg2 time.Time) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Chtimes", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// Chtimes indicates an expected call of Chtimes. -func (mr *MockFsMockRecorder) Chtimes(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Chtimes", reflect.TypeOf((*MockFs)(nil).Chtimes), arg0, arg1, arg2) -} - -// Create mocks base method. -func (m *MockFs) Create(arg0 string) (afero.File, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Create", arg0) - ret0, _ := ret[0].(afero.File) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Create indicates an expected call of Create. -func (mr *MockFsMockRecorder) Create(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockFs)(nil).Create), arg0) -} - -// Mkdir mocks base method. -func (m *MockFs) Mkdir(arg0 string, arg1 fs.FileMode) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Mkdir", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Mkdir indicates an expected call of Mkdir. -func (mr *MockFsMockRecorder) Mkdir(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Mkdir", reflect.TypeOf((*MockFs)(nil).Mkdir), arg0, arg1) -} - -// MkdirAll mocks base method. -func (m *MockFs) MkdirAll(arg0 string, arg1 fs.FileMode) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MkdirAll", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// MkdirAll indicates an expected call of MkdirAll. -func (mr *MockFsMockRecorder) MkdirAll(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MkdirAll", reflect.TypeOf((*MockFs)(nil).MkdirAll), arg0, arg1) -} - -// Name mocks base method. -func (m *MockFs) Name() string { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Name") - ret0, _ := ret[0].(string) - return ret0 -} - -// Name indicates an expected call of Name. -func (mr *MockFsMockRecorder) Name() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockFs)(nil).Name)) -} - -// Open mocks base method. -func (m *MockFs) Open(arg0 string) (afero.File, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Open", arg0) - ret0, _ := ret[0].(afero.File) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Open indicates an expected call of Open. -func (mr *MockFsMockRecorder) Open(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Open", reflect.TypeOf((*MockFs)(nil).Open), arg0) -} - -// OpenFile mocks base method. -func (m *MockFs) OpenFile(arg0 string, arg1 int, arg2 fs.FileMode) (afero.File, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OpenFile", arg0, arg1, arg2) - ret0, _ := ret[0].(afero.File) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// OpenFile indicates an expected call of OpenFile. -func (mr *MockFsMockRecorder) OpenFile(arg0, arg1, arg2 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenFile", reflect.TypeOf((*MockFs)(nil).OpenFile), arg0, arg1, arg2) -} - -// Remove mocks base method. -func (m *MockFs) Remove(arg0 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Remove", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// Remove indicates an expected call of Remove. -func (mr *MockFsMockRecorder) Remove(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*MockFs)(nil).Remove), arg0) -} - -// RemoveAll mocks base method. -func (m *MockFs) RemoveAll(arg0 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RemoveAll", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// RemoveAll indicates an expected call of RemoveAll. -func (mr *MockFsMockRecorder) RemoveAll(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveAll", reflect.TypeOf((*MockFs)(nil).RemoveAll), arg0) -} - -// Rename mocks base method. -func (m *MockFs) Rename(arg0, arg1 string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Rename", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Rename indicates an expected call of Rename. -func (mr *MockFsMockRecorder) Rename(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rename", reflect.TypeOf((*MockFs)(nil).Rename), arg0, arg1) -} - -// Stat mocks base method. -func (m *MockFs) Stat(arg0 string) (fs.FileInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Stat", arg0) - ret0, _ := ret[0].(fs.FileInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Stat indicates an expected call of Stat. -func (mr *MockFsMockRecorder) Stat(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stat", reflect.TypeOf((*MockFs)(nil).Stat), arg0) -} diff --git a/model.go b/model.go index b5b3df0..5ee771e 100644 --- a/model.go +++ b/model.go @@ -8,14 +8,14 @@ import ( // flagConfiguration is a type representing a slice of flag configurations. type flagConfiguration []flagConfig -// OptionFunc is a function that takes a repository pointer and modifies it based on the function's implementation. -type OptionFunc func(r *repository) +// OptionFunc is a function that takes a Repository pointer and modifies it based on the function's implementation. +type OptionFunc func(r *Repository) // closeFileFunc is a function type for closing a file object. type closeFileFunc func(f afero.File) -// Repository interface contains all the functions that are available to public use. -type Repository interface { +// Gonfig interface contains all the functions that are available to public use. +type Gonfig interface { // Load loads configuration data from the file at the file path into the given model. Load(model interface{}) error // WriteSkeleton writes a JSON skeleton of the model to the file path. @@ -24,8 +24,8 @@ type Repository interface { IsEmpty(model interface{}) (bool, error) } -// repository struct is the initialized gonfig. -type repository struct { +// Repository struct is the initialized gonfig. +type Repository struct { data interface{} disableDefaultFlagConfiguration bool disableDefaultFilePathGeneration bool