Skip to content

Commit

Permalink
#69 Normalize to template
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj committed Aug 21, 2024
1 parent 4146576 commit c2cbdd6
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 46 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cmd/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
The cmd package is used for Cobra integration.
Package cmd is used for Cobra and Viper integration.
*/
package cmd
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
38 changes: 1 addition & 37 deletions explainer/doc.go
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions makefiles/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Empty file removed rootfs/.dummy.txt
Empty file.
12 changes: 12 additions & 0 deletions rootfs/app/container-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Return codes.

OK=0
NOT_OK=1

# Tests.

echo "Doing testing."

exit ${OK}
File renamed without changes.

0 comments on commit c2cbdd6

Please sign in to comment.