Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit dfe2a7c

Browse files
committed
chore: Don't send service priority if not set
Sidetree VDR: Don't send service priority if not set Closes #296 Signed-off-by: Sandra Vrtikapa <[email protected]>
1 parent 1ef20ed commit dfe2a7c

File tree

12 files changed

+227
-551
lines changed

12 files changed

+227
-551
lines changed

.github/workflows/vdr-sidetree.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
timeout-minutes: 10
1818
env:
1919
LINT_PATH: component/vdr/sidetree
20+
GOLANGCI_LINT_IMAGE: "golangci/golangci-lint:v1.50.0"
2021
runs-on: ubuntu-18.04
2122
steps:
2223
- uses: actions/checkout@v2
+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#
2+
# Copyright SecureKey Technologies Inc. All Rights Reserved.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
run:
8+
concurrency: 4
9+
deadline: 3m
10+
issues-exit-code: 1
11+
tests: true
12+
build-tags: [""]
13+
skip-dirs: [""]
14+
15+
output:
16+
format: colored-line-number
17+
print-issued-lines: true
18+
print-linter-name: true
19+
20+
21+
linters-settings:
22+
depguard:
23+
list-type: denylist
24+
packages:
25+
# logging is allowed only by logutils.Log, logrus
26+
# is allowed to use only in logutils package
27+
- github.com/sirupsen/logrus
28+
packages-with-error-message:
29+
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
30+
dupl:
31+
threshold: 100
32+
funlen:
33+
lines: 100
34+
statements: 50
35+
goconst:
36+
min-len: 2
37+
min-occurrences: 3
38+
gocritic:
39+
enabled-tags:
40+
- diagnostic
41+
- experimental
42+
- opinionated
43+
- performance
44+
- style
45+
disabled-checks:
46+
- dupImport # https://github.com/go-critic/go-critic/issues/845
47+
- ifElseChain
48+
- octalLiteral
49+
- whyNoLint
50+
- unnamedResult
51+
gocyclo:
52+
min-complexity: 15
53+
goimports:
54+
local-prefixes: github.com/golangci/golangci-lint
55+
gomnd:
56+
# don't include the "operation" and "assign"
57+
checks:
58+
- argument
59+
- case
60+
- condition
61+
- return
62+
ignored-numbers:
63+
- '0'
64+
- '1'
65+
- '2'
66+
- '3'
67+
ignored-functions:
68+
- strings.SplitN
69+
70+
govet:
71+
check-shadowing: true
72+
settings:
73+
printf:
74+
funcs:
75+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
76+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
77+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
78+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
79+
lll:
80+
line-length: 140
81+
misspell:
82+
locale: US
83+
nolintlint:
84+
allow-unused: false # report any unused nolint directives
85+
require-explanation: false # don't require an explanation for nolint directives
86+
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
87+
machine: false # don't require //nolint instead of // nolint
88+
explain: false # don't require //nolint // my explanation instead of just //nolint
89+
90+
linters:
91+
disable-all: true
92+
enable:
93+
- bodyclose
94+
- depguard
95+
- dogsled
96+
- dupl
97+
- errcheck
98+
- exportloopref
99+
- funlen
100+
- gochecknoinits
101+
- goconst
102+
- gocritic
103+
- gocyclo
104+
- goimports
105+
- gomnd
106+
- goprintffuncname
107+
- gosec
108+
- gosimple
109+
- govet
110+
- ineffassign
111+
- lll
112+
- nakedret
113+
- noctx
114+
- nolintlint
115+
- staticcheck
116+
- stylecheck
117+
- typecheck
118+
- unconvert
119+
- unparam
120+
- unused
121+
- whitespace
122+
123+
# don't enable:
124+
# - asciicheck
125+
# - scopelint
126+
# - gochecknoglobals
127+
# - gocognit
128+
# - godot
129+
# - godox
130+
# - goerr113
131+
# - interfacer
132+
# - maligned
133+
# - nestif
134+
# - prealloc
135+
# - testpackage
136+
# - revive
137+
# - wsl
138+
139+
issues:
140+
# Excluding configuration per-path, per-linter, per-text and per-source
141+
exclude-rules:
142+
- path: _test\.go
143+
linters:
144+
- gomnd
145+
- dupl
146+
- funlen
147+
- bodyclose
148+
- dupl
149+
- goconst
150+
- gosec
151+
- noctx
152+
- wrapcheck
153+
- lll
154+
- gocritic
155+
156+
- path: pkg/golinters/errcheck.go
157+
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
158+
- path: pkg/commands/run.go
159+
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
160+
- path: pkg/commands/run.go
161+
text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used."
162+
163+
- path: pkg/golinters/gofumpt.go
164+
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
165+
- path: pkg/golinters/staticcheck_common.go
166+
text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead."
167+
- path: pkg/lint/lintersdb/manager.go
168+
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."
169+
170+
exclude:
171+
- \`config\` is a global variable
172+
- Line contains TODO/BUG/FIXME
173+
# Add comments for package
174+
- at least one file in a package should have a package comment
175+
# Allow package logger variables (for now)
176+
- logger is a global variable

component/vdr/sidetree/api/api.go

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ SPDX-License-Identifier: Apache-2.0
44
*/
55

66
// Package api include interface
7-
//
87
package api
98

109
import "github.com/trustbloc/sidetree-core-go/pkg/jws"

component/vdr/sidetree/client.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"errors"
1414
"fmt"
1515
"io"
16-
"io/ioutil"
1716
"net/http"
1817
"strings"
1918

@@ -461,7 +460,7 @@ func (c *Client) defaultSendRequest(req []byte, getEndpoints func() ([]string, e
461460

462461
defer closeResponseBody(resp.Body)
463462

464-
responseBytes, err := ioutil.ReadAll(resp.Body)
463+
responseBytes, err := io.ReadAll(resp.Body)
465464
if err != nil {
466465
return nil, fmt.Errorf("failed to read response : %w", err)
467466
}
@@ -474,7 +473,7 @@ func (c *Client) defaultSendRequest(req []byte, getEndpoints func() ([]string, e
474473
return responseBytes, nil
475474
}
476475

477-
func createUpdatePatches(updateDIDOpts *update.Opts) ([]patch.Patch, error) { //nolint: gocyclo
476+
func createUpdatePatches(updateDIDOpts *update.Opts) ([]patch.Patch, error) {
478477
var patches []patch.Patch
479478

480479
if len(updateDIDOpts.RemoveAlsoKnownAs) != 0 {

component/vdr/sidetree/doc/doc.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ SPDX-License-Identifier: Apache-2.0
44
*/
55

66
// Package doc implements sidetree document
7-
//
87
package doc
98

109
import (
@@ -166,7 +165,9 @@ func PopulateRawServices(services []docdid.Service) ([]map[string]interface{}, e
166165
rawService[jsonldServicePoint] = json.RawMessage(serviceEndpoint)
167166
}
168167

169-
rawService[jsonldPriority] = services[i].Priority
168+
if services[i].Priority != nil {
169+
rawService[jsonldPriority] = services[i].Priority
170+
}
170171

171172
if len(services[i].RecipientKeys) > 0 {
172173
rawService[jsonldRecipientKeys] = services[i].RecipientKeys

component/vdr/sidetree/go.mod

+10-11
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,31 @@
33
// SPDX-License-Identifier: Apache-2.0
44
module github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree
55

6-
go 1.17
6+
go 1.19
77

88
require (
99
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
10-
github.com/hyperledger/aries-framework-go v0.1.9-0.20221025163359-bee1ddf86975
10+
github.com/hyperledger/aries-framework-go v0.1.9-0.20221104133505-b2cd6a82a8e4
1111
github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693
12-
github.com/stretchr/testify v1.7.2
13-
github.com/trustbloc/sidetree-core-go v1.0.0-rc3.0.20221011173557-7c4f13946f96
12+
github.com/stretchr/testify v1.8.1
13+
github.com/trustbloc/sidetree-core-go v1.0.0-rc3.0.20221028171319-8d44bd1cace7
1414
)
1515

1616
require (
1717
github.com/btcsuite/btcd v0.22.0-beta // indirect
1818
github.com/davecgh/go-spew v1.1.1 // indirect
1919
github.com/google/uuid v1.3.0 // indirect
20-
github.com/hyperledger/aries-framework-go/spi v0.0.0-20220606124520-53422361c38c // indirect
20+
github.com/hyperledger/aries-framework-go/spi v0.0.0-20221025204933-b807371b6f1e // indirect
2121
github.com/kilic/bls12-381 v0.1.1-0.20210503002446-7b7597926c69 // indirect
2222
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
2323
github.com/minio/sha256-simd v0.1.1 // indirect
24-
github.com/mitchellh/mapstructure v1.3.3 // indirect
2524
github.com/mr-tron/base58 v1.2.0 // indirect
26-
github.com/multiformats/go-base32 v0.0.4 // indirect
25+
github.com/multiformats/go-base32 v0.1.0 // indirect
2726
github.com/multiformats/go-base36 v0.1.0 // indirect
28-
github.com/multiformats/go-multibase v0.0.3 // indirect
27+
github.com/multiformats/go-multibase v0.1.1 // indirect
2928
github.com/multiformats/go-multihash v0.0.14 // indirect
3029
github.com/multiformats/go-varint v0.0.6 // indirect
31-
github.com/piprate/json-gold v0.4.1 // indirect
30+
github.com/piprate/json-gold v0.4.2 // indirect
3231
github.com/pkg/errors v0.9.1 // indirect
3332
github.com/pmezard/go-difflib v1.0.0 // indirect
3433
github.com/pquerna/cachecontrol v0.1.0 // indirect
@@ -40,7 +39,7 @@ require (
4039
go.uber.org/atomic v1.7.0 // indirect
4140
go.uber.org/multierr v1.6.0 // indirect
4241
go.uber.org/zap v1.17.0 // indirect
43-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
44-
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
42+
golang.org/x/crypto v0.1.0 // indirect
43+
golang.org/x/sys v0.1.0 // indirect
4544
gopkg.in/yaml.v3 v3.0.1 // indirect
4645
)

0 commit comments

Comments
 (0)