Skip to content

Commit 13d733c

Browse files
committed
Refactor the whole project
1 parent 073dff2 commit 13d733c

31 files changed

+220
-1407
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.git/
2-
pkg/usersd/test-db
32
dist/
3+
pkg/usersd/test-db
44

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/ISSUE_TEMPLATE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(Optional) Provide more detailed explanation about the issue.
2+
3+
<details>
4+
<summary>Environment details</summary><br/>
5+
6+
```shell-session
7+
$ go version
8+
Paste output here
9+
```
10+
11+
```shell-session
12+
$ go env
13+
Paste output here
14+
```
15+
</details>
16+
17+
# Reproduction recipe
18+
19+
Provide the simplest and clearest instructions as possible to reproduce the
20+
issue.
21+

.github/workflows/go.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Go
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
ci:
11+
name: CI
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
go_version:
17+
- "1.16"
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- name: Set up Go
21+
uses: actions/setup-go@v1
22+
with:
23+
go-version: ${{ matrix.go_version }}
24+
25+
- name: Set up tools
26+
run: |
27+
wget -qO "/tmp/golangci-lint-1.36.0-linux-amd64.tar.gz" 'https://github.com/golangci/golangci-lint/releases/download/v1.36.0/golangci-lint-1.36.0-linux-amd64.tar.gz'
28+
tar -xf "/tmp/golangci-lint-1.36.0-linux-amd64.tar.gz" -C "/tmp/"
29+
sudo cp "/tmp/golangci-lint-1.36.0-linux-amd64/golangci-lint" "/usr/bin/"
30+
31+
- name: Get source code
32+
uses: actions/checkout@v2
33+
34+
- name: Build
35+
run: make build
36+
37+
- name: Tests
38+
run: make test-race
39+
40+
- name: Coverage
41+
run: |
42+
make coverage
43+
bash <(curl -s https://codecov.io/bash)
44+
45+
#- name: Benchmarks
46+
# run: make benchmark
47+
48+
- name: Lint
49+
run: make lint
50+
51+
- name: Code Analysis
52+
run: make ca
53+

.gitignore

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
nogit-*
2+
coverage.txt
23
dist/
34

4-
# MacOS
5-
.DS_Store
5+
#######################
6+
# Frameworks and libs #
7+
#######################
68

7-
# Sublime Text
8-
*.sublime*
9+
#########
10+
# Tools #
11+
#########
12+
13+
# Delve
14+
debug.test
915

1016
# GNU Screen
1117
.screenrc
1218

19+
# Sublime Text
20+
*.sublime*
21+
1322
# Vim
1423
*.sw[op]
1524
Session.vim
1625
*~
1726

18-
# Go
19-
coverage.txt
27+
######
28+
# OS #
29+
######
30+
31+
# MacOS
32+
.DS_Store
2033

.golangci.yml

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,61 @@
11
run:
22
tests: true
3-
skip-files:
4-
- mage.go
5-
- magefile.go
3+
timeout: 1m
4+
skip-dirs: []
5+
skip-files: []
6+
linters:
7+
enable-all: true
8+
disable:
9+
- depguard
10+
- exhaustivestruct
11+
- gochecknoglobals
12+
- gochecknoinits
13+
- gofumpt
14+
- gomnd
15+
- ifshort
16+
- nlreturn
17+
- unparam
18+
- unused
619
linters-settings:
720
errcheck:
821
check-type-assertions: true
922
check-blank: true
10-
govet:
11-
check-shadowing: true
12-
golint:
13-
min-confidence: 0
23+
gocognit:
24+
min-complexity: 10
1425
gocyclo:
1526
min-complexity: 10
27+
golint:
28+
min-confidence: 0
29+
govet:
30+
check-shadowing: true
31+
lll:
32+
line-length: 79
1633
maligned:
1734
suggest-new: true
1835
misspell:
1936
locale: US
20-
lll:
21-
line-length: 79
22-
linters:
23-
enable-all: true
24-
disable:
25-
- gochecknoglobals
26-
- gochecknoinits
27-
- depguard
28-
- unparam
29-
- unused
37+
nestif:
38+
min-complexity: 3
39+
wsl:
40+
strict-append: true
41+
allow-assign-and-call: true
42+
allow-assign-and-anything: false
43+
allow-multiline-assign: false
44+
force-case-trailing-whitespace: 0
45+
allow-cuddle-declarations: false
46+
allow-case-trailing-whitespace: true
47+
allow-trailing-comment: false
48+
enforce-err-cuddling: true
49+
issues:
50+
exclude-rules:
51+
- path: _test\.go
52+
linters:
53+
- gocyclo
54+
- gocognit
55+
- goerr113
56+
- forbidigo
57+
- funlen
58+
- lll
59+
- testpackage
60+
- wrapcheck
3061

.ntweb/images/er.svg

Lines changed: 1 addition & 1 deletion
Loading

.ntweb/index.en.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
title: usersd
33
description: Authentication and authorization microservice.
44
tags:
5-
- daemon
65
- cli
7-
- rest-server
8-
- mage
6+
- rest-api
97
- go
10-
- golangci
11-
- travis
128
---
139

14-
[![Travis build status](https://travis-ci.com/ntrrg/usersd.svg?branch=master)](https://travis-ci.com/ntrrg/usersd)
10+
[![GitHub Actions](https://github.com/ntrrg/usersd/workflows/Go/badge.svg)](https://github.com/ntrrg/usersd/actions?query=workflow:Go)
1511
[![codecov](https://codecov.io/gh/ntrrg/usersd/branch/master/graph/badge.svg)](https://codecov.io/gh/ntrrg/usersd)
16-
[![GolangCI](https://golangci.com/badges/github.com/ntrrg/usersd.svg)](https://golangci.com/r/github.com/ntrrg/usersd)
17-
[![GoDoc](https://godoc.org/nt.web.ve/go/usersd/pkg/usersd?status.svg)](https://godoc.org/nt.web.ve/go/usersd/pkg/usersd)
18-
[![BCH compliance](https://bettercodehub.com/edge/badge/ntrrg/usersd?branch=master)](https://bettercodehub.com/results/ntrrg/usersd)
12+
[![Go Reference](https://pkg.go.dev/badge/go.ntrrg.dev/usersd.svg)](https://pkg.go.dev/go.ntrrg.dev/usersd)
1913

2014
**usersd** is an authentication and authorization microservice. It was first
2115
planned as a users management service, but it handles identities instead of
@@ -25,7 +19,7 @@ users, which makes it more flexible and powerful.
2519

2620
If you need help or find a bug, file an issue at the [issue tracker](https://github.com/ntrrg/usersd/issues).
2721
If using technical tools is not your style, feel free to send us an email at
28-
22+
2923

3024
# Contributing
3125

@@ -82,3 +76,9 @@ Working on this project we use/used:
8276

8377
* [Termux](https://termux.com)
8478

79+
* [Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/developer/)
80+
81+
* [GitHub Actions](https://github.com/features/actions)
82+
83+
* [Alpine](https://alpinelinux.org/)
84+

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at [email protected]. All
58+
reported by contacting the project team at [email protected]. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.

0 commit comments

Comments
 (0)