update golang lint

This commit is contained in:
andrey
2026-01-07 20:40:47 +03:00
parent 99c54bfc0c
commit e058492e99
7 changed files with 65 additions and 72 deletions

View File

@@ -1,42 +0,0 @@
kind: pipeline
name: default
steps:
- name: golangci-lint
image: golangci/golangci-lint:v1.49
volumes:
- name: deps
path: /go/src/mod
commands:
- golangci-lint run --timeout 5m
- name: test
image: golang
volumes:
- name: deps
path: /go/src/mod
commands:
- go test ./...
- name: scripts golangci-lint
image: golangci/golangci-lint:v1.49
volumes:
- name: deps
path: /go/src/mod
commands:
- cd scripts
- golangci-lint run --timeout 5m
- name: scripts test
image: golang
volumes:
- name: deps
path: /go/src/mod
commands:
- cd scripts
- go test ./...
volumes:
- name: deps
temp: {}

View File

@@ -0,0 +1,26 @@
name: Go Action
on: [push, pull_request]
jobs:
goaction:
runs-on: ubuntu-latest # Use a Gitea Actions runner label
steps:
- name: Check out repository code
uses: actions/checkout@v4 # Action to clone the repo
- name: Set up Go
uses: actions/setup-go@v5 # Action to install a specific Go version
with:
go-version: '1.25.5' # Specify your required Go version
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8 # Use the golangci-lint action
with:
version: v2.7.2 # Specify the linter version
# Optional: additional arguments
args: --verbose
- name: Run go test
run: go test ./...

View File

@@ -1,4 +1,14 @@
linters-settings:
version: "2"
linters:
default: all
disable:
- wsl
- depguard
- exhaustruct
- rowserrcheck
- sqlclosecheck
- wastedassign
settings:
dupl:
threshold: 100
funlen:
@@ -9,35 +19,32 @@ linters-settings:
min-occurrences: 2
gocyclo:
min-complexity: 15
golint:
min-confidence: 0
govet:
check-shadowing: true
lll:
line-length: 140
maligned:
suggest-new: true
misspell:
locale: US
locale: US
varnamelen:
min-name-length: 2
linters:
enable-all: true
disable:
- varcheck
- maligned
- scopelint
- nosnakecase
- ifshort
- golint
- interfacer
- structcheck
- deadcode
- exhaustivestruct
- exhaustruct
# is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649
- rowserrcheck
- sqlclosecheck
- wastedassign
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@@ -1,3 +1,3 @@
# mime
[![Build Status](https://drone.gitoa.ru/api/badges/go-4devs/mime/status.svg)](https://drone.gitoa.ru/go-4devs/mime)
![Build Status](https://gitoa.ru/go-4devs/mime/actions/workflows/goaction.yml/badge.svg)

View File

@@ -34,6 +34,7 @@ func TestExtUnmarshalText(t *testing.T) {
for _, cs := range cases {
var in mime.Ext
err := in.UnmarshalText([]byte(cs.data))
require.Equal(t, cs.expext, in)
require.NoError(t, err)

2
go.mod
View File

@@ -1,6 +1,6 @@
module gitoa.ru/go-4devs/mime
go 1.19
go 1.22
require github.com/stretchr/testify v1.8.0

View File

@@ -38,6 +38,7 @@ func TestMimeUnmarshalText(t *testing.T) {
for _, cs := range cases {
var in mime.Mime
err := in.UnmarshalText([]byte(cs.data))
require.Equal(t, cs.expext, in)
require.NoError(t, err)