Skip to content

Commit 52a3add

Browse files
committed
#286 Update dependencies
1 parent e2030bc commit 52a3add

15 files changed

+219
-66
lines changed

.github/linters/.golangci.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
run:
2+
modules-download-mode: readonly
3+
show-stats: true
4+
5+
output:
6+
print-linter-name: false
7+
sort-results: true
8+
9+
linters:
10+
enable:
11+
# List generated from: https://golangci-lint.run/usage/linters/
12+
# We are enabling all defaults as well as any bug/security related
13+
- asasalint
14+
- asciicheck
15+
- bidichk
16+
- bodyclose
17+
- contextcheck
18+
- durationcheck
19+
- errcheck
20+
- errchkjson
21+
- errorlint
22+
- exhaustive
23+
- exportloopref
24+
- gocheckcompilerdirectives
25+
- gochecksumtype
26+
- gocritic
27+
- gofmt
28+
- gosec
29+
- gosimple
30+
- gosmopolitan
31+
- govet
32+
- ineffassign
33+
- loggercheck
34+
- makezero
35+
- musttag
36+
- nilerr
37+
- noctx
38+
- protogetter
39+
- reassign
40+
- revive
41+
- rowserrcheck
42+
- spancheck
43+
- sqlclosecheck
44+
- staticcheck
45+
- testifylint
46+
- unused
47+
- zerologlint

.github/linters/.jscpd.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2+
"ignore": [
3+
"**/*.go,**/go-test*.yaml"
4+
],
25
"threshold": 13
36
}

.github/workflows/go-test-darwin.yaml.disabled

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: go test darwin
22

3-
on: [push]
3+
on: [pull_request, workflow_dispatch]
44

55
env:
66
DYLD_LIBRARY_PATH: /opt/senzing/g2/lib:/opt/senzing/g2/lib/macos
77
LD_LIBRARY_PATH: /opt/senzing/g2/lib:/opt/senzing/g2/lib/macos
8-
SENZING_TOOLS_DATABASE_URL: sqlite3://na:na@/tmp/sqlite/G2C.db
8+
SENZING_TOOLS_DATABASE_URL: sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
99

1010
permissions:
1111
contents: read
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
go: ["1.21"]
20-
os: [macos-latest]
20+
os: [macos-13]
2121
senzingapi-version: [staging-v4]
2222

2323
steps:
@@ -43,4 +43,15 @@ jobs:
4343
run: mkdir /tmp/sqlite && cp testdata/sqlite/G2C.db /tmp/sqlite/G2C.db
4444

4545
- name: run go test
46-
run: go test -exec /Users/runner/work/serve-grpc/serve-grpc/bin/macos_exec_dyld.sh -v -p 1 ./...
46+
run: go test -exec /Users/runner/work/serve-grpc/serve-grpc/bin/macos_exec_dyld.sh -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./...
47+
48+
- name: Store coverage file
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: cover.out
52+
path: ./cover.out
53+
54+
coverage:
55+
name: coverage
56+
needs: go-test-darwin
57+
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2

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

+28-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on: [push]
44

55
env:
66
LD_LIBRARY_PATH: /opt/senzing/g2/lib
7-
SENZING_TOOLS_DATABASE_URL: sqlite3://na:na@/tmp/sqlite/G2C.db
7+
SENZING_LOG_LEVEL: TRACE
8+
SENZING_TOOLS_DATABASE_URL: sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
89

910
permissions:
1011
contents: read
@@ -30,16 +31,40 @@ jobs:
3031
with:
3132
go-version: ${{ matrix.go }}
3233

33-
- name: install Senzing API Runtime
34+
- name: install Senzing API
3435
uses: senzing-factory/github-action-install-senzing-api@v3
3536
with:
3637
senzingapi-runtime-version: ${{ matrix.senzingapi-version }}
3738

39+
- name: Set up gotestfmt
40+
uses: gotesttools/gotestfmt-action@v2
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
3844
- name: copy /etc files
3945
run: sudo cp testdata/senzing-license/g2.lic /etc/opt/senzing/g2.lic
4046

4147
- name: copy test database files
4248
run: mkdir /tmp/sqlite && cp testdata/sqlite/G2C.db /tmp/sqlite/G2C.db
4349

4450
- name: run go test
45-
run: go test -v -p 1 ./...
51+
run: go test -json -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
52+
53+
- name: Store coverage file
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: cover.out
57+
path: ./cover.out
58+
59+
- name: Upload test log
60+
uses: actions/upload-artifact@v2
61+
if: always()
62+
with:
63+
name: test-log
64+
path: /tmp/gotest.log
65+
if-no-files-found: error
66+
67+
coverage:
68+
name: coverage
69+
needs: go-test-linux
70+
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2

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

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: go test windows
22

