Skip to content

Commit

Permalink
make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzhichang committed Feb 24, 2021
1 parent f79c8ce commit f97c0cb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.33
version: v1.37

# Optional: working directory, useful for monorepos
# working-directory: somedir

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

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ benchtest: pre
systest: build
bash go.test.sh
lint:
golangci-lint run --issues-exit-code=0 --disable=nakedret,exhaustivestruct,wrapcheck,paralleltest,rowserrcheck
golangci-lint run --issues-exit-code=0 --disable=nakedret,exhaustivestruct,wrapcheck,paralleltest,rowserrcheck,cyclop
run: pre
go run cmd/clickhouse_sinker/main.go --local-cfg-dir conf/

Expand Down
2 changes: 1 addition & 1 deletion cmd/clickhouse_sinker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func initCmdOptions() {
func init() {
initCmdOptions()
if cmdOps.ShowVer {
config.PrintSinkerInfo()
log.Infoln(config.GetSinkerInfo())
os.Exit(0)
}
selfIP = util.GetOutboundIP().String()
Expand Down
17 changes: 9 additions & 8 deletions config/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import "fmt"
var (
// SinkerReleaseVersion information.
SinkerReleaseVersion = "None"
SinkerBuildTS = "None"
SinkerEdition = "None"
SinkerGitHash = "None"
SinkerGitBranch = "None"
SinkerEdition = "None"
SinkerBuildTS = "None"
)

func PrintSinkerInfo() {
fmt.Println("Release Version:", SinkerReleaseVersion)
fmt.Println("Edition:", SinkerEdition)
fmt.Println("Git Commit Hash:", SinkerGitHash)
fmt.Println("Git Branch:", SinkerGitBranch)
fmt.Println("UTC Build Time: ", SinkerBuildTS)
func GetSinkerInfo() string {
return fmt.Sprintf("Release Version: %s, Edition: %s, Git Commit Hash: %s, Git Branch: %s, Build At: %s",
SinkerReleaseVersion,
SinkerEdition,
SinkerGitHash,
SinkerGitBranch,
SinkerBuildTS)
}
5 changes: 1 addition & 4 deletions output/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ func (c *ClickHouse) Init() (err error) {
if err = pool.InitConn(chCfg.Hosts, chCfg.Port, chCfg.DB, chCfg.Username, chCfg.Password, chCfg.DsnParams); err != nil {
return
}
if err = c.initSchema(); err != nil {
return err
}
return nil
return c.initSchema()
}

// Send a batch to clickhouse
Expand Down
3 changes: 1 addition & 2 deletions util/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ func EnvIntVar(value *int, key string) {

func EnvBoolVar(value *bool, key string) {
realKey := strings.ReplaceAll(strings.ToUpper(key), "-", "_")
_, found := os.LookupEnv(realKey)
if found {
if _, found := os.LookupEnv(realKey); found {
*value = true
}
}
Expand Down
3 changes: 1 addition & 2 deletions util/common_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package util

import (
"fmt"
"os"
"testing"

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

0 comments on commit f97c0cb

Please sign in to comment.