use build tagged constraint to check api interface implement

pull/703/head
alimy 7 months ago
parent a82c16ccb4
commit 0a79a062f4
No known key found for this signature in database
GPG Key ID: 6964A0C5FE15145A

@ -9,8 +9,6 @@ import (
"github.com/allegro/bigcache/v3" "github.com/allegro/bigcache/v3"
) )
var _ tweetsCache = (*bigCacheTweetsCache)(nil)
type bigCacheTweetsCache struct { type bigCacheTweetsCache struct {
bc *bigcache.BigCache bc *bigcache.BigCache
} }

@ -0,0 +1,20 @@
//go:build constraint
package cache
import (
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ tweetsCache = (*bigCacheTweetsCache)(nil)
_ core.RedisCache = (*redisCache)(nil)
_ tweetsCache = (*redisCacheTweetsCache)(nil)
_ core.CacheIndexService = (*noneCacheIndexServant)(nil)
_ core.VersionInfo = (*noneCacheIndexServant)(nil)
_ core.CacheIndexService = (*simpleCacheIndexServant)(nil)
_ core.VersionInfo = (*simpleCacheIndexServant)(nil)
)

@ -12,11 +12,6 @@ import (
"github.com/rocboss/paopao-ce/pkg/debug" "github.com/rocboss/paopao-ce/pkg/debug"
) )
var (
_ core.CacheIndexService = (*noneCacheIndexServant)(nil)
_ core.VersionInfo = (*noneCacheIndexServant)(nil)
)
type noneCacheIndexServant struct { type noneCacheIndexServant struct {
ips core.IndexPostsService ips core.IndexPostsService
} }

