Skip to content

Commit

Permalink
style(ci): add editor config
Browse files Browse the repository at this point in the history
add editor config

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Oct 17, 2023
1 parent ae12a02 commit ccb840b
Show file tree
Hide file tree
Showing 94 changed files with 363 additions and 266 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8

end_of_line = lf
insert_final_newline = true

indent_style = space
indent_size = 2
tab_width = 2

[*.go]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[{Makefile,*.json}]
indent_style = tab
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ compile_server_linux_arm64:
@CGO_ENABLED=1 GOOS=linux GOARCH=arm64 GOARM=7 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ AR=aarch64-linux-gnu-ar \
${BUILD_CMD_UNIX} \
-o ${BIN_DIR}/linux_arm64/server ${SERVER_MAIN_FILE}

@rm -rf "${CLIENT_OUT_DIR_UPGRADE}linux_arm64" && mkdir -p "${CLIENT_OUT_DIR_UPGRADE}linux_arm64" && \
cp ${BIN_DIR}/linux_arm64/server "${CLIENT_OUT_DIR_UPGRADE}linux_arm64/"

Expand Down Expand Up @@ -319,3 +319,6 @@ upload_to:
@find ${QINIU_DIR} -name ".DS_Store" -type f -delete
@qshell qupload2 --src-dir=${QINIU_DIR} --bucket=download --thread-count=10 --log-file=qshell.log \
--skip-path-prefixes=ztf,zv,zmanager,driver,deeptest --rescan-local --overwrite --check-hash

help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
26 changes: 26 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://taskfile.dev

version: '3'

vars:
GOOS: $(go env GOOS)
GOARCH: $(go env GOARCH)

tasks:
gofmt:
cmds:
- go install golang.org/x/tools/cmd/goimports@latest
- gofmt -s -w .
- goimports -w .

golint:
cmds:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- golangci-lint run -v ./...

lint:
desc: lint code
cmds:
- task: gofmt
- task: golint

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.0.1
23 changes: 8 additions & 15 deletions cmd/command/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package main