3-
on: [push]
3+
on: [pull_request, workflow_dispatch]
44

55
env:
6-
SENZING_TOOLS_DATABASE_URL: sqlite3://na:na@nowhere/C:\Temp\sqlite\G2C.db
6+
SENZING_TOOLS_DATABASE_URL: "sqlite3://na:na@nowhere/C:\\Temp\\sqlite\\G2C.db"
77

88
permissions:
99
contents: read
@@ -44,4 +44,17 @@ jobs:
4444
run: mkdir "C:\Temp\sqlite" && copy testdata/sqlite/G2C.db "C:\Temp\sqlite\G2C.db"
4545

4646
- name: run go test
47-
run: go test -v -p 1 ./...
47+
run: |
48+
go test -v -p 1 -coverprofile=cover -covermode=atomic -coverpkg=./... ./...
49+
cp cover cover.out
50+
51+
- name: Store coverage file
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: cover.out
55+
path: cover.out
56+
57+
coverage:
58+
name: coverage
59+
needs: go-test-windows
60+
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2

.github/workflows/gofmt.yaml

-12
This file was deleted.

.github/workflows/golangci-lint.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: golangci-lint
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
# Required: allow read access to the content for analysis.
11+
contents: read
12+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
13+
pull-requests: read
14+
15+
jobs:
16+
golangci:
17+
name: lint
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: setup go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version: 1.21
30+
31+
- name: golangci-lint
32+
uses: golangci/golangci-lint-action@v6
33+
with:
34+
args: --config=${{ github.workspace }}/.github/linters/.golangci.yml
35+
only-new-issues: false
36+
version: latest

.github/workflows/gosec.yaml

-27
This file was deleted.

.github/workflows/make-go-github-file.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
jobs:
1313
make-go-github-file:
1414
secrets:
15-
SENZING_GITHUB_GPG_PRIVATE_KEY: ${{ secrets.SENZING_GITHUB_GPG_PRIVATE_KEY }}
16-
SENZING_GITHUB_GPG_PASSPHRASE: ${{ secrets.SENZING_GITHUB_GPG_PASSPHRASE }}
1715
SENZING_GITHUB_ACTOR: ${{ secrets.SENZING_GITHUB_ACTOR }}
16+
SENZING_GITHUB_GPG_PASSPHRASE: ${{ secrets.SENZING_GITHUB_GPG_PASSPHRASE }}
17+
SENZING_GITHUB_GPG_PRIVATE_KEY: ${{ secrets.SENZING_GITHUB_GPG_PRIVATE_KEY }}
1818
uses: senzing-factory/build-resources/.github/workflows/make-go-github-file.yaml@v2

Makefile

+30-1
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ GO_ARCH = $(word 2, $(GO_OSARCH))
3333

3434
# Conditional assignment. ('?=')
3535
# Can be overridden with "export"
36-
# Example: "export LD_LIBRARY_PATH=/path/to/my/senzing/g2/lib"
36+
# Example: "export LD_LIBRARY_PATH=/path/to/my/senzing-garage/g2/lib"
3737

3838
LD_LIBRARY_PATH ?= /opt/senzing/g2/lib
39+
GOBIN ?= $(shell go env GOPATH)/bin
3940
SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@/tmp/sqlite/G2C.db
4041

4142
# Export environment variables.
@@ -64,6 +65,12 @@ hello-world: hello-world-osarch-specific
6465
# Dependency management
6566
# -----------------------------------------------------------------------------
6667

68+
.PHONY: make-dependencies
69+
make-dependencies:
70+
@go install github.com/vladopajic/go-test-coverage/v2@latest
71+
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.58.1
72+
73+
6774
.PHONY: dependencies
6875
dependencies:
6976
@go get -u ./...
@@ -99,6 +106,28 @@ docker-build:
99106
.PHONY: test
100107
test: test-osarch-specific
101108

