Skip to content

Commit

Permalink
Merge pull request #35 from doitintl/update/go
Browse files Browse the repository at this point in the history
go 1.9; golanglint-ci 1.50; define container requests
  • Loading branch information
alexei-led committed Nov 2, 2022
2 parents c3bc3db + c16fb90 commit b8082cd
Show file tree
Hide file tree
Showing 10 changed files with 375 additions and 1,307 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Decide on tag
id: tagger
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
go-version: 1.19.x

- name: Lint
run: |
Expand Down
103 changes: 80 additions & 23 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
run:
# which dirs to skip
skip-dirs:
- mocks
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 5m
# Exit code when at least one issue was found.
# Default: 1
issues-exit-code: 2
# Include test files or not.
# Default: true
tests: false

linters-settings:
govet:
check-shadowing: true
golint:
min-confidence: 0
gocyclo:
min-complexity: 15
maligned:
Expand All @@ -14,8 +26,8 @@ linters-settings:
min-occurrences: 2
misspell:
locale: US
lll:
line-length: 160
ignore-words:
- "cancelled"
goimports:
local-prefixes: github.com/golangci/golangci-lint
gocritic:
Expand All @@ -34,54 +46,99 @@ linters-settings:
- whyNoLint
- wrapperFunc
funlen:
lines: 100
lines: 105
statements: 50

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
disable-all: true
enable:
# - rowserrcheck
- asciicheck
- bidichk
- bodyclose
- deadcode
# - containedctx
# - contextcheck disabled because of generics
- dupword
- decorder
- depguard
- dogsled
- dupl
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
# - exhaustivestruct TODO: check how to fix it
- exportloopref
# - forbidigo TODO: configure forbidden code patterns
# - forcetypeassert
- funlen
- gci
# - gochecknoglobals TODO: remove globals from code
# - gochecknoinits TODO: remove main.init
- gocognit
- goconst
- gocritic
- gocyclo
# - godox
- goerr113
- gofmt
- goimports
- golint
- gomnd
# - gomoddirectives
- gosec
- gosimple
- govet
- goprintffuncname
- grouper
- importas
# - ireturn TODO: not sure if it is a good linter
- ineffassign
- interfacer
- lll
- interfacebloat
- loggercheck
- maintidx
- makezero
- misspell
- nakedret
- scopelint
- staticcheck
- structcheck
# - nestif
- nilerr
- nilnil
# - noctx
- nolintlint
- prealloc
- predeclared
- promlinter
- reassign
- revive
# - rowserrcheck disabled because of generics
# - staticcheck doesn't work with go1.19
# - structcheck disabled because of generics
- stylecheck
- tenv
- testableexamples
- typecheck
- unconvert
- unparam
- unused
- varcheck
# - varnamelen TODO: review naming
# - varcheck depricated 1.49
# - wastedassign disabled because of generics
- whitespace

# don't enable:
# - gochecknoglobals
# - gocognit
# - godox
# - maligned
# - prealloc
- wrapcheck
# - wsl

issues:
exclude:
- Using the variable on range scope `tt` in function literal
exclude-rules:
- path: _test\.go
linters:
- funlen
- bodyclose
- gosec
- dupl
- gocognit
- goconst
- gocyclo
exclude:
- Using the variable on range scope `tt` in function literal
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#
# ----- Go Builder Image ------
#
FROM --platform=${BUILDPLATFORM} golang:1.17-alpine AS builder
FROM --platform=${BUILDPLATFORM} golang:1.19-alpine AS builder

# curl git bash
RUN apk add --no-cache curl git bash make tzdata ca-certificates
COPY --from=golangci/golangci-lint:v1.43-alpine /usr/bin/golangci-lint /usr/bin
COPY --from=golangci/golangci-lint:v1.50-alpine /usr/bin/golangci-lint /usr/bin

#
# ----- Build and Test Image -----
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ platfrom-build: clean lint test ; $(info $(M) building binaries for multiple os/
setup-tools: setup-lint setup-gocov setup-gocov-xml setup-go2xunit setup-mockery setup-ghr

setup-lint:
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.43
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
setup-gocov:
$(GO) install github.com/axw/gocov/...
setup-gocov-xml:
Expand Down
Loading

0 comments on commit b8082cd

Please sign in to comment.