From ba7c7fe7599300f8b910f724efc0bf381e88a02f Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 14:51:21 -0500 Subject: [PATCH 01/10] chore(cdr): Move httpmw to /coderd directory httpmw is specific to coderd and should be scoped under coderd --- coderd/coderd.go | 2 +- coderd/files.go | 2 +- {httpmw => coderd/httpmw}/apikey.go | 0 {httpmw => coderd/httpmw}/apikey_test.go | 2 +- {httpmw => coderd/httpmw}/httpmw.go | 0 {httpmw => coderd/httpmw}/organizationparam.go | 0 {httpmw => coderd/httpmw}/organizationparam_test.go | 2 +- {httpmw => coderd/httpmw}/projectparam.go | 0 {httpmw => coderd/httpmw}/projectparam_test.go | 2 +- {httpmw => coderd/httpmw}/projectversionparam.go | 0 {httpmw => coderd/httpmw}/projectversionparam_test.go | 2 +- {httpmw => coderd/httpmw}/userparam.go | 0 {httpmw => coderd/httpmw}/userparam_test.go | 2 +- {httpmw => coderd/httpmw}/workspaceagent.go | 0 {httpmw => coderd/httpmw}/workspaceagent_test.go | 2 +- {httpmw => coderd/httpmw}/workspacebuildparam.go | 0 {httpmw => coderd/httpmw}/workspacebuildparam_test.go | 2 +- {httpmw => coderd/httpmw}/workspaceparam.go | 0 {httpmw => coderd/httpmw}/workspaceparam_test.go | 2 +- {httpmw => coderd/httpmw}/workspaceresourceparam.go | 0 {httpmw => coderd/httpmw}/workspaceresourceparam_test.go | 2 +- coderd/organizations.go | 2 +- coderd/projects.go | 2 +- coderd/projectversions.go | 2 +- coderd/users.go | 2 +- coderd/users_test.go | 2 +- coderd/workspacebuilds.go | 2 +- coderd/workspaceresources.go | 2 +- coderd/workspaces.go | 2 +- codersdk/client.go | 2 +- codersdk/workspaceresources.go | 2 +- 31 files changed, 21 insertions(+), 21 deletions(-) rename {httpmw => coderd/httpmw}/apikey.go (100%) rename {httpmw => coderd/httpmw}/apikey_test.go (99%) rename {httpmw => coderd/httpmw}/httpmw.go (100%) rename {httpmw => coderd/httpmw}/organizationparam.go (100%) rename {httpmw => coderd/httpmw}/organizationparam_test.go (99%) rename {httpmw => coderd/httpmw}/projectparam.go (100%) rename {httpmw => coderd/httpmw}/projectparam_test.go (99%) rename {httpmw => coderd/httpmw}/projectversionparam.go (100%) rename {httpmw => coderd/httpmw}/projectversionparam_test.go (99%) rename {httpmw => coderd/httpmw}/userparam.go (100%) rename {httpmw => coderd/httpmw}/userparam_test.go (98%) rename {httpmw => coderd/httpmw}/workspaceagent.go (100%) rename {httpmw => coderd/httpmw}/workspaceagent_test.go (97%) rename {httpmw => coderd/httpmw}/workspacebuildparam.go (100%) rename {httpmw => coderd/httpmw}/workspacebuildparam_test.go (98%) rename {httpmw => coderd/httpmw}/workspaceparam.go (100%) rename {httpmw => coderd/httpmw}/workspaceparam_test.go (98%) rename {httpmw => coderd/httpmw}/workspaceresourceparam.go (100%) rename {httpmw => coderd/httpmw}/workspaceresourceparam_test.go (98%) diff --git a/coderd/coderd.go b/coderd/coderd.go index 090dc995791fc..bc29a65fa9d9b 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -12,7 +12,7 @@ import ( "cdr.dev/slog" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/site" ) diff --git a/coderd/files.go b/coderd/files.go index ca176322ae6fb..442d135768f42 100644 --- a/coderd/files.go +++ b/coderd/files.go @@ -15,7 +15,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func (api *api) postFile(rw http.ResponseWriter, r *http.Request) { diff --git a/httpmw/apikey.go b/coderd/httpmw/apikey.go similarity index 100% rename from httpmw/apikey.go rename to coderd/httpmw/apikey.go diff --git a/httpmw/apikey_test.go b/coderd/httpmw/apikey_test.go similarity index 99% rename from httpmw/apikey_test.go rename to coderd/httpmw/apikey_test.go index 309c3917de604..3920fa92665d2 100644 --- a/httpmw/apikey_test.go +++ b/coderd/httpmw/apikey_test.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func randomAPIKeyParts() (id string, secret string) { diff --git a/httpmw/httpmw.go b/coderd/httpmw/httpmw.go similarity index 100% rename from httpmw/httpmw.go rename to coderd/httpmw/httpmw.go diff --git a/httpmw/organizationparam.go b/coderd/httpmw/organizationparam.go similarity index 100% rename from httpmw/organizationparam.go rename to coderd/httpmw/organizationparam.go diff --git a/httpmw/organizationparam_test.go b/coderd/httpmw/organizationparam_test.go similarity index 99% rename from httpmw/organizationparam_test.go rename to coderd/httpmw/organizationparam_test.go index b957950f45075..f91460b920f7b 100644 --- a/httpmw/organizationparam_test.go +++ b/coderd/httpmw/organizationparam_test.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestOrganizationParam(t *testing.T) { diff --git a/httpmw/projectparam.go b/coderd/httpmw/projectparam.go similarity index 100% rename from httpmw/projectparam.go rename to coderd/httpmw/projectparam.go diff --git a/httpmw/projectparam_test.go b/coderd/httpmw/projectparam_test.go similarity index 99% rename from httpmw/projectparam_test.go rename to coderd/httpmw/projectparam_test.go index c8ea119a25125..58209a1d9b033 100644 --- a/httpmw/projectparam_test.go +++ b/coderd/httpmw/projectparam_test.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestProjectParam(t *testing.T) { diff --git a/httpmw/projectversionparam.go b/coderd/httpmw/projectversionparam.go similarity index 100% rename from httpmw/projectversionparam.go rename to coderd/httpmw/projectversionparam.go diff --git a/httpmw/projectversionparam_test.go b/coderd/httpmw/projectversionparam_test.go similarity index 99% rename from httpmw/projectversionparam_test.go rename to coderd/httpmw/projectversionparam_test.go index 2e9e47e2e8798..b108412d789e8 100644 --- a/httpmw/projectversionparam_test.go +++ b/coderd/httpmw/projectversionparam_test.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestProjectVersionParam(t *testing.T) { diff --git a/httpmw/userparam.go b/coderd/httpmw/userparam.go similarity index 100% rename from httpmw/userparam.go rename to coderd/httpmw/userparam.go diff --git a/httpmw/userparam_test.go b/coderd/httpmw/userparam_test.go similarity index 98% rename from httpmw/userparam_test.go rename to coderd/httpmw/userparam_test.go index 4a83084d01fde..bbbaec87a3280 100644 --- a/httpmw/userparam_test.go +++ b/coderd/httpmw/userparam_test.go @@ -14,7 +14,7 @@ import ( "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestUserParam(t *testing.T) { diff --git a/httpmw/workspaceagent.go b/coderd/httpmw/workspaceagent.go similarity index 100% rename from httpmw/workspaceagent.go rename to coderd/httpmw/workspaceagent.go diff --git a/httpmw/workspaceagent_test.go b/coderd/httpmw/workspaceagent_test.go similarity index 97% rename from httpmw/workspaceagent_test.go rename to coderd/httpmw/workspaceagent_test.go index fc14db017a1be..03c260ad291ef 100644 --- a/httpmw/workspaceagent_test.go +++ b/coderd/httpmw/workspaceagent_test.go @@ -12,7 +12,7 @@ import ( "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestWorkspaceAgent(t *testing.T) { diff --git a/httpmw/workspacebuildparam.go b/coderd/httpmw/workspacebuildparam.go similarity index 100% rename from httpmw/workspacebuildparam.go rename to coderd/httpmw/workspacebuildparam.go diff --git a/httpmw/workspacebuildparam_test.go b/coderd/httpmw/workspacebuildparam_test.go similarity index 98% rename from httpmw/workspacebuildparam_test.go rename to coderd/httpmw/workspacebuildparam_test.go index 7ef913770abc4..32f50788a6fd4 100644 --- a/httpmw/workspacebuildparam_test.go +++ b/coderd/httpmw/workspacebuildparam_test.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestWorkspaceBuildParam(t *testing.T) { diff --git a/httpmw/workspaceparam.go b/coderd/httpmw/workspaceparam.go similarity index 100% rename from httpmw/workspaceparam.go rename to coderd/httpmw/workspaceparam.go diff --git a/httpmw/workspaceparam_test.go b/coderd/httpmw/workspaceparam_test.go similarity index 98% rename from httpmw/workspaceparam_test.go rename to coderd/httpmw/workspaceparam_test.go index e68cc80920947..8879604ace086 100644 --- a/httpmw/workspaceparam_test.go +++ b/coderd/httpmw/workspaceparam_test.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestWorkspaceParam(t *testing.T) { diff --git a/httpmw/workspaceresourceparam.go b/coderd/httpmw/workspaceresourceparam.go similarity index 100% rename from httpmw/workspaceresourceparam.go rename to coderd/httpmw/workspaceresourceparam.go diff --git a/httpmw/workspaceresourceparam_test.go b/coderd/httpmw/workspaceresourceparam_test.go similarity index 98% rename from httpmw/workspaceresourceparam_test.go rename to coderd/httpmw/workspaceresourceparam_test.go index 8ac404f84b9f3..d7eb425054c64 100644 --- a/httpmw/workspaceresourceparam_test.go +++ b/coderd/httpmw/workspaceresourceparam_test.go @@ -12,7 +12,7 @@ import ( "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestWorkspaceResourceParam(t *testing.T) { diff --git a/coderd/organizations.go b/coderd/organizations.go index 1bca4d2839173..5d58d516d795f 100644 --- a/coderd/organizations.go +++ b/coderd/organizations.go @@ -15,7 +15,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func (*api) organization(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/projects.go b/coderd/projects.go index 8884e6bfba2d5..f0f8ff7c82e40 100644 --- a/coderd/projects.go +++ b/coderd/projects.go @@ -13,7 +13,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) // Returns a single project. diff --git a/coderd/projectversions.go b/coderd/projectversions.go index 8886424975fac..35fc3ad56ee0e 100644 --- a/coderd/projectversions.go +++ b/coderd/projectversions.go @@ -12,7 +12,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func (api *api) projectVersion(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/users.go b/coderd/users.go index 13060f9998aeb..a1dcb7df25008 100644 --- a/coderd/users.go +++ b/coderd/users.go @@ -20,7 +20,7 @@ import ( "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) // Returns whether the initial user has been created or not. diff --git a/coderd/users_test.go b/coderd/users_test.go index 841ed7dc5cba6..53357645290ea 100644 --- a/coderd/users_test.go +++ b/coderd/users_test.go @@ -10,7 +10,7 @@ import ( "github.com/coder/coder/coderd/coderdtest" "github.com/coder/coder/codersdk" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func TestFirstUser(t *testing.T) { diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 45bf221e560f9..78fa54b809dce 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -10,7 +10,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func (api *api) workspaceBuild(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/workspaceresources.go b/coderd/workspaceresources.go index 1a2c7321bb83d..1fc83fc14ebac 100644 --- a/coderd/workspaceresources.go +++ b/coderd/workspaceresources.go @@ -18,7 +18,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/peerbroker" "github.com/coder/coder/peerbroker/proto" "github.com/coder/coder/provisionersdk" diff --git a/coderd/workspaces.go b/coderd/workspaces.go index e97710f6a0dd3..8bdecb3d0f6a5 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" ) func (api *api) workspace(rw http.ResponseWriter, r *http.Request) { diff --git a/codersdk/client.go b/codersdk/client.go index 61d9e20512e3e..a505c9312f9bb 100644 --- a/codersdk/client.go +++ b/codersdk/client.go @@ -13,8 +13,8 @@ import ( "golang.org/x/xerrors" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" ) // New creates a Coder client for the provided URL. diff --git a/codersdk/workspaceresources.go b/codersdk/workspaceresources.go index 5a86efd442810..b78694eef3d77 100644 --- a/codersdk/workspaceresources.go +++ b/codersdk/workspaceresources.go @@ -16,7 +16,7 @@ import ( "nhooyr.io/websocket" "github.com/coder/coder/database" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/peer" "github.com/coder/coder/peerbroker" "github.com/coder/coder/peerbroker/proto" From 8147977c95fcea70ab1ba5d82a97380a19339b2f Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 14:54:30 -0500 Subject: [PATCH 02/10] chore(cdr): Move httpapi to /coderd directory httpapi is specific to coderd and should be scoped under coderd --- coderd/coderd.go | 2 +- coderd/files.go | 2 +- {httpapi => coderd/httpapi}/httpapi.go | 0 {httpapi => coderd/httpapi}/httpapi_test.go | 2 +- coderd/httpmw/apikey.go | 2 +- coderd/httpmw/apikey_test.go | 2 +- coderd/httpmw/httpmw.go | 2 +- coderd/httpmw/organizationparam.go | 2 +- coderd/httpmw/projectparam.go | 2 +- coderd/httpmw/projectversionparam.go | 2 +- coderd/httpmw/userparam.go | 2 +- coderd/httpmw/workspaceagent.go | 2 +- coderd/httpmw/workspacebuildparam.go | 2 +- coderd/httpmw/workspaceparam.go | 2 +- coderd/httpmw/workspaceresourceparam.go | 2 +- coderd/organizations.go | 2 +- coderd/parameters.go | 2 +- coderd/projects.go | 2 +- coderd/projectversions.go | 2 +- coderd/provisionerdaemons.go | 2 +- coderd/provisionerjobs.go | 2 +- coderd/users.go | 2 +- coderd/workspacebuilds.go | 2 +- coderd/workspaceresourceauth.go | 2 +- coderd/workspaceresources.go | 2 +- coderd/workspaces.go | 2 +- codersdk/client.go | 2 +- 27 files changed, 26 insertions(+), 26 deletions(-) rename {httpapi => coderd/httpapi}/httpapi.go (100%) rename {httpapi => coderd/httpapi}/httpapi_test.go (98%) diff --git a/coderd/coderd.go b/coderd/coderd.go index bc29a65fa9d9b..8d7068375ced2 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -11,7 +11,7 @@ import ( "cdr.dev/slog" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/site" ) diff --git a/coderd/files.go b/coderd/files.go index 442d135768f42..8ffb493edd2ad 100644 --- a/coderd/files.go +++ b/coderd/files.go @@ -14,7 +14,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/httpapi/httpapi.go b/coderd/httpapi/httpapi.go similarity index 100% rename from httpapi/httpapi.go rename to coderd/httpapi/httpapi.go diff --git a/httpapi/httpapi_test.go b/coderd/httpapi/httpapi_test.go similarity index 98% rename from httpapi/httpapi_test.go rename to coderd/httpapi/httpapi_test.go index 46cd85e960e6e..87ce03f51d36c 100644 --- a/httpapi/httpapi_test.go +++ b/coderd/httpapi/httpapi_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) func TestWrite(t *testing.T) { diff --git a/coderd/httpmw/apikey.go b/coderd/httpmw/apikey.go index 45a93c2f91584..13a45dc0ba904 100644 --- a/coderd/httpmw/apikey.go +++ b/coderd/httpmw/apikey.go @@ -14,7 +14,7 @@ import ( "golang.org/x/oauth2" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) // AuthCookie represents the name of the cookie the API key is stored in. diff --git a/coderd/httpmw/apikey_test.go b/coderd/httpmw/apikey_test.go index 3920fa92665d2..a1ef8da599a3e 100644 --- a/coderd/httpmw/apikey_test.go +++ b/coderd/httpmw/apikey_test.go @@ -15,7 +15,7 @@ import ( "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/httpmw.go b/coderd/httpmw/httpmw.go index 655cfbd716027..0c215edab8b9a 100644 --- a/coderd/httpmw/httpmw.go +++ b/coderd/httpmw/httpmw.go @@ -7,7 +7,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/google/uuid" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) // parseUUID consumes a url parameter and parses it as a UUID. diff --git a/coderd/httpmw/organizationparam.go b/coderd/httpmw/organizationparam.go index 6937e060a144b..e5917586c2d64 100644 --- a/coderd/httpmw/organizationparam.go +++ b/coderd/httpmw/organizationparam.go @@ -10,7 +10,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) type organizationParamContextKey struct{} diff --git a/coderd/httpmw/projectparam.go b/coderd/httpmw/projectparam.go index 15d258b5df5ad..c178c5a841eab 100644 --- a/coderd/httpmw/projectparam.go +++ b/coderd/httpmw/projectparam.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" ) type projectParamContextKey struct{} diff --git a/coderd/httpmw/projectversionparam.go b/coderd/httpmw/projectversionparam.go index c506a05107dcb..5530b2b77064f 100644 --- a/coderd/httpmw/projectversionparam.go +++ b/coderd/httpmw/projectversionparam.go @@ -10,7 +10,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) type projectVersionParamContextKey struct{} diff --git a/coderd/httpmw/userparam.go b/coderd/httpmw/userparam.go index 0ce3f67144ebc..b5fbb17f8f3e4 100644 --- a/coderd/httpmw/userparam.go +++ b/coderd/httpmw/userparam.go @@ -8,7 +8,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) type userParamContextKey struct{} diff --git a/coderd/httpmw/workspaceagent.go b/coderd/httpmw/workspaceagent.go index 13fbf556b026e..40ae7e1484d33 100644 --- a/coderd/httpmw/workspaceagent.go +++ b/coderd/httpmw/workspaceagent.go @@ -10,7 +10,7 @@ import ( "github.com/google/uuid" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) type workspaceAgentContextKey struct{} diff --git a/coderd/httpmw/workspacebuildparam.go b/coderd/httpmw/workspacebuildparam.go index 29e88d8f20654..f51ce63b6491c 100644 --- a/coderd/httpmw/workspacebuildparam.go +++ b/coderd/httpmw/workspacebuildparam.go @@ -10,7 +10,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) type workspaceBuildParamContextKey struct{} diff --git a/coderd/httpmw/workspaceparam.go b/coderd/httpmw/workspaceparam.go index e37589aa32a1f..2b686fac5215d 100644 --- a/coderd/httpmw/workspaceparam.go +++ b/coderd/httpmw/workspaceparam.go @@ -8,7 +8,7 @@ import ( "net/http" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) type workspaceParamContextKey struct{} diff --git a/coderd/httpmw/workspaceresourceparam.go b/coderd/httpmw/workspaceresourceparam.go index a02d556866315..e98bd1391395e 100644 --- a/coderd/httpmw/workspaceresourceparam.go +++ b/coderd/httpmw/workspaceresourceparam.go @@ -10,7 +10,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) type workspaceResourceParamContextKey struct{} diff --git a/coderd/organizations.go b/coderd/organizations.go index 5d58d516d795f..114779e9ce544 100644 --- a/coderd/organizations.go +++ b/coderd/organizations.go @@ -14,7 +14,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/parameters.go b/coderd/parameters.go index 3330d5db14617..908d23c6ae898 100644 --- a/coderd/parameters.go +++ b/coderd/parameters.go @@ -12,7 +12,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) func (api *api) postParameter(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/projects.go b/coderd/projects.go index f0f8ff7c82e40..28f1f870e492e 100644 --- a/coderd/projects.go +++ b/coderd/projects.go @@ -12,7 +12,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/projectversions.go b/coderd/projectversions.go index 35fc3ad56ee0e..f8b3e2afa59d6 100644 --- a/coderd/projectversions.go +++ b/coderd/projectversions.go @@ -11,7 +11,7 @@ import ( "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/provisionerdaemons.go b/coderd/provisionerdaemons.go index b34f235d36390..14ef9c5cccbac 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -25,7 +25,7 @@ import ( "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/provisionerd/proto" "github.com/coder/coder/provisionersdk" sdkproto "github.com/coder/coder/provisionersdk/proto" diff --git a/coderd/provisionerjobs.go b/coderd/provisionerjobs.go index aefd678fe585f..45b128e385d33 100644 --- a/coderd/provisionerjobs.go +++ b/coderd/provisionerjobs.go @@ -17,7 +17,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) // Returns provisioner logs based on query parameters. diff --git a/coderd/users.go b/coderd/users.go index a1dcb7df25008..e25708a7b48b0 100644 --- a/coderd/users.go +++ b/coderd/users.go @@ -19,7 +19,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/cryptorand" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 78fa54b809dce..1fc59c68edc7a 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -9,7 +9,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/workspaceresourceauth.go b/coderd/workspaceresourceauth.go index 5165079f140b6..10118bab9ad6b 100644 --- a/coderd/workspaceresourceauth.go +++ b/coderd/workspaceresourceauth.go @@ -11,7 +11,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/mitchellh/mapstructure" ) diff --git a/coderd/workspaceresources.go b/coderd/workspaceresources.go index 1fc83fc14ebac..dd1f5e430dba8 100644 --- a/coderd/workspaceresources.go +++ b/coderd/workspaceresources.go @@ -17,7 +17,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/peerbroker" "github.com/coder/coder/peerbroker/proto" diff --git a/coderd/workspaces.go b/coderd/workspaces.go index 8bdecb3d0f6a5..b2016cabeb69c 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -15,7 +15,7 @@ import ( "github.com/coder/coder/codersdk" "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/codersdk/client.go b/codersdk/client.go index a505c9312f9bb..b28d9b73b643b 100644 --- a/codersdk/client.go +++ b/codersdk/client.go @@ -14,7 +14,7 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/coderd/httpmw" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/httpapi" ) // New creates a Coder client for the provided URL. From 54f426f7076001c4f78ea7dd0eb4166f54b63102 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 14:59:43 -0500 Subject: [PATCH 03/10] chore(cdr): Move database to /coderd directory database is specific to coderd and should be scoped under coderd --- cli/cliui/job.go | 2 +- cli/parametercreate.go | 2 +- cli/projectcreate.go | 2 +- cli/projectcreate_test.go | 2 +- cli/projects.go | 2 +- cli/projectupdate.go | 2 +- cli/start.go | 4 ++-- cli/start_test.go | 2 +- cli/workspacecreate.go | 2 +- cli/workspacedelete.go | 2 +- cli/workspacestart.go | 2 +- cli/workspacestop.go | 2 +- cmd/cliui/main.go | 2 +- cmd/templater/main.go | 4 ++-- coderd/coderd.go | 2 +- coderd/coderdtest/coderdtest.go | 6 +++--- {database => coderd/database}/databasefake/databasefake.go | 2 +- {database => coderd/database}/db.go | 0 {database => coderd/database}/dump.sql | 0 {database => coderd/database}/dump/main.go | 4 ++-- {database => coderd/database}/migrate.go | 0 {database => coderd/database}/migrate_test.go | 4 ++-- .../database}/migrations/000001_base.down.sql | 0 {database => coderd/database}/migrations/000001_base.up.sql | 0 .../database}/migrations/000002_projects.down.sql | 0 .../database}/migrations/000002_projects.up.sql | 0 .../database}/migrations/000003_workspaces.down.sql | 0 .../database}/migrations/000003_workspaces.up.sql | 0 .../database}/migrations/000004_jobs.down.sql | 0 {database => coderd/database}/migrations/000004_jobs.up.sql | 0 .../database}/migrations/create_migration.sh | 0 {database => coderd/database}/models.go | 0 {database => coderd/database}/postgres/postgres.go | 0 {database => coderd/database}/postgres/postgres_test.go | 2 +- {database => coderd/database}/pubsub.go | 0 {database => coderd/database}/pubsub_memory.go | 0 {database => coderd/database}/pubsub_memory_test.go | 2 +- {database => coderd/database}/pubsub_test.go | 4 ++-- {database => coderd/database}/querier.go | 0 {database => coderd/database}/query.sql | 0 {database => coderd/database}/query.sql.go | 0 {database => coderd/database}/sqlc.yaml | 0 {database => coderd/database}/time.go | 0 coderd/files.go | 2 +- coderd/httpmw/apikey.go | 2 +- coderd/httpmw/apikey_test.go | 4 ++-- coderd/httpmw/organizationparam.go | 2 +- coderd/httpmw/organizationparam_test.go | 4 ++-- coderd/httpmw/projectparam.go | 2 +- coderd/httpmw/projectparam_test.go | 4 ++-- coderd/httpmw/projectversionparam.go | 2 +- coderd/httpmw/projectversionparam_test.go | 4 ++-- coderd/httpmw/userparam.go | 2 +- coderd/httpmw/userparam_test.go | 4 ++-- coderd/httpmw/workspaceagent.go | 2 +- coderd/httpmw/workspaceagent_test.go | 4 ++-- coderd/httpmw/workspacebuildparam.go | 2 +- coderd/httpmw/workspacebuildparam_test.go | 4 ++-- coderd/httpmw/workspaceparam.go | 2 +- coderd/httpmw/workspaceparam_test.go | 4 ++-- coderd/httpmw/workspaceresourceparam.go | 2 +- coderd/httpmw/workspaceresourceparam_test.go | 4 ++-- coderd/organizations.go | 2 +- coderd/organizations_test.go | 2 +- coderd/parameter/compute.go | 2 +- coderd/parameter/compute_test.go | 4 ++-- coderd/parameters.go | 2 +- coderd/parameters_test.go | 2 +- coderd/projects.go | 2 +- coderd/projectversions.go | 2 +- coderd/provisionerdaemons.go | 2 +- coderd/provisionerjobs.go | 2 +- coderd/provisionerjobs_test.go | 2 +- coderd/users.go | 2 +- coderd/workspacebuilds.go | 2 +- coderd/workspaceresourceauth.go | 2 +- coderd/workspaceresources.go | 2 +- coderd/workspaces.go | 2 +- coderd/workspaces_test.go | 2 +- codersdk/client.go | 2 +- codersdk/organizations.go | 2 +- codersdk/parameters.go | 2 +- codersdk/projects.go | 2 +- codersdk/projectversions.go | 2 +- codersdk/provisionerdaemons.go | 2 +- codersdk/workspacebuilds.go | 2 +- codersdk/workspaceresources.go | 2 +- codersdk/workspaces.go | 2 +- peerbroker/proxy.go | 2 +- peerbroker/proxy_test.go | 2 +- 90 files changed, 86 insertions(+), 86 deletions(-) rename {database => coderd/database}/databasefake/databasefake.go (99%) rename {database => coderd/database}/db.go (100%) rename {database => coderd/database}/dump.sql (100%) rename {database => coderd/database}/dump/main.go (94%) rename {database => coderd/database}/migrate.go (100%) rename {database => coderd/database}/migrate_test.go (92%) rename {database => coderd/database}/migrations/000001_base.down.sql (100%) rename {database => coderd/database}/migrations/000001_base.up.sql (100%) rename {database => coderd/database}/migrations/000002_projects.down.sql (100%) rename {database => coderd/database}/migrations/000002_projects.up.sql (100%) rename {database => coderd/database}/migrations/000003_workspaces.down.sql (100%) rename {database => coderd/database}/migrations/000003_workspaces.up.sql (100%) rename {database => coderd/database}/migrations/000004_jobs.down.sql (100%) rename {database => coderd/database}/migrations/000004_jobs.up.sql (100%) rename {database => coderd/database}/migrations/create_migration.sh (100%) rename {database => coderd/database}/models.go (100%) rename {database => coderd/database}/postgres/postgres.go (100%) rename {database => coderd/database}/postgres/postgres_test.go (91%) rename {database => coderd/database}/pubsub.go (100%) rename {database => coderd/database}/pubsub_memory.go (100%) rename {database => coderd/database}/pubsub_memory_test.go (94%) rename {database => coderd/database}/pubsub_test.go (94%) rename {database => coderd/database}/querier.go (100%) rename {database => coderd/database}/query.sql (100%) rename {database => coderd/database}/query.sql.go (100%) rename {database => coderd/database}/sqlc.yaml (100%) rename {database => coderd/database}/time.go (100%) diff --git a/cli/cliui/job.go b/cli/cliui/job.go index ed8d04f1c9a64..7cbb868d5ae0a 100644 --- a/cli/cliui/job.go +++ b/cli/cliui/job.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/cobra" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) type JobOptions struct { diff --git a/cli/parametercreate.go b/cli/parametercreate.go index f98445aef64ac..94dd449e2a36d 100644 --- a/cli/parametercreate.go +++ b/cli/parametercreate.go @@ -7,7 +7,7 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func parameterCreate() *cobra.Command { diff --git a/cli/projectcreate.go b/cli/projectcreate.go index 46191cf768f2a..d3c8b7e14ac23 100644 --- a/cli/projectcreate.go +++ b/cli/projectcreate.go @@ -16,7 +16,7 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" ) diff --git a/cli/projectcreate_test.go b/cli/projectcreate_test.go index 900d37958218e..e0639de638479 100644 --- a/cli/projectcreate_test.go +++ b/cli/projectcreate_test.go @@ -7,7 +7,7 @@ import ( "github.com/coder/coder/cli/clitest" "github.com/coder/coder/coderd/coderdtest" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/pty/ptytest" ) diff --git a/cli/projects.go b/cli/projects.go index e4e2e94db78af..79e88e5fdf5ed 100644 --- a/cli/projects.go +++ b/cli/projects.go @@ -9,7 +9,7 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func projects() *cobra.Command { diff --git a/cli/projectupdate.go b/cli/projectupdate.go index 239dd381d4e7a..7019a18de440c 100644 --- a/cli/projectupdate.go +++ b/cli/projectupdate.go @@ -10,7 +10,7 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/provisionersdk" ) diff --git a/cli/start.go b/cli/start.go index bdae6aa0f9ace..b18ffac724601 100644 --- a/cli/start.go +++ b/cli/start.go @@ -30,8 +30,8 @@ import ( "github.com/coder/coder/coderd" "github.com/coder/coder/coderd/tunnel" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/provisioner/terraform" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" diff --git a/cli/start_test.go b/cli/start_test.go index 9c7b5bbaf735d..2547d9bd7db62 100644 --- a/cli/start_test.go +++ b/cli/start_test.go @@ -23,7 +23,7 @@ import ( "github.com/coder/coder/cli/clitest" "github.com/coder/coder/coderd/coderdtest" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database/postgres" + "github.com/coder/coder/coderd/database/postgres" ) func TestStart(t *testing.T) { diff --git a/cli/workspacecreate.go b/cli/workspacecreate.go index fac1f35825fb7..09275d1b12087 100644 --- a/cli/workspacecreate.go +++ b/cli/workspacecreate.go @@ -14,7 +14,7 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func workspaceCreate() *cobra.Command { diff --git a/cli/workspacedelete.go b/cli/workspacedelete.go index 63b3e18f749c4..39096cec1538e 100644 --- a/cli/workspacedelete.go +++ b/cli/workspacedelete.go @@ -7,7 +7,7 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func workspaceDelete() *cobra.Command { diff --git a/cli/workspacestart.go b/cli/workspacestart.go index eeed3d81476b0..2d7d9e508c8a7 100644 --- a/cli/workspacestart.go +++ b/cli/workspacestart.go @@ -7,7 +7,7 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func workspaceStart() *cobra.Command { diff --git a/cli/workspacestop.go b/cli/workspacestop.go index b665bb15b972d..68ba55fd47d79 100644 --- a/cli/workspacestop.go +++ b/cli/workspacestop.go @@ -7,7 +7,7 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func workspaceStop() *cobra.Command { diff --git a/cmd/cliui/main.go b/cmd/cliui/main.go index af4e522e360b8..14a5b6414efbc 100644 --- a/cmd/cliui/main.go +++ b/cmd/cliui/main.go @@ -12,7 +12,7 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func main() { diff --git a/cmd/templater/main.go b/cmd/templater/main.go index dd587a25c8671..ddd6596eab000 100644 --- a/cmd/templater/main.go +++ b/cmd/templater/main.go @@ -21,8 +21,8 @@ import ( "github.com/coder/coder/coderd" "github.com/coder/coder/coderd/tunnel" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/provisioner/terraform" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" diff --git a/coderd/coderd.go b/coderd/coderd.go index 8d7068375ced2..e1137c6dd467e 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -10,7 +10,7 @@ import ( "google.golang.org/api/idtoken" "cdr.dev/slog" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/site" diff --git a/coderd/coderdtest/coderdtest.go b/coderd/coderdtest/coderdtest.go index 6dd759615b18a..646e41fe91c8c 100644 --- a/coderd/coderdtest/coderdtest.go +++ b/coderd/coderdtest/coderdtest.go @@ -22,9 +22,9 @@ import ( "cdr.dev/slog/sloggers/slogtest" "github.com/coder/coder/coderd" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/database/postgres" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/database/postgres" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" diff --git a/database/databasefake/databasefake.go b/coderd/database/databasefake/databasefake.go similarity index 99% rename from database/databasefake/databasefake.go rename to coderd/database/databasefake/databasefake.go index a6b955a92288b..82d1c4a472cbc 100644 --- a/database/databasefake/databasefake.go +++ b/coderd/database/databasefake/databasefake.go @@ -8,7 +8,7 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) // New returns an in-memory fake of the database. diff --git a/database/db.go b/coderd/database/db.go similarity index 100% rename from database/db.go rename to coderd/database/db.go diff --git a/database/dump.sql b/coderd/database/dump.sql similarity index 100% rename from database/dump.sql rename to coderd/database/dump.sql diff --git a/database/dump/main.go b/coderd/database/dump/main.go similarity index 94% rename from database/dump/main.go rename to coderd/database/dump/main.go index a9e3098ccd62f..fd8f87ee282f7 100644 --- a/database/dump/main.go +++ b/coderd/database/dump/main.go @@ -10,8 +10,8 @@ import ( "path/filepath" "runtime" - "github.com/coder/coder/database" - "github.com/coder/coder/database/postgres" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/postgres" ) func main() { diff --git a/database/migrate.go b/coderd/database/migrate.go similarity index 100% rename from database/migrate.go rename to coderd/database/migrate.go diff --git a/database/migrate_test.go b/coderd/database/migrate_test.go similarity index 92% rename from database/migrate_test.go rename to coderd/database/migrate_test.go index d43b6813f6f1c..8bd9c41f0c443 100644 --- a/database/migrate_test.go +++ b/coderd/database/migrate_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/goleak" - "github.com/coder/coder/database" - "github.com/coder/coder/database/postgres" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/postgres" ) func TestMain(m *testing.M) { diff --git a/database/migrations/000001_base.down.sql b/coderd/database/migrations/000001_base.down.sql similarity index 100% rename from database/migrations/000001_base.down.sql rename to coderd/database/migrations/000001_base.down.sql diff --git a/database/migrations/000001_base.up.sql b/coderd/database/migrations/000001_base.up.sql similarity index 100% rename from database/migrations/000001_base.up.sql rename to coderd/database/migrations/000001_base.up.sql diff --git a/database/migrations/000002_projects.down.sql b/coderd/database/migrations/000002_projects.down.sql similarity index 100% rename from database/migrations/000002_projects.down.sql rename to coderd/database/migrations/000002_projects.down.sql diff --git a/database/migrations/000002_projects.up.sql b/coderd/database/migrations/000002_projects.up.sql similarity index 100% rename from database/migrations/000002_projects.up.sql rename to coderd/database/migrations/000002_projects.up.sql diff --git a/database/migrations/000003_workspaces.down.sql b/coderd/database/migrations/000003_workspaces.down.sql similarity index 100% rename from database/migrations/000003_workspaces.down.sql rename to coderd/database/migrations/000003_workspaces.down.sql diff --git a/database/migrations/000003_workspaces.up.sql b/coderd/database/migrations/000003_workspaces.up.sql similarity index 100% rename from database/migrations/000003_workspaces.up.sql rename to coderd/database/migrations/000003_workspaces.up.sql diff --git a/database/migrations/000004_jobs.down.sql b/coderd/database/migrations/000004_jobs.down.sql similarity index 100% rename from database/migrations/000004_jobs.down.sql rename to coderd/database/migrations/000004_jobs.down.sql diff --git a/database/migrations/000004_jobs.up.sql b/coderd/database/migrations/000004_jobs.up.sql similarity index 100% rename from database/migrations/000004_jobs.up.sql rename to coderd/database/migrations/000004_jobs.up.sql diff --git a/database/migrations/create_migration.sh b/coderd/database/migrations/create_migration.sh similarity index 100% rename from database/migrations/create_migration.sh rename to coderd/database/migrations/create_migration.sh diff --git a/database/models.go b/coderd/database/models.go similarity index 100% rename from database/models.go rename to coderd/database/models.go diff --git a/database/postgres/postgres.go b/coderd/database/postgres/postgres.go similarity index 100% rename from database/postgres/postgres.go rename to coderd/database/postgres/postgres.go diff --git a/database/postgres/postgres_test.go b/coderd/database/postgres/postgres_test.go similarity index 91% rename from database/postgres/postgres_test.go rename to coderd/database/postgres/postgres_test.go index 30d027559c35d..8efac0f99a030 100644 --- a/database/postgres/postgres_test.go +++ b/coderd/database/postgres/postgres_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/goleak" - "github.com/coder/coder/database/postgres" + "github.com/coder/coder/coderd/database/postgres" _ "github.com/lib/pq" ) diff --git a/database/pubsub.go b/coderd/database/pubsub.go similarity index 100% rename from database/pubsub.go rename to coderd/database/pubsub.go diff --git a/database/pubsub_memory.go b/coderd/database/pubsub_memory.go similarity index 100% rename from database/pubsub_memory.go rename to coderd/database/pubsub_memory.go diff --git a/database/pubsub_memory_test.go b/coderd/database/pubsub_memory_test.go similarity index 94% rename from database/pubsub_memory_test.go rename to coderd/database/pubsub_memory_test.go index cc69df51bd38b..e5913aa702905 100644 --- a/database/pubsub_memory_test.go +++ b/coderd/database/pubsub_memory_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) func TestPubsubMemory(t *testing.T) { diff --git a/database/pubsub_test.go b/coderd/database/pubsub_test.go similarity index 94% rename from database/pubsub_test.go rename to coderd/database/pubsub_test.go index 55f34896184c6..9a4eb72999b8c 100644 --- a/database/pubsub_test.go +++ b/coderd/database/pubsub_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/coder/coder/database" - "github.com/coder/coder/database/postgres" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/postgres" ) func TestPubsub(t *testing.T) { diff --git a/database/querier.go b/coderd/database/querier.go similarity index 100% rename from database/querier.go rename to coderd/database/querier.go diff --git a/database/query.sql b/coderd/database/query.sql similarity index 100% rename from database/query.sql rename to coderd/database/query.sql diff --git a/database/query.sql.go b/coderd/database/query.sql.go similarity index 100% rename from database/query.sql.go rename to coderd/database/query.sql.go diff --git a/database/sqlc.yaml b/coderd/database/sqlc.yaml similarity index 100% rename from database/sqlc.yaml rename to coderd/database/sqlc.yaml diff --git a/database/time.go b/coderd/database/time.go similarity index 100% rename from database/time.go rename to coderd/database/time.go diff --git a/coderd/files.go b/coderd/files.go index 8ffb493edd2ad..8ed0ef145d395 100644 --- a/coderd/files.go +++ b/coderd/files.go @@ -13,7 +13,7 @@ import ( "github.com/go-chi/render" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/apikey.go b/coderd/httpmw/apikey.go index 13a45dc0ba904..1b18bc56bcde6 100644 --- a/coderd/httpmw/apikey.go +++ b/coderd/httpmw/apikey.go @@ -13,7 +13,7 @@ import ( "golang.org/x/oauth2" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/apikey_test.go b/coderd/httpmw/apikey_test.go index a1ef8da599a3e..1a54b3f615620 100644 --- a/coderd/httpmw/apikey_test.go +++ b/coderd/httpmw/apikey_test.go @@ -13,8 +13,8 @@ import ( "golang.org/x/oauth2" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/organizationparam.go b/coderd/httpmw/organizationparam.go index e5917586c2d64..b59855f86442b 100644 --- a/coderd/httpmw/organizationparam.go +++ b/coderd/httpmw/organizationparam.go @@ -9,7 +9,7 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/organizationparam_test.go b/coderd/httpmw/organizationparam_test.go index f91460b920f7b..86b3814963069 100644 --- a/coderd/httpmw/organizationparam_test.go +++ b/coderd/httpmw/organizationparam_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/projectparam.go b/coderd/httpmw/projectparam.go index c178c5a841eab..d46da6b541bf2 100644 --- a/coderd/httpmw/projectparam.go +++ b/coderd/httpmw/projectparam.go @@ -10,7 +10,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/coder/coder/coderd/httpapi" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) type projectParamContextKey struct{} diff --git a/coderd/httpmw/projectparam_test.go b/coderd/httpmw/projectparam_test.go index 58209a1d9b033..ce3ce68ae619f 100644 --- a/coderd/httpmw/projectparam_test.go +++ b/coderd/httpmw/projectparam_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/projectversionparam.go b/coderd/httpmw/projectversionparam.go index 5530b2b77064f..e2c00d37ac51e 100644 --- a/coderd/httpmw/projectversionparam.go +++ b/coderd/httpmw/projectversionparam.go @@ -9,7 +9,7 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/projectversionparam_test.go b/coderd/httpmw/projectversionparam_test.go index b108412d789e8..354d4194e8e56 100644 --- a/coderd/httpmw/projectversionparam_test.go +++ b/coderd/httpmw/projectversionparam_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/userparam.go b/coderd/httpmw/userparam.go index b5fbb17f8f3e4..22fd223f3e31b 100644 --- a/coderd/httpmw/userparam.go +++ b/coderd/httpmw/userparam.go @@ -7,7 +7,7 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/userparam_test.go b/coderd/httpmw/userparam_test.go index bbbaec87a3280..99fd0f0407694 100644 --- a/coderd/httpmw/userparam_test.go +++ b/coderd/httpmw/userparam_test.go @@ -12,8 +12,8 @@ import ( "github.com/go-chi/chi/v5" "github.com/stretchr/testify/require" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/workspaceagent.go b/coderd/httpmw/workspaceagent.go index 40ae7e1484d33..f90d8ff79f9a4 100644 --- a/coderd/httpmw/workspaceagent.go +++ b/coderd/httpmw/workspaceagent.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/workspaceagent_test.go b/coderd/httpmw/workspaceagent_test.go index 03c260ad291ef..650e68436b836 100644 --- a/coderd/httpmw/workspaceagent_test.go +++ b/coderd/httpmw/workspaceagent_test.go @@ -10,8 +10,8 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/workspacebuildparam.go b/coderd/httpmw/workspacebuildparam.go index f51ce63b6491c..62d4a00efdf09 100644 --- a/coderd/httpmw/workspacebuildparam.go +++ b/coderd/httpmw/workspacebuildparam.go @@ -9,7 +9,7 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/workspacebuildparam_test.go b/coderd/httpmw/workspacebuildparam_test.go index 32f50788a6fd4..e1fb606025356 100644 --- a/coderd/httpmw/workspacebuildparam_test.go +++ b/coderd/httpmw/workspacebuildparam_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/workspaceparam.go b/coderd/httpmw/workspaceparam.go index 2b686fac5215d..3e12dc7a5804c 100644 --- a/coderd/httpmw/workspaceparam.go +++ b/coderd/httpmw/workspaceparam.go @@ -7,7 +7,7 @@ import ( "fmt" "net/http" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/workspaceparam_test.go b/coderd/httpmw/workspaceparam_test.go index 8879604ace086..3ef7487e1a3a0 100644 --- a/coderd/httpmw/workspaceparam_test.go +++ b/coderd/httpmw/workspaceparam_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/httpmw/workspaceresourceparam.go b/coderd/httpmw/workspaceresourceparam.go index e98bd1391395e..1ac1d3904ae53 100644 --- a/coderd/httpmw/workspaceresourceparam.go +++ b/coderd/httpmw/workspaceresourceparam.go @@ -9,7 +9,7 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/httpmw/workspaceresourceparam_test.go b/coderd/httpmw/workspaceresourceparam_test.go index d7eb425054c64..1c0000b434052 100644 --- a/coderd/httpmw/workspaceresourceparam_test.go +++ b/coderd/httpmw/workspaceresourceparam_test.go @@ -10,8 +10,8 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/organizations.go b/coderd/organizations.go index 114779e9ce544..7499c7cb09f6f 100644 --- a/coderd/organizations.go +++ b/coderd/organizations.go @@ -13,7 +13,7 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/organizations_test.go b/coderd/organizations_test.go index 5633717306b23..4e16f0d8b2ca3 100644 --- a/coderd/organizations_test.go +++ b/coderd/organizations_test.go @@ -10,7 +10,7 @@ import ( "github.com/coder/coder/coderd/coderdtest" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/provisioner/echo" ) diff --git a/coderd/parameter/compute.go b/coderd/parameter/compute.go index ef3f624b14e7a..f5960a358548a 100644 --- a/coderd/parameter/compute.go +++ b/coderd/parameter/compute.go @@ -8,7 +8,7 @@ import ( "github.com/google/uuid" "golang.org/x/xerrors" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) // ComputeScope targets identifiers to pull parameters from. diff --git a/coderd/parameter/compute_test.go b/coderd/parameter/compute_test.go index 660be359975a5..c8513ace637c3 100644 --- a/coderd/parameter/compute_test.go +++ b/coderd/parameter/compute_test.go @@ -9,8 +9,8 @@ import ( "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" ) func TestCompute(t *testing.T) { diff --git a/coderd/parameters.go b/coderd/parameters.go index 908d23c6ae898..90a3770d61533 100644 --- a/coderd/parameters.go +++ b/coderd/parameters.go @@ -11,7 +11,7 @@ import ( "github.com/google/uuid" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/parameters_test.go b/coderd/parameters_test.go index 674adec078358..2c2f292c0e3fd 100644 --- a/coderd/parameters_test.go +++ b/coderd/parameters_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/coderd/coderdtest" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func TestPostParameter(t *testing.T) { diff --git a/coderd/projects.go b/coderd/projects.go index 28f1f870e492e..2f289ca77df6a 100644 --- a/coderd/projects.go +++ b/coderd/projects.go @@ -11,7 +11,7 @@ import ( "github.com/google/uuid" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/projectversions.go b/coderd/projectversions.go index f8b3e2afa59d6..fec6795b57f8e 100644 --- a/coderd/projectversions.go +++ b/coderd/projectversions.go @@ -10,7 +10,7 @@ import ( "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/provisionerdaemons.go b/coderd/provisionerdaemons.go index 14ef9c5cccbac..f5a0b5804b271 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -24,7 +24,7 @@ import ( "cdr.dev/slog" "github.com/coder/coder/coderd/parameter" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/provisionerd/proto" "github.com/coder/coder/provisionersdk" diff --git a/coderd/provisionerjobs.go b/coderd/provisionerjobs.go index 45b128e385d33..56382dec67f19 100644 --- a/coderd/provisionerjobs.go +++ b/coderd/provisionerjobs.go @@ -16,7 +16,7 @@ import ( "cdr.dev/slog" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" ) diff --git a/coderd/provisionerjobs_test.go b/coderd/provisionerjobs_test.go index 0265d5097bee4..c4aef5c7550ca 100644 --- a/coderd/provisionerjobs_test.go +++ b/coderd/provisionerjobs_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/coderd/coderdtest" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionersdk/proto" ) diff --git a/coderd/users.go b/coderd/users.go index e25708a7b48b0..3cb1b525dc411 100644 --- a/coderd/users.go +++ b/coderd/users.go @@ -18,7 +18,7 @@ import ( "github.com/coder/coder/coderd/userpassword" "github.com/coder/coder/codersdk" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 1fc59c68edc7a..0888188ecd680 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -8,7 +8,7 @@ import ( "github.com/go-chi/render" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/workspaceresourceauth.go b/coderd/workspaceresourceauth.go index 10118bab9ad6b..93005da96f6d0 100644 --- a/coderd/workspaceresourceauth.go +++ b/coderd/workspaceresourceauth.go @@ -10,7 +10,7 @@ import ( "github.com/go-chi/render" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/mitchellh/mapstructure" diff --git a/coderd/workspaceresources.go b/coderd/workspaceresources.go index dd1f5e430dba8..4f3af44aeeb0d 100644 --- a/coderd/workspaceresources.go +++ b/coderd/workspaceresources.go @@ -16,7 +16,7 @@ import ( "cdr.dev/slog" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/peerbroker" diff --git a/coderd/workspaces.go b/coderd/workspaces.go index b2016cabeb69c..35779d506e0a3 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -14,7 +14,7 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" ) diff --git a/coderd/workspaces_test.go b/coderd/workspaces_test.go index 7bcc003cca5ff..84c63957bacbb 100644 --- a/coderd/workspaces_test.go +++ b/coderd/workspaces_test.go @@ -10,7 +10,7 @@ import ( "github.com/coder/coder/coderd/coderdtest" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionersdk/proto" ) diff --git a/codersdk/client.go b/codersdk/client.go index b28d9b73b643b..d98f2ff3c1592 100644 --- a/codersdk/client.go +++ b/codersdk/client.go @@ -13,8 +13,8 @@ import ( "golang.org/x/xerrors" - "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/coderd/httpmw" ) // New creates a Coder client for the provided URL. diff --git a/codersdk/organizations.go b/codersdk/organizations.go index 8a55a38d21abe..c21314937bacf 100644 --- a/codersdk/organizations.go +++ b/codersdk/organizations.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) // Organization is the JSON representation of a Coder organization. diff --git a/codersdk/parameters.go b/codersdk/parameters.go index 185e2917aec57..e2a2992d5c63b 100644 --- a/codersdk/parameters.go +++ b/codersdk/parameters.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) type ParameterScope string diff --git a/codersdk/projects.go b/codersdk/projects.go index fe28afc1555dc..03d5bc2ee0939 100644 --- a/codersdk/projects.go +++ b/codersdk/projects.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) // Project is the JSON representation of a Coder project. diff --git a/codersdk/projectversions.go b/codersdk/projectversions.go index 215a14a83571d..07771b591a44e 100644 --- a/codersdk/projectversions.go +++ b/codersdk/projectversions.go @@ -10,7 +10,7 @@ import ( "github.com/google/uuid" "github.com/coder/coder/coderd/parameter" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) // ProjectVersion represents a single version of a project. diff --git a/codersdk/provisionerdaemons.go b/codersdk/provisionerdaemons.go index f8080dcc8a9ee..6530dab33c9e4 100644 --- a/codersdk/provisionerdaemons.go +++ b/codersdk/provisionerdaemons.go @@ -15,7 +15,7 @@ import ( "golang.org/x/xerrors" "nhooyr.io/websocket" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/provisionerd/proto" "github.com/coder/coder/provisionersdk" ) diff --git a/codersdk/workspacebuilds.go b/codersdk/workspacebuilds.go index 916ed2e60b231..b71e1d52a6f08 100644 --- a/codersdk/workspacebuilds.go +++ b/codersdk/workspacebuilds.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) // WorkspaceBuild is an at-point representation of a workspace state. diff --git a/codersdk/workspaceresources.go b/codersdk/workspaceresources.go index b78694eef3d77..4d1d9c22b7494 100644 --- a/codersdk/workspaceresources.go +++ b/codersdk/workspaceresources.go @@ -15,7 +15,7 @@ import ( "golang.org/x/xerrors" "nhooyr.io/websocket" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/peer" "github.com/coder/coder/peerbroker" diff --git a/codersdk/workspaces.go b/codersdk/workspaces.go index 0615ba97548da..0724b735bb362 100644 --- a/codersdk/workspaces.go +++ b/codersdk/workspaces.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" ) // Workspace is a per-user deployment of a project. It tracks diff --git a/peerbroker/proxy.go b/peerbroker/proxy.go index e732eb295c2c8..ecaf135863515 100644 --- a/peerbroker/proxy.go +++ b/peerbroker/proxy.go @@ -17,7 +17,7 @@ import ( "storj.io/drpc/drpcserver" "cdr.dev/slog" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/peerbroker/proto" ) diff --git a/peerbroker/proxy_test.go b/peerbroker/proxy_test.go index 8ad5b01ff6de9..f036305b46957 100644 --- a/peerbroker/proxy_test.go +++ b/peerbroker/proxy_test.go @@ -10,7 +10,7 @@ import ( "cdr.dev/slog" "cdr.dev/slog/sloggers/slogtest" - "github.com/coder/coder/database" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/peer" "github.com/coder/coder/peerbroker" "github.com/coder/coder/peerbroker/proto" From b4cbadb234eaf8fef77ab57ea739acbd05d80da5 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 15:00:29 -0500 Subject: [PATCH 04/10] go fmt --- cli/cliui/job.go | 2 +- cli/parametercreate.go | 2 +- cli/projectcreate.go | 2 +- cli/projects.go | 2 +- cli/projectupdate.go | 2 +- cli/start.go | 4 ++-- cli/start_test.go | 2 +- cli/workspacecreate.go | 2 +- cli/workspacedelete.go | 2 +- cli/workspacestart.go | 2 +- cli/workspacestop.go | 2 +- cmd/cliui/main.go | 2 +- cmd/templater/main.go | 4 ++-- coderd/coderdtest/coderdtest.go | 2 +- coderd/files.go | 2 +- coderd/httpmw/apikey_test.go | 2 +- coderd/httpmw/organizationparam_test.go | 2 +- coderd/httpmw/projectparam.go | 2 +- coderd/httpmw/projectparam_test.go | 2 +- coderd/httpmw/projectversionparam_test.go | 2 +- coderd/httpmw/workspacebuildparam_test.go | 2 +- coderd/httpmw/workspaceparam_test.go | 2 +- coderd/organizations.go | 2 +- coderd/organizations_test.go | 2 +- coderd/parameter/compute_test.go | 4 ++-- coderd/parameters.go | 2 +- coderd/projects.go | 2 +- coderd/projectversions.go | 4 ++-- coderd/provisionerdaemons.go | 2 +- coderd/provisionerjobs.go | 2 +- coderd/users.go | 6 +++--- coderd/users_test.go | 2 +- coderd/workspacebuilds.go | 2 +- coderd/workspaceresourceauth.go | 2 +- coderd/workspaceresources.go | 2 +- coderd/workspaces.go | 2 +- coderd/workspaces_test.go | 2 +- codersdk/projectversions.go | 2 +- 38 files changed, 44 insertions(+), 44 deletions(-) diff --git a/cli/cliui/job.go b/cli/cliui/job.go index 7cbb868d5ae0a..bd7983a5cfcd9 100644 --- a/cli/cliui/job.go +++ b/cli/cliui/job.go @@ -10,8 +10,8 @@ import ( "github.com/charmbracelet/lipgloss" "github.com/spf13/cobra" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) type JobOptions struct { diff --git a/cli/parametercreate.go b/cli/parametercreate.go index 94dd449e2a36d..4cd285311f69e 100644 --- a/cli/parametercreate.go +++ b/cli/parametercreate.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" "golang.org/x/xerrors" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) func parameterCreate() *cobra.Command { diff --git a/cli/projectcreate.go b/cli/projectcreate.go index d3c8b7e14ac23..232b8f571f8d6 100644 --- a/cli/projectcreate.go +++ b/cli/projectcreate.go @@ -15,8 +15,8 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/cli/cliui" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" ) diff --git a/cli/projects.go b/cli/projects.go index 79e88e5fdf5ed..5da3262768d49 100644 --- a/cli/projects.go +++ b/cli/projects.go @@ -8,8 +8,8 @@ import ( "github.com/spf13/cobra" "github.com/coder/coder/cli/cliui" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) func projects() *cobra.Command { diff --git a/cli/projectupdate.go b/cli/projectupdate.go index 7019a18de440c..26bccd98772af 100644 --- a/cli/projectupdate.go +++ b/cli/projectupdate.go @@ -9,8 +9,8 @@ import ( "github.com/spf13/cobra" "golang.org/x/xerrors" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisionersdk" ) diff --git a/cli/start.go b/cli/start.go index b18ffac724601..00e4996dc6905 100644 --- a/cli/start.go +++ b/cli/start.go @@ -28,10 +28,10 @@ import ( "github.com/coder/coder/cli/cliui" "github.com/coder/coder/cli/config" "github.com/coder/coder/coderd" - "github.com/coder/coder/coderd/tunnel" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/tunnel" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisioner/terraform" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" diff --git a/cli/start_test.go b/cli/start_test.go index 2547d9bd7db62..2a35f2ca1e713 100644 --- a/cli/start_test.go +++ b/cli/start_test.go @@ -22,8 +22,8 @@ import ( "github.com/coder/coder/cli/clitest" "github.com/coder/coder/coderd/coderdtest" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database/postgres" + "github.com/coder/coder/codersdk" ) func TestStart(t *testing.T) { diff --git a/cli/workspacecreate.go b/cli/workspacecreate.go index 09275d1b12087..93b1997047dcd 100644 --- a/cli/workspacecreate.go +++ b/cli/workspacecreate.go @@ -13,8 +13,8 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/cli/cliui" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) func workspaceCreate() *cobra.Command { diff --git a/cli/workspacedelete.go b/cli/workspacedelete.go index 39096cec1538e..4dfd59a57bf1f 100644 --- a/cli/workspacedelete.go +++ b/cli/workspacedelete.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" "github.com/coder/coder/cli/cliui" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) func workspaceDelete() *cobra.Command { diff --git a/cli/workspacestart.go b/cli/workspacestart.go index 2d7d9e508c8a7..f19ceb2aeaa38 100644 --- a/cli/workspacestart.go +++ b/cli/workspacestart.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" "github.com/coder/coder/cli/cliui" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) func workspaceStart() *cobra.Command { diff --git a/cli/workspacestop.go b/cli/workspacestop.go index 68ba55fd47d79..4b07b478d7717 100644 --- a/cli/workspacestop.go +++ b/cli/workspacestop.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" "github.com/coder/coder/cli/cliui" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) func workspaceStop() *cobra.Command { diff --git a/cmd/cliui/main.go b/cmd/cliui/main.go index 14a5b6414efbc..bd8829cc1be00 100644 --- a/cmd/cliui/main.go +++ b/cmd/cliui/main.go @@ -11,8 +11,8 @@ import ( "golang.org/x/xerrors" "github.com/coder/coder/cli/cliui" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" ) func main() { diff --git a/cmd/templater/main.go b/cmd/templater/main.go index ddd6596eab000..aedb9a5d20681 100644 --- a/cmd/templater/main.go +++ b/cmd/templater/main.go @@ -19,10 +19,10 @@ import ( "cdr.dev/slog" "cdr.dev/slog/sloggers/sloghuman" "github.com/coder/coder/coderd" - "github.com/coder/coder/coderd/tunnel" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/tunnel" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisioner/terraform" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" diff --git a/coderd/coderdtest/coderdtest.go b/coderd/coderdtest/coderdtest.go index 646e41fe91c8c..59886107fdff0 100644 --- a/coderd/coderdtest/coderdtest.go +++ b/coderd/coderdtest/coderdtest.go @@ -21,10 +21,10 @@ import ( "cdr.dev/slog" "cdr.dev/slog/sloggers/slogtest" "github.com/coder/coder/coderd" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/database/postgres" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" diff --git a/coderd/files.go b/coderd/files.go index 8ed0ef145d395..351bc666b77d4 100644 --- a/coderd/files.go +++ b/coderd/files.go @@ -12,10 +12,10 @@ import ( "github.com/go-chi/chi/v5" "github.com/go-chi/render" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/codersdk" ) func (api *api) postFile(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/httpmw/apikey_test.go b/coderd/httpmw/apikey_test.go index 1a54b3f615620..2d4e7c3a6be67 100644 --- a/coderd/httpmw/apikey_test.go +++ b/coderd/httpmw/apikey_test.go @@ -12,11 +12,11 @@ import ( "github.com/stretchr/testify/require" "golang.org/x/oauth2" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/cryptorand" ) func randomAPIKeyParts() (id string, secret string) { diff --git a/coderd/httpmw/organizationparam_test.go b/coderd/httpmw/organizationparam_test.go index 86b3814963069..c21ddb4df5135 100644 --- a/coderd/httpmw/organizationparam_test.go +++ b/coderd/httpmw/organizationparam_test.go @@ -13,10 +13,10 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/cryptorand" ) func TestOrganizationParam(t *testing.T) { diff --git a/coderd/httpmw/projectparam.go b/coderd/httpmw/projectparam.go index d46da6b541bf2..9239dfb996475 100644 --- a/coderd/httpmw/projectparam.go +++ b/coderd/httpmw/projectparam.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type projectParamContextKey struct{} diff --git a/coderd/httpmw/projectparam_test.go b/coderd/httpmw/projectparam_test.go index ce3ce68ae619f..7e84d462116e0 100644 --- a/coderd/httpmw/projectparam_test.go +++ b/coderd/httpmw/projectparam_test.go @@ -13,10 +13,10 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/cryptorand" ) func TestProjectParam(t *testing.T) { diff --git a/coderd/httpmw/projectversionparam_test.go b/coderd/httpmw/projectversionparam_test.go index 354d4194e8e56..bf6c683c6a71d 100644 --- a/coderd/httpmw/projectversionparam_test.go +++ b/coderd/httpmw/projectversionparam_test.go @@ -13,10 +13,10 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/cryptorand" ) func TestProjectVersionParam(t *testing.T) { diff --git a/coderd/httpmw/workspacebuildparam_test.go b/coderd/httpmw/workspacebuildparam_test.go index e1fb606025356..d4a7ae1e59eb4 100644 --- a/coderd/httpmw/workspacebuildparam_test.go +++ b/coderd/httpmw/workspacebuildparam_test.go @@ -13,10 +13,10 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/cryptorand" ) func TestWorkspaceBuildParam(t *testing.T) { diff --git a/coderd/httpmw/workspaceparam_test.go b/coderd/httpmw/workspaceparam_test.go index 3ef7487e1a3a0..3c528ae44e56a 100644 --- a/coderd/httpmw/workspaceparam_test.go +++ b/coderd/httpmw/workspaceparam_test.go @@ -13,10 +13,10 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/cryptorand" ) func TestWorkspaceParam(t *testing.T) { diff --git a/coderd/organizations.go b/coderd/organizations.go index 7499c7cb09f6f..8dde91903bf42 100644 --- a/coderd/organizations.go +++ b/coderd/organizations.go @@ -12,10 +12,10 @@ import ( "github.com/moby/moby/pkg/namesgenerator" "golang.org/x/xerrors" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/codersdk" ) func (*api) organization(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/organizations_test.go b/coderd/organizations_test.go index 4e16f0d8b2ca3..d405e88b3a43e 100644 --- a/coderd/organizations_test.go +++ b/coderd/organizations_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/coderd/coderdtest" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisioner/echo" ) diff --git a/coderd/parameter/compute_test.go b/coderd/parameter/compute_test.go index c8513ace637c3..3ad01d4f5f70e 100644 --- a/coderd/parameter/compute_test.go +++ b/coderd/parameter/compute_test.go @@ -7,10 +7,10 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/coder/coder/coderd/parameter" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/parameter" + "github.com/coder/coder/cryptorand" ) func TestCompute(t *testing.T) { diff --git a/coderd/parameters.go b/coderd/parameters.go index 90a3770d61533..e7eb7fb38994b 100644 --- a/coderd/parameters.go +++ b/coderd/parameters.go @@ -10,9 +10,9 @@ import ( "github.com/go-chi/render" "github.com/google/uuid" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/codersdk" ) func (api *api) postParameter(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/projects.go b/coderd/projects.go index 2f289ca77df6a..70b3817ea523f 100644 --- a/coderd/projects.go +++ b/coderd/projects.go @@ -10,10 +10,10 @@ import ( "github.com/go-chi/render" "github.com/google/uuid" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/codersdk" ) // Returns a single project. diff --git a/coderd/projectversions.go b/coderd/projectversions.go index fec6795b57f8e..d1396a0e6483e 100644 --- a/coderd/projectversions.go +++ b/coderd/projectversions.go @@ -8,11 +8,11 @@ import ( "github.com/go-chi/render" - "github.com/coder/coder/coderd/parameter" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/coderd/parameter" + "github.com/coder/coder/codersdk" ) func (api *api) projectVersion(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/provisionerdaemons.go b/coderd/provisionerdaemons.go index f5a0b5804b271..ce203c283b89e 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -23,9 +23,9 @@ import ( "cdr.dev/slog" - "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/provisionerd/proto" "github.com/coder/coder/provisionersdk" sdkproto "github.com/coder/coder/provisionersdk/proto" diff --git a/coderd/provisionerjobs.go b/coderd/provisionerjobs.go index 56382dec67f19..7e5682e65b67a 100644 --- a/coderd/provisionerjobs.go +++ b/coderd/provisionerjobs.go @@ -15,9 +15,9 @@ import ( "cdr.dev/slog" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/codersdk" ) // Returns provisioner logs based on query parameters. diff --git a/coderd/users.go b/coderd/users.go index 3cb1b525dc411..e5db601ad2828 100644 --- a/coderd/users.go +++ b/coderd/users.go @@ -15,12 +15,12 @@ import ( "github.com/moby/moby/pkg/namesgenerator" "golang.org/x/xerrors" - "github.com/coder/coder/coderd/userpassword" - "github.com/coder/coder/codersdk" - "github.com/coder/coder/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/coderd/userpassword" + "github.com/coder/coder/codersdk" + "github.com/coder/coder/cryptorand" ) // Returns whether the initial user has been created or not. diff --git a/coderd/users_test.go b/coderd/users_test.go index 53357645290ea..116fb1d4a2f3a 100644 --- a/coderd/users_test.go +++ b/coderd/users_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/coderd/coderdtest" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/codersdk" ) func TestFirstUser(t *testing.T) { diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 0888188ecd680..489cb1d7a0761 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -7,10 +7,10 @@ import ( "github.com/go-chi/render" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/codersdk" ) func (api *api) workspaceBuild(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/workspaceresourceauth.go b/coderd/workspaceresourceauth.go index 93005da96f6d0..14a8742f796d2 100644 --- a/coderd/workspaceresourceauth.go +++ b/coderd/workspaceresourceauth.go @@ -9,9 +9,9 @@ import ( "github.com/go-chi/render" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/codersdk" "github.com/mitchellh/mapstructure" ) diff --git a/coderd/workspaceresources.go b/coderd/workspaceresources.go index 4f3af44aeeb0d..7126982169ef9 100644 --- a/coderd/workspaceresources.go +++ b/coderd/workspaceresources.go @@ -15,10 +15,10 @@ import ( "cdr.dev/slog" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/codersdk" "github.com/coder/coder/peerbroker" "github.com/coder/coder/peerbroker/proto" "github.com/coder/coder/provisionersdk" diff --git a/coderd/workspaces.go b/coderd/workspaces.go index 35779d506e0a3..19fd48187c628 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -13,10 +13,10 @@ import ( "github.com/moby/moby/pkg/namesgenerator" "golang.org/x/xerrors" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/httpmw" + "github.com/coder/coder/codersdk" ) func (api *api) workspace(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/workspaces_test.go b/coderd/workspaces_test.go index 84c63957bacbb..84de75af91dda 100644 --- a/coderd/workspaces_test.go +++ b/coderd/workspaces_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" "github.com/coder/coder/coderd/coderdtest" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionersdk/proto" ) diff --git a/codersdk/projectversions.go b/codersdk/projectversions.go index 07771b591a44e..f5417789b3dcd 100644 --- a/codersdk/projectversions.go +++ b/codersdk/projectversions.go @@ -9,8 +9,8 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/parameter" ) // ProjectVersion represents a single version of a project. From ebae07587ee951e3b3c9a176904b5ebb9e7cc758 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 15:08:34 -0500 Subject: [PATCH 05/10] go fmt --- coderd/coderdtest/coderdtest.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coderd/coderdtest/coderdtest.go b/coderd/coderdtest/coderdtest.go index d58ed620f9add..396cd0df4bd03 100644 --- a/coderd/coderdtest/coderdtest.go +++ b/coderd/coderdtest/coderdtest.go @@ -31,11 +31,11 @@ import ( "cdr.dev/slog" "cdr.dev/slog/sloggers/slogtest" "github.com/coder/coder/coderd" - "github.com/coder/coder/codersdk" "github.com/coder/coder/coderd/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/database/postgres" + "github.com/coder/coder/codersdk" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" From bb06734717709aad2f023869c724338fafaf6295 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 15:11:26 -0500 Subject: [PATCH 06/10] Adjust import mistakes from merge --- cli/ssh.go | 2 +- coderd/coderdtest/coderdtest.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/ssh.go b/cli/ssh.go index 358644bac9342..ab9fa14847e77 100644 --- a/cli/ssh.go +++ b/cli/ssh.go @@ -8,8 +8,8 @@ import ( "golang.org/x/term" "golang.org/x/xerrors" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func workspaceSSH() *cobra.Command { diff --git a/coderd/coderdtest/coderdtest.go b/coderd/coderdtest/coderdtest.go index 396cd0df4bd03..72a2af177d468 100644 --- a/coderd/coderdtest/coderdtest.go +++ b/coderd/coderdtest/coderdtest.go @@ -31,11 +31,11 @@ import ( "cdr.dev/slog" "cdr.dev/slog/sloggers/slogtest" "github.com/coder/coder/coderd" - "github.com/coder/coder/coderd/cryptorand" "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/database/postgres" "github.com/coder/coder/codersdk" + "github.com/coder/coder/cryptorand" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" From 319e40dba304b141c80331f971124fab7d72c9cc Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 15:18:20 -0500 Subject: [PATCH 07/10] Update database path in Makefile --- Makefile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 4fb7dd9d3f41d..103c5b9270d6f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ INSTALL_DIR=$(shell go env GOPATH)/bin GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) +DATABASE_DIR=coderd/database bin: goreleaser build --snapshot --rm-dist @@ -10,14 +11,14 @@ build: site/out bin .PHONY: build # Runs migrations to output a dump of the database. -database/dump.sql: $(wildcard database/migrations/*.sql) - go run database/dump/main.go +$(DATABASE_DIR)/dump.sql: $(wildcard database/migrations/*.sql) + go run $(DATABASE_DIR)/dump/main.go # Generates Go code for querying the database. -database/generate: fmt/sql database/dump.sql database/query.sql - cd database && sqlc generate && rm db_tmp.go - cd database && gofmt -w -r 'Querier -> querier' *.go - cd database && gofmt -w -r 'Queries -> sqlQuerier' *.go +database/generate: fmt/sql $(DATABASE_DIR)/dump.sql $(DATABASE_DIR)/query.sql + cd $(DATABASE_DIR) && sqlc generate && rm db_tmp.go + cd $(DATABASE_DIR) && gofmt -w -r 'Querier -> querier' *.go + cd $(DATABASE_DIR) && gofmt -w -r 'Queries -> sqlQuerier' *.go .PHONY: database/generate fmt/prettier: @@ -30,13 +31,13 @@ else endif .PHONY: fmt/prettier -fmt/sql: ./database/query.sql +fmt/sql: ./$(DATABASE_DIR)/query.sql npx sql-formatter \ --language postgresql \ --lines-between-queries 2 \ - ./database/query.sql \ - --output ./database/query.sql - sed -i 's/@ /@/g' ./database/query.sql + ./$(DATABASE_DIR)/query.sql \ + --output ./$(DATABASE_DIR)/query.sql + sed -i 's/@ /@/g' ./$(DATABASE_DIR)/query.sql fmt: fmt/prettier fmt/sql .PHONY: fmt From 5d02d1ede4a47ef25747deda31ad63e16805eda9 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 15:20:10 -0500 Subject: [PATCH 08/10] Update database path in codecov & gitattributes --- .gitattributes | 2 +- codecov.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitattributes b/.gitattributes index 5e229322394d3..13cf2256a019d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Generated files -database/dump.sql linguist-generated=true +coderd/database/dump.sql linguist-generated=true peerbroker/proto/*.go linguist-generated=true provisionerd/proto/*.go linguist-generated=true provisionersdk/proto/*.go linguist-generated=true diff --git a/codecov.yml b/codecov.yml index dcc14725254c5..db1a9afa06cf0 100644 --- a/codecov.yml +++ b/codecov.yml @@ -24,14 +24,14 @@ coverage: ignore: # This is generated code. - - database/models.go - - database/query.sql.go - - database/databasefake + - coderd/database/models.go + - coderd/database/query.sql.go + - coderd/database/databasefake # These are generated or don't require tests. - cmd - coderd/tunnel - - database/dump - - database/postgres + - coderd/database/dump + - coderd/database/postgres - peerbroker/proto - provisionerd/proto - provisionersdk/proto From b63f0842a7e7a17663f9635145c942ba94a8255c Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 15:23:48 -0500 Subject: [PATCH 09/10] Hardcode database path --- Makefile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 103c5b9270d6f..1975123aaa0a9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ INSTALL_DIR=$(shell go env GOPATH)/bin GOOS=$(shell go env GOOS) GOARCH=$(shell go env GOARCH) -DATABASE_DIR=coderd/database bin: goreleaser build --snapshot --rm-dist @@ -11,14 +10,14 @@ build: site/out bin .PHONY: build # Runs migrations to output a dump of the database. -$(DATABASE_DIR)/dump.sql: $(wildcard database/migrations/*.sql) - go run $(DATABASE_DIR)/dump/main.go +coderd/database/dump.sql: $(wildcard coderd/database/migrations/*.sql) + go run coderd/database/dump/main.go # Generates Go code for querying the database. -database/generate: fmt/sql $(DATABASE_DIR)/dump.sql $(DATABASE_DIR)/query.sql - cd $(DATABASE_DIR) && sqlc generate && rm db_tmp.go - cd $(DATABASE_DIR) && gofmt -w -r 'Querier -> querier' *.go - cd $(DATABASE_DIR) && gofmt -w -r 'Queries -> sqlQuerier' *.go +database/generate: fmt/sql coderd/database/dump.sql coderd/database/query.sql + cd coderd/database && sqlc generate && rm db_tmp.go + cd coderd/database && gofmt -w -r 'Querier -> querier' *.go + cd coderd/database && gofmt -w -r 'Queries -> sqlQuerier' *.go .PHONY: database/generate fmt/prettier: @@ -31,13 +30,13 @@ else endif .PHONY: fmt/prettier -fmt/sql: ./$(DATABASE_DIR)/query.sql +fmt/sql: ./coderd/database/query.sql npx sql-formatter \ --language postgresql \ --lines-between-queries 2 \ - ./$(DATABASE_DIR)/query.sql \ - --output ./$(DATABASE_DIR)/query.sql - sed -i 's/@ /@/g' ./$(DATABASE_DIR)/query.sql + ./coderd/database/query.sql \ + --output ./coderd/database/query.sql + sed -i 's/@ /@/g' ./coderd/database/query.sql fmt: fmt/prettier fmt/sql .PHONY: fmt From 457b21aa19706f40da7274e3eb22a922ece3e85f Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 15:57:15 -0500 Subject: [PATCH 10/10] Change Makefile database/generate to correct path --- Makefile | 6 +++--- coderd/database/db.go | 4 ++-- coderd/database/dump.sql | 2 +- coderd/database/dump/main.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1975123aaa0a9..1feec7565321c 100644 --- a/Makefile +++ b/Makefile @@ -14,11 +14,11 @@ coderd/database/dump.sql: $(wildcard coderd/database/migrations/*.sql) go run coderd/database/dump/main.go # Generates Go code for querying the database. -database/generate: fmt/sql coderd/database/dump.sql coderd/database/query.sql +coderd/database/generate: fmt/sql coderd/database/dump.sql coderd/database/query.sql cd coderd/database && sqlc generate && rm db_tmp.go cd coderd/database && gofmt -w -r 'Querier -> querier' *.go cd coderd/database && gofmt -w -r 'Queries -> sqlQuerier' *.go -.PHONY: database/generate +.PHONY: coderd/database/generate fmt/prettier: @echo "--- prettier" @@ -41,7 +41,7 @@ fmt/sql: ./coderd/database/query.sql fmt: fmt/prettier fmt/sql .PHONY: fmt -gen: database/generate peerbroker/proto provisionersdk/proto provisionerd/proto +gen: coderd/database/generate peerbroker/proto provisionersdk/proto provisionerd/proto .PHONY: gen install: bin diff --git a/coderd/database/db.go b/coderd/database/db.go index a4399ee953ad8..5236b18d65c82 100644 --- a/coderd/database/db.go +++ b/coderd/database/db.go @@ -4,8 +4,8 @@ // // To modify the database schema: // 1. Add a new migration using "create_migration.sh" in database/migrations/ -// 2. Run "make database/generate" in the root to generate models. -// 3. Add/Edit queries in "query.sql" and run "make database/generate" to create Go code. +// 2. Run "make coderd/database/generate" in the root to generate models. +// 3. Add/Edit queries in "query.sql" and run "make coderd/database/generate" to create Go code. package database import ( diff --git a/coderd/database/dump.sql b/coderd/database/dump.sql index b43f00df80680..dc3d6a7c6e50d 100644 --- a/coderd/database/dump.sql +++ b/coderd/database/dump.sql @@ -1,4 +1,4 @@ --- Code generated by 'make database/generate'. DO NOT EDIT. +-- Code generated by 'make coderd/database/generate'. DO NOT EDIT. CREATE TYPE log_level AS ENUM ( 'trace', diff --git a/coderd/database/dump/main.go b/coderd/database/dump/main.go index fd8f87ee282f7..c6a84576353ca 100644 --- a/coderd/database/dump/main.go +++ b/coderd/database/dump/main.go @@ -76,7 +76,7 @@ func main() { } } - dump := fmt.Sprintf("-- Code generated by 'make database/generate'. DO NOT EDIT.\n%s", output.Bytes()) + dump := fmt.Sprintf("-- Code generated by 'make coderd/database/generate'. DO NOT EDIT.\n%s", output.Bytes()) _, mainPath, _, ok := runtime.Caller(0) if !ok { panic("couldn't get caller path")