Skip to content

Commit

Permalink
#167 Update to template (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj authored Jun 11, 2024
1 parent 65d9157 commit a416f66
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 245 deletions.
2 changes: 2 additions & 0 deletions .github/linters/.checkov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
quiet: true
skip-check: CKV_DOCKER_7
2 changes: 1 addition & 1 deletion .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
run:
run:
modules-download-mode: readonly
show-stats: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go-test-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
go-version: ${{ matrix.go }}

- name: run go test
run: go test -v -p 1 ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
run: go test -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./...

- name: Store coverage file
uses: actions/upload-artifact@v4
Expand All @@ -37,4 +37,4 @@ jobs:
coverage:
name: coverage
needs: go-test-darwin
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@main
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2
2 changes: 1 addition & 1 deletion .github/workflows/go-test-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
go-version: ${{ matrix.go }}

- name: run go test
run: go test -v -p 1 ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
run: go test -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./...

- name: Store coverage file
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: run go test
run: |
go test -v -p 1 ./... -coverprofile=cover.out -covermode=atomic -coverpkg=./...
go test -v -p 1 -coverprofile=cover -covermode=atomic -coverpkg=./... ./...
cp cover cover.out
- name: Store coverage file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ permissions:

jobs:
lint-workflows:
uses: senzing-factory/build-resources/.github/workflows/lint-workflows.yaml@main
uses: senzing-factory/build-resources/.github/workflows/lint-workflows.yaml@v2
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

-

## [0.13.3] - 2024-06-11

### Changed in 0.13.3

## [0.13.2] - 2024-05-21

### Changed in 0.13.2
Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ GO_PACKAGE_NAME := $(shell echo $(GIT_REMOTE_URL) | sed -e 's|^[email protected]:|g
GO_OSARCH = $(subst /, ,$@)
GO_OS = $(word 1, $(GO_OSARCH))
GO_ARCH = $(word 2, $(GO_OSARCH))
GOBIN ?= $$(go env GOPATH)/bin

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

LD_LIBRARY_PATH ?= /opt/senzing/g2/lib
GOBIN ?= $(shell go env GOPATH)/bin

# Export environment variables.

Expand Down Expand Up @@ -58,6 +60,12 @@ hello-world: hello-world-osarch-specific
# Dependency management
# -----------------------------------------------------------------------------

.PHONY: make-dependencies
make-dependencies:
@go install github.com/vladopajic/go-test-coverage/v2@latest
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.58.1


.PHONY: dependencies
dependencies:
@go get -u ./...
Expand Down Expand Up @@ -108,11 +116,6 @@ test: test-osarch-specific
# Coverage
# -----------------------------------------------------------------------------

.PHONY: install-go-test-coverage
install-go-test-coverage:
go install github.com/vladopajic/go-test-coverage/v2@latest


.PHONY: coverage
coverage: coverage-osarch-specific

Expand All @@ -122,14 +125,13 @@ check-coverage: install-go-test-coverage
go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
${GOBIN}/go-test-coverage --config=./.testcoverage.yml


# -----------------------------------------------------------------------------
# Lint
# -----------------------------------------------------------------------------

.PHONY: run-golangci-lint
run-golangci-lint:
golangci-lint run --config=.github/linters/.golangci.yml
${GOBIN}/golangci-lint run --config=.github/linters/.golangci.yml

# -----------------------------------------------------------------------------
# Utility targets
Expand Down
12 changes: 2 additions & 10 deletions bin/generate_response_response_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"testing"
truncator "github.com/aquilax/truncate"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const (
Expand All @@ -60,14 +60,6 @@
printResult(test, "Actual", actual)
}
func testError(test *testing.T, ctx context.Context, err error) {
_ = ctx
if err != nil {
test.Log("Error:", err.Error())
assert.FailNow(test, err.Error())
}
}
// ----------------------------------------------------------------------------
// Test interface functions
// ----------------------------------------------------------------------------
Expand All @@ -77,7 +69,7 @@
ctx := context.TODO()
jsonString := `{{json}}`
result, err := {{struct}}(ctx, jsonString)
testError(test, ctx, err)
require.NoError(test, err)
printActual(test, result)
""" # noqa: E101,F541,W191

Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
*/
package main

func main() {}
import "fmt"

func main() {
fmt.Println("Nothing to test")
}
13 changes: 13 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"testing"
)

/*
* The unit tests in this file simulate command line invocation.
*/
func TestMain(test *testing.T) {
_ = test
main()
}
430 changes: 211 additions & 219 deletions response/response_test.go

Large diffs are not rendered by default.

0 comments on commit a416f66

Please sign in to comment.