Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Removed unused param on table.go and tables.go: canAddr #1081

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

ramonamorim
Copy link
Contributor

@ramonamorim ramonamorim commented Dec 2, 2024

Hi, I found the parameter canAddr in table.go. It's passed as false during the initialization of table.init here:

func (t *Tables) InProgress(typ reflect.Type) *Table {
	if table, ok := t.inProgress[typ]; ok {
		return table
	}

	table := new(Table)
	t.inProgress[typ] = table
	table.init(t.dialect, typ, false)

	return table
}
func (table *Table) init(dialect Dialect, typ reflect.Type, canAddr bool) {
	table.dialect = dialect
	table.Type = typ
	table.ZeroValue = reflect.New(table.Type).Elem()
	table.ZeroIface = reflect.New(table.Type).Interface()
	table.TypeName = internal.ToExported(table.Type.Name())
	table.ModelName = internal.Underscore(table.Type.Name())
	tableName := tableNameInflector(table.ModelName)
	table.setName(tableName)
	table.Alias = table.ModelName
	table.SQLAlias = table.quoteIdent(table.ModelName)
	table.Schema = dialect.DefaultSchema()

	table.Fields = make([]*Field, 0, typ.NumField())
	table.FieldMap = make(map[string]*Field, typ.NumField())
	table.processFields(typ, canAddr)

This parameter is simply passed along to the table.processFields(typ, canAddr) function, but it’s never actually used inside that function. Based on this, I went ahead and removed it. If there are any plans to use this in the future, please feel free to close this PR or let me know.

@j2gg0s
Copy link
Collaborator

j2gg0s commented Dec 3, 2024

Thank you for your contribution. Could you handle the commit message linter?

@ramonamorim
Copy link
Contributor Author

@j2gg0s Yes sure, fixed. thank you

@j2gg0s j2gg0s merged commit 7703a2e into uptrace:master Dec 3, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants