From ba698202815f883d9117f159da3e2723dbbcaddb Mon Sep 17 00:00:00 2001 From: shubhendra Date: Thu, 25 Feb 2021 15:19:28 +0530 Subject: [PATCH] Combine multiple `append`s into a single call --- .deepsource.toml | 10 ++++++++++ schema/relationship.go | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 00000000..2a1e6721 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,10 @@ +version = 1 + +test_patterns = ["**/*_test.go"] + +[[analyzers]] +name = "go" +enabled = true + + [analyzers.meta] + import_paths = ["github.com/go-gorm/gorm"] diff --git a/schema/relationship.go b/schema/relationship.go index 606e722a..7f903687 100644 --- a/schema/relationship.go +++ b/schema/relationship.go @@ -429,9 +429,7 @@ func (schema *Schema) guessRelation(relation *Relationship, field *Field, cgl gu lookUpNames := []string{lookUpName} if len(primaryFields) == 1 { - lookUpNames = append(lookUpNames, strings.TrimSuffix(lookUpName, primaryField.Name)+"ID") - lookUpNames = append(lookUpNames, strings.TrimSuffix(lookUpName, primaryField.Name)+"Id") - lookUpNames = append(lookUpNames, schema.namer.ColumnName(foreignSchema.Table, strings.TrimSuffix(lookUpName, primaryField.Name)+"ID")) + lookUpNames = append(lookUpNames, strings.TrimSuffix(lookUpName, primaryField.Name)+"ID", strings.TrimSuffix(lookUpName, primaryField.Name)+"Id", schema.namer.ColumnName(foreignSchema.Table, strings.TrimSuffix(lookUpName, primaryField.Name)+"ID")) } for _, name := range lookUpNames {