Skip to content

Commit cd381d7

Browse files
authored
updated & relinted (#70)
* updated go version, in line with other go-openapi packages * updated golangci-lint config * relinted (essentially test code) * removed code guards with build tags for pre19 * updated github actions, added run on windows * updated README (badges) Signed-off-by: Frederic BIDON <[email protected]>
1 parent 4de0676 commit cd381d7

20 files changed

+440
-550
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/go-test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: go test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
name: Lint
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-go@v4
12+
with:
13+
go-version: stable
14+
check-latest: true
15+
cache: true
16+
- name: golangci-lint
17+
uses: golangci/golangci-lint-action@v3
18+
with:
19+
version: latest
20+
only-new-issues: true
21+
22+
test:
23+
name: Unit tests
24+
runs-on: ${{ matrix.os }}
25+
26+
strategy:
27+
matrix:
28+
os: [ ubuntu-latest, macos-latest, windows-latest ]
29+
go_version: ['oldstable', 'stable' ]
30+
31+
steps:
32+
- name: Run unit tests
33+
uses: actions/setup-go@v4
34+
with:
35+
go-version: '${{ matrix.go_version }}'
36+
check-latest: true
37+
cache: true
38+
39+
- uses: actions/checkout@v3
40+
41+
- run: go test -v -race -coverprofile="coverage-${{ matrix.os }}.${{ matrix.go_version }}.out" -covermode=atomic ./...
42+
43+
- name: Upload coverage to codecov
44+
uses: codecov/codecov-action@v3
45+
with:
46+
files: './coverage-${{ matrix.os }}.${{ matrix.go_version }}.out'
47+
flags: '${{ matrix.go_version }}'
48+
os: '${{ matrix.os }}'
49+
fail_ci_if_error: false
50+
verbose: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ secrets.yml
22
vendor
33
Godeps
44
.idea
5+
*.out

.golangci.yml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ linters-settings:
44
golint:
55
min-confidence: 0
66
gocyclo:
7-
min-complexity: 25
7+
min-complexity: 45
88
maligned:
99
suggest-new: true
1010
dupl:
11-
threshold: 100
11+
threshold: 200
1212
goconst:
1313
min-len: 3
1414
min-occurrences: 3
@@ -20,39 +20,41 @@ linters:
2020
- lll
2121
- gochecknoinits
2222
- gochecknoglobals
23-
- nlreturn
24-
- testpackage
23+
- funlen
24+
- godox
25+
- gocognit
26+
- whitespace
27+
- wsl
2528
- wrapcheck
29+
- testpackage
30+
- nlreturn
2631
- gomnd
27-
- exhaustive
2832
- exhaustivestruct
2933
- goerr113
30-
- wsl
31-
- whitespace
32-
- gofumpt
33-
- godot
34+
- errorlint
3435
- nestif
35-
- godox
36-
- funlen
37-
- gci
38-
- gocognit
36+
- godot
37+
- gofumpt
3938
- paralleltest
39+
- tparallel
4040
- thelper
4141
- ifshort
42-
- gomoddirectives
43-
- cyclop
44-
- forcetypeassert
45-
- ireturn
46-
- tagliatelle
47-
- varnamelen
48-
- goimports
49-
- tenv
50-
- golint
5142
- exhaustruct
52-
- nilnil
43+
- varnamelen
44+
- gci
45+
- depguard
46+
- errchkjson
47+
- inamedparam
5348
- nonamedreturns
49+
- musttag
50+
- ireturn
51+
- forcetypeassert
52+
- cyclop
53+
# deprecated linters
54+
- deadcode
55+
- interfacer
56+
- scopelint
57+
- varcheck
58+
- structcheck
59+
- golint
5460
- nosnakecase
55-
- depguard
56-
# temporarily disabled
57-
- goconst
58-
- testifylint

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Swag [![Build Status](https://travis-ci.org/go-openapi/swag.svg?branch=master)](https://travis-ci.org/go-openapi/swag) [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
1+
# Swag [![Build Status](https://github.com/go-openapi/swag/actions/workflows/go-test.yml/badge.svg)](https://github.com/go-openapi/swag/actions?query=workflow%3A"go+test") [![codecov](https://codecov.io/gh/go-openapi/swag/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/swag)
22

3+
[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io)
34
[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/swag/master/LICENSE)
4-
[![GoDoc](https://godoc.org/github.com/go-openapi/swag?status.svg)](http://godoc.org/github.com/go-openapi/swag)
5+
[![GoDoc](https://pkg.go.dev/github.com/go-openapi/swag?status.svg)](http://pkg.go.dev.org/github.com/go-openapi/swag)
56
[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/swag)](https://goreportcard.com/report/github.com/go-openapi/swag)
67

78
Contains a bunch of helper functions for go-openapi and go-swagger projects.
@@ -18,4 +19,4 @@ You may also use it standalone for your projects.
1819

1920
This repo has only few dependencies outside of the standard library:
2021

21-
* YAML utilities depend on gopkg.in/yaml.v2
22+
* YAML utilities depend on gopkg.in/yaml.v3

0 commit comments

Comments
 (0)