From d89e0cd8eb03069057c8cf901b80d77416ee165e Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Sep 2026 14:01:48 +0800 Subject: [PATCH] =?UTF-8?q?chore=E2=AC=86=EF=B8=8F:=20upgrade=20go-admin-c?= =?UTF-8?q?ore=20to=20v2.11.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/other/apis/tools/gen.go | 9 +++++---- app/other/apis/tools/gen_errors_test.go | 6 +++--- example/app-order/go.mod | 2 +- example/app-order/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- test/e2e-apporder/go.mod | 2 +- test/e2e-apporder/go.sum | 4 ++-- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app/other/apis/tools/gen.go b/app/other/apis/tools/gen.go index 4bd9094d..689aa7f5 100644 --- a/app/other/apis/tools/gen.go +++ b/app/other/apis/tools/gen.go @@ -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 diff --git a/app/other/apis/tools/gen_errors_test.go b/app/other/apis/tools/gen_errors_test.go index 4df190f8..eb26653c 100644 --- a/app/other/apis/tools/gen_errors_test.go +++ b/app/other/apis/tools/gen_errors_test.go @@ -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") diff --git a/example/app-order/go.mod b/example/app-order/go.mod index f91a095f..942bcfeb 100644 --- a/example/app-order/go.mod +++ b/example/app-order/go.mod @@ -5,7 +5,7 @@ go 1.27.1 require ( github.com/gin-gonic/gin v1.12.0 github.com/glebarez/sqlite v1.11.0 - github.com/go-admin-team/go-admin-core/v2 v2.10.0 + github.com/go-admin-team/go-admin-core/v2 v2.11.0 gorm.io/gorm v1.31.2 ) diff --git a/example/app-order/go.sum b/example/app-order/go.sum index 3a366855..6ef142a9 100644 --- a/example/app-order/go.sum +++ b/example/app-order/go.sum @@ -58,8 +58,8 @@ github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= -github.com/go-admin-team/go-admin-core/v2 v2.10.0 h1:MM1wl9s2iW3M4GFsT8SyaUWaj2Q8m1NSuundXc6DWzI= -github.com/go-admin-team/go-admin-core/v2 v2.10.0/go.mod h1:Q0FfO+8pfPNkPqk9fcRpe2sSOHfir82cjZO8Nol/8SI= +github.com/go-admin-team/go-admin-core/v2 v2.11.0 h1:kAiGaQWPHHiEnoa+UeKQqTmIQAptDPjEbdu6s4jBZ7A= +github.com/go-admin-team/go-admin-core/v2 v2.11.0/go.mod h1:Q0FfO+8pfPNkPqk9fcRpe2sSOHfir82cjZO8Nol/8SI= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= diff --git a/go.mod b/go.mod index 07597d3f..af3ac349 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/casbin/casbin/v3 v3.8.1 github.com/gin-gonic/gin v1.12.0 github.com/glebarez/sqlite v1.11.0 - github.com/go-admin-team/go-admin-core/v2 v2.10.0 + github.com/go-admin-team/go-admin-core/v2 v2.11.0 github.com/google/uuid v1.6.0 github.com/huaweicloud/huaweicloud-sdk-go-obs v3.26.6+incompatible github.com/mssola/user_agent v0.6.0 diff --git a/go.sum b/go.sum index a5d866c5..9f61ddb6 100644 --- a/go.sum +++ b/go.sum @@ -145,8 +145,8 @@ github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= -github.com/go-admin-team/go-admin-core/v2 v2.10.0 h1:MM1wl9s2iW3M4GFsT8SyaUWaj2Q8m1NSuundXc6DWzI= -github.com/go-admin-team/go-admin-core/v2 v2.10.0/go.mod h1:Q0FfO+8pfPNkPqk9fcRpe2sSOHfir82cjZO8Nol/8SI= +github.com/go-admin-team/go-admin-core/v2 v2.11.0 h1:kAiGaQWPHHiEnoa+UeKQqTmIQAptDPjEbdu6s4jBZ7A= +github.com/go-admin-team/go-admin-core/v2 v2.11.0/go.mod h1:Q0FfO+8pfPNkPqk9fcRpe2sSOHfir82cjZO8Nol/8SI= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= diff --git a/test/e2e-apporder/go.mod b/test/e2e-apporder/go.mod index 270626c9..f71ce9aa 100644 --- a/test/e2e-apporder/go.mod +++ b/test/e2e-apporder/go.mod @@ -40,7 +40,7 @@ require ( github.com/gin-contrib/sse v1.1.1 // indirect github.com/gin-gonic/gin v1.12.0 // indirect github.com/glebarez/sqlite v1.11.0 // indirect - github.com/go-admin-team/go-admin-core/v2 v2.10.0 // indirect + github.com/go-admin-team/go-admin-core/v2 v2.11.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-openapi/jsonpointer v1.0.0 // indirect github.com/go-openapi/jsonreference v1.0.0 // indirect diff --git a/test/e2e-apporder/go.sum b/test/e2e-apporder/go.sum index a5d866c5..9f61ddb6 100644 --- a/test/e2e-apporder/go.sum +++ b/test/e2e-apporder/go.sum @@ -145,8 +145,8 @@ github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= -github.com/go-admin-team/go-admin-core/v2 v2.10.0 h1:MM1wl9s2iW3M4GFsT8SyaUWaj2Q8m1NSuundXc6DWzI= -github.com/go-admin-team/go-admin-core/v2 v2.10.0/go.mod h1:Q0FfO+8pfPNkPqk9fcRpe2sSOHfir82cjZO8Nol/8SI= +github.com/go-admin-team/go-admin-core/v2 v2.11.0 h1:kAiGaQWPHHiEnoa+UeKQqTmIQAptDPjEbdu6s4jBZ7A= +github.com/go-admin-team/go-admin-core/v2 v2.11.0/go.mod h1:Q0FfO+8pfPNkPqk9fcRpe2sSOHfir82cjZO8Nol/8SI= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=