Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Github Workflow #95

Merged
merged 2 commits into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: golangci-lint

on:
push:
tags:
- v*
branches:
- master
pull_request:
Expand All @@ -13,8 +11,11 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.5.2
uses: golangci/golangci-lint-action@v3
with:
version: v1.38.0
version: v1.49
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x]
go-version: [1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x, 1.18.x, 1.19.x]
env:
GO: ${{ matrix.go-version }}
runs-on: ubuntu-latest
Expand All @@ -23,23 +23,23 @@ jobs:
sudo cp -i cockroach-v20.1.3.linux-amd64/cockroach /usr/local/bin/

- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: $(go env GOCACHE)
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
Expand All @@ -48,7 +48,7 @@ jobs:
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... --cockroach-binary cockroach

- name: Upload Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt
flags: unittests
Expand Down
9 changes: 3 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- dogsled
- dupl
- errcheck
Expand All @@ -18,7 +17,6 @@ linters:
- gofmt
- gofumpt
- goimports
- golint
- gomnd
- goprintffuncname
- gosec
Expand All @@ -30,16 +28,15 @@ linters:
- nakedret
- noctx
- nolintlint
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- testpackage
- unconvert
- unparam
- unused
- varcheck
- whitespace

# don't enable:
Expand Down Expand Up @@ -89,8 +86,6 @@ linters-settings:
check-all: true
goimports:
local-prefixes: github.com/georgysavva/scany
golint:
min-confidence: 0
gomnd:
settings:
mnd:
Expand All @@ -107,6 +102,7 @@ issues:
exclude-use-default: false
exclude:
- "should have a package comment, unless it's in another file for this package"
- "err113: do not define dynamic errors, use wrapped static errors instead"
exclude-rules:
- linters:
- errcheck
Expand All @@ -116,6 +112,7 @@ issues:
- linters:
- funlen
- rowserrcheck
- lll
path: _test\.go

max-same-issues: 0
6 changes: 3 additions & 3 deletions dbscan/dbscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func WithAllowUnknownColumns(allowUnknownColumns bool) APIOption {
// Before starting, ScanAll resets the destination slice,
// so if it's not empty it will overwrite all existing elements.
func (api *API) ScanAll(dst interface{}, rows Rows) error {
return api.processRows(dst, rows, true /* multipleRows */)
return api.processRows(dst, rows, true /* multipleRows. */)
}

// ScanOne iterates all rows to the end and makes sure that there was exactly one row
Expand All @@ -171,7 +171,7 @@ func (api *API) ScanAll(dst interface{}, rows Rows) error {
// and propagates any errors that could pop up.
// It scans data from that single row into the destination.
func (api *API) ScanOne(dst interface{}, rows Rows) error {
return api.processRows(dst, rows, false /* multipleRows */)
return api.processRows(dst, rows, false /* multipleRows. */)
}

// NotFound returns true if err is a not found error.
Expand All @@ -190,7 +190,7 @@ type sliceDestinationMeta struct {
}

func (api *API) processRows(dst interface{}, rows Rows, multipleRows bool) error {
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck
var sliceMeta *sliceDestinationMeta
if multipleRows {
var err error
Expand Down
4 changes: 2 additions & 2 deletions dbscan/dbscan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func TestScanOne_multipleRows_returnsErr(t *testing.T) {
func TestScanRow(t *testing.T) {
t.Parallel()
rows := queryRows(t, singleRowsQuery)
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck
rows.Next()
expected := testModel{Foo: "foo val", Bar: "bar val"}

Expand Down Expand Up @@ -360,7 +360,7 @@ func TestNewAPI_WithScannableTypes_InvalidInput(t *testing.T) {
func TestScanRow_withAllowUnknownColumns_returnsRow(t *testing.T) {
t.Parallel()
rows := queryRows(t, singleRowsQuery)
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck
rows.Next()

got := &struct{ Foo string }{}
Expand Down
4 changes: 2 additions & 2 deletions dbscan/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func ExampleScanAll() {

var users []*User
if err := dbscan.ScanAll(&users, rows); err != nil {
// Handle rows processing error
// Handle rows processing error.
}
// users variable now contains data from all rows.
}
Expand Down Expand Up @@ -111,7 +111,7 @@ func ExampleAPI() {
var users []*User
// Use the custom API instance to access dbscan functionality.
if err := api.ScanAll(&users, rows); err != nil {
// Handle rows processing error
// Handle rows processing error.
}
// users variable now contains data from all rows.
}
2 changes: 1 addition & 1 deletion dbscan/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func getAPI(opts ...dbscan.APIOption) (*dbscan.API, error) {
}

func scan(t *testing.T, dst interface{}, rows dbscan.Rows) error {
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck
rs := testAPI.NewRowScanner(rows)
rows.Next()
if err := rs.Scan(dst); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion dbscan/internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func DoTestRowScannerStartCalledExactlyOnce(t *testing.T, api *API, queryRows qu
) AS t (foo, bar)
`
rows := queryRows(t, query)
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck

mockStart := &mockStartScannerFunc{}
rs := api.NewRowScanner(rows)
Expand Down
2 changes: 1 addition & 1 deletion dbscan/rowscanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (cst *CustomScannableType) Scan(val interface{}) error {
case string:
return json.Unmarshal([]byte(v), cst)
default:
return fmt.Errorf("Unsupported type: %T", v)
return fmt.Errorf("unsupported type: %T", v)
}
}

Expand Down
2 changes: 1 addition & 1 deletion sqlscan/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func ExampleScanAll() {

var users []*User
if err := sqlscan.ScanAll(&users, rows); err != nil {
// Handle rows processing error
// Handle rows processing error.
}
// users variable now contains data from all rows.
}
Expand Down
6 changes: 3 additions & 3 deletions sqlscan/sqlscan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestRowScanner_Scan(t *testing.T) {
t.Parallel()
rows, err := testDB.Query(singleRowsQuery)
require.NoError(t, err)
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck
rs := testAPI.NewRowScanner(rows)
rows.Next()
expected := testModel{Foo: "foo val", Bar: "bar val"}
Expand All @@ -161,7 +161,7 @@ func TestScanRow(t *testing.T) {
t.Parallel()
rows, err := testDB.Query(singleRowsQuery)
require.NoError(t, err)
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck
rows.Next()
expected := testModel{Foo: "foo val", Bar: "bar val"}

Expand Down Expand Up @@ -229,7 +229,7 @@ func TestRowScanner_Scan_NULLableScannerType(t *testing.T) {
t.Parallel()
rows, err := testDB.Query(tc.query)
require.NoError(t, err)
defer rows.Close() // nolint: errcheck
defer rows.Close() //nolint: errcheck
rs := testAPI.NewRowScanner(rows)
rows.Next()

Expand Down