Skip to content

Instantly share code, notes, and snippets.

@slimsag
Created June 9, 2021 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slimsag/60e1a39b601d2262df289806ba8b148d to your computer and use it in GitHub Desktop.
Save slimsag/60e1a39b601d2262df289806ba8b148d to your computer and use it in GitHub Desktop.

Index

Package testdata

testdata is a small package containing sample Go source code used for testing the indexing routines of github.com/sourcegraph/lsif-go.

Index

hover
const Const untyped int = 5

Const is a constant equal to 5. It's the best constant I've ever written. 😹

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 6
    },
    "end": {
     "line": 4,
     "character": 11
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 6
    },
    "end": {
     "line": 4,
     "character": 11
    }
   }
  ]
 }
]
const Const = 5

Const is a constant equal to 5. It's the best constant I've ever written. 😹

hover
const ConstBlock1 untyped int = 1

ConstBlock1 is a constant in a block.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 1
    },
    "end": {
     "line": 9,
     "character": 12
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 1
    },
    "end": {
     "line": 9,
     "character": 12
    }
   }
  ]
 }
]
const ConstBlock1 = 1

Docs for the const block itself.

ConstBlock1 is a constant in a block.

hover
const ConstBlock2 untyped int = 2

ConstBlock2 is a constant in a block.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 12,
     "character": 1
    },
    "end": {
     "line": 12,
     "character": 12
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 12,
     "character": 1
    },
    "end": {
     "line": 12,
     "character": 12
    }
   }
  ]
 }
]
const ConstBlock2 = 2

Docs for the const block itself.

ConstBlock2 is a constant in a block.

hover
const Score uint64 = 42

Score is just a hardcoded number.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 39,
     "character": 6
    },
    "end": {
     "line": 39,
     "character": 11
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 39,
     "character": 6
    },
    "end": {
     "line": 39,
     "character": 11
    }
   }
  ]
 }
]
const Score = uint64(42)

Score is just a hardcoded number.

hover
const secretScore uint64 = 43
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 40,
     "character": 6
    },
    "end": {
     "line": 40,
     "character": 17
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 40,
     "character": 6
    },
    "end": {
     "line": 40,
     "character": 17
    }
   }
  ]
 }
]
const secretScore = secret.SecretScore
hover
const SomeString untyped string = "foobar"
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 42,
     "character": 6
    },
    "end": {
     "line": 42,
     "character": 16
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 42,
     "character": 6
    },
    "end": {
     "line": 42,
     "character": 16
    }
   }
  ]
 }
]
const SomeString = "foobar"
hover
const LongString untyped string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidu...
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 43,
     "character": 6
    },
    "end": {
     "line": 43,
     "character": 16
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 43,
     "character": 6
    },
    "end": {
     "line": 43,
     "character": 16
    }
   }
  ]
 }
]
const LongString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt viverra aliquam. Phasellus finibus, arcu eu commodo porta, dui quam dictum ante, nec porta enim leo quis felis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur luctus orci tortor, non condimentum arcu bibendum ut. Proin sit amet vulputate lorem, ut egestas arcu. Curabitur quis sagittis mi. Aenean elit sem, imperdiet ut risus eget, varius varius erat.\nNullam lobortis tortor sed sodales consectetur. Aenean condimentum vehicula elit, eget interdum ante finibus nec. Mauris mollis, nulla eu vehicula rhoncus, eros lectus viverra tellus, ac hendrerit quam massa et felis. Nunc vestibulum diam a facilisis sollicitudin. Aenean nec varius metus. Sed nec diam nibh. Ut erat erat, suscipit et ante eget, tincidunt condimentum orci. Aenean nec facilisis augue, ac sodales ex. Nulla dictum hendrerit tempus. Aliquam fringilla tortor in massa molestie, quis bibendum nulla ullamcorper. Suspendisse congue laoreet elit, vitae consectetur orci facilisis non. Aliquam tempus ultricies sapien, rhoncus tincidunt nisl tincidunt eget. Aliquam nisi ante, rutrum eget viverra imperdiet, congue ut nunc. Donec mollis sed tellus vel placerat. Sed mi ex, fringilla a fermentum a, tincidunt eget lectus.\nPellentesque lacus nibh, accumsan eget feugiat nec, gravida eget urna. Donec quam velit, imperdiet in consequat eget, ultricies eget nunc. Curabitur interdum vel sem et euismod. Donec sed vulputate odio, sit amet bibendum tellus. Integer pellentesque nunc eu turpis cursus, vestibulum sodales ipsum posuere. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Ut at vestibulum sapien. In hac habitasse platea dictumst. Nullam sed lobortis urna, non bibendum ipsum. Sed in sapien quis purus semper fringilla. Integer ut egestas nulla, eu ornare lectus. Maecenas quis sapien condimentum, dignissim urna quis, hendrerit neque. Donec cursus sit amet metus eu mollis.\nSed scelerisque vitae odio non egestas. Cras hendrerit tortor mauris. Aenean quis imperdiet nulla, a viverra purus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent finibus faucibus orci, sed ultrices justo iaculis ut. Ut libero massa, condimentum at elit non, fringilla iaculis quam. Sed sit amet ipsum placerat, tincidunt sem in, efficitur lacus. Curabitur ligula orci, tempus ut magna eget, sodales tristique odio.\nPellentesque in libero ac risus pretium ultrices. In hac habitasse platea dictumst. Curabitur a quam sed orci tempus luctus. Integer commodo nec odio quis consequat. Aenean vitae dapibus augue, nec dictum lectus. Etiam sit amet leo diam. Duis eu ligula venenatis, fermentum lacus vel, interdum odio. Vivamus sit amet libero vitae elit interdum cursus et eu erat. Cras interdum augue sit amet ex aliquet tempor. Praesent dolor nisl, convallis bibendum mauris a, euismod commodo ante. Phasellus non ipsum condimentum, molestie dolor quis, pretium nisi. Mauris augue urna, fermentum ut lacinia a, efficitur vitae odio. Praesent finibus nisl et dolor luctus faucibus. Donec eget lectus sed mi porttitor placerat ac eu odio."
hover
const ConstMath untyped int = 26
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 44,
     "character": 6
    },
    "end": {
     "line": 44,
     "character": 15
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 44,
     "character": 6
    },
    "end": {
     "line": 44,
     "character": 15
    }
   }
  ]
 }
]
const ConstMath = 1 + (2+3)*5
hover
const AliasedString StringAlias = "foobar"
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 48,
     "character": 6
    },
    "end": {
     "line": 48,
     "character": 19
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 48,
     "character": 6
    },
    "end": {
     "line": 48,
     "character": 19
    }
   }
  ]
 }
]
const AliasedString StringAlias = "foobar"
hover
var Var Interface

