Dependencies and generated code
Go dependency management
We use Go modules to manage Go dependencies in this repository.
The Sourcegraph repository relies on code generation triggered by
go generate. Code generation is used for a variety of tasks:
- generating code for mocking interfaces
- generate wrappers for interfaces (e.g.,
- pack app templates and assets into binaries
To generate everything, just run:
Note: Sometimes, there are erroneous diffs. This occurs for a fewreasons, none of which are legitimate (i.e., they are tech debt itemswe need to address):
- The codegen tools might emit code that depends on system configuration,such as the system timezone or packages you have in your GOPATH. Weneed to submit PRs to the tools to eliminate these issues.
- You might have existing but gitignored files that the codegen toolsread on your disk that other developers don't have. (This occurs forapp assets especially.)
If you think a diff is erroneous, don't commit it. Add a tech debtitem to the issue tracker and assign the person who you think isresponsible (or ask).