util

package
v0.0.0-...-d28153c Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChannelToSlice

func ChannelToSlice[t any](channel <-chan t) []t

channelToSlice converts a channel to a slice by reading all values from the channel.

func GetIssueKey

func GetIssueKey(ruleId string, path string, startLine int, endLine int, startCol int, endCol int) string

func Hash

func Hash(content []byte) string

func Ignored

func Ignored(gitIgnore *ignore.GitIgnore, path string) bool

func Max

func Max[T ordered](values ...T) T

func Min

func Min[T ordered](values ...T) T

func Result

func Result[t any](value t, _ error) t

Result returns the result of a function call and ignores the error. This saves lines when you don't care about the error and want to inline the call.

For example, instead of writing: val, _ := someFunc() foo(val)

You can write: foo(Result(someFunc()))

Types

This section is empty.

Jump to

Keyboard shortcuts

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