Var is a variable interface.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 16,
     "character": 4
    },
    "end": {
     "line": 16,
     "character": 7
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 16,
     "character": 4
    },
    "end": {
     "line": 16,
     "character": 7
    }
   }
  ]
 }
]
var Var Interface = ...

Var is a variable interface.

hover
var unexportedVar Interface

unexportedVar is an unexported variable interface.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 19,
     "character": 4
    },
    "end": {
     "line": 19,
     "character": 17
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 19,
     "character": 4
    },
    "end": {
     "line": 19,
     "character": 17
    }
   }
  ]
 }
]
var unexportedVar Interface = ...

unexportedVar is an unexported variable interface.

hover
var x error

x has a builtin error type

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 22,
     "character": 4
    },
    "end": {
     "line": 22,
     "character": 5
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 22,
     "character": 4
    },
    "end": {
     "line": 22,
     "character": 5
    }
   }
  ]
 }
]
var x error

x has a builtin error type

hover
var BigVar Interface
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 24,
     "character": 4
    },
    "end": {
     "line": 24,
     "character": 10
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 24,
     "character": 4
    },
    "end": {
     "line": 24,
     "character": 10
    }
   }
  ]
 }
]
var BigVar Interface = ...
hover
var VarBlock1 string

This has some docs

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 46,
     "character": 1
    },
    "end": {
     "line": 46,
     "character": 10
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 46,
     "character": 1
    },
    "end": {
     "line": 46,
     "character": 10
    }
   }
  ]
 }
]
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

hover
var VarBlock2 string

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?!

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 48,
     "character": 1
    },
    "end": {
     "line": 48,
     "character": 10
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 48,
     "character": 1
    },
    "end": {
     "line": 48,
     "character": 10
    }
   }
  ]
 }
]
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?!

hover
var _ invalid type

Yeah this is some Go magic incantation which is common.

 ,_     _
 |\\_,-~/
 / _  _ |    ,--.
(  @  @ )   / ,-'
 \  _T_/-._( (
/         `. \
|         _  \ |
\ \ ,  /      |
 || |-_\__   /
((_/`(____,-'

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 116,
     "character": 4
    },
    "end": {
     "line": 116,
     "character": 5
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 116,
     "character": 4
    },
    "end": {
     "line": 116,
     "character": 5
    }
   }
  ]
 }
]
var _ = Interface(&Struct{})

Yeah this is some Go magic incantation which is common.

 ,_     _
 |\\_,-~/
 / _  _ |    ,--.