109+
# -----------------------------------------------------------------------------
110+
# Coverage
111+
# -----------------------------------------------------------------------------
112+
113+
.PHONY: coverage
114+
coverage: coverage-osarch-specific
115+
116+
117+
.PHONY: check-coverage
118+
check-coverage: export SENZING_LOG_LEVEL=TRACE
119+
check-coverage:
120+
go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
121+
${GOBIN}/go-test-coverage --config=./.testcoverage.yml
122+
123+
# -----------------------------------------------------------------------------
124+
# Lint
125+
# -----------------------------------------------------------------------------
126+
127+
.PHONY: run-golangci-lint
128+
run-golangci-lint:
129+
${GOBIN}/golangci-lint run --config=.github/linters/.golangci.yml
130+
102131
# -----------------------------------------------------------------------------
103132
# Run
104133
# -----------------------------------------------------------------------------

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/senzing-garage/go-logging v1.5.0
1010
github.com/senzing-garage/go-observing v0.3.2
1111
github.com/senzing-garage/sz-sdk-go v0.13.4
12-
github.com/senzing-garage/sz-sdk-go-core v0.7.2-0.20240613215505-2784a96de8b7
12+
github.com/senzing-garage/sz-sdk-go-core v0.7.3
1313
github.com/senzing-garage/sz-sdk-proto v0.7.6
1414
github.com/spf13/cobra v1.8.1
1515
github.com/spf13/viper v1.19.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ github.com/senzing-garage/go-observing v0.3.2 h1:jXW5u656aZywe/UEUi7ga7nieBSW4CU
4949
github.com/senzing-garage/go-observing v0.3.2/go.mod h1:5yHCwaaIrwX81JOghAL/1Q1V8eF7SQhyBBdhTb7+rgY=
5050
github.com/senzing-garage/sz-sdk-go v0.13.4 h1:x1VWf4Kch8wlEPVEVOWbizhYyCbp5LiTSm9cQsv9XJI=
5151
github.com/senzing-garage/sz-sdk-go v0.13.4/go.mod h1:pr9d622FPNGFPgAFooCcUWNeh+AEyVDkvR3Fmsp6whg=
52-
github.com/senzing-garage/sz-sdk-go-core v0.7.2-0.20240613215505-2784a96de8b7 h1:wzO15ErgeBWUuU31ihnrMLXR6UdZw18PRCcvGY24gTk=
53-
github.com/senzing-garage/sz-sdk-go-core v0.7.2-0.20240613215505-2784a96de8b7/go.mod h1:+N+l991tA8PHqtKD/f8ubZ/KaedN4uiXB6oHsQo+b6g=
52+
github.com/senzing-garage/sz-sdk-go-core v0.7.3 h1:hRG/xSzal+uPY3UAhdPv+nQNwiTMoyNOQ2bgY8QfmqQ=
53+
github.com/senzing-garage/sz-sdk-go-core v0.7.3/go.mod h1:+N+l991tA8PHqtKD/f8ubZ/KaedN4uiXB6oHsQo+b6g=
5454
github.com/senzing-garage/sz-sdk-proto v0.7.6 h1:mHiZr094UTBcRW1OkNam1Pu/pMLZRO/4cIIyjQ/yDlY=
5555
github.com/senzing-garage/sz-sdk-proto v0.7.6/go.mod h1:7CZSZ5yEVmT2T0yiijjdq7dWsdQ/KtRgvKRqCy+j7SI=
5656
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=

makefiles/darwin.mk

+14-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,28 @@ SENZING_TOOLS_SENZING_DIRECTORY ?= $(SENZING_DIR)
99

1010
LD_LIBRARY_PATH := $(SENZING_TOOLS_SENZING_DIRECTORY)/lib:$(SENZING_TOOLS_SENZING_DIRECTORY)/lib/macos
1111
DYLD_LIBRARY_PATH := $(LD_LIBRARY_PATH)
12-
SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@/tmp/sqlite/G2C.db
12+
SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
1313

1414
# -----------------------------------------------------------------------------
1515
# OS specific targets
1616
# -----------------------------------------------------------------------------
1717

1818
.PHONY: clean-osarch-specific
1919
clean-osarch-specific:
20-
@docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true
20+
@docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true
2121
@docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true
22-
@rm -rf $(TARGET_DIRECTORY) || true
23-
@rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true
24-
@rm -rf /tmp/sqlite || true
22+
@rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true
23+
@rm -f $(MAKEFILE_DIRECTORY)/coverage.html || true
24+
@rm -f $(MAKEFILE_DIRECTORY)/coverage.out || true
25+
@rm -fr $(TARGET_DIRECTORY) || true
26+
@rm -fr /tmp/sqlite || true
27+
28+
29+
.PHONY: coverage-osarch-specific
30+
coverage-osarch-specific:
31+
@go test -v -coverprofile=coverage.out -p 1 ./...
32+
@go tool cover -html="coverage.out" -o coverage.html
33+
@open file://$(MAKEFILE_DIRECTORY)/coverage.html
2534

2635

2736
.PHONY: hello-world-osarch-specific

0 commit comments

Comments
 (0)