import (
"flag"
"io"
"os"
"os/signal"
"strings"
"syscall"

"github.com/easysoft/zendata/internal/command"
commandConfig "github.com/easysoft/zendata/internal/command/config"
configUtils "github.com/easysoft/zendata/internal/pkg/config"
Expand All @@ -11,27 +17,17 @@ import (
logUtils "github.com/easysoft/zendata/pkg/utils/log"
"github.com/easysoft/zendata/pkg/utils/vari"
"github.com/fatih/color"
"io/ioutil"
"os"
"os/signal"
"strings"
"syscall"
)

var (
configs []string
defaultFile string
configFile string
exportFields string

defaultDefContent []byte
configDefContent []byte

root string
input string

parse bool
decode bool
listData bool
listRes bool
view string
Expand All @@ -44,9 +40,6 @@ var (
version bool
set bool

isStartServer bool
uuid = ""

AppVersion string
BuildTime string
GoVersion string
Expand All @@ -56,7 +49,7 @@ var (
)

func main() {
channel := make(chan os.Signal)
channel := make(chan os.Signal, 1) // fix for sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify
signal.Notify(channel, os.Interrupt, syscall.SIGTERM)
go func() {
<-channel
Expand Down Expand Up @@ -159,7 +152,7 @@ func execCommand() {
vari.DB, _ = commandConfig.NewGormDB()
//defer vari.DB.Close()

flagSet.SetOutput(ioutil.Discard)
flagSet.SetOutput(io.Discard)
if err := flagSet.Parse(os.Args[1:]); err == nil {
opts(files)
} else {
Expand Down
7 changes: 4 additions & 3 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package main

import (
"flag"
"os"
"os/signal"
"syscall"

configUtils "github.com/easysoft/zendata/internal/pkg/config"
consts "github.com/easysoft/zendata/internal/pkg/const"
serverConfig "github.com/easysoft/zendata/internal/server/config"
Expand All @@ -12,9 +16,6 @@ import (
logUtils "github.com/easysoft/zendata/pkg/utils/log"
"github.com/easysoft/zendata/pkg/utils/vari"
"github.com/fatih/color"
"os"
"os/signal"
"syscall"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion cmd/test/func/comm/excel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package comm

import (
"fmt"
"strings"

"github.com/360EntSecGroup-Skylar/excelize/v2"
fileUtils "github.com/easysoft/zendata/pkg/utils/file"
"strings"
)

func GetExcelTable(filePath, sheetName string) (records []map[string]interface{}) {
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/func/proto/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/easysoft/zendata/internal/pkg/model"
"github.com/easysoft/zendata/pkg/utils/vari"
"log"
"reflect"
"strconv"
"time"

"github.com/easysoft/zendata/internal/pkg/model"
"github.com/easysoft/zendata/pkg/utils/vari"
)

var (
Expand Down
10 changes: 7 additions & 3 deletions cmd/test/func/proto/dist/person.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/test/unit/mod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestMod(t *testing.T) {
arrOfArr[2] = []string{"X", "Y", "Z"}

indexArr := make([]int, 0)
for _, _ = range arrOfArr {
for range arrOfArr {
indexArr = append(indexArr, 0)
}

Expand Down
11 changes: 6 additions & 5 deletions cmd/test/unit/parse_table/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package parse_table

import (
"flag"
"log"
"os"
"path/filepath"
"strings"
"testing"

"github.com/easysoft/zendata/internal/command"
commandConfig "github.com/easysoft/zendata/internal/command/config"
configUtils "github.com/easysoft/zendata/internal/pkg/config"
Expand All @@ -11,11 +17,6 @@ import (
"gopkg.in/yaml.v3"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"log"
"os"
"path/filepath"
"strings"
"testing"
)

var (
Expand Down
9 changes: 5 additions & 4 deletions cmd/test/unit/pinyin_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package main

import (
"github.com/360EntSecGroup-Skylar/excelize/v2"
"github.com/Chain-Zhang/pinyin"
i118Utils "github.com/easysoft/zendata/pkg/utils/i118"
logUtils "github.com/easysoft/zendata/pkg/utils/log"
"strconv"
"strings"
"testing"
"unicode"

"github.com/360EntSecGroup-Skylar/excelize/v2"
"github.com/Chain-Zhang/pinyin"
i118Utils "github.com/easysoft/zendata/pkg/utils/i118"
logUtils "github.com/easysoft/zendata/pkg/utils/log"
)

func TestPinYin(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/unit/server_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package main

import (
fileUtils "github.com/easysoft/zendata/pkg/utils/file"
httpUtils "github.com/easysoft/zendata/pkg/utils/http"
"net/url"
"testing"

fileUtils "github.com/easysoft/zendata/pkg/utils/file"
httpUtils "github.com/easysoft/zendata/pkg/utils/http"
)

func TestServer(t *testing.T) {
Expand Down
28 changes: 10 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module github.com/easysoft/zendata

go 1.19
go 1.21

require (
github.com/getkin/kin-openapi v0.112.0
golang.org/x/text v0.5.0
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
github.com/getkin/kin-openapi v0.120.0
golang.org/x/text v0.13.0
)

require (
Expand All @@ -13,31 +14,24 @@ require (
github.com/CloudyKit/jet/v6 v6.1.0 // indirect
github.com/Shopify/goreferrer v0.0.0-20210630161223-536fa16abd6f // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/denisenkom/go-mssqldb v0.12.0 // indirect
github.com/dsnet/compress v0.0.1 // indirect
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/flosch/pongo2/v4 v4.0.2 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.19.5 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/gobwas/ws v1.1.0 // indirect
github.com/goccy/go-json v0.9.4 // indirect
github.com/godror/godror v0.20.0 // indirect
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gonutz/rsrc v0.0.0-20180911104558-96f130112cb1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/invopop/yaml v0.1.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/iris-contrib/go.uuid v2.0.0+incompatible // indirect
github.com/iris-contrib/jade v1.1.4 // indirect
github.com/iris-contrib/schema v0.0.6 // indirect
Expand All @@ -64,21 +58,21 @@ require (
github.com/nats-io/nkeys v0.3.0 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/richardlehane/mscfb v1.0.3 // indirect
github.com/richardlehane/msoleps v1.0.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/schollz/closestmatch v2.1.0+incompatible // indirect
github.com/tdewolff/minify/v2 v2.10.0 // indirect
github.com/tdewolff/parse/v2 v2.5.27 // indirect
github.com/thoas/go-funk v0.7.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/yosssi/ace v0.0.5 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
Expand All @@ -89,7 +83,6 @@ require (
github.com/Chain-Zhang/pinyin v0.1.3
github.com/Knetic/govaluate v3.0.0+incompatible
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible // indirect
github.com/dzwvip/oracle v1.2.1
github.com/emirpasic/gods v1.12.0
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/inject v0.0.0-20180706035515-f23751cae28b
Expand All @@ -103,7 +96,7 @@ require (
github.com/kataras/iris/v12 v12.2.0-alpha9
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/mattn/go-runewidth v0.0.10
github.com/mattn/go-sqlite3 v1.14.15
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/mholt/archiver/v3 v3.5.0
github.com/oklog/ulid/v2 v2.0.2
github.com/pierrec/lz4/v4 v4.1.3 // indirect
Expand All @@ -119,7 +112,6 @@ require (
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.3.3
gorm.io/driver/sqlite v1.5.0
gorm.io/driver/sqlserver v1.3.2
gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11
gorm.io/plugin/dbresolver v1.2.0
)
Loading

0 comments on commit ccb840b

Please sign in to comment.