Skip to content

Commit 25d31f7

Browse files
committed
Initial release
0 parents  commit 25d31f7

File tree

119 files changed

+9122
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+9122
-0
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
jobs:
11+
golangci:
12+
name: golangci-lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: golangci-lint
17+
uses: golangci/golangci-lint-action@v2.2.1
18+
with:
19+
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
20+
version: v1.31
21+
22+
# Optional: golangci-lint command line arguments.
23+
# args: ./the-only-dir-to-analyze/...
24+
25+
# Required: the token is used for fetching a list of releases of golangci-lint.
26+
# The secret `GITHUB_TOKEN` is automatically created by GitHub,
27+
# no need to create it manually.
28+
# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#about-the-github_token-secret
29+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-examples.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: test-examples
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
env:
11+
GO111MODULE: "on"
12+
jobs:
13+
test:
14+
strategy:
15+
matrix:
16+
go-version: [ 1.13.x, 1.14.x, 1.15.x ]
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Install Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: ${{ matrix.go-version }}
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
- name: Test Examples
26+
run: make test-examples

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: test
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
env:
11+
GO111MODULE: "on"
12+
jobs:
13+
test:
14+
strategy:
15+
matrix:
16+
go-version: [ 1.13.x, 1.14.x, 1.15.x ]
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Install Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: ${{ matrix.go-version }}
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
- uses: actions/cache@v1
26+
with:
27+
path: vendor
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
31+
- name: Populate dependencies
32+
run: '(test -d vendor && echo vendor found) || go mod vendor'
33+
- name: Test
34+
run: make test-unit
35+
- name: Upload code coverage
36+
if: matrix.go-version == '1.15.x'
37+
uses: codecov/codecov-action@v1
38+
with:
39+
file: ./unit.coverprofile
40+
flags: unittests

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea
2+
coverage.txt
3+
unit.coverprofile
4+
*_last_run.json
5+
.vscode

.golangci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
2+
run:
3+
tests: true
4+
deadline: 5m
5+
6+
linters-settings:
7+
errcheck:
8+
check-type-assertions: true
9+
check-blank: true
10+
gocyclo:
11+
min-complexity: 20
12+
dupl:
13+
threshold: 100
14+
misspell:
15+
locale: US
16+
unused:
17+
check-exported: false
18+
unparam:
19+
check-exported: true
20+
21+
linters:
22+
enable-all: true
23+
disable:
24+
- gochecknoglobals
25+
- testpackage
26+
- goerr113
27+
28+
issues:
29+
exclude-use-default: false
30+
exclude-rules:
31+
- linters:
32+
- gomnd
33+
- goconst
34+
- goerr113
35+
- noctx
36+
- funlen
37+
path: "_test.go"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Viacheslav Poturaev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
GOLANGCI_LINT_VERSION := "v1.31.0"
2+
3+
# The head of Makefile determines location of dev-go to include standard targets.
4+
GO ?= go
5+
export GO111MODULE = on
6+
7+
ifneq "$(GOFLAGS)" ""
8+
$(info GOFLAGS: ${GOFLAGS})
9+
endif
10+
11+
ifneq "$(wildcard ./vendor )" ""
12+
$(info Using vendor)
13+
modVendor = -mod=vendor
14+
ifeq (,$(findstring -mod,$(GOFLAGS)))
15+
export GOFLAGS := ${GOFLAGS} ${modVendor}
16+
endif
17+
ifneq "$(wildcard ./vendor/github.com/bool64/dev)" ""
18+
DEVGO_PATH := ./vendor/github.com/bool64/dev
19+
endif
20+
endif
21+
22+
ifeq ($(DEVGO_PATH),)
23+
DEVGO_PATH := $(shell GO111MODULE=on $(GO) list ${modVendor} -f '{{.Dir}}' -m github.com/bool64/dev)
24+
ifeq ($(DEVGO_PATH),)
25+
$(info Module github.com/bool64/dev not found, downloading.)
26+
DEVGO_PATH := $(shell export GO111MODULE=on && $(GO) mod tidy && $(GO) list -f '{{.Dir}}' -m github.com/bool64/dev)
27+
endif
28+
endif
29+
30+
-include $(DEVGO_PATH)/makefiles/main.mk
31+
-include $(DEVGO_PATH)/makefiles/test-unit.mk
32+
-include $(DEVGO_PATH)/makefiles/lint.mk
33+
-include $(DEVGO_PATH)/makefiles/github-actions.mk
34+
35+
## Run tests
36+
test: test-unit test-examples
37+
38+
test-examples:
39+
cd _examples && go test -race ./...

0 commit comments

Comments
 (0)