From 143fa71a488f9c3b278851a9cef012ccd2832633 Mon Sep 17 00:00:00 2001 From: docktermj Date: Wed, 10 Jul 2024 18:32:52 -0400 Subject: [PATCH] #152 Savepoint --- .github/linters/.golangci.yaml | 2 +- .github/linters/README.md | 2 +- Makefile | 4 ++-- cmd/cmd_test.go | 13 ++++++------- makefiles/darwin.mk | 6 +++++- makefiles/linux.mk | 6 +++++- makefiles/windows.mk | 9 +++++++-- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/linters/.golangci.yaml b/.github/linters/.golangci.yaml index 3bdbc74..8c22489 100644 --- a/.github/linters/.golangci.yaml +++ b/.github/linters/.golangci.yaml @@ -1,10 +1,10 @@ run: modules-download-mode: readonly - show-stats: true timeout: 10m output: print-linter-name: false + show-stats: true sort-results: true linters: diff --git a/.github/linters/README.md b/.github/linters/README.md index f123939..4f67b3b 100644 --- a/.github/linters/README.md +++ b/.github/linters/README.md @@ -8,7 +8,7 @@ - Used by [golangci-lint.yaml](../workflows/golangci-lint.yaml) - [golangci-lint](https://golangci-lint.run/) - - [Configuration](https://golangci-lint.run/usage/configuration/) + - [Configuration](https://golangci-lint.run/usage/configuration/) ## .jscpd.json diff --git a/Makefile b/Makefile index 3e5c0d2..de5669f 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ hello-world: hello-world-osarch-specific # ----------------------------------------------------------------------------- .PHONY: dependencies-for-make -make-dependencies: +dependencies-for-make: @go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest @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 @@ -87,7 +87,7 @@ setup: setup-osarch-specific # ----------------------------------------------------------------------------- .PHONY: lint -run-golangci-lint: +lint: ${GOBIN}/golangci-lint run --config=.github/linters/.golangci.yaml # ----------------------------------------------------------------------------- diff --git a/cmd/cmd_test.go b/cmd/cmd_test.go index d2951ec..641c112 100644 --- a/cmd/cmd_test.go +++ b/cmd/cmd_test.go @@ -48,29 +48,28 @@ func Test_RunE(test *testing.T) { require.NoError(test, err) } - func Test_RootCmd(test *testing.T) { _ = test err := RootCmd.Execute() - testError(err) + require.NoError(test, err) err = RootCmd.RunE(RootCmd, []string{}) - testError(err) + require.NoError(test, err) } func Test_completionCmd(test *testing.T) { _ = test err := completionCmd.Execute() - testError(err) + require.NoError(test, err) err = completionCmd.RunE(completionCmd, []string{}) - testError(err) + require.NoError(test, err) } func Test_docsCmd(test *testing.T) { _ = test err := docsCmd.Execute() - testError(err) + require.NoError(test, err) err = docsCmd.RunE(docsCmd, []string{}) - testError(err) + require.NoError(test, err) } // ---------------------------------------------------------------------------- diff --git a/makefiles/darwin.mk b/makefiles/darwin.mk index 1a95f6e..5ab0b9c 100644 --- a/makefiles/darwin.mk +++ b/makefiles/darwin.mk @@ -15,13 +15,17 @@ SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@nowhere/tmp/sqlite/G2C.db # OS specific targets # ----------------------------------------------------------------------------- +.PHONY: build-osarch-specific +build-osarch-specific: darwin/amd64 + + .PHONY: clean-osarch-specific clean-osarch-specific: @docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true @docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true @rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true @rm -f $(MAKEFILE_DIRECTORY)/coverage.html || true - @rm -f $(MAKEFILE_DIRECTORY)/coverage.out || true + @rm -f $(MAKEFILE_DIRECTORY)/cover.out || true @rm -fr $(TARGET_DIRECTORY) || true @rm -fr /tmp/sqlite || true diff --git a/makefiles/linux.mk b/makefiles/linux.mk index c3e7b71..faec0cb 100644 --- a/makefiles/linux.mk +++ b/makefiles/linux.mk @@ -11,13 +11,17 @@ SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@nowhere/tmp/sqlite/G2C.db # OS specific targets # ----------------------------------------------------------------------------- +.PHONY: build-osarch-specific +build-osarch-specific: linux/amd64 + + .PHONY: clean-osarch-specific clean-osarch-specific: @docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true @docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true @rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true @rm -f $(MAKEFILE_DIRECTORY)/coverage.html || true - @rm -f $(MAKEFILE_DIRECTORY)/coverage.out || true + @rm -f $(MAKEFILE_DIRECTORY)/cover.out || true @rm -fr $(TARGET_DIRECTORY) || true @rm -fr /tmp/sqlite || true diff --git a/makefiles/windows.mk b/makefiles/windows.mk index 7ce7927..7ffb36f 100644 --- a/makefiles/windows.mk +++ b/makefiles/windows.mk @@ -10,11 +10,16 @@ SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@nowhere/C:\Temp\sqlite\G2C.db # OS specific targets # ----------------------------------------------------------------------------- +.PHONY: build-osarch-specific +build-osarch-specific: windows/amd64 + @mv $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME).exe + + .PHONY: clean-osarch-specific clean-osarch-specific: del /F /S /Q $(GOPATH)/bin/$(PROGRAM_NAME) del /F /S /Q $(MAKEFILE_DIRECTORY)/coverage.html - del /F /S /Q $(MAKEFILE_DIRECTORY)/coverage.out + del /F /S /Q $(MAKEFILE_DIRECTORY)/cover.out del /F /S /Q $(TARGET_DIRECTORY) del /F /S /Q C:\Temp\sqlite @@ -46,7 +51,7 @@ setup-osarch-specific: @mkdir C:\Temp\sqlite @copy testdata\sqlite\G2C.db C:\Temp\sqlite\G2C.db @mkdir $(TARGET_DIRECTORY)\ - @mkdir $(TARGET_DIRECTORY)\$(GO_OS)-$(GO_ARCH) + @mkdir $(TARGET_DIRECTORY)\$(GO_OS)-$(GO_ARCH) .PHONY: test-osarch-specific