Skip to content

Commit

Permalink
golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlkaidChan committed Sep 14, 2023
1 parent fef57b8 commit d504625
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (

var defaultCachePath = "/tmp/bk-bscp"
var instance *Cache

// Enable define whether to enable local cache
var Enable bool

// Cache is the bscp sdk cache
Expand Down
3 changes: 2 additions & 1 deletion cli/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"fmt"
"strings"

"github.com/spf13/viper"

"github.com/TencentBlueKing/bscp-go/cli/config"
"github.com/TencentBlueKing/bscp-go/cli/constant"
"github.com/spf13/viper"
)

var (
Expand Down
1 change: 1 addition & 0 deletions cli/cmd/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
)

var (
// PullCmd command to pull app files
PullCmd = &cobra.Command{
Use: "pull",
Short: "pull",
Expand Down
1 change: 1 addition & 0 deletions cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

var (
// VersionCmd command to show version info
VersionCmd = &cobra.Command{
Use: "version",
Short: "show version of the bscp-go cli.",
Expand Down
1 change: 1 addition & 0 deletions cli/cmd/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
)

var (
// WatchCmd command to watch app files
WatchCmd = &cobra.Command{
Use: "watch",
Short: "watch",
Expand Down
2 changes: 1 addition & 1 deletion cli/constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package constant

const (
// !important: promise of compatibility
// DefaultTempDir is the bscp cli default temp dir.
// !important: promise of compatibility
DefaultTempDir = "/data/bscp"
)
1 change: 1 addition & 0 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package main

import (
"bscp.io/pkg/logs"

"github.com/TencentBlueKing/bscp-go/cli/cmd"
)

Expand Down
4 changes: 2 additions & 2 deletions cli/util/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const (
// executePythonCmd python script executor
executePythonCmd = "python3"

// !important: promise of compatibility
// EnvAppTempDir bscp app temp dir env
// !important: promise of compatibility
EnvAppTempDir = "bk_bscp_app_temp_dir"
// EnvTempDir bscp temp dir env
EnvTempDir = "bk_bscp_temp_dir"
// EnvApp bscp biz id env
// EnvBiz bscp biz id env
EnvBiz = "bk_bscp_biz"
// EnvApp bscp app name env
EnvApp = "bk_bscp_app"
Expand Down
1 change: 1 addition & 0 deletions cli/util/hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"bscp.io/pkg/dal/table"
pbhook "bscp.io/pkg/protocol/core/hook"

"github.com/TencentBlueKing/bscp-go/cli/util"
)

Expand Down
5 changes: 4 additions & 1 deletion downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ const (
defaultDownloadSemaphoreWight = 10
)

// DownloadTo defines the download target.
type DownloadTo string

var (
instance *downloader

// DownloadToBytes download file content to bytes.
DownloadToBytes DownloadTo = "bytes"
DownloadToFile DownloadTo = "file"
// DownloadToFile download file content to file.
DownloadToFile DownloadTo = "file"
)

// Downloader implements all the supported operations which used to download
Expand Down
2 changes: 1 addition & 1 deletion option/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package option

import (
pbhook "bscp.io/pkg/protocol/core/hook"

"github.com/TencentBlueKing/bscp-go/types"
)

Expand All @@ -32,6 +33,5 @@ type WatchOptions struct {
BizID uint32
}

// TODO: how to wrapper file, kv, table types in one watch result
// Callback watch callback
type Callback func(releaseID uint32, files []*types.ConfigItemFile, pre *pbhook.HookSpec, post *pbhook.HookSpec) error
2 changes: 0 additions & 2 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func (rs ReconnectSignal) String() string {
return rs.Reason
}

type OnAppReleaseChange func(event *sfs.ReleaseChangeEvent)

// ConfigItemFile defines config item file
type ConfigItemFile struct {
// Config file name
Expand Down
1 change: 1 addition & 0 deletions watch/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"bscp.io/pkg/logs"
sfs "bscp.io/pkg/sf-share"
"bscp.io/pkg/tools"

"github.com/TencentBlueKing/bscp-go/types"
)

Expand Down
1 change: 1 addition & 0 deletions watch/reconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"bscp.io/pkg/criteria/uuid"
"bscp.io/pkg/logs"
"bscp.io/pkg/tools"

"github.com/TencentBlueKing/bscp-go/types"
)

Expand Down
5 changes: 3 additions & 2 deletions watch/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ import (
pbfs "bscp.io/pkg/protocol/feed-server"
"bscp.io/pkg/runtime/jsoni"
sfs "bscp.io/pkg/sf-share"
"go.uber.org/atomic"
"google.golang.org/grpc"

"github.com/TencentBlueKing/bscp-go/cache"
"github.com/TencentBlueKing/bscp-go/option"
"github.com/TencentBlueKing/bscp-go/types"
"github.com/TencentBlueKing/bscp-go/upstream"
"go.uber.org/atomic"
"google.golang.org/grpc"
)

// Watcher is the main watch stream for instance
Expand Down

0 comments on commit d504625

Please sign in to comment.