Skip to content

Commit

Permalink
Project refactor, update readme, github actions, optimize setBody and…
Browse files Browse the repository at this point in the history
… update golang version
  • Loading branch information
pzentenoe committed Apr 9, 2024
1 parent 8009066 commit 621fd42
Show file tree
Hide file tree
Showing 10 changed files with 381 additions and 494 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Go

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Go 1.22
uses: actions/setup-go@v3
with:
go-version: 1.22
id: go

- name: Cache Go modules
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: go test ./... -v
env:
GO111MODULE: on

- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57

- name: Run golangci-lint
run: golangci-lint run ./...
env:
GO111MODULE: on
153 changes: 11 additions & 142 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,151 +1,20 @@
linters-settings:
# depguard:
# list-type: blacklist
# packages:
# # logging is allowed only by logutils.Log, logrus
# # is allowed to use only in logutils package
# - github.com/sirupsen/logrus
# packages-with-error-message:
# - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
dupl:
threshold: 200
exhaustive:
default-signifies-exhaustive: false
funlen:
lines: 50
statements: 50
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
gocyclo:
min-complexity: 15
# goimports:
# local-prefixes: github.com/golangci/golangci-lint
golint:
min-confidence: 0.81
gomnd:
settings:
mnd:
# don't include the "operation" and "assign"
checks: argument,case,condition,return
revive:
# Configura revive si es necesario. Revive es altamente configurable.
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 150
maligned:
suggest-new: true
misspell:
locale: US, ES
ignore-words:
- regiones
nolintlint:
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
enable:
- fieldalignment

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:
- bodyclose
- deadcode
# - depguard
- dogsled
- dupl
- errcheck
- exhaustive
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- gomnd
- goprintffuncname
- gosimple
- govet
- ineffassign
- interfacer
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
#- revive
- unused
- varcheck
- whitespace

# don't enable:
# - asciicheck
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl
#- govet
- exportloopref
- exhaustruct

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- gomnd

# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"

run:
tests: false
skip-dirs:
- test/testdata_etc
- internal/cache
- internal/renameio
- internal/robustio

modules-download-mode: vendor

# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
service:
project-path: github.com/pzentenoe/httpclient-go
analyzed-paths:
- ./...
golangci-lint-version: 1.31.0
exclude-use-default: false
exclude-files:
- "_test\\.go$"
Loading

0 comments on commit 621fd42

Please sign in to comment.