Fix exhaustive structs
This commit is contained in:
parent
d049228980
commit
cddc290ee0
@ -148,7 +148,7 @@ func TestJobValidation(t *testing.T) {
|
|||||||
Name: "Test job",
|
Name: "Test job",
|
||||||
Schedule: "@daily",
|
Schedule: "@daily",
|
||||||
Config: ValidResticConfig(),
|
Config: ValidResticConfig(),
|
||||||
Tasks: []main.JobTask{{}},
|
Tasks: []main.JobTask{{}}, //nolint:exhaustruct
|
||||||
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
||||||
Forget: nil,
|
Forget: nil,
|
||||||
MySQL: []main.JobTaskMySQL{},
|
MySQL: []main.JobTaskMySQL{},
|
||||||
@ -166,7 +166,7 @@ func TestJobValidation(t *testing.T) {
|
|||||||
Tasks: []main.JobTask{},
|
Tasks: []main.JobTask{},
|
||||||
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
||||||
Forget: nil,
|
Forget: nil,
|
||||||
MySQL: []main.JobTaskMySQL{{}},
|
MySQL: []main.JobTaskMySQL{{}}, //nolint:exhaustruct
|
||||||
Postgres: []main.JobTaskPostgres{},
|
Postgres: []main.JobTaskPostgres{},
|
||||||
Sqlite: []main.JobTaskSqlite{},
|
Sqlite: []main.JobTaskSqlite{},
|
||||||
},
|
},
|
||||||
@ -183,7 +183,7 @@ func TestJobValidation(t *testing.T) {
|
|||||||
Forget: nil,
|
Forget: nil,
|
||||||
MySQL: []main.JobTaskMySQL{},
|
MySQL: []main.JobTaskMySQL{},
|
||||||
Postgres: []main.JobTaskPostgres{},
|
Postgres: []main.JobTaskPostgres{},
|
||||||
Sqlite: []main.JobTaskSqlite{{}},
|
Sqlite: []main.JobTaskSqlite{{}}, //nolint:exhaustruct
|
||||||
},
|
},
|
||||||
expectedErr: main.ErrMissingField,
|
expectedErr: main.ErrMissingField,
|
||||||
},
|
},
|
||||||
@ -222,6 +222,7 @@ func TestConfigValidation(t *testing.T) {
|
|||||||
Config: ValidResticConfig(),
|
Config: ValidResticConfig(),
|
||||||
Tasks: []main.JobTask{},
|
Tasks: []main.JobTask{},
|
||||||
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
||||||
|
Forget: nil,
|
||||||
MySQL: []main.JobTaskMySQL{},
|
MySQL: []main.JobTaskMySQL{},
|
||||||
Postgres: []main.JobTaskPostgres{},
|
Postgres: []main.JobTaskPostgres{},
|
||||||
Sqlite: []main.JobTaskSqlite{},
|
Sqlite: []main.JobTaskSqlite{},
|
||||||
@ -239,6 +240,7 @@ func TestConfigValidation(t *testing.T) {
|
|||||||
Config: nil,
|
Config: nil,
|
||||||
Tasks: []main.JobTask{},
|
Tasks: []main.JobTask{},
|
||||||
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
Backup: main.BackupFilesTask{Paths: []string{"/test"}}, //nolint:exhaustruct
|
||||||
|
Forget: nil,
|
||||||
MySQL: []main.JobTaskMySQL{},
|
MySQL: []main.JobTaskMySQL{},
|
||||||
Postgres: []main.JobTaskPostgres{},
|
Postgres: []main.JobTaskPostgres{},
|
||||||
Sqlite: []main.JobTaskSqlite{},
|
Sqlite: []main.JobTaskSqlite{},
|
||||||
|
8
main.go
8
main.go
@ -31,6 +31,10 @@ func ParseConfig(path string) ([]Job, error) {
|
|||||||
Params: []function.Parameter{{
|
Params: []function.Parameter{{
|
||||||
Name: "var",
|
Name: "var",
|
||||||
Type: cty.String,
|
Type: cty.String,
|
||||||
|
AllowNull: false,
|
||||||
|
AllowUnknown: false,
|
||||||
|
AllowDynamicType: false,
|
||||||
|
AllowMarked: false,
|
||||||
}},
|
}},
|
||||||
VarParam: nil,
|
VarParam: nil,
|
||||||
Type: function.StaticReturnType(cty.String),
|
Type: function.StaticReturnType(cty.String),
|
||||||
@ -42,6 +46,10 @@ func ParseConfig(path string) ([]Job, error) {
|
|||||||
Params: []function.Parameter{{
|
Params: []function.Parameter{{
|
||||||
Name: "path",
|
Name: "path",
|
||||||
Type: cty.String,
|
Type: cty.String,
|
||||||
|
AllowNull: false,
|
||||||
|
AllowUnknown: false,
|
||||||
|
AllowDynamicType: false,
|
||||||
|
AllowMarked: false,
|
||||||
}},
|
}},
|
||||||
VarParam: nil,
|
VarParam: nil,
|
||||||
Type: function.StaticReturnType(cty.String),
|
Type: function.StaticReturnType(cty.String),
|
||||||
|
Loading…
Reference in New Issue
Block a user