entc/gen: remove unnecessary import from templates (#3105)

This commit is contained in:
Ariel Mashraki
2022-11-18 21:45:48 +02:00
committed by GitHub
parent 209d446859
commit da9322fd2e
4 changed files with 13 additions and 6 deletions

View File

@@ -219,7 +219,6 @@ var (
"time": "time",
"ent": "entgo.io/ent",
"dialect": "entgo.io/ent/dialect",
"schema": "entgo.io/ent/schema",
"field": "entgo.io/ent/schema/field",
}
)

View File

@@ -42,7 +42,7 @@ import (
{{- $fields := $.Fields }}{{ if $.HasOneFieldID }}{{ if $.ID.UserDefined }}{{ $fields = append $fields $.ID }}{{ end }}{{ end }}
{{- range $f := $fields }}
{{- $pkg := $f.Type.PkgPath }}
{{- if and $pkg (not (hasImport (base $pkg ))) }}
{{- if and $pkg (not (hasImport (base $pkg))) }}
{{- $name := $f.Type.PkgName }}
{{ if ne $name (base $pkg) }}{{ $name }} {{ end}}"{{ $pkg }}"
{{- end }}