Skip to content

Commit

Permalink
updated & relinted (#70)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
fredbi authored Dec 6, 2023
1 parent 4de0676 commit cd381d7
Show file tree
Hide file tree
Showing 20 changed files with 440 additions and 550 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/ci.yaml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: go test

on: [push, pull_request]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: stable
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
only-new-issues: true

test:
name: Unit tests
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
go_version: ['oldstable', 'stable' ]

steps:
- name: Run unit tests
uses: actions/setup-go@v4
with:
go-version: '${{ matrix.go_version }}'
check-latest: true
cache: true

- uses: actions/checkout@v3

- run: go test -v -race -coverprofile="coverage-${{ matrix.os }}.${{ matrix.go_version }}.out" -covermode=atomic ./...

- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
files: './coverage-${{ matrix.os }}.${{ matrix.go_version }}.out'
flags: '${{ matrix.go_version }}'
os: '${{ matrix.os }}'
fail_ci_if_error: false
verbose: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ secrets.yml
vendor
Godeps
.idea
*.out
56 changes: 29 additions & 27 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ linters-settings:
golint:
min-confidence: 0
gocyclo:
min-complexity: 25
min-complexity: 45
maligned:
suggest-new: true
dupl:
threshold: 100
threshold: 200
goconst:
min-len: 3
min-occurrences: 3
Expand All @@ -20,39 +20,41 @@ linters:
- lll
- gochecknoinits
- gochecknoglobals
- nlreturn
- testpackage
- funlen
- godox
- gocognit
- whitespace
- wsl
- wrapcheck
- testpackage
- nlreturn
- gomnd
- exhaustive
- exhaustivestruct
- goerr113
- wsl
- whitespace
- gofumpt
- godot
- errorlint
- nestif
- godox
- funlen
- gci
- gocognit
- godot
- gofumpt
- paralleltest
- tparallel
- thelper
- ifshort
- gomoddirectives
- cyclop
- forcetypeassert
- ireturn
- tagliatelle
- varnamelen
- goimports
- tenv
- golint
- exhaustruct
- nilnil
- varnamelen
- gci
- depguard
- errchkjson
- inamedparam
- nonamedreturns
- musttag
- ireturn
- forcetypeassert
- cyclop
# deprecated linters
- deadcode
- interfacer
- scopelint
- varcheck
- structcheck
- golint
- nosnakecase
- depguard
# temporarily disabled
- goconst
- testifylint
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 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)
# 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)

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

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

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

* YAML utilities depend on gopkg.in/yaml.v2
* YAML utilities depend on gopkg.in/yaml.v3
Loading

0 comments on commit cd381d7

Please sign in to comment.