refactor(layout): relocate go.mod to backend/ and clean import paths to module root

- Relocated go.mod and go.sum into backend/ root directory
- Stripped redundant backend/ segments from all Go imports (github.com/Rain-kl/Wavelet/...)
- Unified Makefile, swagger, and build-test to execute in backend/ module context
- Ensured 100% build-test, code-check, format, and swagger pass
This commit is contained in:
ryan
2026-08-28 13:01:51 +08:00
parent 43dc97e48c
commit f2ab94501c
185 changed files with 557 additions and 557 deletions
@@ -8,9 +8,9 @@ import (
"sync"
"time"
"github.com/Rain-kl/Wavelet/backend/pkg/batchwriter"
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control/logstore"
"github.com/Rain-kl/Wavelet/pkg/batchwriter"
"github.com/Rain-kl/Wavelet/pkg/logger"
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control/logstore"
)
var (
@@ -9,8 +9,8 @@ import (
"fmt"
"time"
"github.com/Rain-kl/Wavelet/backend/pkg/util"
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
"github.com/Rain-kl/Wavelet/pkg/util"
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
"gorm.io/gorm"
)
@@ -9,7 +9,7 @@ import (
"sort"
"time"
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
)
const hoursInDay = 24
@@ -17,7 +17,7 @@ import (
"github.com/stretchr/testify/require"
"gorm.io/gorm"
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
)
func setupChGormDB(t *testing.T) *gorm.DB {
@@ -7,7 +7,7 @@ import (
"context"
"fmt"
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
)
// BatchInsert writes access logs to ClickHouse using the native batch API.
@@ -10,7 +10,7 @@ import (
"strconv"
"time"
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
"github.com/Rain-kl/Wavelet/pkg/logger"
)
const (
@@ -9,7 +9,7 @@ import (
"time"
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
)
type clickhouseUserAccessLogStore struct {
@@ -11,7 +11,7 @@ import (
"strings"
"time"
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
"github.com/Rain-kl/Wavelet/pkg/idgen"
"gorm.io/gorm"
)
@@ -12,12 +12,12 @@ import (
// plugins/domain 不得直接 import 已废弃的 internal。
var forbiddenImports = []string{
"github.com/Rain-kl/Wavelet/internal",
"github.com/Rain-kl/Wavelet/backend/internal",
"github.com/Rain-kl/Wavelet/internal",
}
func TestAppsMustNotImportPersistenceDirectly(t *testing.T) {
t.Chdir("../../../../..")
out, err := exec.Command("go", "list", "-test", "-f", `{{.ImportPath}} {{join .Imports " "}}`, "./backend/plugins/domain/...").Output()
t.Chdir("../../../..")
out, err := exec.Command("go", "list", "-test", "-f", `{{.ImportPath}} {{join .Imports " "}}`, "./plugins/domain/...").Output()
if err != nil {
t.Fatalf("go list: %v", err)
}
@@ -27,7 +27,7 @@ func TestAppsMustNotImportPersistenceDirectly(t *testing.T) {
continue
}
pkg := fields[0]
if !strings.HasPrefix(pkg, "github.com/Rain-kl/Wavelet/backend/plugins/domain") {
if !strings.HasPrefix(pkg, "github.com/Rain-kl/Wavelet/plugins/domain") {
continue
}
for _, imp := range fields[1:] {
@@ -10,9 +10,9 @@ import (
"sync"
"time"
"github.com/Rain-kl/Wavelet/backend/pkg/config"
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
"github.com/Rain-kl/Wavelet/pkg/config"
"github.com/Rain-kl/Wavelet/pkg/logger"
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
)
const (
@@ -9,12 +9,12 @@ import (
"net/http"
"time"
"github.com/Rain-kl/Wavelet/backend/core/contracts"
"github.com/Rain-kl/Wavelet/backend/pkg/config"
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
"github.com/Rain-kl/Wavelet/backend/pkg/response"
"github.com/Rain-kl/Wavelet/backend/pkg/util"
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control/logstore"
"github.com/Rain-kl/Wavelet/core/contracts"
"github.com/Rain-kl/Wavelet/pkg/config"
"github.com/Rain-kl/Wavelet/pkg/idgen"
"github.com/Rain-kl/Wavelet/pkg/response"
"github.com/Rain-kl/Wavelet/pkg/util"
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control/logstore"
"github.com/gin-gonic/gin"
)
@@ -12,13 +12,13 @@ import (
"testing"
"time"
"github.com/Rain-kl/Wavelet/backend/core/contracts"
"github.com/Rain-kl/Wavelet/backend/pkg/batchwriter"
"github.com/Rain-kl/Wavelet/backend/pkg/config"
"github.com/Rain-kl/Wavelet/backend/pkg/testhelper"
"github.com/Rain-kl/Wavelet/backend/pkg/util"
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control"
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control/logstore"
"github.com/Rain-kl/Wavelet/core/contracts"
"github.com/Rain-kl/Wavelet/pkg/batchwriter"
"github.com/Rain-kl/Wavelet/pkg/config"
"github.com/Rain-kl/Wavelet/pkg/testhelper"
"github.com/Rain-kl/Wavelet/pkg/util"
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control"
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control/logstore"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
@@ -8,8 +8,8 @@ import (
"context"
"embed"
"github.com/Rain-kl/Wavelet/backend/core"
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
"github.com/Rain-kl/Wavelet/core"
"github.com/Rain-kl/Wavelet/core/extpoints"
"github.com/gin-gonic/gin"
)
@@ -11,8 +11,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Rain-kl/Wavelet/backend/core"
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control"
"github.com/Rain-kl/Wavelet/core"
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control"
)
func TestRiskControlPluginUnit(t *testing.T) {