sleuth

test_and_lint

sleuth detects when an append is used on a slice with an initial size.

Instruction

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

Usage

package main

func main() {
	test := []int{1, 2, 3, 4, 5}
	a := make([]int, 5)
	for _, tt := range test {
		a = append(a, tt)
	}
}

fish

$ go vet -vettool=(which sleuth) ./...
main.go:7:3: sleuth found you are trying append to a slice with an initial size

bash

$ go vet -vettool=`which sleuth` ./...
main.go:7:3: sleuth found you are trying append to a slice with an initial size

CI

CircleCI

- run:
    name: Install sleuth
    command: go get github.com/sivchari/sleuth

- run:
    name: Run sleuth
    command: go vet -vettool=`which sleuth` ./...

GitHub Actions

- name: Install sleuth
    run: go get github.com/sivchari/sleuth

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

GitHub

https://github.com/sivchari/sleuth