Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Toktar committed Jul 18, 2022
1 parent fa91905 commit db161d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions services/ledger_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ func (ls LedgerService) QueryResource(did string, resourceId string) (resource.R
client := resource.NewQueryClient(conn)
resourceResponse, err := client.Resource(context.Background(), &resource.QueryGetResourceRequest{CollectionId: collectionId, Id: resourceId})
if err != nil {
log.Info().Msgf("Resource not found %r", err.Error())

log.Info().Msgf("Resource not found %s", err.Error())
return resource.Resource{}, false, nil
}

Expand Down
6 changes: 4 additions & 2 deletions utils/did_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"regexp"
)

var ResourcePath, _ = regexp.Compile(`resources\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`)
var ResourceId, _ = regexp.Compile(`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`)
var (
ResourcePath, _ = regexp.Compile(`resources\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`)
ResourceId, _ = regexp.Compile(`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`)
)

func GetResourceId(didUrlPath string) (id string) {
if !ResourcePath.Match([]byte(didUrlPath)) {
Expand Down

0 comments on commit db161d5

Please sign in to comment.