Code AI platform with Code Search & Cody
Go to file
Adam Harvey 79226578ec
lib/process: always pipe _exactly_ what the command outputs (#36574)
Right now, we use the default scanner split function, which is
`bufio.SplitLines`. This removes the trailing newline and any preceding
`\r` before it, then returns the remainder of the token. `PipeOutput`
then puts the newline back by invoking `fmt.Fprintln`.

This has the positive effect that we essentially normalise `\r\n` and
`\n` into `\n`, but the negative effect that every line of output
becomes newline-terminated, even if it's a final line that doesn't
include a newline.

This matters because this output is then used for output variables when
executing batch specs, which means that something like `echo -n hi` will
end up with an extraneous newline, even though `echo -n` has only
written two bytes to stdout.

Instead, let's set the split function to one that splits by line, but
_retains_ the newline, and then we can write it to the piped writer(s)
with `fmt.Fprint` directly.

The one tradeoff here is that I haven't reimplemented the `\r`
swallowing that `bufio.SplitLines` does. In practice, I don't believe we
ever actually used this behaviour: Docker _may_ return extraneous `\r`
bytes when running with TTY mode enabled, but we never enable that when
executing batch specs, and if the user's container actually outputs `\r`
we should actually retain it, rather than trying to filter their output.

Fixes #36562.
2022-06-03 15:13:27 -07:00
.buildkite ci: fix failed hook leading to unset exit code (#34602) 2022-04-27 12:39:04 -07:00
.github Update DevX and FPT notifications (#36572) 2022-06-03 13:55:14 -06:00
.vscode dx: enable VSCode search for .go files inside of the ui/assets/ folder (#35038) 2022-05-09 02:48:13 -07:00
client fixes whitescreen crash with datadog combined with ublock origin (#36585) 2022-06-03 14:41:32 -07:00
cmd search: add rule transformation and unquoting to lucky search (#36519) 2022-06-03 21:14:07 +00:00
dev dev/ci: remove set -x in all tests (#36577) 2022-06-03 13:52:48 -07:00
doc doc/dev/setup: Fix typo (#36559) 2022-06-04 00:03:22 +05:30
docker-images typo: occurrence has a double r. (#36579) 2022-06-03 20:49:57 +00:00
enterprise typo: occurrence has a double r. (#36579) 2022-06-03 20:49:57 +00:00
hacktoberfest hacktoberfest: fix sentence case in the subheading (#29297) 2022-01-11 12:09:48 +08:00
internal Search backend: fix issues with null and zero-length offsetAndLength (#36586) 2022-06-03 22:06:27 +00:00
lib lib/process: always pipe _exactly_ what the command outputs (#36574) 2022-06-03 15:13:27 -07:00
migrations Migration to add unique index to external_services (#36416) 2022-06-02 11:48:19 -07:00
monitoring monitoring: rebrand PossibleSolutions as NextSteps (#36500) 2022-06-02 10:51:06 -07:00
schema search: frontend scaffolding for 'Feeling Lucky' search mode (#36514) 2022-06-03 19:52:11 +00:00
third-party-licenses luasandbox: Add initial libraries (#34022) 2022-04-18 22:12:34 +00:00
ui/assets notebooks: Add notepad enable/disable button and CTA (#33905) 2022-04-15 00:41:26 +02:00
.dockerignore symbols: Build in Docker (#34335) 2022-04-25 16:03:55 -06:00
.editorconfig sg: add run-set for core app (#23156) 2021-07-23 07:59:43 +00:00
.eslintignore vscode: create integration test harness (#33921) 2022-04-22 09:54:35 -04:00
.eslintrc.js [SG-36018] Wildcard V2: <Typography /> Manual migration, Revert usage of Typography.XXXXX namespace (#36215) 2022-06-01 08:29:26 +01:00
.gitattributes bext: refactor integration tests (#33598) 2022-04-13 11:03:08 +03:00
.gitignore Ignore go.work.sum in addition to go.work (#36049) 2022-05-25 14:05:32 -06:00
.golangci.yml ci: disable depguard again (#34359) 2022-04-22 17:53:21 +02:00
.graphqlrc.yml Support multiple GraphQL schema files (#20077) 2021-04-19 14:35:49 +02:00
.hadolint.yaml bump comby version to 1.7.1 (#35830) 2022-05-20 20:12:01 -07:00
.mailmap mailmap: update replacements for Joe (#29614) 2022-01-12 10:56:56 +08:00
.mocharc.js web: make web integration tests great again! (#25027) 2021-09-23 16:32:25 +02:00
.percy.yml Update browser extention installation detection logic on web (#32449) 2022-03-14 23:29:39 +06:00
.prettierignore Remove unused LSIF Typed code (#35791) 2022-05-25 11:23:13 +00:00
.stylelintignore docs: extension architecture (#15679) 2020-12-02 21:17:24 -05:00
.stylelintrc.json web: integrate @sourcegraph/stylelint-plugin-sourcegraph and ban bootstrap imports (#34956) 2022-05-05 04:27:26 +00:00
.tool-versions dev/ci: make sg lint in CI conditional, unify linter steps (#35331) 2022-05-12 10:39:08 -07:00
.trivyignore ci: ignore benign CVE-2021-43816 in prometheus (#31069) 2022-02-11 16:49:10 +00:00
.yarnrc Ignore workspace root check (#19608) 2021-03-31 15:30:11 +01:00
babel.config.js [SG-33302] Upgrade all client packages to use the latest version of the JSX transform (#34287) 2022-04-22 12:25:38 +01:00
buf.gen.yaml lsif typed syntax highlighter v0.1 (#30016) 2022-02-23 11:44:17 -05:00
buf.work.yaml RFC 519: Add LSIF typed schema (#29457) 2022-01-11 16:16:12 -06:00
CHANGELOG.md Commit/diff search: remove limits (#36486) 2022-06-03 13:46:18 -06:00
CODENOTIFY api docs: bye (#34798) 2022-05-18 01:03:03 +00:00
CONTRIBUTING.md docs: mention contributing to enterprise code, update code of conduct link (#33772) 2022-04-13 10:37:45 +01:00
doc.go Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
go.mod gomod: bump pgtype version for hstore fixes (#36550) 2022-06-03 15:48:01 +01:00
go.sum gomod: bump pgtype version for hstore fixes (#36550) 2022-06-03 15:48:01 +01:00
graphql-schema-linter.config.js Support multiple GraphQL schema files (#20077) 2021-04-19 14:35:49 +02:00
gulpfile.js web: lint root *.js files (#34164) 2022-04-20 05:22:08 -07:00
jest.config.base.js [Wildcard] New Tooltip Component (#35870) 2022-05-31 13:40:48 -04:00
jest.config.js tests: use glob for jest projects field (#29681) 2022-01-13 01:11:52 -08:00
LICENSE update licensing language (#25620) 2021-10-04 15:40:59 +01:00
LICENSE.apache Move all client code into client/ folder (#14480) 2020-10-07 22:23:53 +02:00
LICENSE.enterprise clarify license (#2543) 2019-03-03 16:39:46 +08:00
lighthouserc.js Lighthouse: Fix protocol_timeout (#27565) 2021-12-10 15:56:16 +00:00
package.json Update eslint-config (#36547) 2022-06-03 14:13:00 +00:00
postcss.config.js extensibility: add featured extensions to registry (#21665) 2021-06-10 13:55:20 -04:00
prettier.config.js Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
README.md doc: use absolute images for image links in README (#33299) 2022-03-31 22:08:51 -07:00
renovate.json chore: add test plans to bot and release tool PRs (#31351) 2022-02-22 07:53:25 -08:00
SECURITY.md consolidate security policy (#7906) 2020-01-21 10:03:11 -08:00
sg.config.yaml Fix PGHOST env var in sg.config.yaml (#36485) 2022-06-02 18:06:54 +02:00
shell.nix nix: disable fortify due to issues with delve (#35885) 2022-05-23 19:07:43 +01:00
svgo.config.js Performance: Optimize static SVG assets with SVGO (#26285) 2021-10-27 15:27:36 +01:00
tsconfig.all.json Create a client-api package (#31151) 2022-03-17 01:17:26 -07:00
tsconfig.eslint.json web: lint root *.js files (#34164) 2022-04-20 05:22:08 -07:00
tsconfig.json web: flatten frontend packages inside of the client folder (#19378) 2021-03-26 15:35:26 +08:00
yarn.lock Update eslint-config (#36547) 2022-06-03 14:13:00 +00:00

Sourcegraph

build

Sourcegraph is a fast and featureful code search and navigation engine.

sourcegraph com_github com_golang_go_-_blob_src_net_http_request go_L855_6

Features

Try it now

Sourcegraph has three editions:

  • Sourcegraph Cloud lets you search over the open-source ecosystem plus your private code. Search strings, search patterns, search symbols and find references across your entire codebase and the open-source world.
  • Sourcegraph Enterprise lets you run your own Sourcegraph instance in your own environment.
  • Sourcegraph OSS is an open-source version of Sourcegraph that provides the core functionality of Sourcegraph (code search, code browsing, basic code navigation), but lacks more advanced features (enterprise authentication, repository permissions, admin controls, advanced code navigation, etc.)

Source code for all three editions is contained in this repository. See the License section for more details.

More:

  • Install the open-source browser extension to add Sourcegraph-like powers to your code review and code host.
  • File feature requests and bug reports in our issue tracker.
  • Visit about.sourcegraph.com for more information about features, use cases, and organizations that use Sourcegraph.

Self-hosted installation

Sourcegraph Enterprise (free up to 10 users)

The fastest way to run Sourcegraph self-hosted is with the Docker container. See the quickstart installation guide. There are also several additional ways of running a production instance.

Sourcegraph OSS

  1. Go through Quickstart to install sg and dependencies
  2. Start the development environment in OSS mode:
    sg start oss
    

Sourcegraph should now be running at https://sourcegraph.test:3443.

For detailed instructions and troubleshooting, see the local development documentation.

Development

Refer to the Developing Sourcegraph guide to get started.

Documentation

The doc directory has additional documentation for developing and understanding Sourcegraph:

License

This repository contains both OSS-licensed and non-OSS-licensed files. We maintain one repository rather than two separate repositories mainly for development convenience.

All files in the enterprise and client/web/src/enterprise fall under LICENSE.enterprise.

The remaining files fall under the Apache 2 license. Sourcegraph OSS is built only from the Apache-licensed files in this repository.