template-go

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

template-go

Go Reference Go Report Card go-test.yaml

Synopsis

The template-go repository serves as a starting point for new repositories hosting Go code. It also shows best practices that can be retro-fitted into existing repositories hosting Go code.

Overview

Aspects of the template-go repository:

  1. Badges: Example badges can be seen above.
  2. Makefile: Simplifies development lifecycle commands.
  3. Sample code: main.go and examplepackage code examples.
  4. Sample test cases: *_test.go files showing how to write and document test cases.
  5. Sample documentation: Documentation style conducive to the Go Package library.
  6. Dockerfile: Containerizing the Go program.
  7. RPM/DEB builds: Using package.Dockerfile to build RPM and DEB files for installation.
  8. .github/workflows: GitActions tailored to Go programming.
  9. .github/dependabot.yml Specifications for keeping Go dependencies up-to-date.

Development

Build
  1. Identify repository. Example:

    export GIT_ACCOUNT=senzing
    export GIT_REPOSITORY=template-go
    export GIT_ACCOUNT_DIR=~/${GIT_ACCOUNT}.git
    export GIT_REPOSITORY_DIR="${GIT_ACCOUNT_DIR}/${GIT_REPOSITORY}"
    
    
  2. Using the environment variables values just set, follow steps in clone-repository to install the Git repository.

  3. Build the binaries. Example:

    cd ${GIT_REPOSITORY_DIR}
    make build
    
    
  4. The binaries will be found in ${GIT_REPOSITORY_DIR}/target. Example:

    tree ${GIT_REPOSITORY_DIR}/target
    
    
  5. Run the binary. Example:

    ${GIT_REPOSITORY_DIR}/target/linux/template-go
    
    
  6. Clean up. Example:

    cd ${GIT_REPOSITORY_DIR}
    make clean
    
    
Test
  1. Run Go tests. Example:

    cd ${GIT_REPOSITORY_DIR}
    make test
    
    
Documentation
  1. Start godoc documentation server. Example:

     cd ${GIT_REPOSITORY_DIR}
     godoc
    
    
  2. Visit localhost:6060

  3. Senzing documentation will be in the "Third party" section. github.com > senzing > template-go

  4. 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: Go Reference

Docker
  1. Use make target to run a docker images that builds RPM and DEB files. Example:

    cd ${GIT_REPOSITORY_DIR}
    make docker-build
    
    
  2. Run docker container. Example:

    docker run \
      --rm \
      senzing/template-go
    
    
Package
Package RPM and DEB files
  1. Use make target to run a docker images that builds RPM and DEB files. Example:

    cd ${GIT_REPOSITORY_DIR}
    make package
    
    
  2. The results will be in the ${GIT_REPOSITORY_DIR}/target directory. Example:

    tree ${GIT_REPOSITORY_DIR}/target
    
    
Test DEB package on Ubuntu
  1. Determine if template-go is installed. Example:

    apt list --installed | grep template-go
    
    
  2. ✏ Install template-go. Example:

    cd ${GIT_REPOSITORY_DIR}/target
    sudo apt install ./template-go-0.0.0.deb
    
    
  3. Run command. Example:

    template-go
    
    
  4. Remove template-go from system. Example:

    sudo apt-get remove template-go
    
    

Documentation

Overview

The Senzing XXXX module is...

Synopsis

The Senzing XXXX packages are...

Overview

(This page describes the nature of the entire Go module or the top-level command, not an individual package.)

More information at https://github.com/senzing/template--go

Another Header

Lorem ipsum dolor sit amet, consectetur adipiscing elit...

Examples

Examples of use can be seen in the xxxx_test.go files.

Directories

Path Synopsis
The example package is used to...
The example package is used to...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL