Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linting errors in config package and related files #235

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion cmd/api/admin-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
mw2 "github.com/OpenIMSDK/chat/pkg/common/mw"

"github.com/OpenIMSDK/chat/internal/api"
"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/OpenIMSDK/chat/pkg/common/config_fixed"

Check failure on line 28 in cmd/api/admin-api/main.go

View workflow job for this annotation

GitHub Actions / coverage

no required module provides package github.com/OpenIMSDK/chat/pkg/common/config_fixed; to add it:
openKeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mw"
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/chat-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
mw2 "github.com/OpenIMSDK/chat/pkg/common/mw"

"github.com/OpenIMSDK/chat/internal/api"
"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/OpenIMSDK/chat/pkg/common/config_fixed"
openKeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/tools/mw"
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpc/admin-rpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"time"

"github.com/OpenIMSDK/chat/internal/rpc/admin"
"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/OpenIMSDK/chat/pkg/common/config_fixed"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpc/chat-rpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"time"

"github.com/OpenIMSDK/chat/internal/rpc/chat"
"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/OpenIMSDK/chat/pkg/common/config_fixed"
)

func main() {
Expand Down
4 changes: 3 additions & 1 deletion pkg/common/config/im.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

package config

var imConfig struct {
func init() {
func init() {
var imConfig struct {
Mysql struct {
Address []string `yaml:"address"`
Username string `yaml:"username"`
Expand Down
6 changes: 5 additions & 1 deletion pkg/common/config/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ var (
Root = filepath.Join(filepath.Dir(b), "../../..")
)

func readConfig(configFile string) ([]byte, error) {
// Added variable declarations inside the function body
func InitConfig(configFile string) error {
_, b, _, _ := runtime.Caller(0)
// Root folder of this project.
Root := filepath.Join(filepath.Dir(b), "../../..")
b, err := os.ReadFile(configFile)
if err != nil {
return nil, utils.Wrap(err, configFile)
Expand Down
2 changes: 1 addition & 1 deletion tools/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package component

import (
"fmt"
"github.com/OpenIMSDK/chat/pkg/common/config"
"github.com/OpenIMSDK/chat/pkg/common/config_fixed"
"github.com/OpenIMSDK/protocol/constant"
"github.com/OpenIMSDK/tools/errs"
"github.com/OpenIMSDK/tools/log"
Expand Down
Loading