Skip to content

nyuoss/vaporeon-go-template-repository

Repository files navigation

go-template

An initial template repository for a Go project

Prerequisites

  • Install the golang compiler from the official source (version 1.21.3)
  • Include $GOPATH in your path via export PATH=$PATH:$(go env GOPATH)/bin
  • Adding the above to your ~/.bashrc file will require source ~/.bashrc

Running the code

go run main.go

Introduction

Tools

  1. Language: [email protected]
  2. Package Management Tool: go mod
  3. Code Format Tool: [email protected]
  4. Static Analysis Tool: [email protected]
  5. CI Tool: [email protected]

Structure

$ tree
.
|____go.mod         # dependencies
|____LICENSE		
|____Makefile       # make test, fmt….
|____README.md
|____.gitignore
|____.circleci	    # CI configuration
|____main.go	    # main function
|____pkg            # Components
|____.golangci.yml  # golangci-lint Configuration

Components Example

Calculator Component is the Interface exposed to the user.

  • It gives the user an encapsulated calculator object which receives operands.

Operator Component is the internal library for the Calculator.

  • It gives the calculator some operator objects which implements the real calculations.

Please edit it for your projects.

CI Steps

  1. Install dependency and tools (golangci-lint)
  2. Run unit tests
  3. Code static analysis and format check

Getting Started

You have to prepare tools with make.

make tools

Also, you can run lint, format and test with make before making a pull request.

# test 
make test

# lint
make lint

# format
make format

Start your CI project

Contributing

About

A initial template for Go project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published