(  @  @ )   / ,-'
 \  _T_/-._( (
/         `. \
|         _  \ |
\ \ ,  /      |
 || |-_\__   /
((_/`(____,-'

hover
var wg WaitGroup
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/parallel.go",
  "Ranges": [
   {
    "start": {
     "line": 14,
     "character": 5
    },
    "end": {
     "line": 14,
     "character": 7
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/parallel.go",
  "Ranges": [
   {
    "start": {
     "line": 14,
     "character": 5
    },
    "end": {
     "line": 14,
     "character": 7
    }
   }
  ]
 }
]
var wg sync.WaitGroup
hover
type Embedded struct

Embedded is a struct, to be embedded in another struct.


struct {
    EmbeddedField string
    Field string
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 52,
     "character": 5
    },
    "end": {
     "line": 52,
     "character": 13
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 52,
     "character": 5
    },
    "end": {
     "line": 52,
     "character": 13
    }
   }
  ]
 }
]
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.

hover
type Struct struct

struct {
    *Embedded
    Field string
    Anonymous struct {
        FieldA int
        FieldB int
        FieldC int
    }
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 58,
     "character": 5
    },
    "end": {
     "line": 58,
     "character": 11
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 58,
     "character": 5
    },
    "end": {
     "line": 58,
     "character": 11
    }
   }
  ]
 }
]
type Struct struct {
	*Embedded
	Field     string
	Anonymous struct {
		FieldA int
		FieldB int
		FieldC int
	}
}
hover
type Interface interface

Interface has docs too


interface {
    ImplementsInterface() string
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 97,
     "character": 5
    },
    "end": {
     "line": 97,
     "character": 14
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 97,
     "character": 5
    },
    "end": {
     "line": 97,
     "character": 14
    }
   }
  ]
 }
]
type Interface interface {
	ImplementsInterface() string
}

Interface has docs too

hover
func NewInterface() Interface
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 101,
     "character": 5
    },
    "end": {
     "line": 101,
     "character": 17
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 101,
     "character": 5
    },
    "end": {
     "line": 101,
     "character": 17
    }
   }
  ]
 }
]
func NewInterface() Interface
hover
type X struct

And confusing


struct {
    bar string
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 121,
     "character": 1
    },
    "end": {
     "line": 121,
     "character": 2
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 121,
     "character": 1
    },
    "end": {
     "line": 121,
     "character": 2
    }
   }
  ]
 }
]
type X struct {
	bar string
}

Go can be fun

And confusing

hover
type Y struct

Go can be fun


struct {
    baz invalid type
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 125,
     "character": 1
    },
    "end": {
     "line": 125,
     "character": 2
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/child_symbols.go",
  "Ranges": [
   {
    "start": {
     "line": 125,
     "character": 1
    },
    "end": {
     "line": 125,
     "character": 2
    }
   }
  ]
 }
]
type Y struct {
	baz float
}

Go can be fun

hover
type Inner struct

struct {
    X int
    Y int
    Z int
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/composite.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 5
    },
    "end": {
     "line": 4,
     "character": 10
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/composite.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 5
    },
    "end": {
     "line": 4,
     "character": 10
    }
   }
  ]
 }
]
type Inner struct {
	X int
	Y int
	Z int
}
hover
type Outer struct

struct {
    Inner
    W int
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/composite.go",
  "Ranges": [
   {
    "start": {
     "line": 10,
     "character": 5
    },
    "end": {
     "line": 10,
     "character": 10
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/composite.go",
  "Ranges": [
   {
    "start": {
     "line": 10,
     "character": 5
    },
    "end": {
     "line": 10,
     "character": 10
    }
   }
  ]
 }
]
type Outer struct {
	Inner
	W int
}
hover
type TestInterface interface

TestInterface is an interface used for testing.


interface {
    Do(ctx Context, data string) (score int, _ error)
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 5
    },
    "end": {
     "line": 9,
     "character": 18
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 5
    },
    "end": {
     "line": 9,
     "character": 18
    }
   }
  ]
 }
]
type TestInterface interface {
	// Do does a test thing.
	Do(ctx context.Context, data string) (score int, _ error)
}

TestInterface is an interface used for testing.

hover
type TestStruct struct

TestStruct is a struct used for testing.


struct {
    SimpleA int
    SimpleB int
    SimpleC int
    FieldWithTag string "json:\"tag\""
    FieldWithAnonymousType struct {
        NestedA string
        NestedB string
        NestedC string
    }
    EmptyStructField struct{}
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 16,
     "character": 1
    },
    "end": {
     "line": 16,
     "character": 11
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 16,
     "character": 1
    },
    "end": {
     "line": 16,
     "character": 11
    }
   }
  ]
 }
]
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.