@ -12,12 +12,6 @@ import (
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/redis/rueidis" "github.com/redis/rueidis"
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ core.RedisCache = (*redisCache)(nil)
_ tweetsCache = (*redisCacheTweetsCache)(nil)
) )
const ( const (

@ -16,11 +16,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var (
_ core.CacheIndexService = (*simpleCacheIndexServant)(nil)
_ core.VersionInfo = (*simpleCacheIndexServant)(nil)
)
type simpleCacheIndexServant struct { type simpleCacheIndexServant struct {
ips core.IndexPostsService ips core.IndexPostsService

@ -0,0 +1,13 @@
//go:build constraint
package jinzhu
import "github.com/rocboss/paopao-ce/internal/core"
var (
_ core.DataService = (*dataSrv)(nil)
_ core.VersionInfo = (*dataSrv)(nil)
_ core.WebDataServantA = (*webDataSrvA)(nil)
_ core.VersionInfo = (*webDataSrvA)(nil)
)

@ -18,15 +18,7 @@ import (
"github.com/rocboss/paopao-ce/internal/dao/security" "github.com/rocboss/paopao-ce/internal/dao/security"
) )
var ( var _onceInitial sync.Once
_ core.DataService = (*dataSrv)(nil)
_ core.VersionInfo = (*dataSrv)(nil)
_ core.WebDataServantA = (*webDataSrvA)(nil)
_ core.VersionInfo = (*webDataSrvA)(nil)
_onceInitial sync.Once
)
type dataSrv struct { type dataSrv struct {
core.WalletService core.WalletService

@ -12,8 +12,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ core.TweetSearchService = (*bridgeTweetSearchServant)(nil)
type documents struct { type documents struct {
primaryKey []string primaryKey []string
docItems []core.TsDocItem docItems []core.TsDocItem

@ -0,0 +1,15 @@
//go:build constraint
package search
import "github.com/rocboss/paopao-ce/internal/core"
var (
_ core.TweetSearchService = (*bridgeTweetSearchServant)(nil)
_ core.TweetSearchService = (*meiliTweetSearchServant)(nil)
_ core.VersionInfo = (*meiliTweetSearchServant)(nil)
_ core.TweetSearchService = (*zincTweetSearchServant)(nil)
_ core.VersionInfo = (*zincTweetSearchServant)(nil)
)

@ -16,11 +16,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var (
_ core.TweetSearchService = (*meiliTweetSearchServant)(nil)
_ core.VersionInfo = (*meiliTweetSearchServant)(nil)
)
type meiliTweetSearchServant struct { type meiliTweetSearchServant struct {
tweetSearchFilter tweetSearchFilter

@ -15,11 +15,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var (
_ core.TweetSearchService = (*zincTweetSearchServant)(nil)
_ core.VersionInfo = (*zincTweetSearchServant)(nil)
)
type zincTweetSearchServant struct { type zincTweetSearchServant struct {
tweetSearchFilter tweetSearchFilter

@ -12,8 +12,6 @@ import (
"github.com/rocboss/paopao-ce/internal/core" "github.com/rocboss/paopao-ce/internal/core"
) )
var _ core.AttachmentCheckService = (*attachmentCheckServant)(nil)
type attachmentCheckServant struct { type attachmentCheckServant struct {
domain string domain string
} }

@ -0,0 +1,12 @@
//go:build constraint
package security
import (
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ core.AttachmentCheckService = (*attachmentCheckServant)(nil)
_ core.PhoneVerifyService = (*juheSmsServant)(nil)
)

@ -7,13 +7,10 @@ import (
"github.com/cockroachdb/errors" "github.com/cockroachdb/errors"
"github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/conf"
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/pkg/json" "github.com/rocboss/paopao-ce/pkg/json"
"gopkg.in/resty.v1" "gopkg.in/resty.v1"
) )
var _ core.PhoneVerifyService = (*juheSmsServant)(nil)
type juhePhoneCaptchaRsp struct { type juhePhoneCaptchaRsp struct {
ErrorCode int `json:"error_code"` ErrorCode int `json:"error_code"`
Reason string `json:"reason"` Reason string `json:"reason"`

@ -16,14 +16,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var (
_ core.ObjectStorageService = (*aliossServant)(nil)
_ core.OssCreateService = (*aliossCreateServant)(nil)
_ core.OssCreateService = (*aliossCreateRetentionServant)(nil)
_ core.OssCreateService = (*aliossCreateTempDirServant)(nil)
_ core.VersionInfo = (*aliossServant)(nil)
)
type aliossCreateServant struct { type aliossCreateServant struct {
bucket *oss.Bucket bucket *oss.Bucket
domain string domain string

@ -0,0 +1,37 @@
//go:build constraint
package storage
import (
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ core.ObjectStorageService = (*aliossServant)(nil)
_ core.OssCreateService = (*aliossCreateServant)(nil)
_ core.OssCreateService = (*aliossCreateRetentionServant)(nil)
_ core.OssCreateService = (*aliossCreateTempDirServant)(nil)
_ core.VersionInfo = (*aliossServant)(nil)
_ core.ObjectStorageService = (*cosServant)(nil)
_ core.OssCreateService = (*cosCreateServant)(nil)
_ core.OssCreateService = (*cosCreateTempDirServant)(nil)
_ core.VersionInfo = (*cosServant)(nil)
_ core.ObjectStorageService = (*huaweiobsServant)(nil)
_ core.OssCreateService = (*hwobsCreateServant)(nil)
_ core.OssCreateService = (*hwobsCreateRetentionServant)(nil)
_ core.OssCreateService = (*hwobsCreateTempDirServant)(nil)
_ core.VersionInfo = (*huaweiobsServant)(nil)
_ core.ObjectStorageService = (*localossServant)(nil)
_ core.OssCreateService = (*localossCreateServant)(nil)
_ core.OssCreateService = (*localossCreateTempDirServant)(nil)
_ core.VersionInfo = (*localossServant)(nil)
_ core.ObjectStorageService = (*minioServant)(nil)
_ core.OssCreateService = (*minioCreateServant)(nil)
_ core.OssCreateService = (*minioCreateRetentionServant)(nil)
_ core.OssCreateService = (*minioCreateTempDirServant)(nil)
_ core.VersionInfo = (*minioServant)(nil)
)

@ -19,13 +19,6 @@ import (
"github.com/tencentyun/cos-go-sdk-v5" "github.com/tencentyun/cos-go-sdk-v5"
) )
var (
_ core.ObjectStorageService = (*cosServant)(nil)
_ core.OssCreateService = (*cosCreateServant)(nil)
_ core.OssCreateService = (*cosCreateTempDirServant)(nil)
_ core.VersionInfo = (*cosServant)(nil)
)
type cosCreateServant struct { type cosCreateServant struct {
client *cos.Client client *cos.Client
domain string domain string

@ -15,14 +15,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var (
_ core.ObjectStorageService = (*huaweiobsServant)(nil)
_ core.OssCreateService = (*hwobsCreateServant)(nil)
_ core.OssCreateService = (*hwobsCreateRetentionServant)(nil)
_ core.OssCreateService = (*hwobsCreateTempDirServant)(nil)
_ core.VersionInfo = (*huaweiobsServant)(nil)
)
type hwobsCreateServant struct { type hwobsCreateServant struct {
client *obs.ObsClient client *obs.ObsClient
bucket string bucket string

@ -18,13 +18,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var (
_ core.ObjectStorageService = (*localossServant)(nil)
_ core.OssCreateService = (*localossCreateServant)(nil)
_ core.OssCreateService = (*localossCreateTempDirServant)(nil)
_ core.VersionInfo = (*localossServant)(nil)
)
type localossCreateServant struct { type localossCreateServant struct {
savePath string savePath string
domain string domain string

@ -17,14 +17,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var (
_ core.ObjectStorageService = (*minioServant)(nil)
_ core.OssCreateService = (*minioCreateServant)(nil)
_ core.OssCreateService = (*minioCreateRetentionServant)(nil)
_ core.OssCreateService = (*minioCreateTempDirServant)(nil)
_ core.VersionInfo = (*minioServant)(nil)
)
type minioCreateServant struct { type minioCreateServant struct {
client *minio.Client client *minio.Client
bucket string bucket string

@ -0,0 +1,9 @@
//go:build constraint
package admin
import (
api "github.com/rocboss/paopao-ce/auto/api/m/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/internal/servants/base"
) )
var _ api.User = (*userSrv)(nil)
type userSrv struct { type userSrv struct {
*base.BaseServant *base.BaseServant
api.UnimplementedUserServant api.UnimplementedUserServant

@ -0,0 +1,9 @@
//go:build constraint
package bot
import (
api "github.com/rocboss/paopao-ce/auto/api/r/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/internal/servants/base"
) )
var _ api.User = (*userSrv)(nil)
type userSrv struct { type userSrv struct {
*base.BaseServant *base.BaseServant
api.UnimplementedUserServant api.UnimplementedUserServant

@ -0,0 +1,9 @@
//go:build constraint
package localoss
import (
api "github.com/rocboss/paopao-ce/auto/api/s/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/internal/servants/base"
) )
var _ api.User = (*userSrv)(nil)
type userSrv struct { type userSrv struct {
*base.BaseServant *base.BaseServant
api.UnimplementedUserServant api.UnimplementedUserServant

@ -0,0 +1,9 @@
//go:build constraint
package mobile
import (
api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1"
)
var _ api.GreetServiceServer = (*greetServiceSrv)(nil)

@ -8,8 +8,6 @@ import (
api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1" api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1"
) )
var _ api.GreetServiceServer = (*greetServiceSrv)(nil)
type greetServiceSrv struct { type greetServiceSrv struct {
api.UnimplementedGreetServiceServer api.UnimplementedGreetServiceServer
} }

@ -0,0 +1,9 @@
//go:build constraint
package space
import (
api "github.com/rocboss/paopao-ce/auto/api/x/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base" "github.com/rocboss/paopao-ce/internal/servants/base"
) )
var _ api.User = (*userSrv)(nil)
type userSrv struct { type userSrv struct {
*base.BaseServant *base.BaseServant
api.UnimplementedUserServant api.UnimplementedUserServant

@ -18,8 +18,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ api.Admin = (*adminSrv)(nil)
type adminSrv struct { type adminSrv struct {
api.UnimplementedAdminServant api.UnimplementedAdminServant
*base.DaoServant *base.DaoServant

@ -16,11 +16,6 @@ import (
"github.com/smartwalle/alipay/v3" "github.com/smartwalle/alipay/v3"
) )
var (
_ api.AlipayPub = (*alipayPubSrv)(nil)
_ api.AlipayPriv = (*alipayPrivSrv)(nil)
)
type alipayPubSrv struct { type alipayPubSrv struct {
api.UnimplementedAlipayPubServant api.UnimplementedAlipayPubServant
*base.DaoServant *base.DaoServant

@ -0,0 +1,23 @@
//go:build constraint
package web
import (
api "github.com/rocboss/paopao-ce/auto/api/v1"
)
var (
_ api.Admin = (*adminSrv)(nil)
_ api.AlipayPub = (*alipayPubSrv)(nil)
_ api.AlipayPriv = (*alipayPrivSrv)(nil)
_ api.Core = (*coreSrv)(nil)
_ api.Followship = (*followshipSrv)(nil)
_ api.Friendship = (*friendshipSrv)(nil)
_ api.Loose = (*looseSrv)(nil)
_ api.Pub = (*pubSrv)(nil)
_ api.Relax = (*relaxSrv)(nil)
_ api.Site = (*siteSrv)(nil)
_ api.Trends = (*trendsSrv)(nil)
_ api.Priv = (*privSrv)(nil)
_ api.PrivChain = (*privChain)(nil)
)

@ -29,8 +29,6 @@ var (
_maxCaptchaTimes int = 2 _maxCaptchaTimes int = 2
) )
var _ api.Core = (*coreSrv)(nil)
type coreSrv struct { type coreSrv struct {
api.UnimplementedCoreServant api.UnimplementedCoreServant
*base.DaoServant *base.DaoServant

@ -15,8 +15,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ api.Followship = (*followshipSrv)(nil)
type followshipSrv struct { type followshipSrv struct {
api.UnimplementedFollowshipServant api.UnimplementedFollowshipServant
*base.DaoServant *base.DaoServant

@ -14,8 +14,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ api.Friendship = (*friendshipSrv)(nil)
type friendshipSrv struct { type friendshipSrv struct {
api.UnimplementedFriendshipServant api.UnimplementedFriendshipServant
*base.DaoServant *base.DaoServant

@ -21,8 +21,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ api.Loose = (*looseSrv)(nil)
type looseSrv struct { type looseSrv struct {
api.UnimplementedLooseServant api.UnimplementedLooseServant
*base.DaoServant *base.DaoServant

@ -27,17 +27,12 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var ( var _uploadAttachmentTypeMap = map[string]ms.AttachmentType{
_ api.Priv = (*privSrv)(nil) "public/image": ms.AttachmentTypeImage,
_ api.PrivChain = (*privChain)(nil) "public/avatar": ms.AttachmentTypeImage,
"public/video": ms.AttachmentTypeVideo,
_uploadAttachmentTypeMap = map[string]ms.AttachmentType{ "attachment": ms.AttachmentTypeOther,
"public/image": ms.AttachmentTypeImage, }
"public/avatar": ms.AttachmentTypeImage,
"public/video": ms.AttachmentTypeVideo,
"attachment": ms.AttachmentTypeOther,
}
)
type privSrv struct { type privSrv struct {
api.UnimplementedPrivServant api.UnimplementedPrivServant

@ -27,8 +27,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ api.Pub = (*pubSrv)(nil)
const ( const (
_MaxLoginErrTimes = 10 _MaxLoginErrTimes = 10
_MaxPhoneCaptcha = 10 _MaxPhoneCaptcha = 10

@ -15,8 +15,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ api.Relax = (*relaxSrv)(nil)
type relaxSrv struct { type relaxSrv struct {
api.UnimplementedRelaxServant api.UnimplementedRelaxServant
*base.DaoServant *base.DaoServant

@ -12,8 +12,6 @@ import (
"github.com/rocboss/paopao-ce/pkg/version" "github.com/rocboss/paopao-ce/pkg/version"
) )
var _ api.Site = (*siteSrv)(nil)
type siteSrv struct { type siteSrv struct {
api.UnimplementedSiteServant api.UnimplementedSiteServant
*base.BaseServant *base.BaseServant

@ -18,8 +18,6 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var _ api.Trends = (*trendsSrv)(nil)
type trendsSrv struct { type trendsSrv struct {
api.UnimplementedTrendsServant api.UnimplementedTrendsServant
*base.DaoServant *base.DaoServant

@ -16,8 +16,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants" "github.com/rocboss/paopao-ce/internal/servants"
) )
var _ Service = (*adminService)(nil)
type adminService struct { type adminService struct {
*baseHttpService *baseHttpService
} }

@ -16,8 +16,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants" "github.com/rocboss/paopao-ce/internal/servants"
) )
var _ Service = (*botService)(nil)
type botService struct { type botService struct {
*baseHttpService *baseHttpService
} }

@ -0,0 +1,18 @@
//go:build constraint
package service
var (
_ server = (*grpcServer)(nil)
_ server = (*httpServer)(nil)
_ Service = (*adminService)(nil)
_ Service = (*botService)(nil)
_ Service = (*frontendWebService)(nil)
_ Service = (*localossService)(nil)
_ Service = (*metricsService)(nil)
_ Service = (*pprofService)(nil)
_ Service = (*mobileService)(nil)
_ Service = (*spaceXService)(nil)
_ Service = (*webService)(nil)
)

@ -14,8 +14,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants" "github.com/rocboss/paopao-ce/internal/servants"
) )
var _ Service = (*frontendWebService)(nil)
type frontendWebService struct { type frontendWebService struct {
*baseHttpService *baseHttpService
} }

@ -10,8 +10,6 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
) )
var _ server = (*grpcServer)(nil)
// grpcServer wraper for grpc.Server // grpcServer wraper for grpc.Server
type grpcServer struct { type grpcServer struct {
*baseServer *baseServer

@ -11,8 +11,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
var _ server = (*httpServer)(nil)
// httpServer wraper for gin.engine and http.Server // httpServer wraper for gin.engine and http.Server
type httpServer struct { type httpServer struct {
*baseServer *baseServer

@ -15,8 +15,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants" "github.com/rocboss/paopao-ce/internal/servants"
) )
var _ Service = (*localossService)(nil)
type localossService struct { type localossService struct {
*baseHttpService *baseHttpService
} }

@ -17,8 +17,6 @@ import (
"github.com/rocboss/paopao-ce/internal/infra/metrics/statistics" "github.com/rocboss/paopao-ce/internal/infra/metrics/statistics"
) )
var _ Service = (*metricsService)(nil)
type metricsService struct { type metricsService struct {
*baseHttpService *baseHttpService
} }

@ -16,8 +16,6 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
) )
var _ Service = (*mobileService)(nil)
type mobileService struct { type mobileService struct {
*baseGRPCService *baseGRPCService
} }

@ -13,8 +13,6 @@ import (
"github.com/rocboss/paopao-ce/internal/conf" "github.com/rocboss/paopao-ce/internal/conf"
) )
var _ Service = (*pprofService)(nil)
type pprofService struct { type pprofService struct {
*baseHttpService *baseHttpService
} }

@ -16,8 +16,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants" "github.com/rocboss/paopao-ce/internal/servants"
) )
var _ Service = (*spaceXService)(nil)
type spaceXService struct { type spaceXService struct {
*baseHttpService *baseHttpService
} }

@ -17,8 +17,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants" "github.com/rocboss/paopao-ce/internal/servants"
) )
var _ Service = (*webService)(nil)
type webService struct { type webService struct {
*baseHttpService *baseHttpService
} }

Loading…
Cancel
Save