mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-29 04:27:17 +00:00
chore⬆️: upgrade go-admin-core to v2.11.0
v2.11.0 makes pkg.FileCreate return its error instead of ending the process when the file cannot be created. Two comments in the code generator described the old behaviour in the present tense.
This commit is contained in:
@@ -554,10 +554,11 @@ func renderAll(data any, tpls ...*template.Template) ([][]byte, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// writeGenerated writes one generated file, creating its directory first.
|
||||
// It stands in for pkg.FileCreate, which returns no error at all and, when
|
||||
// the file cannot be created, closes a nil file and ends the process with
|
||||
// log.Fatalln - one unwritable path took the whole server down with it.
|
||||
// writeGenerated writes one generated file, creating its directory first,
|
||||
// which pkg.FileCreate does not do. It replaced pkg.FileCreate here while
|
||||
// that returned no error and, when the file could not be created, ended the
|
||||
// process with log.Fatalln - one unwritable path took the whole server down
|
||||
// with it. go-admin-core v2.11.0 made pkg.FileCreate return the error.
|
||||
func writeGenerated(path string, content []byte) error {
|
||||
if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil {
|
||||
return err
|
||||
|
||||
@@ -134,9 +134,9 @@ func TestNOActionsGenWritesNothingWhenATemplateFails(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// pkg.FileCreate, which this used to write through, ends the process with
|
||||
// log.Fatalln when it cannot create the file. Reaching the assertions at all
|
||||
// is half of this test.
|
||||
// pkg.FileCreate, which this used to write through, ended the process with
|
||||
// log.Fatalln when it could not create the file, until go-admin-core v2.11.0.
|
||||
// Reaching the assertions at all is half of this test.
|
||||
func TestNOActionsGenReportsAFileItCannotWrite(t *testing.T) {
|
||||
dir := genWorkspace(t)
|
||||
blocker := filepath.Join(dir, "app", "admin", "models")
|
||||
|
||||
Reference in New Issue
Block a user