This page describes how you can automate data indexing in SCIP for Go codebases or index data manually.
Automated indexingSourcegraph provides the Docker images sourcegraph/scip-go
and sourcegraph/src-cli
so that you can easily automate indexing in your favorite CI framework. Note that the scip-go
image bundles src-cli
, so the second image may not be necessary.
The following examples show you how to set up automated indexing in a few popular frameworks. You'll need to substitute the indexer and upload commands with what works for your project locally. If you implement automated indexing in a different framework, feel free to edit this page with instructions!
GitHub Actionson:
- push
jobs:
scip-go:
# this line will prevent forks of this repo from uploading lsif indexes
if: github.repository == '<insert your repo name>'
runs-on: ubuntu-latest
container: sourcegraph/scip-go:latest
steps:
- uses: actions/checkout@v1
- name: Generate SCIP data
run: scip-go
- name: Install src CLI
run: |
curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src
- name: Upload SCIP data
# this will upload to Sourcegraph.com, you may need to substitute a different command.
# by default, we ignore failures to avoid disrupting CI pipelines with non-critical errors.
run: src code-intel upload -github-token=${{ secrets.GITHUB_TOKEN }} -ignore-upload-failure
The following projects have example GitHub Actions workflows to generate and upload LSIF indexes:
CircleCIversion: 2.1
jobs:
scip-go:
docker:
- image: sourcegraph/scip-go:latest
steps:
- checkout
- run: scip-go
- run: |
curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src;
# this will upload to Sourcegraph.com, you may need to substitute a different command.
# by default, we ignore failures to avoid disrupting CI pipelines with non-critical errors.
- run: src code-intel upload -github-token=<<parameters.github-token>> -ignore-upload-failure
workflows:
scip-typescript:
jobs:
- scip-typescript
The following projects have example CircleCI configurations to generate and upload SCIP indexes.
Travis CIservices:
- docker
jobs:
include:
- stage: scip-go
# this will upload to Sourcegraph.com, you may need to substitute a different command.
# by default, we ignore failures to avoid disrupting CI pipelines with non-critical errors.
script:
- |
docker run --rm -v $(pwd):/src -w /src sourcegraph/scip-go:latest /bin/sh -c \
"scip-go; curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src; chmod +x /usr/local/bin/src; src code-intel upload -github-token=$GITHUB_TOKEN -ignore-upload-failure"
The following projects have example Travis CI configurations to generate and upload SCIP indexes.
Manual indexingInstall the Go SCIP indexer.
Install the Sourcegraph CLI with the following command:
curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src
linux
with darwin
in the URL and choose the appropriate architecture: M1/M2 chips - arm64
, Intel chips - amd64
.cd
into your Go project's root (where the go.mod
file lives, if you have one) and run: scip-go # generates a file named index.scip
src -endpoint=<your sourcegraph endpoint> code-intel upload # for private instances
src code-intel upload -github-token=<your github token> # for public instances
The upload command will provide a URL you can visit to see the upload status. When the upload is complete, you can visit the repo and check out the difference in code navigation quality!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4