Skip to content

Commit dc0905e

Browse files
authored
#302 Change wraperror.Errorf signature (#306)
* #302 Prepare for versioned release * #302 Prepare for versioned release * #302 Prepare for versioned release * #302 Prepare for versioned release * #302 Sync with sz-sdk-go-mock
1 parent 2c0250d commit dc0905e

23 files changed

+268
-219
lines changed

.github/linters/.golangci.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ linters:
109109
- zerologlint
110110
disable:
111111
- gochecknoglobals
112-
- mnd
113112
- paralleltest
114113
exclusions:
115114
generated: lax
@@ -139,7 +138,8 @@ linters:
139138
- '.+/subject\.SimpleSubject$'
140139
goconst:
141140
min-occurrences: 5
142-
ignore-string-values: ["CUSTOMERS"]
141+
ignore-string-values:
142+
- "CUSTOMERS"
143143
ireturn:
144144
allow:
145145
- error
@@ -154,6 +154,16 @@ linters:
154154
- senzing.SzProduct
155155
maintidx:
156156
under: 15
157+
mnd:
158+
ignored-functions:
159+
- '^logger\.Log$'
160+
- '^client\.newError$'
161+
- '^client\.traceExit$'
162+
- '^client\.traceEntry$'
163+
- '^notifier\.Notify'
164+
- "^failOnError$"
165+
- '^logging\.NewSenzingLogger$'
166+
- '^big\.NewInt$'
157167
nlreturn:
158168
block-size: 2
159169
tagliatelle:

.github/linters/bearer.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rule:
2+
skip-rule:
3+
- go_gosec_unsafe_unsafe

.github/workflows/bearer.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: bearer
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
rule_check:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Bearer
20+
uses: bearer/bearer-action@v2
21+
with:
22+
config-file: .github/linters/bearer.yml

.github/workflows/go-test-windows.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
steps:
2222
- name: Checkout repository
2323
uses: actions/checkout@v4
24-
with:
25-
fetch-depth: 0
2624

2725
- name: Setup go ${{ matrix.go }}
2826
uses: actions/setup-go@v5

.vscode/cspell.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@
7575
".dockerignore",
7676
".git/*",
7777
".github/linters/.golangci.yaml",
78-
".history/*",
7978
".gitignore",
79+
".history/*",
8080
"**/*.go",
8181
"**/*.mod",
8282
"**/*.sum",
83+
"bearer.ignore",
8384
"Makefile"
8485
]
85-
}
86+
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning].
99

1010
-
1111

12+
## [0.9.5] - 2025-05-21
13+
14+
### Changed in 0.9.5
15+
16+
- Improved error messages
17+
1218
## [0.9.4] - 2025-04-29
1319

1420
### Changed in 0.9.4

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ dependencies-for-development: dependencies-for-development-osarch-specific
7171
@go install github.com/vladopajic/go-test-coverage/v2@latest
7272
@go install golang.org/x/tools/cmd/godoc@latest
7373
@go install golang.org/x/vuln/cmd/govulncheck@latest
74+
@go install mvdan.cc/gofumpt@latest
7475
@sudo npm install -g cspell@latest
7576

7677

@@ -178,6 +179,11 @@ update-pkg-cache:
178179
# Specific programs
179180
# -----------------------------------------------------------------------------
180181

182+
.PHONY: bearer
183+
bearer:
184+
@bearer scan --config-file .github/linters/bearer.yml .
185+
186+
181187
.PHONY: cspell
182188
cspell:
183189
@cspell lint --dot .

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ go 1.24
44

