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:
zhangwenjian
2026-09-27 14:01:48 +08:00
parent c055dc68c5
commit d89e0cd8eb
8 changed files with 17 additions and 16 deletions
+5 -4
View File
@@ -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
+3 -3
View File
@@ -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")