Skip to content

Commit 716a8d7

Browse files
committed
add base and db client
1 parent 39d1914 commit 716a8d7

File tree

12 files changed

+730
-22
lines changed

12 files changed

+730
-22
lines changed

.github/workflows/go.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: '1.20'
19+
cache-dependency-path: go.sum
20+
21+
- name: Build
22+
run: go build -o ./bin/ -v ./...
23+
24+
- name: Test
25+
run: go test -v ./...
26+
27+
linter:
28+
name: lint
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
- uses: actions/setup-go@v4
33+
with:
34+
go-version: '1.20'
35+
cache: false
36+
- name: golangci-lint
37+
uses: golangci/golangci-lint-action@v3
38+
with:
39+
# Require: The version of golangci-lint to use.
40+
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
41+
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
42+
version: v1.53
43+
44+
# Optional: working directory, useful for monorepos
45+
# working-directory: somedir
46+
47+
# Optional: golangci-lint command line arguments.
48+
#
49+
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
50+
# The location of the configuration file can be changed by using `--config=`
51+
args: --timeout=30m --config=./.golangci.pipeline.yaml --issues-exit-code=0
52+
53+
# Optional: show only new issues if it's a pull request. The default value is `false`.
54+
# only-new-issues: true
55+
56+
# Optional: if set to true, then all caching functionality will be completely disabled,
57+
# takes precedence over all other caching options.
58+
# skip-cache: true
59+
60+
# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
61+
# skip-pkg-cache: true
62+
63+
# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
64+
# skip-build-cache: true
65+
66+
# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
67+
# install-mode: "goinstall"

.gitignore

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,2 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
4-
# Binaries for programs and plugins
5-
*.exe
6-
*.exe~
7-
*.dll
8-
*.so
9-
*.dylib
10-
11-
# Test binary, built with `go test -c`
12-
*.test
13-
14-
# Output of the go coverage tool, specifically when used with LiteIDE
15-
*.out
16-
17-
# Dependency directories (remove the comment below to include it)
18-
# vendor/
19-
20-
# Go workspace file
21-
go.work
1+
.idea
2+
bin

.golangci.pipeline.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# More info on config here: https://golangci-lint.run/usage/configuration/#config-file
2+
run:
3+
concurrency: 8
4+
timeout: 10m
5+
issues-exit-code: 1
6+
tests: true
7+
skip-dirs:
8+
- bin
9+
- vendor
10+
- var
11+
- tmp
12+
- .cache
13+
skip-files:
14+
- \.pb\.go$
15+
- \.pb\.gw\.go$
16+
17+
output:
18+
format: colored-line-number
19+
print-issued-lines: true
20+
print-linter-name: true
21+
22+
linters-settings:
23+
govet:
24+
check-shadowing: true
25+
dupl:
26+
threshold: 100
27+
goconst:
28+
min-len: 2
29+
min-occurrences: 2
30+
31+
linters:
32+
disable-all: true
33+
enable:
34+
- errcheck
35+
- goconst
36+
- goimports
37+
- gosec
38+
- govet
39+
- ineffassign
40+
- megacheck
41+
- revive
42+
- typecheck
43+
- unused
44+
45+
issues:
46+
exclude-use-default: false
47+
exclude:
48+
# _ instead of err checks
49+
- G104
50+
- exported func .* returns unexported type .*, which can be annoying to use
51+
- should have a package comment
52+
- don't use an underscore in package name
53+
- or be unexported

Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
LOCAL_BIN:=$(CURDIR)/bin
2+
3+
install-deps:
4+
GOBIN=$(LOCAL_BIN) go install github.com/golangci/golangci-lint/cmd/[email protected]
5+
6+
lint:
7+
GOBIN=$(LOCAL_BIN) golangci-lint run ./... --config .golangci.pipeline.yaml

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# platform_common
1+
# platform_common
2+
3+
Репозиторий содержит общие компоненты, которые можно переиспользовать в других проектах.

go.mod

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module github.com/olezhek28/platform_common
2+
3+
go 1.20
4+
5+
require (
6+
github.com/georgysavva/scany v1.2.1
7+
github.com/jackc/pgconn v1.14.1
8+
github.com/jackc/pgx/v4 v4.18.1
9+
github.com/pkg/errors v0.9.1
10+
)
11+
12+
require (
13+
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
14+
github.com/jackc/pgio v1.0.0 // indirect
15+
github.com/jackc/pgpassfile v1.0.0 // indirect
16+
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
17+
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
18+
github.com/jackc/pgtype v1.14.0 // indirect
19+
github.com/jackc/puddle v1.3.0 // indirect
20+
golang.org/x/crypto v0.6.0 // indirect
21+
golang.org/x/sys v0.7.0 // indirect
22+
golang.org/x/text v0.9.0 // indirect
23+
)

0 commit comments

Comments
 (0)