Skip to content

Commit

Permalink
Samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jskonst committed May 13, 2024
1 parent 5f85edc commit 9d6a53c
Show file tree
Hide file tree
Showing 22 changed files with 933 additions and 633 deletions.
222 changes: 111 additions & 111 deletions golang/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,111 +1,111 @@
run:
tests: false
skip-files:
- \.pb\.go$
- \.pb\.validate\.go$
- \.pb\.gw\.go$

linters-settings:
dupl:
threshold: 500
# commented linter rules should be uncommented when corresponding linter will be enabled
# funlen:
# lines: 160
# statements: 60
gci:
local-prefixes: github.com/golangci/golangci-lint
# revive:
# min-confidence: 0
# gomnd:
# checks:
# - argument
# - case
# - condition
# - return
lll:
line-length: 160

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
# Disabled linters should be enabled later
disable-all: true
enable:
- asciicheck
- bidichk
- bodyclose
- containedctx
# - deadcode
- decorder
- depguard
- dogsled
- dupl
- durationcheck
# - errcheck
- errchkjson
# - errname
- errorlint
- execinquery
- exportloopref
# - forbidigo
- forcetypeassert
# - funlen
- gocognit
- goconst
# - gocritic
- gocyclo
# - gofmt
# - gofumpt
- goheader
# - goimports
# - gomnd
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- grouper
# - ifshort
- importas
- ineffassign
- lll
# - maintidx
- makezero
# - misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
# - nolintlint
- nosprintfhostport
- paralleltest
# - prealloc
# - predeclared
- promlinter
# - revive
- rowserrcheck
- sqlclosecheck
# - structcheck
# - stylecheck
# - tagliatelle
- tenv
- testpackage
- tparallel
- typecheck
- unconvert
- unparam
- unused
# - varcheck
- wastedassign
- whitespace

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- text: "File is not `goimports`-ed with -local github.com/golangci/golangci-lint"
linters:
- goimports
run:
tests: false
skip-files:
- \.pb\.go$
- \.pb\.validate\.go$
- \.pb\.gw\.go$

linters-settings:
dupl:
threshold: 500
# commented linter rules should be uncommented when corresponding linter will be enabled
# funlen:
# lines: 160
# statements: 60
gci:
local-prefixes: github.com/golangci/golangci-lint
# revive:
# min-confidence: 0
# gomnd:
# checks:
# - argument
# - case
# - condition
# - return
lll:
line-length: 160

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
# Disabled linters should be enabled later
disable-all: true
enable:
- asciicheck
- bidichk
- bodyclose
- containedctx
# - deadcode
- decorder
- depguard
- dogsled
- dupl
- durationcheck
# - errcheck
- errchkjson
# - errname
- errorlint
- execinquery
- exportloopref
# - forbidigo
- forcetypeassert
# - funlen
- gocognit
- goconst
# - gocritic
- gocyclo
# - gofmt
# - gofumpt
- goheader
# - goimports
# - gomnd
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- grouper
# - ifshort
- importas
- ineffassign
- lll
# - maintidx
- makezero
# - misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
# - nolintlint
- nosprintfhostport
- paralleltest
# - prealloc
# - predeclared
- promlinter
# - revive
- rowserrcheck
- sqlclosecheck
# - structcheck
# - stylecheck
# - tagliatelle
- tenv
- testpackage
- tparallel
- typecheck
- unconvert
- unparam
- unused
# - varcheck
- wastedassign
- whitespace

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd
- text: "File is not `goimports`-ed with -local github.com/golangci/golangci-lint"
linters:
- goimports
48 changes: 24 additions & 24 deletions golang/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch test function",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${file}",
},
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"console": "integratedTerminal",
"args": ["sample"],
"showLog": true
}
]
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"console": "integratedTerminal",
"args": ["sample"],
"showLog": true
}
{
"name": "Launch test function",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${file}",
},
]
}
11 changes: 7 additions & 4 deletions golang/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"]
}
{
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.delveConfig": {
"debugAdapter": "legacy"
}
}
66 changes: 33 additions & 33 deletions golang/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Работа с проектом

`vscode` при старте предложит установить рекомендованныек расширения - с ним лучше согласиться.


## Настройка окружения

### Golang

Установите `golang` для соответствующей операционной системы.

Запустите выкачивание зависимостей

```shell
go mod tidy
```

Для локальной проверки линтером следует установить линтер. Устанавливать следует из git bash терминала в случае `windows`

```shell
# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
```

Для запуска линтера следует выполнить следующую команду
```shell
$(go env GOPATH)/bin/golangci-lint run -vvv --out-format tab --print-resources-usage --timeout=180s --config=.golangci.yml
```

### Запуск тестов

```shell
go test -count=1 -p 1 -v ./...
# Работа с проектом

`vscode` при старте предложит установить рекомендованныек расширения - с ним лучше согласиться.


## Настройка окружения

### Golang

Установите `golang` для соответствующей операционной системы.

Запустите выкачивание зависимостей

```shell
go mod tidy
```

Для локальной проверки линтером следует установить линтер. Устанавливать следует из git bash терминала в случае `windows`

```shell
# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.1
```

Для запуска линтера следует выполнить следующую команду
```shell
$(go env GOPATH)/bin/golangci-lint run -vvv --out-format tab --print-resources-usage --timeout=180s --config=.golangci.yml
```

### Запуск тестов

```shell
go test -count=1 -p 1 -v ./...
```
36 changes: 18 additions & 18 deletions golang/algorithm.code-workspace
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"folders": [
{
"path": "."
},
],
"settings": {
"files.exclude": {
"**/.git": true,
},
},
"extensions": {
"recommendations": [
"golang.go",
"eamodio.gitlens"
]
}
}
{
"folders": [
{
"path": "."
},
],
"settings": {
"files.exclude": {
"**/.git": true,
},
},
"extensions": {
"recommendations": [
"golang.go",
"eamodio.gitlens"
]
}
}
Loading

0 comments on commit 9d6a53c

Please sign in to comment.