Skip to content

RFC: abuse of api.RepoName

Warren Gifford requested to merge k/reponame into main

Created by: keegancsmith

This PR is minimal and exists for discussion purposes only.

Context

We have the api.RepoName type. Whenever we are refering to a Sourcegraph repository name, we expect it to be an api.RepoName. Both responses from our database as well as user input is cast to this type. This makes the type mostly useless, since it doesn't really tell us anything.

Proposal

User input is never cast to api.RepoName. Only the database can create a api.RepoName, then if we see an api.RepoName we know it is a real repository name. All functions which looks like GetRepoByName take a string.

Alternatively get rid of the tiny type. It doesn't seem to prevent any mistakes nor make our code clearer.

WDYT?

Merge request reports

Loading