Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: introduce api dependency gate to prevent unintended package dependency (#1517)

tianzhoufd821da57295
diff --git a/api/api_dependency_gate.go b/api/api_dependency_gate.go
new file mode 100644
index 0000000000..85446d94ef
--- /dev/null
+++ b/api/api_dependency_gate.go
@@ -0,0 +1,18 @@
+//go:build !release
+// +build !release
+
+// The idea of dependency gate is to use compiler check to prevent introducing unintended dependency.
+// In particular:
+// 1. the plugin package should NOT depend on the api package as the plugin package should be self-contained.
+package api
+
+import (
+ // TODO(rebelice): fix the incorrect dependency and uncomment these
+ // _ "github.com/bytebase/bytebase/plugin/advisor"
+ // _ "github.com/bytebase/bytebase/plugin/catalog"
+ // _ "github.com/bytebase/bytebase/plugin/restore/mysql"
+ _ "github.com/bytebase/bytebase/plugin/db"
+ _ "github.com/bytebase/bytebase/plugin/metric"
+ _ "github.com/bytebase/bytebase/plugin/vcs"
+ _ "github.com/bytebase/bytebase/plugin/webhook"
+)