Skip to content

Commit

Permalink
feat: format openim make lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw committed Mar 4, 2024
1 parent 88bcabe commit 6d9c45a
Show file tree
Hide file tree
Showing 91 changed files with 220 additions and 375 deletions.
16 changes: 15 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ linters-settings:
right-to-left-isolate: true
first-strong-isolate: true
pop-directional-isolate: true
dogsled:
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 2
dupl:
Expand Down Expand Up @@ -729,6 +728,21 @@ linters:
- gofmt # Format check
- govet # Go's standard linting tool
- gosimple # Suggestions for simplifying code
- errcheck
- decorder
- sloglint
- ineffassign
- revive
- reassign
- tparallel
- unconvert
- dupl
- dupword
- errname
- gci
- goheader
- goprintffuncname
- gosec
- misspell # Spelling mistakes
- staticcheck # Static analysis
- unused # Checks for unused code
Expand Down
6 changes: 2 additions & 4 deletions cmd/openim-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ import (
"syscall"
"time"

util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"

"github.com/OpenIMSDK/tools/errs"

"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"

"github.com/openimsdk/open-im-server/v3/internal/api"
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
Expand All @@ -40,6 +37,7 @@ import (
kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister"
ginprom "github.com/openimsdk/open-im-server/v3/pkg/common/ginprometheus"
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
)

func main() {
Expand Down
3 changes: 1 addition & 2 deletions internal/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
package api

import (
"github.com/gin-gonic/gin"

"github.com/OpenIMSDK/protocol/auth"
"github.com/OpenIMSDK/tools/a2r"
"github.com/gin-gonic/gin"

"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)
Expand Down
3 changes: 1 addition & 2 deletions internal/api/conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
package api

import (
"github.com/gin-gonic/gin"

"github.com/OpenIMSDK/protocol/conversation"
"github.com/OpenIMSDK/tools/a2r"
"github.com/gin-gonic/gin"

"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)
Expand Down
3 changes: 1 addition & 2 deletions internal/api/custom_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
package api

import (
"github.com/go-playground/validator/v10"

"github.com/OpenIMSDK/protocol/constant"
"github.com/go-playground/validator/v10"
)

// RequiredIf validates if the specified field is required based on the session type.
Expand Down
3 changes: 1 addition & 2 deletions internal/api/friend.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ package api
import (
"github.com/OpenIMSDK/protocol/friend"
"github.com/OpenIMSDK/tools/a2r"
"github.com/gin-gonic/gin"

"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"

"github.com/gin-gonic/gin"
)

type FriendApi rpcclient.Friend
Expand Down
3 changes: 1 addition & 2 deletions internal/api/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ package api
import (
"github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/tools/a2r"
"github.com/gin-gonic/gin"

"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"

"github.com/gin-gonic/gin"
)

type GroupApi rpcclient.Group
Expand Down
3 changes: 1 addition & 2 deletions internal/api/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ import (
"github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure"

"github.com/openimsdk/open-im-server/v3/pkg/apistruct"
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"

"github.com/openimsdk/open-im-server/v3/pkg/apistruct"
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)

Expand Down
15 changes: 6 additions & 9 deletions internal/api/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@ import (

"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/apiresp"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mw"
"github.com/OpenIMSDK/tools/tokenverify"

"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/controller"

"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-playground/validator/v10"
"github.com/redis/go-redis/v9"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mw"

"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/controller"
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)

Expand Down
3 changes: 1 addition & 2 deletions internal/api/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
package api

import (
"github.com/gin-gonic/gin"

"github.com/OpenIMSDK/protocol/user"
"github.com/OpenIMSDK/tools/a2r"
"github.com/gin-gonic/gin"

"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)
Expand Down
6 changes: 2 additions & 4 deletions internal/api/third.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ import (
"net/http"
"strconv"

config2 "github.com/openimsdk/open-im-server/v3/pkg/common/config"

"github.com/gin-gonic/gin"

"github.com/OpenIMSDK/protocol/third"
"github.com/OpenIMSDK/tools/a2r"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/gin-gonic/gin"

config2 "github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)

Expand Down
10 changes: 4 additions & 6 deletions internal/msggateway/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@ import (
"sync"
"sync/atomic"

"github.com/OpenIMSDK/tools/errs"

"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"

"google.golang.org/protobuf/proto"

"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/apiresp"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
"google.golang.org/protobuf/proto"

"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions internal/msggateway/hub_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ package msggateway
import (
"context"

"google.golang.org/grpc"

"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msggateway"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
"google.golang.org/grpc"

"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
Expand Down
8 changes: 3 additions & 5 deletions internal/msggateway/message_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ import (
"context"
"sync"

"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/push"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"

"github.com/OpenIMSDK/tools/utils"
"github.com/go-playground/validator/v10"
"google.golang.org/protobuf/proto"

"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/utils"

"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)

Expand Down
10 changes: 4 additions & 6 deletions internal/msggateway/n_ws_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ import (
"sync/atomic"
"time"

"github.com/OpenIMSDK/tools/apiresp"

"github.com/go-playground/validator/v10"
"github.com/redis/go-redis/v9"
"golang.org/x/sync/errgroup"

"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/msggateway"
"github.com/OpenIMSDK/tools/apiresp"
"github.com/OpenIMSDK/tools/discoveryregistry"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
"github.com/go-playground/validator/v10"
"github.com/redis/go-redis/v9"
"golang.org/x/sync/errgroup"

"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
Expand Down
9 changes: 3 additions & 6 deletions internal/msgtransfer/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ import (
"context"
"errors"
"fmt"

"github.com/OpenIMSDK/tools/errs"

util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"

"net/http"
"os"
"os/signal"
"syscall"

"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/mw"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
Expand All @@ -42,6 +38,7 @@ import (
kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister"
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
)

type MsgTransfer struct {
Expand Down Expand Up @@ -121,7 +118,7 @@ func (m *MsgTransfer) Start(prometheusPort int) error {

var (
netDone = make(chan struct{}, 1)
netErr error
netErr error
)

go m.historyCH.historyConsumerGroup.RegisterHandleAndConsumer(m.ctx, m.historyCH)
Expand Down
11 changes: 4 additions & 7 deletions internal/msgtransfer/online_history_msg_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,20 @@ import (
"sync/atomic"
"time"

"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"

"github.com/OpenIMSDK/tools/errs"

"github.com/IBM/sarama"
"github.com/go-redis/redis"
"google.golang.org/protobuf/proto"

"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/protocol/sdkws"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils"
"github.com/go-redis/redis"
"google.golang.org/protobuf/proto"

"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/controller"
"github.com/openimsdk/open-im-server/v3/pkg/common/kafka"
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
"github.com/openimsdk/open-im-server/v3/pkg/rpcclient"
)

Expand Down
3 changes: 1 addition & 2 deletions internal/msgtransfer/online_msg_to_mongo_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import (
"context"

"github.com/IBM/sarama"
"google.golang.org/protobuf/proto"

pbmsg "github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/tools/log"
"google.golang.org/protobuf/proto"

"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/controller"
Expand Down
3 changes: 1 addition & 2 deletions internal/push/offlinepush/fcm/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (

firebase "firebase.google.com/go"
"firebase.google.com/go/messaging"
"github.com/OpenIMSDK/protocol/constant"
"github.com/redis/go-redis/v9"
"google.golang.org/api/option"

"github.com/OpenIMSDK/protocol/constant"

"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
Expand Down
3 changes: 1 addition & 2 deletions internal/push/offlinepush/getui/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ import (
"sync"
"time"

"github.com/redis/go-redis/v9"

"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mcontext"
"github.com/OpenIMSDK/tools/utils/splitter"
"github.com/redis/go-redis/v9"

"github.com/openimsdk/open-im-server/v3/internal/push/offlinepush"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
Expand Down
3 changes: 1 addition & 2 deletions internal/push/push_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ import (
"context"

"github.com/IBM/sarama"
"google.golang.org/protobuf/proto"

"github.com/OpenIMSDK/protocol/constant"
pbchat "github.com/OpenIMSDK/protocol/msg"
pbpush "github.com/OpenIMSDK/protocol/push"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/utils"
"google.golang.org/protobuf/proto"

"github.com/openimsdk/open-im-server/v3/pkg/common/config"
kfk "github.com/openimsdk/open-im-server/v3/pkg/common/kafka"
Expand Down
Loading

0 comments on commit 6d9c45a

Please sign in to comment.