From bf01882628003846045a8d2d3ac1373478b3d2d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A7=E9=A9=8A?= Date: Wed, 15 Jan 2025 13:19:55 +0800 Subject: [PATCH] feat: add ignore --- .gitignore | 7 +++ .golangci.yaml | 134 +++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 71 ++++++++++++++++++++++++ readme.md | 0 4 files changed, 212 insertions(+) create mode 100644 .gitignore create mode 100644 .golangci.yaml create mode 100644 docker-compose.yml create mode 100644 readme.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..404884e --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.idea/ +go.sum +gen_result/ +etc/comment.yaml +etc/comment.dev.yaml +client/ +.DS_Store \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..36f79f3 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,134 @@ +run: + timeout: 3m + # Exit code when at least one issue was found. + # Default: 1 + issues-exit-code: 2 + # Include test files or not. + # Default: true + tests: false + +# Reference URL: https://golangci-lint.run/usage/linters/ +linters: + # Disable everything by default so upgrades to not include new - default + # enabled- linters. + disable-all: true + # Specifically enable linters we want to use. + enable: + # - depguard + - errcheck + # - godot + - gofmt + - goimports + - gosimple + - govet + - ineffassign + - misspell + - revive + - typecheck + - unused + - asasalint + - asciicheck + - bidichk + - bodyclose + - contextcheck + - wastedassign + - whitespace + - thelper + - tparallel + - unconvert + - unparam + - usestdlibvars + - tenv + - testableexamples + - stylecheck + - sqlclosecheck + - nosprintfhostport + - paralleltest + - prealloc + - predeclared + - promlinter + - reassign + - rowserrcheck + - nakedret + - nestif + - nilerr + - nilnil + - nlreturn + - noctx + - nolintlint + - nonamedreturns + - decorder + - dogsled + - dupword + - durationcheck + - errchkjson + - errname + - errorlint + # - execinquery + - exhaustive + - exportloopref + - forbidigo + - forcetypeassert + - gochecknoinits + - gocognit + - goconst + - gocritic + - gocyclo + - goheader + - gomoddirectives + - goprintffuncname + - gosec + - grouper + - importas + - interfacebloat + - lll + - loggercheck + - maintidx + - makezero + +issues: + exclude-rules: + - path: _test\.go + linters: + - funlen + - goconst + - interfacer + - dupl + - lll + - goerr113 + - errcheck + - gocritic + - cyclop + - wrapcheck + - gocognit + - contextcheck + + exclude-dirs: + - internal/logic + + exclude-files: + - .*_test.go + + + +linters-settings: + gci: + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + gocognit: + # Minimal code complexity to report. + # Default: 30 (but we recommend 10-20) + min-complexity: 40 + nestif: + # Minimal complexity of if statements to report. + # Default: 5 + min-complexity: 10 + lll: + # Max line length, lines longer will be reported. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option. + # Default: 120. + line-length: 200 + # Tab width in spaces. + # Default: 1 + tab-width: 1 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8d28c23 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,71 @@ +version: "3.9" + +services: + app: + image: igs170911/comment:v1.0.4 + container_name: app-service + ports: + - "8080:8080" # 替換為您的應用服務的公開端口 + depends_on: + - mongo + - etcd + - redis + environment: + MONGO_URI: mongodb://mongo:27017/appdb + ETCD_ENDPOINT: http://etcd:2379 + REDIS_HOST: redis + REDIS_PORT: 6379 + networks: + - app-network + + mongo: + image: mongo:8.0 + container_name: mongo + restart: always + ports: + - "27017:27017" + environment: + MONGO_INITDB_ROOT_USERNAME: root + MONGO_INITDB_ROOT_PASSWORD: example + networks: + - app-network + volumes: + - mongo-data:/data/db + + etcd: + image: quay.io/coreos/etcd:v3.5.5 + container_name: etcd + restart: always + command: > + /usr/local/bin/etcd + --data-dir=/etcd-data + --name=etcd + --listen-client-urls=http://0.0.0.0:2379 + --advertise-client-urls=http://etcd:2379 + ports: + - "2379:2379" + - "2380:2380" + networks: + - app-network + volumes: + - etcd-data:/etcd-data + + redis: + image: redis:7.0 + container_name: redis + restart: always + ports: + - "6379:6379" + networks: + - app-network + volumes: + - redis-data:/data + +networks: + app-network: + driver: bridge + +volumes: + mongo-data: + etcd-data: + redis-data: \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e69de29