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

Panic will be caused when the column's comment value is one string #134

Closed
dorlolo opened this issue Oct 7, 2022 · 0 comments
Closed

Panic will be caused when the column's comment value is one string #134

dorlolo opened this issue Oct 7, 2022 · 0 comments
Assignees

Comments

@dorlolo
Copy link

dorlolo commented Oct 7, 2022

Description

Main problem is the function MigrateColumn in file migrator.go ,

func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnType gorm.ColumnType) error {
    //....
    //....
    comment := field.Comment
    if comment != "" {
	    comment = comment[1 : len(comment)-1]
    }
    //....
}

excample,when the comment value is 'h' or one space, comment = comment[1 : len(comment)-1] become comment = comment[1 : 0] ,so it wuill be caused panic

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

No branches or pull requests

2 participants