Skip to content

Commit f97c0cb

Browse files
committed
make lint happy
1 parent f79c8ce commit f97c0cb

File tree

7 files changed

+16
-20
lines changed

7 files changed

+16
-20
lines changed

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
uses: golangci/golangci-lint-action@v2
1717
with:
1818
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
19-
version: v1.33
19+
version: v1.37
2020

2121
# Optional: working directory, useful for monorepos
2222
# working-directory: somedir
2323

2424
# Optional: golangci-lint command line arguments.
25-
args: --issues-exit-code=0 --disable=nakedret,exhaustivestruct,wrapcheck,paralleltest,rowserrcheck
25+
args: --issues-exit-code=0 --disable=nakedret,exhaustivestruct,wrapcheck,paralleltest,rowserrcheck,cyclop
2626

2727
# Optional: show only new issues if it's a pull request. The default value is `false`.
2828
# only-new-issues: true

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ benchtest: pre
2525
systest: build
2626
bash go.test.sh
2727
lint:
28-
golangci-lint run --issues-exit-code=0 --disable=nakedret,exhaustivestruct,wrapcheck,paralleltest,rowserrcheck
28+
golangci-lint run --issues-exit-code=0 --disable=nakedret,exhaustivestruct,wrapcheck,paralleltest,rowserrcheck,cyclop
2929
run: pre
3030
go run cmd/clickhouse_sinker/main.go --local-cfg-dir conf/
3131

cmd/clickhouse_sinker/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func initCmdOptions() {
115115
func init() {
116116
initCmdOptions()
117117
if cmdOps.ShowVer {
118-
config.PrintSinkerInfo()
118+
log.Infoln(config.GetSinkerInfo())
119119
os.Exit(0)
120120
}
121121
selfIP = util.GetOutboundIP().String()

config/build.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ import "fmt"
55
var (
66
// SinkerReleaseVersion information.
77
SinkerReleaseVersion = "None"
8-
SinkerBuildTS = "None"
8+
SinkerEdition = "None"
99
SinkerGitHash = "None"
1010
SinkerGitBranch = "None"
11-
SinkerEdition = "None"
11+
SinkerBuildTS = "None"
1212
)
1313

14-
func PrintSinkerInfo() {
15-
fmt.Println("Release Version:", SinkerReleaseVersion)
16-
fmt.Println("Edition:", SinkerEdition)
17-
fmt.Println("Git Commit Hash:", SinkerGitHash)
18-
fmt.Println("Git Branch:", SinkerGitBranch)
19-
fmt.Println("UTC Build Time: ", SinkerBuildTS)
14+
func GetSinkerInfo() string {
15+
return fmt.Sprintf("Release Version: %s, Edition: %s, Git Commit Hash: %s, Git Branch: %s, Build At: %s",
16+
SinkerReleaseVersion,
17+
SinkerEdition,
18+
SinkerGitHash,
19+
SinkerGitBranch,
20+
SinkerBuildTS)
2021
}

output/clickhouse.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ func (c *ClickHouse) Init() (err error) {
6464
if err = pool.InitConn(chCfg.Hosts, chCfg.Port, chCfg.DB, chCfg.Username, chCfg.Password, chCfg.DsnParams); err != nil {
6565
return
6666
}
67-
if err = c.initSchema(); err != nil {
68-
return err
69-
}
70-
return nil
67+
return c.initSchema()
7168
}
7269

7370
// Send a batch to clickhouse

util/common.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ func EnvIntVar(value *int, key string) {
162162

163163
func EnvBoolVar(value *bool, key string) {
164164
realKey := strings.ReplaceAll(strings.ToUpper(key), "-", "_")
165-
_, found := os.LookupEnv(realKey)
166-
if found {
165+
if _, found := os.LookupEnv(realKey); found {
167166
*value = true
168167
}
169168
}

util/common_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package util
22

33
import (
4-
"fmt"
54
"os"
65
"testing"
76

@@ -19,6 +18,6 @@ func TestJksToPem(t *testing.T) {
1918
}
2019
certPemPath, keyPemPath, err = JksToPem(jksPath, jksPassword, true)
2120
require.Nil(t, err, "err should be nothing")
22-
fmt.Printf("converted %s to %s, %s\n", jksPath, certPemPath, keyPemPath)
21+
t.Logf("converted %s to %s, %s\n", jksPath, certPemPath, keyPemPath)
2322
}
2423
}

0 commit comments

Comments
 (0)