Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
/ lsif-go Public archive

Language Server Indexing Format (LSIF) generator for Go

License

Notifications You must be signed in to change notification settings

sourcegraph/lsif-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f45d7a7 · Mar 3, 2022
Feb 28, 2022
Nov 24, 2021
Sep 9, 2021
Feb 18, 2022
Aug 3, 2021
Jul 21, 2021
Apr 16, 2020
Aug 21, 2020
Mar 3, 2022
Nov 24, 2021
Mar 3, 2022
Jul 21, 2019
Nov 10, 2021
Jun 16, 2021
Nov 4, 2021
Nov 4, 2021

Repository files navigation

Go LSIF indexer

Visit https://lsif.dev/ to learn about LSIF.

Installation

Binary downloads are available on the releases tab.

Installation: Linux

curl -L  https://github.com/sourcegraph/lsif-go/releases/download/v1.2.0/src_linux_amd64 -o /usr/local/bin/lsif-go
chmod +x /usr/local/bin/lsif-go

Installation: MacOS

curl -L  https://github.com/sourcegraph/lsif-go/releases/download/v1.2.0/src_darwin_amd64 -o /usr/local/bin/lsif-go
chmod +x /usr/local/bin/lsif-go

Installation: Docker

docker pull sourcegraph/lsif-go:v1.2.0

Indexing your repository

After installing lsif-go onto your PATH, run the command in the root where your go.mod file is located.

$ lsif-go -v
✔ Loading packages... Done (753.22ms)
✔ Emitting documents... Done (72.76µs)
✔ Adding import definitions... Done (86.24µs)
✔ Indexing definitions... Done (16.83ms)
✔ Indexing references... Done (93.36ms)
✔ Linking items to definitions... Done (8.46ms)
✔ Emitting contains relations... Done (294.13µs)

Stats:
	Wall time elapsed:   873.2ms
	Packages indexed:    14
	Files indexed:       53
	Definitions indexed: 1756
	Elements emitted:    35718
	Packages traversed:  40

If lsif-go is using too much memory, try setting --dep-batch-size=100 to only load 100 dependencies into memory at once (~1GB overhead). Lowering the batch size will decrease the overhead further, but increase the runtime a lot more because loading a batch has a fixed cost of ~500ms and each additional package loaded within a batch only adds ~10ms.

Use lsif-go --help for more information.

Updating your index

To keep your index up-to-date, you can add a step to your CI to generate new data when your repository changes. See our documentation on adding LSIF to your workflows.