ent-go: Explicitly set runtime version (#437174)

This commit is contained in:
Sandro
2025-08-27 15:44:46 +02:00
committed by GitHub
2 changed files with 37 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
--- a/entc/gen/graph.go 2025-08-26 12:42:17.548313631 +0100
+++ b/entc/gen/graph.go 2025-08-26 12:43:32.398186157 +0100
@@ -1008,22 +1008,10 @@
// ModuleInfo returns the entgo.io/ent version.
func (Config) ModuleInfo() (m debug.Module) {
- const pkg = "entgo.io/ent"
- info, ok := debug.ReadBuildInfo()
- if !ok {
- return
- }
- // Was running as a CLI (ent/cmd/ent).
- if info.Main.Path == pkg {
- return info.Main
- }
- // Or, as a main package (ent/entc).
- for _, dep := range info.Deps {
- if dep.Path == pkg {
- return *dep
- }
+ return debug.Module{
+ Version: "@version@",
+ Sum: "@sum@",
}
- return
}
// FeatureEnabled reports if the given feature name is enabled.
+9
View File
@@ -3,6 +3,7 @@
buildGoModule,
fetchFromGitHub,
installShellFiles,
replaceVars,
}:
buildGoModule rec {
@@ -18,6 +19,14 @@ buildGoModule rec {
vendorHash = "sha256-ec5tA9TsDKGnHVZWilLj7bdHrd46uQcNQ8YCK/s6UAY=";
patches = [
# patch in version information so we don't get "version = "(devel)";"
(replaceVars ./ent_version.patch {
inherit version;
sum = src.outputHash;
})
];
subPackages = [ "cmd/ent" ];
ldflags = [