just use gofumpt instead to fmt source code

pull/699/head
alimy 6 months ago
parent 24f35a18d5
commit 4fb7beb25d
No known key found for this signature in database
GPG Key ID: 6964A0C5FE15145A

@ -1,4 +1,4 @@
.PHONY: all build build-web run test clean fmt pre-commit help
.PHONY: all build build-web run test clean fmt vet pre-commit help
PROJECT = paopao-ce
TARGET = paopao
@ -22,6 +22,7 @@ BUILD_VERSION := $(shell git describe --tags --always)
BUILD_DATE := $(shell date +'%Y-%m-%d %H:%M:%S %Z')
SHA_SHORT := $(shell git rev-parse --short HEAD)
GOFMT ?= gofumpt -l -w
MOD_NAME = github.com/rocboss/paopao-ce
LDFLAGS = -X "${MOD_NAME}/pkg/version.version=${BUILD_VERSION}" \
-X "${MOD_NAME}/pkg/version.buildDate=${BUILD_DATE}" \
@ -84,18 +85,18 @@ generate: gen-mir gen-rpc gen-enum
.PHONY: gen-mir
gen-mir:
@go generate mirc/gen.go
@go fmt ./auto/api/...
$(GOFMT) ./auto/api
.PHONY: gen-rpc
gen-rpc:
@rm -rf auto/rpc
@buf generate proto
@go fmt ./auto/rpc/...
buf generate proto
$(GOFMT) ./auto/rpc
.PHONY: gen-enum
gen-enum:
@go generate ./internal/model/enum/...
go fmt ./internal/model/enum/...
$(GOFMT) ./internal/model/enum
.PHONY: proto-mod
proto-mod:
@ -111,8 +112,9 @@ clean:
fmt:
@echo Formatting...
@go fmt ./internal/...
@go fmt ./pkg/...
$(GOFMT) .
vet:
@go vet -composites=false ./internal/...
@go vet -composites=false ./pkg/...
@ -125,6 +127,7 @@ pre-commit: fmt
.PHONY: install-tools
install-tools: install-protobuf-plugins
@go install github.com/abice/go-enum@latest
@go install mvdan.cc/gofumpt@latest
.PHONY: install-protobuf-plugins
install-protobuf-plugins:

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: core/v1/auth.proto

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.6.0
// - protoc (unknown)
// source: core/v1/auth.proto
@ -89,13 +89,13 @@ type AuthenticateServiceServer interface {
type UnimplementedAuthenticateServiceServer struct{}
func (UnimplementedAuthenticateServiceServer) PreLogin(context.Context, *User) (*ActionReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method PreLogin not implemented")
return nil, status.Error(codes.Unimplemented, "method PreLogin not implemented")
}
func (UnimplementedAuthenticateServiceServer) Login(context.Context, *User) (*LoginReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
return nil, status.Error(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedAuthenticateServiceServer) Logout(context.Context, *User) (*ActionReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented")
return nil, status.Error(codes.Unimplemented, "method Logout not implemented")
}
func (UnimplementedAuthenticateServiceServer) mustEmbedUnimplementedAuthenticateServiceServer() {}
func (UnimplementedAuthenticateServiceServer) testEmbeddedByValue() {}
@ -108,7 +108,7 @@ type UnsafeAuthenticateServiceServer interface {
}
func RegisterAuthenticateServiceServer(s grpc.ServiceRegistrar, srv AuthenticateServiceServer) {
// If the following call pancis, it indicates UnimplementedAuthenticateServiceServer was
// If the following call panics, it indicates UnimplementedAuthenticateServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: greet/v1/greet.proto

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.6.0
// - protoc (unknown)
// source: greet/v1/greet.proto
@ -63,7 +63,7 @@ type GreetServiceServer interface {
type UnimplementedGreetServiceServer struct{}
func (UnimplementedGreetServiceServer) Greet(context.Context, *GreetRequest) (*GreetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Greet not implemented")
return nil, status.Error(codes.Unimplemented, "method Greet not implemented")
}
func (UnimplementedGreetServiceServer) mustEmbedUnimplementedGreetServiceServer() {}
func (UnimplementedGreetServiceServer) testEmbeddedByValue() {}
@ -76,7 +76,7 @@ type UnsafeGreetServiceServer interface {
}
func RegisterGreetServiceServer(s grpc.ServiceRegistrar, srv GreetServiceServer) {
// If the following call pancis, it indicates UnimplementedGreetServiceServer was
// If the following call panics, it indicates UnimplementedGreetServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.

@ -8,13 +8,11 @@ import (
"github.com/spf13/cobra"
)
var (
rootCmd = &cobra.Command{
Use: "paopao",
Short: `an artistic "twitter like" community`,
Long: `an artistic "twitter like" community`,
}
)
var rootCmd = &cobra.Command{
Use: "paopao",
Short: `an artistic "twitter like" community`,
Long: `an artistic "twitter like" community`,
}
// Setup set root command name,short-describe, long-describe
// return &cobra.Command to custom other options

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

@ -15,9 +15,7 @@ import (
"github.com/sirupsen/logrus"
)
var (
_onceInit sync.Once
)
var _onceInit sync.Once
func NewRedisCache() core.RedisCache {
return &redisCache{

@ -12,9 +12,7 @@ import (
"gorm.io/gorm"
)
var (
_ core.AuthorizationManageService = (*authorizationManageSrv)(nil)
)
var _ core.AuthorizationManageService = (*authorizationManageSrv)(nil)
type authorizationManageSrv struct {
db *gorm.DB

@ -14,9 +14,7 @@ import (
"gorm.io/gorm"
)
var (
_ core.ContactManageService = (*contactManageSrv)(nil)
)
var _ core.ContactManageService = (*contactManageSrv)(nil)
type contactManageSrv struct {
db *gorm.DB

@ -20,8 +20,10 @@ type Model struct {
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag" json:"is_del"`
}
type ConditionsT map[string]any
type Predicates map[string][]any
type (
ConditionsT map[string]any
Predicates map[string][]any
)
func (m *Model) BeforeCreate(tx *gorm.DB) (err error) {
nowTime := time.Now().Unix()

@ -24,15 +24,13 @@ const (
ContentTypeChargeAttachment
)
var (
mediaContentType = []PostContentT{
ContentTypeImage,
ContentTypeVideo,
ContentTypeAudio,
ContentTypeAttachment,
ContentTypeChargeAttachment,
}
)
var mediaContentType = []PostContentT{
ContentTypeImage,
ContentTypeVideo,
ContentTypeAudio,
ContentTypeAttachment,
ContentTypeChargeAttachment,
}
type PostContent struct {
*Model

@ -12,9 +12,7 @@ import (
"gorm.io/gorm"
)
var (
_ core.FollowingManageService = (*followingManageSrv)(nil)
)
var _ core.FollowingManageService = (*followingManageSrv)(nil)
type followingManageSrv struct {
db *gorm.DB

@ -12,9 +12,7 @@ import (
"gorm.io/gorm"
)
var (
_ core.MessageService = (*messageSrv)(nil)
)
var _ core.MessageService = (*messageSrv)(nil)
type messageSrv struct {
db *gorm.DB

@ -15,9 +15,7 @@ import (
"gorm.io/gorm"
)
var (
_ core.SecurityService = (*securitySrv)(nil)
)
var _ core.SecurityService = (*securitySrv)(nil)
type securitySrv struct {
db *gorm.DB

@ -250,7 +250,6 @@ func (s *tweetManageSrv) DeletePost(post *ms.Post) ([]string, error) {
return nil
},
)
if err != nil {
return nil, err
}
@ -472,7 +471,7 @@ func (s *tweetSrv) ListFollowingTweets(userId int64, limit, offset int) (res []*
}
beFriendCount, beFollowCount := len(beFriendIds), len(beFollowIds)
db := s.db.Model(&dbr.Post{})
//可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开',
// 可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开',
switch {
case beFriendCount > 0 && beFollowCount > 0:
db = db.Where("user_id=? OR (visibility>=50 AND user_id IN(?)) OR (visibility>=60 AND user_id IN(?))", userId, beFriendIds, beFollowIds)

@ -15,9 +15,7 @@ import (
"gorm.io/gorm"
)
var (
_ core.UserManageService = (*userManageSrv)(nil)
)
var _ core.UserManageService = (*userManageSrv)(nil)
type userManageSrv struct {
db *gorm.DB

@ -12,9 +12,7 @@ import (
"gorm.io/gorm"
)
var (
_ core.WalletService = (*walletSrv)(nil)
)
var _ core.WalletService = (*walletSrv)(nil)
type walletSrv struct {
db *gorm.DB
@ -35,6 +33,7 @@ func (s *walletSrv) GetRechargeByID(id int64) (*ms.WalletRecharge, error) {
return recharge.Get(s.db)
}
func (s *walletSrv) CreateRecharge(userId, amount int64) (*ms.WalletRecharge, error) {
recharge := &dbr.WalletRecharge{
UserID: userId,

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

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

@ -12,9 +12,7 @@ import (
"gopkg.in/resty.v1"
)
var (
_ core.PhoneVerifyService = (*juheSmsServant)(nil)
)
var _ core.PhoneVerifyService = (*juheSmsServant)(nil)
type juhePhoneCaptchaRsp struct {
ErrorCode int `json:"error_code"`

@ -120,7 +120,6 @@ func (s *cosServant) IsObjectExist(objectKey string) (bool, error) {
func (s *cosServant) SignURL(objectKey string, expiredInSec int64) (string, error) {
signedURL, err := s.client.Object.GetPresignedURL(context.Background(),
http.MethodGet, objectKey, conf.COSSetting.SecretID, conf.COSSetting.SecretKey, time.Second*time.Duration(expiredInSec), nil)
if err != nil {
logrus.Errorf("client.SignURL err: %v", err)
return "", err

@ -45,7 +45,7 @@ type localossServant struct {
func (s *localossCreateServant) PutObject(objectKey string, reader io.Reader, objectSize int64, contentType string, _persistance bool) (string, error) {
saveDir := s.savePath + filepath.Dir(objectKey)
err := os.MkdirAll(saveDir, 0750)
err := os.MkdirAll(saveDir, 0o750)
if err != nil && !os.IsExist(err) {
return "", err
}
@ -80,7 +80,7 @@ func (s *localossCreateTempDirServant) PutObject(objectKey string, reader io.Rea
objectName = s.tempDir + objectKey
}
saveDir := s.savePath + filepath.Dir(objectName)
err := os.MkdirAll(saveDir, 0750)
err := os.MkdirAll(saveDir, 0o750)
if err != nil && !os.IsExist(err) {
return "", err
}
@ -112,7 +112,7 @@ func (s *localossCreateTempDirServant) PersistObject(objectKey string) error {
}
saveDir := s.savePath + filepath.Dir(objectKey)
if err = os.MkdirAll(saveDir, 0750); err != nil && !os.IsExist(err) {
if err = os.MkdirAll(saveDir, 0o750); err != nil && !os.IsExist(err) {
return err
}

@ -1,8 +1,8 @@
// Code generated by go-enum DO NOT EDIT.
// Version: v0.7.0
// Revision: 03ade876e762757c985a1cde66576bd63f75d7cd
// Build Date: 2025-04-20T09:27:58+0000
// Built By: alimy
// Version: 0.9.2
// Revision: 9d73c76728916582359433d1eb0b27340a8268b7
// Build Date: 2025-10-17T20:10:48Z
// Built By: goreleaser
package enum
@ -112,6 +112,14 @@ func (x *Boolean) UnmarshalText(text []byte) error {
return nil
}
// AppendText appends the textual representation of itself to the end of b
// (allocating a larger slice if necessary) and returns the updated slice.
//
// Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (x *Boolean) AppendText(b []byte) ([]byte, error) {
return append(b, x.String()...), nil
}
var errBooleanNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.

@ -69,11 +69,15 @@ type SendWhisperReq struct {
Content string `json:"content" binding:"required"`
}
type GetCollectionsReq BasePageReq
type GetCollectionsResp base.PageResp
type (
GetCollectionsReq BasePageReq
GetCollectionsResp base.PageResp
)
type GetStarsReq BasePageReq
type GetStarsResp base.PageResp
type (
GetStarsReq BasePageReq
GetStarsResp base.PageResp
)
type UserPhoneBindReq struct {
BaseInfo `json:"-" binding:"-"`

@ -13,9 +13,7 @@ import (
"github.com/rocboss/paopao-ce/pkg/xerror"
)
var (
bindAny = base.NewBindAnyFn()
)
var bindAny = base.NewBindAnyFn()
type BaseInfo struct {
User *ms.User

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

@ -137,7 +137,6 @@ func bindAnySentry(c *gin.Context, obj any) error {
setter.SetPageInfo(page, pageSize)
}
return nil
}
func RenderAny(c *gin.Context, data any, err error) {

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

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

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

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

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

@ -7,7 +7,6 @@ package web
import (
"context"
"fmt"
"time"
"unicode/utf8"
@ -30,9 +29,7 @@ var (
_maxCaptchaTimes int = 2
)
var (
_ api.Core = (*coreSrv)(nil)
)
var _ api.Core = (*coreSrv)(nil)
type coreSrv struct {
api.UnimplementedCoreServant

@ -273,7 +273,7 @@ func (e *messageActionEvent) Action() (err error) {
default:
// TODO
}
//清除该用户所有消息缓存
// 清除该用户所有消息缓存
err = e.wc.DelAny(fmt.Sprintf("%s%d:*", conf.PrefixMessages, userId))
}
return

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

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

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

@ -748,7 +748,8 @@ func (s *privSrv) deletePostCommentReply(reply *ms.CommentReply) error {
}
func (s *privSrv) createPostPreHandler(commentID int64, userID, atUserID int64) (*ms.Post, *ms.Comment, int64,
error) {
error,
) {
// 加载Comment
comment, err := s.Ds.GetCommentByID(commentID)
if err != nil {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -8,6 +8,4 @@ import (
"errors"
)
var (
ErrNotImplemented = errors.New("not implemented")
)
var ErrNotImplemented = errors.New("not implemented")

@ -11,9 +11,7 @@ import (
gp "github.com/alimy/tryst/pool"
)
var (
_ AsyncClient = (*wormClient)(nil)
)
var _ AsyncClient = (*wormClient)(nil)
const (
_minRequestBuf = 10

@ -62,7 +62,8 @@ func NewSnakeNamingStrategy() NamingStrategy {
"API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP",
"HTTPS", "ID", "IP", "JSON", "LHS", "QPS", "RAM", "RHS", "RPC", "SLA",
"SMTP", "SSH", "TLS", "TTL", "UID", "UI", "UUID", "URI", "URL", "UTF8",
"VM", "XML", "XSRF", "XSS"}
"VM", "XML", "XSRF", "XSS",
}
var oldnews []string
for _, initialism := range initialisms {

@ -12,9 +12,7 @@ import (
hx "github.com/rocboss/paopao-ce/pkg/http"
)
var (
_ OpenObserveClient = (*obxClient)(nil)
)
var _ OpenObserveClient = (*obxClient)(nil)
const (
_userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"

@ -47,7 +47,6 @@ func (j *JsonBox[T]) UnmarshalJSON(data []byte) error {
return errors.New("JsonBox.UnmarshalJSON: on nil pointer")
}
return json.Unmarshal(data, &j.data)
}
func (j *JsonBox[T]) Value() (driver.Value, error) {

@ -11,7 +11,6 @@ import (
)
func PrintHelloBanner(text string) {
fmt.Println(" ____ __ __ ____ __ __ ")
fmt.Println("( _ \\ / _\\ / \\( _ \\ / _\\ / \\ ")
fmt.Println(" ) __// \\( O )) __// \\( O )")

@ -20,8 +20,10 @@ const (
CLEAR // 去除部分易混淆的字符
)
var fontKinds = [][]int{{10, 48}, {26, 97}, {26, 65}}
var letters = []byte("34578acdefghjkmnpqstwxyABCDEFGHJKMNPQRSVWXY")
var (
fontKinds = [][]int{{10, 48}, {26, 97}, {26, 65}}
letters = []byte("34578acdefghjkmnpqstwxyABCDEFGHJKMNPQRSVWXY")
)
// 生成随机字符串
// size 个数 kind 模式

@ -10,9 +10,7 @@ import (
"time"
)
var (
BuildTime = time.Now()
)
var BuildTime = time.Now()
func init() {
exe, err := os.Executable()

@ -12,11 +12,9 @@ import (
"github.com/alimy/mir/v5"
)
var (
_ mir.Error = (*Error)(nil)
var _ mir.Error = (*Error)(nil)
// codes = map[int]string{}
)
// codes = map[int]string{}
type Error struct {
code int

@ -126,7 +126,6 @@ func (c *ZincClient) ExistIndex(name string) bool {
// 新增/更新文档
func (c *ZincClient) PutDoc(name string, id int64, doc any) (bool, error) {
resp, err := c.request().SetBody(doc).Put(fmt.Sprintf("/api/%s/_doc/%d", name, id))
if err != nil {
return false, err
}

Loading…
Cancel
Save