mirror of
https://github.com/jimeh/go-golden.git
synced 2026-02-19 03:16:38 +00:00
ci(deps): update actions and lint config to get them all running again (#5)
This commit is contained in:
53
.github/workflows/ci.yml
vendored
53
.github/workflows/ci.yml
vendored
@@ -6,29 +6,28 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: golangci-lint
|
- uses: actions/setup-go@v5
|
||||||
uses: golangci/golangci-lint-action@v2
|
|
||||||
with:
|
with:
|
||||||
version: v1.42
|
go-version-file: go.mod
|
||||||
env:
|
- name: golangci-lint
|
||||||
VERBOSE: "true"
|
uses: golangci/golangci-lint-action@v6
|
||||||
|
with:
|
||||||
|
version: v1.64
|
||||||
|
|
||||||
tidy:
|
tidy:
|
||||||
name: Tidy
|
name: Tidy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version-file: go.mod
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
- name: Check if mods are tidy
|
- name: Check if mods are tidy
|
||||||
run: make check-tidy
|
run: make check-tidy
|
||||||
|
|
||||||
@@ -36,18 +35,12 @@ jobs:
|
|||||||
name: Coverage
|
name: Coverage
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version-file: go.mod
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
- name: Publish coverage
|
- name: Publish coverage
|
||||||
uses: paambaati/codeclimate-action@v2.7.4
|
uses: paambaati/codeclimate-action@v9.0.0
|
||||||
env:
|
env:
|
||||||
VERBOSE: "true"
|
VERBOSE: "true"
|
||||||
GOMAXPROCS: 4
|
GOMAXPROCS: 4
|
||||||
@@ -73,15 +66,9 @@ jobs:
|
|||||||
- "1.17"
|
- "1.17"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go_version }}
|
go-version: ${{ matrix.go_version }}
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test -v -count=1 -race ./...
|
run: go test -v -count=1 -race ./...
|
||||||
|
|||||||
@@ -4,18 +4,13 @@ linters-settings:
|
|||||||
statements: 150
|
statements: 150
|
||||||
gocyclo:
|
gocyclo:
|
||||||
min-complexity: 20
|
min-complexity: 20
|
||||||
golint:
|
|
||||||
min-confidence: 0
|
|
||||||
govet:
|
govet:
|
||||||
check-shadowing: true
|
|
||||||
enable-all: true
|
enable-all: true
|
||||||
disable:
|
disable:
|
||||||
- fieldalignment
|
- fieldalignment
|
||||||
lll:
|
lll:
|
||||||
line-length: 80
|
line-length: 80
|
||||||
tab-width: 4
|
tab-width: 4
|
||||||
maligned:
|
|
||||||
suggest-new: true
|
|
||||||
misspell:
|
misspell:
|
||||||
locale: US
|
locale: US
|
||||||
|
|
||||||
@@ -24,13 +19,11 @@ linters:
|
|||||||
enable:
|
enable:
|
||||||
- asciicheck
|
- asciicheck
|
||||||
- bodyclose
|
- bodyclose
|
||||||
- deadcode
|
- copyloopvar
|
||||||
- depguard
|
|
||||||
- durationcheck
|
- durationcheck
|
||||||
- errcheck
|
- errcheck
|
||||||
- errorlint
|
- errorlint
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- exportloopref
|
|
||||||
- funlen
|
- funlen
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
- goconst
|
- goconst
|
||||||
@@ -58,13 +51,10 @@ linters:
|
|||||||
- rowserrcheck
|
- rowserrcheck
|
||||||
- sqlclosecheck
|
- sqlclosecheck
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
|
||||||
- tparallel
|
|
||||||
- typecheck
|
- typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
- unparam
|
||||||
- unused
|
- unused
|
||||||
- varcheck
|
|
||||||
- wastedassign
|
- wastedassign
|
||||||
- whitespace
|
- whitespace
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ type MyStruct struct {
|
|||||||
// TestExampleMyStruct reads/writes the following golden file:
|
// TestExampleMyStruct reads/writes the following golden file:
|
||||||
//
|
//
|
||||||
// testdata/TestExampleMyStruct.golden
|
// testdata/TestExampleMyStruct.golden
|
||||||
//
|
|
||||||
func TestExampleMyStruct(t *testing.T) {
|
func TestExampleMyStruct(t *testing.T) {
|
||||||
got, err := json.Marshal(&MyStruct{Foo: "Bar"})
|
got, err := json.Marshal(&MyStruct{Foo: "Bar"})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@@ -34,7 +33,6 @@ func TestExampleMyStruct(t *testing.T) {
|
|||||||
//
|
//
|
||||||
// testdata/TestExampleMyStructTabular/empty_struct.golden
|
// testdata/TestExampleMyStructTabular/empty_struct.golden
|
||||||
// testdata/TestExampleMyStructTabular/full_struct.golden
|
// testdata/TestExampleMyStructTabular/full_struct.golden
|
||||||
//
|
|
||||||
func TestExampleMyStructTabular(t *testing.T) {
|
func TestExampleMyStructTabular(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@@ -62,7 +60,6 @@ func TestExampleMyStructTabular(t *testing.T) {
|
|||||||
//
|
//
|
||||||
// testdata/TestExampleMyStructP/json.golden
|
// testdata/TestExampleMyStructP/json.golden
|
||||||
// testdata/TestExampleMyStructP/xml.golden
|
// testdata/TestExampleMyStructP/xml.golden
|
||||||
//
|
|
||||||
func TestExampleMyStructP(t *testing.T) {
|
func TestExampleMyStructP(t *testing.T) {
|
||||||
gotJSON, _ := json.Marshal(&MyStruct{Foo: "Bar"})
|
gotJSON, _ := json.Marshal(&MyStruct{Foo: "Bar"})
|
||||||
gotXML, _ := xml.Marshal(&MyStruct{Foo: "Bar"})
|
gotXML, _ := xml.Marshal(&MyStruct{Foo: "Bar"})
|
||||||
@@ -82,7 +79,6 @@ func TestExampleMyStructP(t *testing.T) {
|
|||||||
// testdata/TestExampleMyStructTabularP/empty_struct/xml.golden
|
// testdata/TestExampleMyStructTabularP/empty_struct/xml.golden
|
||||||
// testdata/TestExampleMyStructTabularP/full_struct/json.golden
|
// testdata/TestExampleMyStructTabularP/full_struct/json.golden
|
||||||
// testdata/TestExampleMyStructTabularP/full_struct/xml.golden
|
// testdata/TestExampleMyStructTabularP/full_struct/xml.golden
|
||||||
//
|
|
||||||
func TestExampleMyStructTabularP(t *testing.T) {
|
func TestExampleMyStructTabularP(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// compatible with Linux, macOS and Windows systems regardless of what crazy
|
// compatible with Linux, macOS and Windows systems regardless of what crazy
|
||||||
// characters might be in a subtest's name.
|
// characters might be in a subtest's name.
|
||||||
//
|
//
|
||||||
// Usage
|
// # Usage
|
||||||
//
|
//
|
||||||
// Typical usage should look something like this:
|
// Typical usage should look something like this:
|
||||||
//
|
//
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
// GOLDEN_UPDATE environment variable to one of "1", "y", "t", "yes", "on", or
|
// GOLDEN_UPDATE environment variable to one of "1", "y", "t", "yes", "on", or
|
||||||
// "true" when running tests.
|
// "true" when running tests.
|
||||||
//
|
//
|
||||||
// Sub-Tests
|
// # Sub-Tests
|
||||||
//
|
//
|
||||||
// As the golden filename is based on t.Name(), it works with sub-tests too,
|
// As the golden filename is based on t.Name(), it works with sub-tests too,
|
||||||
// ensuring each sub-test gets it's own golden file. For example:
|
// ensuring each sub-test gets it's own golden file. For example:
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
// testdata/TestExampleMyStructTabular/empty_struct.golden
|
// testdata/TestExampleMyStructTabular/empty_struct.golden
|
||||||
// testdata/TestExampleMyStructTabular/full_struct.golden
|
// testdata/TestExampleMyStructTabular/full_struct.golden
|
||||||
//
|
//
|
||||||
// Multiple Golden Files in a Single Test
|
// # Multiple Golden Files in a Single Test
|
||||||
//
|
//
|
||||||
// The "P" suffixed methods, GetP(), SetP(), and FileP(), all take a name
|
// The "P" suffixed methods, GetP(), SetP(), and FileP(), all take a name
|
||||||
// argument which allows using specific golden files within a given *testing.T
|
// argument which allows using specific golden files within a given *testing.T
|
||||||
@@ -119,7 +119,6 @@
|
|||||||
// testdata/TestExampleMyStructTabularP/empty_struct/xml.golden
|
// testdata/TestExampleMyStructTabularP/empty_struct/xml.golden
|
||||||
// testdata/TestExampleMyStructTabularP/full_struct/json.golden
|
// testdata/TestExampleMyStructTabularP/full_struct/json.golden
|
||||||
// testdata/TestExampleMyStructTabularP/full_struct/xml.golden
|
// testdata/TestExampleMyStructTabularP/full_struct/xml.golden
|
||||||
//
|
|
||||||
package golden
|
package golden
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
Reference in New Issue
Block a user