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

Replace strings.Trim with strings.TrimFunc in ParseRDF #5494

Merged
merged 3 commits into from
May 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions chunker/rdf_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ L:
item := it.Item()
switch item.Typ {
case itemSubject:
rnq.Subject = strings.Trim(item.Val, " ")
rnq.Subject = strings.TrimSpace(item.Val)

case itemSubjectFunc:
var err error
Expand All @@ -113,10 +113,10 @@ L:

case itemPredicate:
// Here we split predicate and lang directive (ex: "name@en"), if needed.
rnq.Predicate, rnq.Lang = x.PredicateLang(strings.Trim(item.Val, " "))
rnq.Predicate, rnq.Lang = x.PredicateLang(strings.TrimSpace(item.Val))

case itemObject:
rnq.ObjectId = strings.Trim(item.Val, " ")
rnq.ObjectId = strings.TrimSpace(item.Val)

case itemStar:
switch {
Expand Down Expand Up @@ -144,9 +144,9 @@ L:
return rnq, errors.Errorf("If predicate/subject is *, value should be * as well")
}

val := strings.Trim(item.Val, " ")
val := strings.TrimSpace(item.Val)
// TODO: Check if this condition is required.
if strings.Trim(val, " ") == "*" {
if val == "*" {
return rnq, errors.Errorf("itemObject can't be *")
}
// Lets find out the storage type from the type map.
Expand Down Expand Up @@ -190,7 +190,7 @@ L:
break L

case itemLabel:
rnq.Label = strings.Trim(item.Val, " ")
rnq.Label = strings.TrimSpace(item.Val)

case itemLeftRound:
it.Prev() // backup '('
Expand Down