55
require (
66
github.com/aquilax/truncate v1.0.1
7-
github.com/senzing-garage/go-helpers v0.6.11
8-
github.com/senzing-garage/go-logging v1.5.2
7+
github.com/senzing-garage/go-helpers v0.6.12
8+
github.com/senzing-garage/go-logging v1.5.3
99
github.com/senzing-garage/go-messaging v1.5.3
10-
github.com/senzing-garage/go-observing v0.3.4
10+
github.com/senzing-garage/go-observing v0.3.5
1111
github.com/senzing-garage/sz-sdk-go v0.15.3
1212
github.com/stretchr/testify v1.10.0
1313
)
@@ -19,8 +19,8 @@ require (
1919
golang.org/x/net v0.40.0 // indirect
2020
golang.org/x/sys v0.33.0 // indirect
2121
golang.org/x/text v0.25.0 // indirect
22-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 // indirect
23-
google.golang.org/grpc v1.72.0 // indirect
22+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect
23+
google.golang.org/grpc v1.72.1 // indirect
2424
google.golang.org/protobuf v1.36.6 // indirect
2525
gopkg.in/yaml.v3 v3.0.1 // indirect
2626
)

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
2222
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2323
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
2424
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
25-
github.com/senzing-garage/go-helpers v0.6.11 h1:cwXZLVFKRnriyX+RCaS1Rg9+x7/sJcJjN0TIVZo/vdo=
26-
github.com/senzing-garage/go-helpers v0.6.11/go.mod h1:xjTBckB68M54X5fPyG1ArjXsqfs4rW4CKLNkMDFxAmo=
27-
github.com/senzing-garage/go-logging v1.5.2 h1:9Rhsvxu6jLHfCLIoDxSMXX0sf/w0TY/L7i7fFfSdP64=
28-
github.com/senzing-garage/go-logging v1.5.2/go.mod h1:+QsFSi/qKmCC3YAyuXcRbQlBpvpmhTWLWVH2Miap1Fw=
25+
github.com/senzing-garage/go-helpers v0.6.12 h1:RnoDm2pnVMMGslDbJxtgZpGpuSR5dK+T7BZYoXjRaeM=
26+
github.com/senzing-garage/go-helpers v0.6.12/go.mod h1:/gceFlOcg8+0ujQH/CzLjqVAsXtR9xRJgMWDlpSqHGY=
27+
github.com/senzing-garage/go-logging v1.5.3 h1:RYF5hHL4fAUzOFMQwwotT5/I0YD3ItDF589wKtw73X4=
28+
github.com/senzing-garage/go-logging v1.5.3/go.mod h1:AAZvO6ectkKzD1ZbUl24X1TOd3riCQLYaMKgBnuiZF0=
2929
github.com/senzing-garage/go-messaging v1.5.3 h1:bH+LtEgNJj/PRbg1VMK9/Gk457CdfdcjMiubxffbTog=
3030
github.com/senzing-garage/go-messaging v1.5.3/go.mod h1:7qvSNAVyWcSIcsnDAm8obCxHItljN295O3fX4bOgfp0=
31-
github.com/senzing-garage/go-observing v0.3.4 h1:SQuRmgXZEzcvHYBxObmRf7GYyPt+olZPZhm46ckYGe0=
32-
github.com/senzing-garage/go-observing v0.3.4/go.mod h1:EC0jh0estTXmrnLQyUtbsVzSBNdSWFjL5O+gCA/RJJc=
31+
github.com/senzing-garage/go-observing v0.3.5 h1:DDb8MzycnbTv4Gu9BVO1Whjmbq51CMdlmzUKYn//bCM=
32+
github.com/senzing-garage/go-observing v0.3.5/go.mod h1:U9WB1nmAZ+BfxuDcfJ3SydwtxhhWS0uXupCkNokbiYU=
3333
github.com/senzing-garage/sz-sdk-go v0.15.3 h1:fq5eZgEooZaQZCv6Knt1zkpo0C9QU1CLS9LCOkRanqo=
3434
github.com/senzing-garage/sz-sdk-go v0.15.3/go.mod h1:RPZG4W1AgWxjpA1ogJ0r4TYX0ITx5YhWSIRqEXkdrrg=
3535
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
@@ -54,10 +54,10 @@ golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
5454
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
5555
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
5656
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
57-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 h1:IqsN8hx+lWLqlN+Sc3DoMy/watjofWiU8sRFgQ8fhKM=
58-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
59-
google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM=
60-
google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
57+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 h1:cJfm9zPbe1e873mHJzmQ1nwVEeRDU/T1wXDK2kUSU34=
58+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
59+
google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA=
60+
google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
6161
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
6262
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
6363
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

main.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"github.com/senzing-garage/sz-sdk-go/senzing"
2020
)
2121

