From babd7723ccf38835f897bf278ba3945b0a96be5e Mon Sep 17 00:00:00 2001 From: Marvin Wendt Date: Sun, 11 Apr 2021 23:20:46 +0200 Subject: [PATCH] Initial commit --- .github/settings.yml | 23 ++++++++++ .github/workflows/atomicgo.yml | 13 ++++++ .github/workflows/go.yml | 36 +++++++++++++++ .github/workflows/golangci.yml | 13 ++++++ .gitignore | 30 ++++++++++++ .golangci.yml | 71 +++++++++++++++++++++++++++++ CHANGELOG.md | 0 LICENSE | 21 +++++++++ README.md | 83 ++++++++++++++++++++++++++++++++++ doc.go | 9 ++++ go.mod | 3 ++ go.sum | 0 template.go | 6 +++ template_test.go | 9 ++++ 14 files changed, 317 insertions(+) create mode 100644 .github/settings.yml create mode 100644 .github/workflows/atomicgo.yml create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/golangci.yml create mode 100644 .gitignore create mode 100644 .golangci.yml create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 doc.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 template.go create mode 100644 template_test.go diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..0ed80b6 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,23 @@ +_extends: .github + +repository: + # See https://developer.github.com/v3/repos/#edit for all available settings. + + # A short description of the repository that will show up on GitHub + description: 🔹 Golang module + + # A comma-separated list of topics to set on the repository + topics: atomicgo, go, golang, golang-library + + # Either `true` to make the repository private, or `false` to make it public. + # private: false + + # Either `true` to enable issues for this repository, `false` to disable them. + # has_issues: true + + # Either `true` to enable projects for this repository, or `false` to disable them. + # If projects are disabled for the organization, passing `true` will cause an API error. + # has_projects: false + + # Either `true` to enable the wiki for this repository, `false` to disable it. + # has_wiki: false diff --git a/.github/workflows/atomicgo.yml b/.github/workflows/atomicgo.yml new file mode 100644 index 0000000..f8d3e91 --- /dev/null +++ b/.github/workflows/atomicgo.yml @@ -0,0 +1,13 @@ +on: push + +name: AtomicGo +jobs: + docs: + if: "!contains(github.event.head_commit.message, 'autoupdate')" + runs-on: ubuntu-latest + steps: + - name: Update Docs + uses: atomicgo/ci@main + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + TERM: xterm-256color diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..597968d --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,36 @@ +name: Go + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + name: Build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: go get -v -t -d ./... + + - name: Build + run: go build -v . + + - name: Test + run: go test -coverprofile="coverage.txt" -covermode=atomic -v -p 1 . + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml new file mode 100644 index 0000000..755e014 --- /dev/null +++ b/.github/workflows/golangci.yml @@ -0,0 +1,13 @@ +name: golangci-lint +on: [ push, pull_request ] +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: v1.39 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e30b64b --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +### Go template +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +vendor/ + +### IntelliJ +.idea +*.iml +out +gen + +### VisualStudioCode +.vscode +*.code-workspace + +### macOS +# General +.DS_Store diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..d18a485 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,71 @@ +linters-settings: + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + disabled-checks: + - dupImport + - ifElseChain + - octalLiteral + - whyNoLint + - wrapperFunc + - exitAfterDefer + - hugeParam + - ptrToRefParam + - paramTypeCombine + - unnamedResult + misspell: + locale: US +linters: + disable-all: true + enable: + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - asciicheck + - bodyclose + - dupl + - durationcheck + - errorlint + - exhaustive + - gci + - gocognit + - gocritic + - godot + - godox + - goerr113 + - gofmt + - goimports + - goprintffuncname + - misspell + - nilerr + - nlreturn + - noctx + - prealloc + - predeclared + - thelper + - unconvert + - unparam + - wastedassign + - wrapcheck +issues: + # Excluding configuration per-path, per-linter, per-text and per-source + exclude-rules: + - path: _test\.go + linters: + - errcheck + - dupl + - gocritic + - wrapcheck + - goerr113 + # https://github.com/go-critic/go-critic/issues/926 + - linters: + - gocritic + text: "unnecessaryDefer:" +service: + golangci-lint-version: 1.39.x # use the fixed version to not introduce new linters unexpectedly diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c78d7a5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Marvin Wendt (MarvinJWendt) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3be0dfc --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +

AtomicGo | template

+ +

+ + +Latest Release + + + +Tests + + + +Coverage + + + +Unit test count + + + +Issues + + + +License: MIT + + +

+ +--- + +

+Get The Module +| +Documentation +| +Contributing +| +Code of Conduct +

+ +--- + +

+ AtomicGo +

+ +## Description + +Package template is used to generate new AtomicGo repositories. + +Write the description of the module here. You can use **markdown**! This +description should clearly explain what the package does. + +Example description: https://golang.org/src/encoding/gob/doc.go + +## Install + +```console +# Execute this command inside your project +go get -u github.com/atomicgo/template +``` + +```go +// Add this to your imports +import "github.com/atomicgo/template" +``` + +## Usage + +#### func HelloWorld + +```go +func HelloWorld() string +``` +HelloWorld returns `Hello, World!`. + +--- + +> [AtomicGo.dev](https://atomicgo.dev)  ·  +> with ❤️ by [@MarvinJWendt](https://github.com/MarvinJWendt) | +> [MarvinJWendt.com](https://marvinjwendt.com) diff --git a/doc.go b/doc.go new file mode 100644 index 0000000..0731a16 --- /dev/null +++ b/doc.go @@ -0,0 +1,9 @@ +/* +Package template is used to generate new AtomicGo repositories. + +Write the description of the module here. You can use **markdown**! +This description should clearly explain what the package does. + +Example description: https://golang.org/src/encoding/gob/doc.go +*/ +package template diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..eb6e377 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/atomicgo/template + +go 1.15 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/template.go b/template.go new file mode 100644 index 0000000..f74b2c0 --- /dev/null +++ b/template.go @@ -0,0 +1,6 @@ +package template + +// HelloWorld returns `Hello, World!`. +func HelloWorld() string { + return "Hello, World!" +} diff --git a/template_test.go b/template_test.go new file mode 100644 index 0000000..b2fd824 --- /dev/null +++ b/template_test.go @@ -0,0 +1,9 @@ +package template + +import "testing" + +func TestHelloWorld(t *testing.T) { + if HelloWorld() != "Hello, World!" { + t.Fatal("Not equal") + } +}