aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/sylvia7788/contextcheck/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/sylvia7788/contextcheck/README.md')
-rw-r--r--vendor/github.com/sylvia7788/contextcheck/README.md61
1 files changed, 61 insertions, 0 deletions
diff --git a/vendor/github.com/sylvia7788/contextcheck/README.md b/vendor/github.com/sylvia7788/contextcheck/README.md
new file mode 100644
index 000000000..dc951aca4
--- /dev/null
+++ b/vendor/github.com/sylvia7788/contextcheck/README.md
@@ -0,0 +1,61 @@
+[![CircleCI](https://circleci.com/gh/sylvia7788/contextcheck.svg?style=svg)](https://circleci.com/gh/sylvia7788/contextcheck)
+
+
+# contextcheck
+
+`contextcheck` is a static analysis tool, it is used to check the function whether use a non-inherited context, which will result in a broken call link.
+
+For example:
+
+```go
+func call1(ctx context.Context) {
+ ...
+
+ ctx = getNewCtx(ctx)
+ call2(ctx) // OK
+
+ call2(context.Background()) // Non-inherited new context, use function like `context.WithXXX` instead
+
+ call3() // Function `call3` should pass the context parameter
+ ...
+}
+
+func call2(ctx context.Context) {
+ ...
+}
+
+func call3() {
+ ctx := context.TODO()
+ call2(ctx)
+}
+
+func getNewCtx(ctx context.Context) (newCtx context.Context) {
+ ...
+ return
+}
+```
+
+## Installation
+
+You can get `contextcheck` by `go get` command.
+
+```bash
+$ go get -u github.com/sylvia7788/contextcheck
+```
+
+or build yourself.
+
+```bash
+$ make build
+$ make install
+```
+
+## Usage
+
+Invoke `contextcheck` with your package name
+
+```bash
+$ contextcheck ./...
+$ # or
+$ go vet -vettool=`which contextcheck` ./...
+```