containedctx

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 4 Imported by: 15

README

containedctx

test_and_lint

containedctx is a linter that detects struct contained context.Context field

Instruction

go install github.com/sivchari/containedctx/cmd/containedctx

Usage

package main

import "context"

type ok struct {
	i int
	s string
}

type ng struct {
	ctx context.Context
}

type empty struct{}
go vet -vettool=(which containedctx) ./...

# a
./main.go:11:2: found a struct that contains a context.Context field

CI

CircleCI
- run:
    name: install containedctx
    command: go install github.com/sivchari/containedctx/cmd/containedctx

- run:
    name: run containedctx
    command: go vet -vettool=`which containedctx` ./...
GitHub Actions
- name: install containedctx
  run: go install github.com/sivchari/containedctx/cmd/containedctx

- name: run containedctx
  run: go vet -vettool=`which containedctx` ./...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "containedctx",
	Doc:  doc,
	Run:  run,
	Requires: []*analysis.Analyzer{
		inspect.Analyzer,
	},
}

Analyzer is the contanedctx analyzer

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
containedctx command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL