diff --git a/.circleci/config.yml b/.circleci/config.yml
index 5ada2f0..a7b8fa2 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -10,6 +10,7 @@ commands:
setup:
steps:
- checkout
+
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}-{{ .Environment.CACHE_VERSION }}
@@ -20,14 +21,31 @@ commands:
- save_cache:
key: go-mod-v4-{{ checksum "go.sum" }}-{{ .Environment.CACHE_VERSION }}
paths:
- - "/go/pkg/mod"
+ - /go/pkg/mod
+
+ - restore_cache:
+ keys:
+ - gotip-{{ .Environment.CACHE_VERSION }}
+ - run:
+ name: Install gotip
+ command: |
+ command -v /go/bin/gotip && echo "Skipping gotip installation" && exit
+ go install golang.org/dl/gotip@latest
+ - save_cache:
+ key: gotip-{{ .Environment.CACHE_VERSION }}
+ paths:
+ - /go/bin/gotip
+ - run:
+ name: Run gotip download
+ command: | # Nov 12 (https://go-review.googlesource.com/c/go/+/359478)
+ yes | gotip download 359478 || true
setup-lint:
description: Set up lint
parameters:
version:
type: string
- default: v1.40.1
+ default: v1.43.0
steps:
- restore_cache:
keys:
@@ -68,7 +86,7 @@ commands:
- run:
name: Install goimports
command: |
- command -v /go/bin/goimports && echo "Skipping go-acc installation" && exit
+ command -v /go/bin/goimports && echo "Skipping goimports installation" && exit
go get -v golang.org/x/tools/cmd/goimports
- save_cache:
@@ -123,4 +141,3 @@ workflows:
- lint
- test
- gen
-
diff --git a/.golangci.yml b/.golangci.yml
index db2f26b..bc76426 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -104,7 +104,7 @@ linters-settings:
sizeThreshold: 256
gofumpt:
- lang-version: "1.16"
+ lang-version: "1.18"
extra-rules: true
goimports:
@@ -117,11 +117,11 @@ linters-settings:
enableAllRules: true
staticcheck:
- go: "1.16"
+ go: "1.18"
checks: [all]
stylecheck:
- go: "1.16"
+ go: "1.18"
checks: [all]
linters:
@@ -147,6 +147,7 @@ linters:
- thelper # enforce t.Helper()
- varcheck # unused global var and const
- wastedassign
+ disable:
fast: false
issues:
@@ -156,3 +157,12 @@ issues:
- dupl
- gocognit
- gocyclo
+
+ # temporary fixes for unsupported type parameters syntax
+ exclude:
+ - "expected .*, found .*"
+ - "expected expression"
+ - "undeclared name: `any`"
+ - "missing ',' in parameter list"
+ - "missing element type in array type expression"
+ - "mixed named and unnamed parameters"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1d98386..30b5cdd 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -26,7 +26,6 @@ The main documentation can help understand how the repository globally works:
- [Go package documentation](https://pkg.go.dev/github.com/drykit-go/testx#section-documentation)
- [Main Readme](./README.md)
- [Package `check` Readme](./check/README.md)
-- [Package `checkconv` Readme](./checkconv/README.md)
## Internal documentation
@@ -36,7 +35,6 @@ The main documentation can help understand how the repository globally works:
. # Package testx (test runners)
├── bin # Binary files (for code generation)
├── check # Package check (checkers interfaces & providers)
-├── checkconv # Package checkconv (checkers conversion)
├── cmd # Runnable source files
│ └── gen # Code generation main command
└── internal # Cross-packages utilities for internal use only
@@ -55,47 +53,19 @@ The main documentation can help understand how the repository globally works:
We use code generation to reduce code repetition, and consequently
reduce the complexity of implementations and the risks of errors.
-We have 2 use cases for that:
-- Generate repetitive declarations for each checker type declared in `internal/gen/types.go`.
-- Generate public interfaces of checker providers from their implementation.
+We have 1 use case for that: generate public interfaces of checker providers
+from their implementation.
#### Generated files
The following files are generated:
-Generated files
-
-
-
-
-
-
-
- File
- Use case
-
-
-
- check/check.goCheckers types declarations
-
-
-
- check/checkers.goCheckers types declarations
-
-
-
- check/providers.goCheckers providers interfaces
-
-
-
-
- checkconv/assert.goCheckers types declarations
-
@@ -22,7 +21,7 @@
testx
testx/check
- testx/checkconv
boolcheck.Boolint, intN (8, 16, 32, 64)check.Int, check.IntNTypeCheckerProvider
+
+ NumberCheckerProvider[int], NumberCheckerProvider[intN]
+
+ uint, uintN (8, 16, 32, 64)check.Uint, check.UintNNumberCheckerProvider[uint], NumberCheckerProvider[uintN]
intcheck.IntfloatN (32, 64)check.FloatNIntCheckerProvider
+
+ NumberCheckerProvider[floatN]
float64check.Float64boolcheck.BoolFloat64CheckerProvider
+
+ BoolCheckerProvider
interface{}anycheck.Valuestructcheck.Boolcheck.StructStructCheckerProvider
@@ -205,29 +205,28 @@ There are 2 ways to extend a provided checker.
#### Using a `New` function
-With every `| testx | -testx/check | -testx/checkconv | -