sourcegraph

How do I filter by file type on Sourcegraph?


I want to do a Sourcegraph search and have it show only results from files with a certain extension.


Solution

  • You can use the file: token to filter results by filename regex. For example, file:\.go$ would limit results to files ending in ".go".

    The full search query syntax is documented here: https://docs.sourcegraph.com/code_search/reference/queries