hover
func (*TestStruct).Doer(ctx Context, data string) (score int, err error)

Doer is similar to the test interface (but not the same).

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 51,
     "character": 22
    },
    "end": {
     "line": 51,
     "character": 26
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 51,
     "character": 22
    },
    "end": {
     "line": 51,
     "character": 26
    }
   }
  ]
 }
]
func (ts *TestStruct) Doer(ctx context.Context, data string) (score int, err error)

Doer is similar to the test interface (but not the same).

hover
type TestEmptyStruct struct

struct{}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 35,
     "character": 1
    },
    "end": {
     "line": 35,
     "character": 16
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 35,
     "character": 1
    },
    "end": {
     "line": 35,
     "character": 16
    }
   }
  ]
 }
]
type TestEmptyStruct struct{}
hover
string
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 46,
     "character": 5
    },
    "end": {
     "line": 46,
     "character": 16
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 46,
     "character": 5
    },
    "end": {
     "line": 46,
     "character": 16
    }
   }
  ]
 }
]
type StringAlias string
hover
type StructTagRegression struct

StructTagRegression is a struct that caused panic in the wild. Added here to support a regression test.

See https://github.com/tal-tech/go-zero/blob/11dd3d75ecceaa3f5772024fb3f26dec1ada8e9c/core/mapping/unmarshaler_test.go#L2272.


struct {
    Value int "key:\",range=[:}\""
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 59,
     "character": 5
    },
    "end": {
     "line": 59,
     "character": 24
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 59,
     "character": 5
    },
    "end": {
     "line": 59,
     "character": 24
    }
   }
  ]
 }
]
type StructTagRegression struct {
	Value int `key:",range=[:}"`
}

StructTagRegression is a struct that caused panic in the wild. Added here to support a regression test.

See https://github.com/tal-tech/go-zero/blob/11dd3d75ecceaa3f5772024fb3f26dec1ada8e9c/core/mapping/unmarshaler_test.go#L2272.

hover
type TestEqualsStruct = struct

struct {
    Value int
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 63,
     "character": 5
    },
    "end": {
     "line": 63,
     "character": 21
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 63,
     "character": 5
    },
    "end": {
     "line": 63,
     "character": 21
    }
   }
  ]
 }
]
type TestEqualsStruct = struct {
	Value int
}
hover
type ShellStruct struct

struct {
    InnerStruct
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 67,
     "character": 5
    },
    "end": {
     "line": 67,
     "character": 16
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 67,
     "character": 5
    },
    "end": {
     "line": 67,
     "character": 16
    }
   }
  ]
 }
]
type ShellStruct struct {
	// Ensure this field comes before the definition
	// so that we grab the correct one in our unit
	// tests.
	InnerStruct
}
hover
type InnerStruct struct

struct{}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 74,
     "character": 5
    },
    "end": {
     "line": 74,
     "character": 16
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 74,
     "character": 5
    },
    "end": {
     "line": 74,
     "character": 16
    }
   }
  ]
 }
]
type InnerStruct struct{}
hover

ParallelizableFunc is a function that can be called concurrently with other instances of this function type.


func(ctx Context) error
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/parallel.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 5
    },
    "end": {
     "line": 9,
     "character": 23
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/parallel.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 5
    },
    "end": {
     "line": 9,
     "character": 23
    }
   }
  ]
 }
]
type ParallelizableFunc func(ctx context.Context) error

ParallelizableFunc is a function that can be called concurrently with other instances of this function type.

hover
type SecretBurger = secret.Burger

Type aliased doc


