Skip to content

Commit

Permalink
feat: setup ddd structure and add system config domain
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotxx committed Aug 7, 2023
1 parent ac4fe3c commit 9b8f2f8
Show file tree
Hide file tree
Showing 74 changed files with 6,416 additions and 159 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.19
- name: Login to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v1
Expand All @@ -43,4 +43,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
14 changes: 7 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
matrix:
os: [ubuntu-latest]
steps:
- name: Set up Go 1.16
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.19
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@master
Expand All @@ -37,19 +37,19 @@ jobs:
name: Lint checks
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
- name: Set up Go 1.19
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.19
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@master
- name: Download golangci-lint
run: |
wget https://github.com/golangci/golangci-lint/releases/download/v1.41.0/golangci-lint-1.41.0-linux-amd64.tar.gz
tar -xvf ./golangci-lint-1.41.0-linux-amd64.tar.gz
wget https://github.com/golangci/golangci-lint/releases/download/v1.52.2/golangci-lint-1.52.2-linux-amd64.tar.gz
tar -xvf ./golangci-lint-1.52.2-linux-amd64.tar.gz
- name: Running golangci-lint
env:
GO111MODULE: on
GOPATH: /home/runner/work/
run: GOLINTER=./golangci-lint-1.41.0-linux-amd64/golangci-lint make lint
run: GOLINTER=./golangci-lint-1.52.2-linux-amd64/golangci-lint make lint
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
dist/
build/
_build/
coverage.out
tmp/
tmp/
*.log
log/
__debug_bin
.vscode/
.idea/
22 changes: 11 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ run:
linters:
disable-all: true
enable: # please keep this alphabetized
# Don't use soon to deprecated[1] linters that lead to false
# https://github.com/golangci/golangci-lint/issues/1841
# - deadcode
# - structcheck
# - varcheck
# Don't use soon to deprecated[1] linters that lead to false
# https://github.com/golangci/golangci-lint/issues/1841
# - deadcode
# - structcheck
# - varcheck
# - wsl
- ineffassign
- staticcheck
- unused
Expand All @@ -29,26 +30,25 @@ linters:
- exhaustive
- goconst
- gocritic
- gomnd
- gosec
# - gomnd
# - gosec
- misspell
- nolintlint
- prealloc
- predeclared
- revive
# - revive
- stylecheck
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- whitespace
- wsl

linters-settings:
gofumpt:
# Select the Go version to target. The default is `1.15`.
lang-version: "1.16"
lang-version: "1.19"
# Choose whether or not to use the extra rules that are disabled
# by default
extra-rules: false
extra-rules: false
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
- make gen-version
builds:
- env:
- CGO_ENABLED=0
Expand Down
36 changes: 26 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,44 @@ include go.mk

.PHONY: clean
clean: ## Clean build bundles
-rm -rf ./build
-rm -rf ./_build

.PHONY: build-all
build-all: build-darwin build-linux build-windows ## Build for all platforms

.PHONY: build-darwin
build-darwin: ## Build for MacOS
-rm -rf ./build/darwin
build-darwin: gen-version ## Build for MacOS
-rm -rf ./_build/darwin
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 \
go build -o ./build/darwin/$(APPROOT) \
go build -o ./_build/darwin/$(APPROOT) \
./cmd/main.go

.PHONY: build-linux
build-linux: ## Build for Linux
-rm -rf ./build/linux
build-linux: gen-version ## Build for Linux
-rm -rf ./_build/linux
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -o ./build/linux/$(APPROOT) \
go build -o ./_build/linux/$(APPROOT) \
./cmd/main.go

.PHONY: build-windows
build-windows: ## Build for Windows
-rm -rf ./build/windows
build-windows: gen-version ## Build for Windows
-rm -rf ./_build/windows
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
go build -o ./build/windows/$(APPROOT).exe \
go build -o ./_build/windows/$(APPROOT).exe \
./cmd/main.go

.PHONY: gen-api-docs
gen-api-docs: ## Generate API documentation with OpenAPI format
@which swag > /dev/null || (echo "Installing swag@v1.7.8 ..."; go install github.com/swaggo/swag/cmd/swag@v1.7.8 && echo "Installation complete!\n")
# Generate API documentation with OpenAPI format
-swag init --parseDependency --parseDepth 1 -g cmd/main.go -o api/openapispec/
# Format swagger comments
-swag fmt -g pkg/**/*.go
@echo "🎉 Done!"

.PHONY: gen-version
gen-version: ## Generate version file
# Delete old version file
-rm -f ./pkg/version/z_update_version.go
# Update version
-cd pkg/version/scripts && go run gen/gen.go

0 comments on commit 9b8f2f8

Please sign in to comment.