Package testdata
testdata is a small package containing sample Go source code used for testing the indexing routines of github.com/sourcegraph/lsif-go.
- Constants
- Variables
- Types
- type Embedded struct
- type Struct struct
- type Interface interface
- type X struct
- type Y struct
- type TestInterface interface
- type TestStruct struct
- type TestEmptyStruct struct{}
- type StructTagRegression struct
- type TestEqualsStruct struct
- type ParallelizableFunc func(ctx context.Context) error
- type SecretBurger secret.Burger
- type BadBurger struct
- Functions
const Const = 5
Const is a constant equal to 5. It's the best constant I've ever written. 😹
const ConstBlock1 = 1
Docs for the const block itself.
ConstBlock1 is a constant in a block.
const ConstBlock2 = 2
Docs for the const block itself.
ConstBlock2 is a constant in a block.
const Score = uint64(42)
Score is just a hardcoded number.
const secretScore = secret.SecretScore
var Var Interface = ...
Var is a variable interface.
var unexportedVar Interface = ...
unexportedVar is an unexported variable interface.
var BigVar Interface = ...
var VarBlock1 = "if you're reading this"
What are docs, really? I can't say for sure, I don't write any. But look, a CAT!
|\ _,,,---,,_
ZZZzz /,`.-'`' -. ;-;;,_
|,4- ) )-,_. ,\ ( `'-'
'---''(_/--' `-'\_)
It's sleeping! Some people write that as sleeping
but Markdown isn't allowed in Go docstrings, right? right?!
This has some docs
var VarBlock2 = "hi"
What are docs, really? I can't say for sure, I don't write any. But look, a CAT!
|\ _,,,---,,_
ZZZzz /,`.-'`' -. ;-;;,_
|,4- ) )-,_. ,\ ( `'-'
'---''(_/--' `-'\_)
It's sleeping! Some people write that as sleeping
but Markdown isn't allowed in Go docstrings, right? right?!
var _ = Interface(&Struct{})
Yeah this is some Go magic incantation which is common.
,_ _
|\\_,-~/
/ _ _ | ,--.
( @ @ ) / ,-'
\ _T_/-._( (
/ `. \
| _ \ |
\ \ , / |
|| |-_\__ /
((_/`(____,-'
var wg sync.WaitGroup
type Embedded struct {
// EmbeddedField has some docs!
EmbeddedField string
Field string // conflicts with parent "Field"
}
Embedded is a struct, to be embedded in another struct.
type Struct struct {
*Embedded
Field string
Anonymous struct {
FieldA int
FieldB int
FieldC int
}
}
type Interface interface {
ImplementsInterface() string
}
Interface has docs too
func NewInterface() Interface
type X struct {
bar string
}
Go can be fun
And confusing
type Y struct {
baz float
}
Go can be fun
type TestInterface interface {
// Do does a test thing.
Do(ctx context.Context, data string) (score int, _ error)
}
TestInterface is an interface used for testing.
type TestStruct struct {
// SimpleA docs
SimpleA int
// SimpleB docs
SimpleB int
// SimpleC docs
SimpleC int
FieldWithTag string `json:"tag"`
FieldWithAnonymousType struct {
NestedA string
NestedB string
// NestedC docs
NestedC string
}
EmptyStructField struct{}
}
TestStruct is a struct used for testing.
func (ts *TestStruct) Doer(ctx context.Context, data string) (score int, err error)
Doer is similar to the test interface (but not the same).
type TestEmptyStruct struct{}
type StructTagRegression struct {
Value int `key:",range=[:}"`
}
StructTagRegression is a struct that caused panic in the wild. Added here to support a regression test.
type TestEqualsStruct = struct {
Value int
}
type ParallelizableFunc func(ctx context.Context) error
ParallelizableFunc is a function that can be called concurrently with other instances of this function type.
type SecretBurger = secret.Burger
Type aliased doc
type BadBurger = struct {
Field string
}
func Parallel(ctx context.Context, fns ...ParallelizableFunc) error
Parallel invokes each of the given parallelizable functions in their own goroutines and returns the first error to occur. This method will block until all goroutines have returned.
func Switch(interfaceValue interface{}) bool
secret is a package that holds secrets.
const SecretScore = uint64(43)
SecretScore is like score but secret.
type Burger struct {
Field int
}
Original doc
This package has no tests.
func foo() bool
This package has tests.
func foo() bool
func TestFoo(t *testing.T)
This package has tests, but in a separate _test package.
func foo() bool
func TestFoo(t *testing.T)