22+
const filePermissions = 0o750
23+
2224
// ----------------------------------------------------------------------------
2325
// Variables
2426
// ----------------------------------------------------------------------------
@@ -50,7 +52,7 @@ func main() {
5052
err = os.RemoveAll(filepath.Clean(testDirectoryPath)) // Cleanup any previous test run.
5153
failOnError(5001, err)
5254

53-
err = os.MkdirAll(filepath.Clean(testDirectoryPath), 0o750) // Recreate the test target directory.
55+
err = os.MkdirAll(filepath.Clean(testDirectoryPath), filePermissions) // Recreate the test target directory.
5456
failOnError(5002, err)
5557

5658
// Setup dependencies.
@@ -112,7 +114,7 @@ func demonstrateAddRecord(ctx context.Context, szEngine senzing.SzEngine) (strin
112114

113115
result, err = szEngine.AddRecord(ctx, dataSourceCode, recordID, jsonData, flags)
114116

115-
return result, wraperror.Errorf(err, "demonstrateAddRecord error: %w", err)
117+
return result, wraperror.Errorf(err, wraperror.NoMessage)
116118
}
117119

118120
func demonstrateConfigFunctions(ctx context.Context, szAbstractFactory senzing.SzAbstractFactory) {
@@ -189,25 +191,32 @@ func copyDatabase() (string, error) {
189191

190192
testDirectoryPath := getTestDirectoryPath()
191193

192-
dbTargetPath, err := filepath.Abs(filepath.Join(testDirectoryPath, "G2C.db"))
194+
rawDbTargetPath := filepath.Join(testDirectoryPath, "G2C.db")
195+
196+
dbTargetPath, err := filepath.Abs(rawDbTargetPath)
193197
if err != nil {
194-
return result, fmt.Errorf("failed to make target database path (%s) absolute. Error: %w", dbTargetPath, err)
198+
return result, wraperror.Errorf(err, "failed to make target database path (%s) absolute", rawDbTargetPath)
195199
}
196200

197201
result = "sqlite3://na:na@nowhere/" + dbTargetPath
198202

199203
// Copy template file to test directory.
200204

201-
databaseTemplatePath, err := filepath.Abs(getDatabaseTemplatePath())
205+
rawDatabaseTemplatePath := getDatabaseTemplatePath()
206+
207+
databaseTemplatePath, err := filepath.Abs(rawDatabaseTemplatePath)
202208
if err != nil {
203-
return result, fmt.Errorf("failed to obtain absolute path to database file (%s): %w",
204-
databaseTemplatePath, err)
209+
return result, wraperror.Errorf(
210+
err,
211+
"failed to obtain absolute path to database file (%s)",
212+
rawDatabaseTemplatePath,
213+
)
205214
}
206215

207216
_, _, err = fileutil.CopyFile(databaseTemplatePath, testDirectoryPath, true) // Copy the SQLite database file.
208217
if err != nil {
209-
return result, fmt.Errorf("setup failed to copy template database (%v) to target path (%v): %w",
210-
databaseTemplatePath, testDirectoryPath, err)
218+
return result, wraperror.Errorf(err, "setup failed to copy template database (%s) to target path (%s)",
219+
databaseTemplatePath, testDirectoryPath)
211220
}
212221

213222
return result, nil
@@ -228,14 +237,14 @@ func getLogger(ctx context.Context) (logging.Logging, error) {
228237
_ = ctx
229238
result, err := logging.NewSenzingLogger(9999, Messages)
230239

231-
return result, wraperror.Errorf(err, "getLogger error: %w", err)
240+
return result, wraperror.Errorf(err, wraperror.NoMessage)
232241
}
233242

234243
func getSettings(databaseURL string) (string, error) {
235244
configAttrMap := map[string]string{"databaseUrl": databaseURL}
236245
result, err := settings.BuildSimpleSettingsUsingMap(configAttrMap)
237246

238-
return result, wraperror.Errorf(err, "getSettings error: %w", err)
247+
return result, wraperror.Errorf(err, wraperror.NoMessage)
239248
}
240249

241250
func getTestDirectoryPath() string {

0 commit comments

Comments
 (0)