struct {
    Field int
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typealias.go",
  "Ranges": [
   {
    "start": {
     "line": 7,
     "character": 5
    },
    "end": {
     "line": 7,
     "character": 17
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typealias.go",
  "Ranges": [
   {
    "start": {
     "line": 7,
     "character": 5
    },
    "end": {
     "line": 7,
     "character": 17
    }
   }
  ]
 }
]
type SecretBurger = secret.Burger

Type aliased doc

hover
type BadBurger = struct

struct {
    Field string
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typealias.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 5
    },
    "end": {
     "line": 9,
     "character": 14
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typealias.go",
  "Ranges": [
   {
    "start": {
     "line": 9,
     "character": 5
    },
    "end": {
     "line": 9,
     "character": 14
    }
   }
  ]
 }
]
type BadBurger = struct {
	Field string
}
hover
func useOfCompositeStructs()
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/composite.go",
  "Ranges": [
   {
    "start": {
     "line": 15,
     "character": 5
    },
    "end": {
     "line": 15,
     "character": 26
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/composite.go",
  "Ranges": [
   {
    "start": {
     "line": 15,
     "character": 5
    },
    "end": {
     "line": 15,
     "character": 26
    }
   }
  ]
 }
]
func useOfCompositeStructs()
hover
func Parallel(ctx 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.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/parallel.go",
  "Ranges": [
   {
    "start": {
     "line": 13,
     "character": 5
    },
    "end": {
     "line": 13,
     "character": 13
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/parallel.go",
  "Ranges": [
   {
    "start": {
     "line": 13,
     "character": 5
    },
    "end": {
     "line": 13,
     "character": 13
    }
   }
  ]
 }
]
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.

hover
func Switch(interfaceValue interface{}) bool
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typeswitch.go",
  "Ranges": [
   {
    "start": {
     "line": 2,
     "character": 5
    },
    "end": {
     "line": 2,
     "character": 11
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typeswitch.go",
  "Ranges": [
   {
    "start": {
     "line": 2,
     "character": 5
    },
    "end": {
     "line": 2,
     "character": 11
    }
   }
  ]
 }
]
func Switch(interfaceValue interface{}) bool
hover
package "github.com/sourcegraph/lsif-go/internal/testdata/internal/secret"

secret is a package that holds secrets.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 5,
     "character": 2
    },
    "end": {
     "line": 5,
     "character": 66
    }
   }
  ]
 },
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typealias.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 2
    },
    "end": {
     "line": 3,
     "character": 66
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/data.go",
  "Ranges": [
   {
    "start": {
     "line": 5,
     "character": 2
    },
    "end": {
     "line": 5,
     "character": 66
    }
   }
  ]
 },
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/typealias.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 2
    },
    "end": {
     "line": 3,
     "character": 66
    }
   }
  ]
 }
]

secret is a package that holds secrets.

Index

hover
const SecretScore uint64 = 43

SecretScore is like score but secret.

definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/secret/secret.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 6
    },
    "end": {
     "line": 3,
     "character": 17
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/secret/secret.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 6
    },
    "end": {
     "line": 3,
     "character": 17
    }
   }
  ]
 }
]
const SecretScore = uint64(43)

SecretScore is like score but secret.

hover
type Burger struct

Original doc


struct {
    Field int
}
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/secret/secret.go",
  "Ranges": [
   {
    "start": {
     "line": 6,
     "character": 5
    },
    "end": {
     "line": 6,
     "character": 11
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/secret/secret.go",
  "Ranges": [
   {
    "start": {
     "line": 6,
     "character": 5
    },
    "end": {
     "line": 6,
     "character": 11
    }
   }
  ]
 }
]
type Burger struct {
	Field int
}

Original doc

This package has no tests.

Index

hover
func foo() bool
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/notests/notests.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 5
    },
    "end": {
     "line": 3,
     "character": 8
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/notests/notests.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 5
    },
    "end": {
     "line": 3,
     "character": 8
    }
   }
  ]
 }
]
func foo() bool

This package has tests.

Index

hover
func foo() bool
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests/tests.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 5
    },
    "end": {
     "line": 3,
     "character": 8
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests/tests.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 5
    },
    "end": {
     "line": 3,
     "character": 8
    }
   }
  ]
 }
]
func foo() bool
hover
func TestFoo(t *T)
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests/tests_test.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 5
    },
    "end": {
     "line": 4,
     "character": 12
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests/tests_test.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 5
    },
    "end": {
     "line": 4,
     "character": 12
    }
   }
  ]
 }
]
func TestFoo(t *testing.T)

This package has tests, but in a separate _test package.

Index

hover
func foo() bool
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests_separate/pkg.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 5
    },
    "end": {
     "line": 3,
     "character": 8
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests_separate/pkg.go",
  "Ranges": [
   {
    "start": {
     "line": 3,
     "character": 5
    },
    "end": {
     "line": 3,
     "character": 8
    }
   }
  ]
 }
]
func foo() bool

Index

hover
func TestFoo(t *T)
definitions
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests_separate/pkg_test.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 5
    },
    "end": {
     "line": 4,
     "character": 12
    }
   }
  ]
 }
]
references
[
 {
  "Document": "file:///Users/slimsag/go/lsif-go/internal/testdata/internal/shouldvisit/tests_separate/pkg_test.go",
  "Ranges": [
   {
    "start": {
     "line": 4,
     "character": 5
    },
    "end": {
     "line": 4,
     "character": 12
    }
   }
  ]
 }
]
func TestFoo(t *testing.T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment