diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml new file mode 100644 index 0000000..444b398 --- /dev/null +++ b/.github/workflows/golangci-lint.yaml @@ -0,0 +1,59 @@ +name: Golangci lint + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + # Required: allow read access to the content for analysis. + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Senzing API + uses: senzing-factory/github-action-install-senzing-api@v3 + with: + senzingapi-runtime-version: staging-v4 + + - name: Copy Senzing headers + run: | + mkdir --parents ./szconfig/gohelpers + cp /opt/senzing/er/sdk/c/*.h ./szconfig/ + cp /opt/senzing/er/sdk/c/gohelpers/*.h ./szconfig/gohelpers + mkdir --parents ./szconfigmanager/gohelpers + cp /opt/senzing/er/sdk/c/*.h ./szconfigmanager/ + cp /opt/senzing/er/sdk/c/gohelpers/*.h ./szconfigmanager/gohelpers + mkdir --parents ./szdiagnostic/gohelpers + cp /opt/senzing/er/sdk/c/*.h ./szdiagnostic/ + cp /opt/senzing/er/sdk/c/gohelpers/*.h ./szdiagnostic/gohelpers + mkdir --parents ./szengine/gohelpers + cp /opt/senzing/er/sdk/c/*.h ./szengine/ + cp /opt/senzing/er/sdk/c/gohelpers/*.h ./szengine/gohelpers + mkdir --parents ./szproduct/gohelpers + cp /opt/senzing/er/sdk/c/*.h ./szproduct/ + cp /opt/senzing/er/sdk/c/gohelpers/*.h ./szproduct/gohelpers + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version: 1.21 + + - name: Perform linting + uses: golangci/golangci-lint-action@v6 + with: + args: --config=${{ github.workspace }}/.github/linters/.golangci.yaml + only-new-issues: false + version: latest diff --git a/Makefile b/Makefile index ad62ae4..9576d5b 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ GO_ARCH = $(word 2, $(GO_OSARCH)) # Can be overridden with "export" # Example: "export LD_LIBRARY_PATH=/path/to/my/senzing/er/lib" +DOCKER_IMAGE_TAG ?= $(GIT_REPOSITORY_NAME):$(GIT_VERSION) GOBIN ?= $(shell go env GOPATH)/bin LD_LIBRARY_PATH ?= /opt/senzing/er/lib diff --git a/cmd/doc.go b/cmd/doc.go index 631a207..b78ad9e 100644 --- a/cmd/doc.go +++ b/cmd/doc.go @@ -1,4 +1,4 @@ /* -The cmd package is used for Cobra integration. +Package cmd is used for Cobra and Viper integration. */ package cmd diff --git a/doc.go b/doc.go index 044fa0d..ed6e2ed 100644 --- a/doc.go +++ b/doc.go @@ -1,4 +1,4 @@ /* -One or two sentence synopsys of the module. The Senzing XXXX module is... +Module explain is the implementation of the "senzing-tools explain" command. */ package main diff --git a/docs/development.md b/docs/development.md index 6ff5155..eca91bf 100644 --- a/docs/development.md +++ b/docs/development.md @@ -13,7 +13,6 @@ These are "one-time tasks" which may already have been completed. 1. The following software programs need to be installed: 1. [git] 1. [make] - 1. [docker] 1. [go] ## Install Senzing C library @@ -168,7 +167,7 @@ Create a code coverage map. 1. If a web page doesn't appear, visit [localhost:6060]. 1. Senzing documentation will be in the "Third party" section. - `github.com` > `senzing` > `go-cmdhelping` + `github.com` > `senzing` > `explain` 1. When a versioned release is published with a `v0.0.0` format tag, the reference can be found by clicking on the following badge at the top of the README.md page. @@ -243,7 +242,6 @@ Example: ## References [clone-repository]: https://github.com/senzing-garage/knowledge-base/blob/main/HOWTO/clone-repository.md -[docker]: https://github.com/senzing-garage/knowledge-base/blob/main/WHATIS/docker.md [git]: https://github.com/senzing-garage/knowledge-base/blob/main/WHATIS/git.md [Go Reference Badge]: https://pkg.go.dev/badge/github.com/senzing-garage/explain.svg [Go Reference]: https://pkg.go.dev/github.com/senzing-garage/explain diff --git a/explainer/doc.go b/explainer/doc.go index 107ba9e..52d7b53 100644 --- a/explainer/doc.go +++ b/explainer/doc.go @@ -1,40 +1,4 @@ /* -One or two sentence synopsis of the package... - -# Overview - -One or two paragraph overview of the package... -(This page describes the nature of the individual package.) - -More information at https://github.com/senzing-garage/explain - -# Another Header - -Details of the package... -Lorem ipsum dolor sit amet, consectetur adipiscing elit... - -# Examples - -The examples given here should be specific to the package. - -Examples of use can be seen in the examplepackage_test.go files. - - package main - import ( - fmt - - "github.com/senzing-garage/explain/examplepackage" - ) - - func main() { - ctx := context.TODO() - testObject := &ExamplePackageImpl{ - Something: "I'm here", - } - err := testObject.SaySomething(ctx) - if err != nil { - fmt.Println("whoops") - } - } +Package explainer implements the "explainer" command. */ package explainer diff --git a/makefiles/linux.mk b/makefiles/linux.mk index 800641e..9896ffa 100644 --- a/makefiles/linux.mk +++ b/makefiles/linux.mk @@ -47,8 +47,8 @@ hello-world-osarch-specific: package-osarch-specific: docker-build-package @mkdir -p $(TARGET_DIRECTORY) || true @CONTAINER_ID=$$(docker create $(DOCKER_BUILD_IMAGE_NAME)); \ - @docker cp $$CONTAINER_ID:/output/. $(TARGET_DIRECTORY)/; \ - @docker rm -v $$CONTAINER_ID + docker cp $$CONTAINER_ID:/output/. $(TARGET_DIRECTORY)/; \ + docker rm -v $$CONTAINER_ID .PHONY: run-osarch-specific diff --git a/package.Dockerfile b/package.Dockerfile index cb6543f..e1c8f17 100755 --- a/package.Dockerfile +++ b/package.Dockerfile @@ -105,8 +105,8 @@ ARG PROGRAM_NAME # Copy files from prior step. -COPY --from=fpm_builder "/output/*" "/output/" -COPY --from=fpm_builder "/output/linux-amd64/${PROGRAM_NAME}" "/output/linux-amd64/${PROGRAM_NAME}" +COPY --from=fpm_builder "/output/*" "/output/" +COPY --from=fpm_builder "/output/linux-amd64/${PROGRAM_NAME}" "/output/linux-amd64/${PROGRAM_NAME}" USER 1001 CMD ["/bin/bash"] diff --git a/rootfs/.dummy.txt b/rootfs/.dummy.txt deleted file mode 100644 index e69de29..0000000 diff --git a/rootfs/app/container-test.sh b/rootfs/app/container-test.sh new file mode 100644 index 0000000..9f72897 --- /dev/null +++ b/rootfs/app/container-test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Return codes. + +OK=0 +NOT_OK=1 + +# Tests. + +echo "Doing testing." + +exit ${OK} diff --git a/rootfs/healthcheck.sh b/rootfs/app/healthcheck.sh similarity index 100% rename from rootfs/healthcheck.sh rename to rootfs/app/healthcheck.sh