From 591523a07882c13e7a68b28d03ca89a15fc63fcf Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Fri, 25 Mar 2022 16:07:45 -0500 Subject: [PATCH] chore: Move httpapi, httpmw, & database into `coderd` (#568) * chore: Move httpmw to /coderd directory httpmw is specific to coderd and should be scoped under coderd * chore: Move httpapi to /coderd directory httpapi is specific to coderd and should be scoped under coderd * chore: Move database to /coderd directory database is specific to coderd and should be scoped under coderd * chore: Update codecov & gitattributes for generated files * chore: Update Makefile --- .gitattributes | 2 +- Makefile | 24 +++++++++---------- 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/ssh.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 ++-- codecov.yml | 10 ++++---- coderd/coderd.go | 6 ++--- coderd/coderdtest/coderdtest.go | 6 ++--- .../database}/databasefake/databasefake.go | 2 +- {database => coderd/database}/db.go | 4 ++-- {database => coderd/database}/dump.sql | 2 +- {database => coderd/database}/dump/main.go | 6 ++--- {database => coderd/database}/migrate.go | 0 {database => coderd/database}/migrate_test.go | 4 ++-- .../database}/migrations/000001_base.down.sql | 0 .../database}/migrations/000001_base.up.sql | 0 .../migrations/000002_projects.down.sql | 0 .../migrations/000002_projects.up.sql | 0 .../migrations/000003_workspaces.down.sql | 0 .../migrations/000003_workspaces.up.sql | 0 .../database}/migrations/000004_jobs.down.sql | 0 .../database}/migrations/000004_jobs.up.sql | 0 .../database}/migrations/create_migration.sh | 0 {database => coderd/database}/models.go | 0 .../database}/postgres/postgres.go | 0 .../database}/postgres/postgres_test.go | 2 +- {database => coderd/database}/pubsub.go | 0 .../database}/pubsub_memory.go | 0 .../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 | 6 ++--- {httpapi => coderd/httpapi}/httpapi.go | 0 {httpapi => coderd/httpapi}/httpapi_test.go | 2 +- {httpmw => coderd/httpmw}/apikey.go | 4 ++-- {httpmw => coderd/httpmw}/apikey_test.go | 8 +++---- {httpmw => coderd/httpmw}/httpmw.go | 2 +- .../httpmw}/organizationparam.go | 4 ++-- .../httpmw}/organizationparam_test.go | 6 ++--- {httpmw => coderd/httpmw}/projectparam.go | 4 ++-- .../httpmw}/projectparam_test.go | 6 ++--- .../httpmw}/projectversionparam.go | 4 ++-- .../httpmw}/projectversionparam_test.go | 6 ++--- {httpmw => coderd/httpmw}/userparam.go | 4 ++-- {httpmw => coderd/httpmw}/userparam_test.go | 6 ++--- {httpmw => coderd/httpmw}/workspaceagent.go | 4 ++-- .../httpmw}/workspaceagent_test.go | 6 ++--- .../httpmw}/workspacebuildparam.go | 4 ++-- .../httpmw}/workspacebuildparam_test.go | 6 ++--- {httpmw => coderd/httpmw}/workspaceparam.go | 4 ++-- .../httpmw}/workspaceparam_test.go | 6 ++--- .../httpmw}/workspaceresourceparam.go | 4 ++-- .../httpmw}/workspaceresourceparam_test.go | 6 ++--- coderd/organizations.go | 6 ++--- coderd/organizations_test.go | 2 +- coderd/parameter/compute.go | 2 +- coderd/parameter/compute_test.go | 4 ++-- coderd/parameters.go | 4 ++-- coderd/parameters_test.go | 2 +- coderd/projects.go | 6 ++--- coderd/projectversions.go | 6 ++--- coderd/provisionerdaemons.go | 4 ++-- coderd/provisionerjobs.go | 4 ++-- coderd/provisionerjobs_test.go | 2 +- coderd/users.go | 6 ++--- coderd/users_test.go | 2 +- coderd/workspacebuilds.go | 6 ++--- coderd/workspaceresourceauth.go | 4 ++-- coderd/workspaceresources.go | 6 ++--- coderd/workspaces.go | 6 ++--- coderd/workspaces_test.go | 2 +- codersdk/client.go | 4 ++-- 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 | 4 ++-- codersdk/workspaces.go | 2 +- peerbroker/proxy.go | 2 +- peerbroker/proxy_test.go | 2 +- 98 files changed, 155 insertions(+), 155 deletions(-) rename {database => coderd/database}/databasefake/databasefake.go (99%) rename {database => coderd/database}/db.go (91%) rename {database => coderd/database}/dump.sql (99%) rename {database => coderd/database}/dump/main.go (88%) 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%) rename {httpapi => coderd/httpapi}/httpapi.go (100%) rename {httpapi => coderd/httpapi}/httpapi_test.go (98%) rename {httpmw => coderd/httpmw}/apikey.go (98%) rename {httpmw => coderd/httpmw}/apikey_test.go (98%) rename {httpmw => coderd/httpmw}/httpmw.go (94%) rename {httpmw => coderd/httpmw}/organizationparam.go (97%) rename {httpmw => coderd/httpmw}/organizationparam_test.go (96%) rename {httpmw => coderd/httpmw}/projectparam.go (94%) rename {httpmw => coderd/httpmw}/projectparam_test.go (96%) rename {httpmw => coderd/httpmw}/projectversionparam.go (95%) rename {httpmw => coderd/httpmw}/projectversionparam_test.go (96%) rename {httpmw => coderd/httpmw}/userparam.go (94%) rename {httpmw => coderd/httpmw}/userparam_test.go (95%) rename {httpmw => coderd/httpmw}/workspaceagent.go (95%) rename {httpmw => coderd/httpmw}/workspaceagent_test.go (91%) rename {httpmw => coderd/httpmw}/workspacebuildparam.go (95%) rename {httpmw => coderd/httpmw}/workspacebuildparam_test.go (96%) rename {httpmw => coderd/httpmw}/workspaceparam.go (95%) rename {httpmw => coderd/httpmw}/workspaceparam_test.go (96%) rename {httpmw => coderd/httpmw}/workspaceresourceparam.go (96%) rename {httpmw => coderd/httpmw}/workspaceresourceparam_test.go (95%) 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/Makefile b/Makefile index 4fb7dd9d3f41d..1feec7565321c 100644 --- a/Makefile +++ b/Makefile @@ -10,15 +10,15 @@ 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 +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/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 -.PHONY: database/generate +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: coderd/database/generate fmt/prettier: @echo "--- prettier" @@ -30,18 +30,18 @@ else endif .PHONY: fmt/prettier -fmt/sql: ./database/query.sql +fmt/sql: ./coderd/database/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 + ./coderd/database/query.sql \ + --output ./coderd/database/query.sql + sed -i 's/@ /@/g' ./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/cli/cliui/job.go b/cli/cliui/job.go index ed8d04f1c9a64..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) type JobOptions struct { diff --git a/cli/parametercreate.go b/cli/parametercreate.go index f98445aef64ac..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func parameterCreate() *cobra.Command { diff --git a/cli/projectcreate.go b/cli/projectcreate.go index 46191cf768f2a..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/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..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func projects() *cobra.Command { diff --git a/cli/projectupdate.go b/cli/projectupdate.go index 239dd381d4e7a..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" "github.com/coder/coder/provisionersdk" ) 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/cli/start.go b/cli/start.go index bdae6aa0f9ace..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/database" + "github.com/coder/coder/coderd/database/databasefake" "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/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..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/coderd/database/postgres" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database/postgres" ) func TestStart(t *testing.T) { diff --git a/cli/workspacecreate.go b/cli/workspacecreate.go index fac1f35825fb7..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func workspaceCreate() *cobra.Command { diff --git a/cli/workspacedelete.go b/cli/workspacedelete.go index 63b3e18f749c4..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func workspaceDelete() *cobra.Command { diff --git a/cli/workspacestart.go b/cli/workspacestart.go index eeed3d81476b0..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func workspaceStart() *cobra.Command { diff --git a/cli/workspacestop.go b/cli/workspacestop.go index b665bb15b972d..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func workspaceStop() *cobra.Command { diff --git a/cmd/cliui/main.go b/cmd/cliui/main.go index af4e522e360b8..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" ) func main() { diff --git a/cmd/templater/main.go b/cmd/templater/main.go index dd587a25c8671..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/database" + "github.com/coder/coder/coderd/database/databasefake" "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/provisioner/terraform" "github.com/coder/coder/provisionerd" "github.com/coder/coder/provisionersdk" 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 diff --git a/coderd/coderd.go b/coderd/coderd.go index 090dc995791fc..e1137c6dd467e 100644 --- a/coderd/coderd.go +++ b/coderd/coderd.go @@ -10,9 +10,9 @@ import ( "google.golang.org/api/idtoken" "cdr.dev/slog" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" + "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 ccce26571c1f9..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/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/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/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 91% rename from database/db.go rename to coderd/database/db.go index a4399ee953ad8..5236b18d65c82 100644 --- a/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/database/dump.sql b/coderd/database/dump.sql similarity index 99% rename from database/dump.sql rename to coderd/database/dump.sql index b43f00df80680..dc3d6a7c6e50d 100644 --- a/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/database/dump/main.go b/coderd/database/dump/main.go similarity index 88% rename from database/dump/main.go rename to coderd/database/dump/main.go index a9e3098ccd62f..c6a84576353ca 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() { @@ -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") 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 ca176322ae6fb..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/coderd/database" + "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" ) func (api *api) postFile(rw http.ResponseWriter, r *http.Request) { 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/httpmw/apikey.go b/coderd/httpmw/apikey.go similarity index 98% rename from httpmw/apikey.go rename to coderd/httpmw/apikey.go index 45a93c2f91584..1b18bc56bcde6 100644 --- a/httpmw/apikey.go +++ b/coderd/httpmw/apikey.go @@ -13,8 +13,8 @@ import ( "golang.org/x/oauth2" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) // AuthCookie represents the name of the cookie the API key is stored in. diff --git a/httpmw/apikey_test.go b/coderd/httpmw/apikey_test.go similarity index 98% rename from httpmw/apikey_test.go rename to coderd/httpmw/apikey_test.go index 309c3917de604..2d4e7c3a6be67 100644 --- a/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/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" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" ) func randomAPIKeyParts() (id string, secret string) { diff --git a/httpmw/httpmw.go b/coderd/httpmw/httpmw.go similarity index 94% rename from httpmw/httpmw.go rename to coderd/httpmw/httpmw.go index 655cfbd716027..0c215edab8b9a 100644 --- a/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/httpmw/organizationparam.go b/coderd/httpmw/organizationparam.go similarity index 97% rename from httpmw/organizationparam.go rename to coderd/httpmw/organizationparam.go index 6937e060a144b..b59855f86442b 100644 --- a/httpmw/organizationparam.go +++ b/coderd/httpmw/organizationparam.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type organizationParamContextKey struct{} diff --git a/httpmw/organizationparam_test.go b/coderd/httpmw/organizationparam_test.go similarity index 96% rename from httpmw/organizationparam_test.go rename to coderd/httpmw/organizationparam_test.go index b957950f45075..c21ddb4df5135 100644 --- a/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/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" ) func TestOrganizationParam(t *testing.T) { diff --git a/httpmw/projectparam.go b/coderd/httpmw/projectparam.go similarity index 94% rename from httpmw/projectparam.go rename to coderd/httpmw/projectparam.go index 15d258b5df5ad..9239dfb996475 100644 --- a/httpmw/projectparam.go +++ b/coderd/httpmw/projectparam.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type projectParamContextKey struct{} diff --git a/httpmw/projectparam_test.go b/coderd/httpmw/projectparam_test.go similarity index 96% rename from httpmw/projectparam_test.go rename to coderd/httpmw/projectparam_test.go index c8ea119a25125..7e84d462116e0 100644 --- a/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/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" ) func TestProjectParam(t *testing.T) { diff --git a/httpmw/projectversionparam.go b/coderd/httpmw/projectversionparam.go similarity index 95% rename from httpmw/projectversionparam.go rename to coderd/httpmw/projectversionparam.go index c506a05107dcb..e2c00d37ac51e 100644 --- a/httpmw/projectversionparam.go +++ b/coderd/httpmw/projectversionparam.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type projectVersionParamContextKey struct{} diff --git a/httpmw/projectversionparam_test.go b/coderd/httpmw/projectversionparam_test.go similarity index 96% rename from httpmw/projectversionparam_test.go rename to coderd/httpmw/projectversionparam_test.go index 2e9e47e2e8798..bf6c683c6a71d 100644 --- a/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/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" ) func TestProjectVersionParam(t *testing.T) { diff --git a/httpmw/userparam.go b/coderd/httpmw/userparam.go similarity index 94% rename from httpmw/userparam.go rename to coderd/httpmw/userparam.go index 0ce3f67144ebc..22fd223f3e31b 100644 --- a/httpmw/userparam.go +++ b/coderd/httpmw/userparam.go @@ -7,8 +7,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type userParamContextKey struct{} diff --git a/httpmw/userparam_test.go b/coderd/httpmw/userparam_test.go similarity index 95% rename from httpmw/userparam_test.go rename to coderd/httpmw/userparam_test.go index 4a83084d01fde..99fd0f0407694 100644 --- a/httpmw/userparam_test.go +++ b/coderd/httpmw/userparam_test.go @@ -12,9 +12,9 @@ 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/httpmw" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" ) func TestUserParam(t *testing.T) { diff --git a/httpmw/workspaceagent.go b/coderd/httpmw/workspaceagent.go similarity index 95% rename from httpmw/workspaceagent.go rename to coderd/httpmw/workspaceagent.go index 13fbf556b026e..f90d8ff79f9a4 100644 --- a/httpmw/workspaceagent.go +++ b/coderd/httpmw/workspaceagent.go @@ -9,8 +9,8 @@ import ( "github.com/google/uuid" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type workspaceAgentContextKey struct{} diff --git a/httpmw/workspaceagent_test.go b/coderd/httpmw/workspaceagent_test.go similarity index 91% rename from httpmw/workspaceagent_test.go rename to coderd/httpmw/workspaceagent_test.go index fc14db017a1be..650e68436b836 100644 --- a/httpmw/workspaceagent_test.go +++ b/coderd/httpmw/workspaceagent_test.go @@ -10,9 +10,9 @@ 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/httpmw" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" ) func TestWorkspaceAgent(t *testing.T) { diff --git a/httpmw/workspacebuildparam.go b/coderd/httpmw/workspacebuildparam.go similarity index 95% rename from httpmw/workspacebuildparam.go rename to coderd/httpmw/workspacebuildparam.go index 29e88d8f20654..62d4a00efdf09 100644 --- a/httpmw/workspacebuildparam.go +++ b/coderd/httpmw/workspacebuildparam.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type workspaceBuildParamContextKey struct{} diff --git a/httpmw/workspacebuildparam_test.go b/coderd/httpmw/workspacebuildparam_test.go similarity index 96% rename from httpmw/workspacebuildparam_test.go rename to coderd/httpmw/workspacebuildparam_test.go index 7ef913770abc4..d4a7ae1e59eb4 100644 --- a/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/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" ) func TestWorkspaceBuildParam(t *testing.T) { diff --git a/httpmw/workspaceparam.go b/coderd/httpmw/workspaceparam.go similarity index 95% rename from httpmw/workspaceparam.go rename to coderd/httpmw/workspaceparam.go index e37589aa32a1f..3e12dc7a5804c 100644 --- a/httpmw/workspaceparam.go +++ b/coderd/httpmw/workspaceparam.go @@ -7,8 +7,8 @@ import ( "fmt" "net/http" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type workspaceParamContextKey struct{} diff --git a/httpmw/workspaceparam_test.go b/coderd/httpmw/workspaceparam_test.go similarity index 96% rename from httpmw/workspaceparam_test.go rename to coderd/httpmw/workspaceparam_test.go index e68cc80920947..3c528ae44e56a 100644 --- a/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/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" - "github.com/coder/coder/httpmw" ) func TestWorkspaceParam(t *testing.T) { diff --git a/httpmw/workspaceresourceparam.go b/coderd/httpmw/workspaceresourceparam.go similarity index 96% rename from httpmw/workspaceresourceparam.go rename to coderd/httpmw/workspaceresourceparam.go index a02d556866315..1ac1d3904ae53 100644 --- a/httpmw/workspaceresourceparam.go +++ b/coderd/httpmw/workspaceresourceparam.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" ) type workspaceResourceParamContextKey struct{} diff --git a/httpmw/workspaceresourceparam_test.go b/coderd/httpmw/workspaceresourceparam_test.go similarity index 95% rename from httpmw/workspaceresourceparam_test.go rename to coderd/httpmw/workspaceresourceparam_test.go index 8ac404f84b9f3..1c0000b434052 100644 --- a/httpmw/workspaceresourceparam_test.go +++ b/coderd/httpmw/workspaceresourceparam_test.go @@ -10,9 +10,9 @@ 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/httpmw" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/database/databasefake" + "github.com/coder/coder/coderd/httpmw" ) func TestWorkspaceResourceParam(t *testing.T) { diff --git a/coderd/organizations.go b/coderd/organizations.go index 1bca4d2839173..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/coderd/database" + "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" ) func (*api) organization(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/organizations_test.go b/coderd/organizations_test.go index 5633717306b23..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/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..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/database" + "github.com/coder/coder/coderd/database/databasefake" "github.com/coder/coder/coderd/parameter" "github.com/coder/coder/cryptorand" - "github.com/coder/coder/database" - "github.com/coder/coder/database/databasefake" ) func TestCompute(t *testing.T) { diff --git a/coderd/parameters.go b/coderd/parameters.go index 3330d5db14617..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/coderd/database" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" ) func (api *api) postParameter(rw http.ResponseWriter, r *http.Request) { 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 8884e6bfba2d5..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/coderd/database" + "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" ) // Returns a single project. diff --git a/coderd/projectversions.go b/coderd/projectversions.go index 8886424975fac..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/database" + "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/coderd/httpmw" "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/httpmw" ) func (api *api) projectVersion(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/provisionerdaemons.go b/coderd/provisionerdaemons.go index b34f235d36390..ce203c283b89e 100644 --- a/coderd/provisionerdaemons.go +++ b/coderd/provisionerdaemons.go @@ -23,9 +23,9 @@ import ( "cdr.dev/slog" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/coderd/parameter" - "github.com/coder/coder/database" - "github.com/coder/coder/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..7e5682e65b67a 100644 --- a/coderd/provisionerjobs.go +++ b/coderd/provisionerjobs.go @@ -15,9 +15,9 @@ import ( "cdr.dev/slog" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" ) // Returns provisioner logs based on query parameters. 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 13060f9998aeb..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/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" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/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..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/coderd/httpmw" "github.com/coder/coder/codersdk" - "github.com/coder/coder/httpmw" ) func TestFirstUser(t *testing.T) { diff --git a/coderd/workspacebuilds.go b/coderd/workspacebuilds.go index 45bf221e560f9..489cb1d7a0761 100644 --- a/coderd/workspacebuilds.go +++ b/coderd/workspacebuilds.go @@ -7,10 +7,10 @@ import ( "github.com/go-chi/render" + "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/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" ) func (api *api) workspaceBuild(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/workspaceresourceauth.go b/coderd/workspaceresourceauth.go index 5165079f140b6..14a8742f796d2 100644 --- a/coderd/workspaceresourceauth.go +++ b/coderd/workspaceresourceauth.go @@ -9,9 +9,9 @@ import ( "github.com/go-chi/render" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpapi" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" "github.com/mitchellh/mapstructure" ) diff --git a/coderd/workspaceresources.go b/coderd/workspaceresources.go index 1a2c7321bb83d..7126982169ef9 100644 --- a/coderd/workspaceresources.go +++ b/coderd/workspaceresources.go @@ -15,10 +15,10 @@ import ( "cdr.dev/slog" + "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/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/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..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/coderd/database" + "github.com/coder/coder/coderd/httpapi" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/httpmw" ) func (api *api) workspace(rw http.ResponseWriter, r *http.Request) { diff --git a/coderd/workspaces_test.go b/coderd/workspaces_test.go index 7bcc003cca5ff..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/coderd/database" "github.com/coder/coder/codersdk" - "github.com/coder/coder/database" "github.com/coder/coder/provisioner/echo" "github.com/coder/coder/provisionersdk/proto" ) diff --git a/codersdk/client.go b/codersdk/client.go index 61d9e20512e3e..d98f2ff3c1592 100644 --- a/codersdk/client.go +++ b/codersdk/client.go @@ -13,8 +13,8 @@ import ( "golang.org/x/xerrors" - "github.com/coder/coder/httpapi" - "github.com/coder/coder/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..f5417789b3dcd 100644 --- a/codersdk/projectversions.go +++ b/codersdk/projectversions.go @@ -9,8 +9,8 @@ import ( "github.com/google/uuid" + "github.com/coder/coder/coderd/database" "github.com/coder/coder/coderd/parameter" - "github.com/coder/coder/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 bfbbda4e34524..07bffb92932db 100644 --- a/codersdk/workspaceresources.go +++ b/codersdk/workspaceresources.go @@ -16,8 +16,8 @@ import ( "nhooyr.io/websocket" "github.com/coder/coder/agent" - "github.com/coder/coder/database" - "github.com/coder/coder/httpmw" + "github.com/coder/coder/coderd/database" + "github.com/coder/coder/coderd/httpmw" "github.com/coder/coder/peer" "github.com/coder/coder/peerbroker" "github.com/coder/coder/peerbroker/proto" 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"