ent / ent/ent

Duplicate Method Error for "value" Field Name in Generated Ent Files

Open
#3,840 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
17.2k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

## Description:
When utilizing Ent ORM and defining a field named "value" within my schema, an issue arises where the generated Ent files produce a duplicate method error. Specifically, the GetValue method is being generated in two separate files, resulting in a conflict.

- [ ] The issue is present in the latest release.
- [x] I have searched the [issues](https://github.com/ent/ent/issues) of this repository and believe that this is not a duplicate.

## Current Behavior 😯

The GetValue method is duplicated across separate files within the generated Ent codebase, leading to a conflict.

## Expected Behavior 🤔

The Ent code generation process should not result in duplicate method creation, especially when defining a field named "value."

## Steps to Reproduce 🕹

Steps:

1. Define an Ent schema with a field named "value".
2. Generate Ent files using the defined schema.
3. Review the generated code to observe the duplicate GetValue method across different files.

## Your Environment 🌎

| Tech | Version |
| ----------- | ------- |
| Go | 1.21.1 |
| Ent | 0.12.3 |
| Database | Postgresql |
| Driver | https://pkg.go.dev/database/sql/driver |

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.