From d07025a2ea3fe1c570971b8bf01b868b5bb0e513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=9APS=E7=9A=84=E5=B0=8F=E7=A0=81=E5=86=9C?= <747357766@qq.com> Date: Tue, 6 Aug 2024 09:24:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=88=9D=E6=AD=A5=E5=8F=AF?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bazelrc | 1 + .cz.toml | 6 + .dockerignore | 32 + .github/workflows/go.yaml | 50 ++ .github/workflows/golangci-lint.yml | 63 ++ .github/workflows/pr.yaml | 20 + .github/workflows/release.yaml | 58 ++ .gitignore | 513 +++++++++++++++- .golangci.yml | 322 ++++++++++ BUILD.bazel | 54 +- CHANGELOG.md | 640 +++++++++++++++++++ Dockerfile | 78 +++ LICENSE | 674 ++++++++++++++++++++ MODULE.bazel | 39 +- MODULE.bazel.lock | 912 ++++++++++++++++++++++------ Makefile | 168 +++++ README.Docker.md | 22 + README.md | 146 ++++- WORKSPACE | 36 +- bazel-bazel_go_test | 1 - bazel-bin | 1 - bazel-go | 1 - bazel-out | 1 - bazel-testlogs | 1 - compose.yaml | 153 +++++ deps.bzl | 33 - go.mod | 2 +- lib/BUILD.bazel | 9 - lib/BUILD.bazel1 | 12 - lib/lib.go | 18 - hello.go => main.go | 0 sonar-project.properties | 14 + 32 files changed, 3745 insertions(+), 335 deletions(-) create mode 100644 .bazelrc create mode 100644 .cz.toml create mode 100644 .dockerignore create mode 100644 .github/workflows/go.yaml create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .github/workflows/pr.yaml create mode 100644 .github/workflows/release.yaml mode change 100755 => 100644 .gitignore create mode 100644 .golangci.yml create mode 100644 CHANGELOG.md create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.Docker.md delete mode 120000 bazel-bazel_go_test delete mode 120000 bazel-bin delete mode 120000 bazel-go delete mode 120000 bazel-out delete mode 120000 bazel-testlogs create mode 100644 compose.yaml delete mode 100644 deps.bzl delete mode 100644 lib/BUILD.bazel delete mode 100644 lib/BUILD.bazel1 delete mode 100644 lib/lib.go rename hello.go => main.go (100%) create mode 100644 sonar-project.properties diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..3ce91d2 --- /dev/null +++ b/.bazelrc @@ -0,0 +1 @@ +common --enable_bzlmod diff --git a/.cz.toml b/.cz.toml new file mode 100644 index 0000000..a6b57ae --- /dev/null +++ b/.cz.toml @@ -0,0 +1,6 @@ +[tool.commitizen] +name = "cz_conventional_commits" +tag_format = "$version" +version_scheme = "semver" +version = "0.5.4" +update_changelog_on_bump = true diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e5c60ab --- /dev/null +++ b/.dockerignore @@ -0,0 +1,32 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/go/build-context-dockerignore/ + +**/.DS_Store +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml new file mode 100644 index 0000000..e64465d --- /dev/null +++ b/.github/workflows/go.yaml @@ -0,0 +1,50 @@ +name: Go + +on: + push: + branches: + - main + paths: + - '**.go' + pull_request: + branches: + - main + paths: + - '**.go' + workflow_dispatch: { } + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '^1.20' + cache: true + + - uses: bazelbuild/setup-bazelisk@v2 + + - name: Mount bazel cache + id: cache-bazel + uses: actions/cache@v3 + with: + path: "/home/runner/.cache/bazel" + key: bazel + + - name: Build + run: make build + + - name: Test + run: make test + + - name: coverage + run: make coverage + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..1ea521a --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,63 @@ +name: golangci-lint + +on: + push: + branches: + - main + paths: + - '**.go' + pull_request: + branches: + - main + paths: + - '**.go' + workflow_dispatch: { } + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v4 + with: + go-version: '^1.21' + cache: true + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Require: The version of golangci-lint to use. + # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. + # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. + version: v1.54 + + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + # + # Note: By default, the `.golangci.yml` file should be at the root of the repository. + # The location of the configuration file can be changed by using `--config=` + # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true, then all caching functionality will be completely disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true, then the action won't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. + # skip-build-cache: true + + # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. + # install-mode: "goinstall" \ No newline at end of file diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..8e57088 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,20 @@ +name: Code Review GPT + +on: + pull_request: + branches: [main] + +jobs: + run_code_review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Code Review GPT + uses: mattzcarey/code-review-gpt@v0.1.8 + with: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + MODEL: 'gpt-4o' + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..8a61aee --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,58 @@ +name: Release + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '^1.20' + cache: true + + - uses: bazelbuild/setup-bazelisk@v2 + + - name: Mount bazel cache + id: cache-bazel + uses: actions/cache@v3 + with: + path: "/home/runner/.cache/bazel" + key: bazel + + - name: Build + run: make build + + - name: Test + run: make test + + - name: Docker Login + uses: docker/login-action@v2.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + run: | + make docker-push + + create-release: + runs-on: ubuntu-latest + permissions: + contents: write + needs: + - build + steps: + - name: Create Release + uses: ncipollo/release-action@v1.12.0 + with: + generateReleaseNotes: true + prerelease: false + makeLatest: true diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 index 4b830af..a5bb808 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,500 @@ -.idea +# Created by https://www.toptal.com/developers/gitignore/api/windows,linux,macos,vim,visualstudiocode,intellij+all,go,python,rust,react,helm,ansible,terraform +# Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,macos,vim,visualstudiocode,intellij+all,go,python,rust,react,helm,ansible,terraform + +### Ansible ### +*.retry + +### Go ### +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +### Helm ### +# Chart dependencies +**/charts/*.tgz + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General .DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments .env -goravel/public/admin -goravel/public/app -*.exe -/storage/* -!/storage/readme.md -./goravel -./goravel.db -frp/fipc.ini -goravel/tmp/* - -bazel-bin/* -bazel-go/* -bazel-out/* -bazel-testlogs/* \ No newline at end of file +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### react ### +.DS_* +logs +**/*.backup.* +**/*.back.* + +node_modules +bower_components + +*.sublime* + +psd +thumb +sketch + +### Rust ### +# Generated by Cargo +# will have compiled files and executables +debug/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +### Terraform ### +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,vim,visualstudiocode,intellij+all,go,python,rust,react,helm,ansible,terraform + +# Created by https://www.toptal.com/developers/gitignore/api/bazel +# Edit at https://www.toptal.com/developers/gitignore?templates=bazel + +### Bazel ### +# gitignore template for Bazel build system +# website: https://bazel.build/ + +# Ignore all bazel-* symlinks. There is no full list since this can change +# based on the name of the directory bazel is cloned into. +/bazel-* + +# Directories for the Bazel IntelliJ plugin containing the generated +# IntelliJ project files and plugin configuration. Seperate directories are +# for the IntelliJ, Android Studio and CLion versions of the plugin. +/.ijwb/ +/.aswb/ +/.clwb/ + +# End of https://www.toptal.com/developers/gitignore/api/bazel + +# Serverless directories +.serverless + +# golang output binary directory +bin + +deployments diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..fa7a62b --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,322 @@ +# This code is licensed under the terms of the MIT license https://opensource.org/license/mit +# Copyright (c) 2021 Marat Reymers + +## Golden config for golangci-lint v1.54.2 +# +# This is the best config for golangci-lint based on my experience and opinion. +# It is very strict, but not extremely strict. +# Feel free to adapt and change it for your needs. + +run: + # Timeout for analysis, e.g. 30s, 5m. + # Default: 1m + timeout: 1m + + +# This file contains only configs which differ from defaults. +# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml +linters-settings: + cyclop: + # The maximal code complexity to report. + # Default: 10 + max-complexity: 30 + # The maximal average package complexity. + # If it's higher than 0.0 (float) the check is enabled + # Default: 0.0 + package-average: 10.0 + + errcheck: + # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. + # Such cases aren't reported by default. + # Default: false + check-type-assertions: true + + exhaustive: + # Program elements to check for exhaustiveness. + # Default: [ switch ] + check: + - switch + - map + + exhaustruct: + # List of regular expressions to exclude struct packages and names from check. + # Default: [] + exclude: + # std libs + - "^net/http.Client$" + - "^net/http.Cookie$" + - "^net/http.Request$" + - "^net/http.Response$" + - "^net/http.Server$" + - "^net/http.Transport$" + - "^net/url.URL$" + - "^os/exec.Cmd$" + - "^reflect.StructField$" + # public libs + - "^github.com/Shopify/sarama.Config$" + - "^github.com/Shopify/sarama.ProducerMessage$" + - "^github.com/mitchellh/mapstructure.DecoderConfig$" + - "^github.com/prometheus/client_golang/.+Opts$" + - "^github.com/spf13/cobra.Command$" + - "^github.com/spf13/cobra.CompletionOptions$" + - "^github.com/stretchr/testify/mock.Mock$" + - "^github.com/testcontainers/testcontainers-go.+Request$" + - "^github.com/testcontainers/testcontainers-go.FromDockerfile$" + - "^golang.org/x/tools/go/analysis.Analyzer$" + - "^google.golang.org/protobuf/.+Options$" + - "^gopkg.in/yaml.v3.Node$" + + funlen: + # Checks the number of lines in a function. + # If lower than 0, disable the check. + # Default: 60 + lines: 100 + # Checks the number of statements in a function. + # If lower than 0, disable the check. + # Default: 40 + statements: 50 + # Ignore comments when counting lines. + # Default false + ignore-comments: true + + gocognit: + # Minimal code complexity to report. + # Default: 30 (but we recommend 10-20) + min-complexity: 20 + + gocritic: + # Settings passed to gocritic. + # The settings key is the name of a supported gocritic checker. + # The list of supported checkers can be find in https://go-critic.github.io/overview. + settings: + captLocal: + # Whether to restrict checker to params only. + # Default: true + paramsOnly: false + underef: + # Whether to skip (*x).method() calls where x is a pointer receiver. + # Default: true + skipRecvDeref: false + + gomnd: + # List of function patterns to exclude from analysis. + # Values always ignored: `time.Date`, + # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, + # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. + # Default: [] + ignored-functions: + - flag.Arg + - flag.Duration.* + - flag.Float.* + - flag.Int.* + - flag.Uint.* + - os.Chmod + - os.Mkdir.* + - os.OpenFile + - os.WriteFile + - prometheus.ExponentialBuckets.* + - prometheus.LinearBuckets + + gomodguard: + blocked: + # List of blocked modules. + # Default: [] + modules: + - github.com/golang/protobuf: + recommendations: + - google.golang.org/protobuf + reason: "see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules" + - github.com/satori/go.uuid: + recommendations: + - github.com/google/uuid + reason: "satori's package is not maintained" + - github.com/gofrs/uuid: + recommendations: + - github.com/google/uuid + reason: "gofrs' package is not go module" + + govet: + # Enable all analyzers. + # Default: false + enable-all: true + # Disable analyzers by name. + # Run `go tool vet help` to see all analyzers. + # Default: [] + disable: + - fieldalignment # too strict + # Settings per analyzer. + settings: + shadow: + # Whether to be strict about shadowing; can be noisy. + # Default: false + strict: true + + nakedret: + # Make an issue if func has more lines of code than this setting, and it has naked returns. + # Default: 30 + max-func-lines: 0 + + nolintlint: + # Exclude following linters from requiring an explanation. + # Default: [] + allow-no-explanation: [ funlen, gocognit, lll ] + # Enable to require an explanation of nonzero length after each nolint directive. + # Default: false + require-explanation: true + # Enable to require nolint directives to mention the specific linter being suppressed. + # Default: false + require-specific: true + + rowserrcheck: + # database/sql is always checked + # Default: [] + packages: + - github.com/jmoiron/sqlx + + tenv: + # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. + # Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. + # Default: false + all: true + + +linters: + disable-all: true + enable: + ## enabled by default + - errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases + - gosimple # specializes in simplifying a code + - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string + - ineffassign # detects when assignments to existing variables are not used + - staticcheck # is a go vet on steroids, applying a ton of static analysis checks + - typecheck # like the front-end of a Go compiler, parses and type-checks Go code +# - unused # checks for unused constants, variables, functions and types + ## disabled by default + - asasalint # checks for pass []any as any in variadic func(...any) + - asciicheck # checks that your code does not contain non-ASCII identifiers + - bidichk # checks for dangerous unicode character sequences + - bodyclose # checks whether HTTP response body is closed successfully + - cyclop # checks function and package cyclomatic complexity + - dupl # tool for code clone detection + - durationcheck # checks for two durations multiplied together + - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error + - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13 + - execinquery # checks query string in Query function which reads your Go src files and warning it finds + - exhaustive # checks exhaustiveness of enum switch statements + - exportloopref # checks for pointers to enclosing loop variables +# - forbidigo # forbids identifiers + - funlen # tool for detection of long functions + - gocheckcompilerdirectives # validates go compiler directive comments (//go:) +# - gochecknoglobals # checks that no global variables exist +# - gochecknoinits # checks that no init functions are present in Go code + - gocognit # computes and checks the cognitive complexity of functions + - goconst # finds repeated strings that could be replaced by a constant + - gocritic # provides diagnostics that check for bugs, performance and style issues + - gocyclo # computes and checks the cyclomatic complexity of functions +# - godot # checks if comments end in a period + - goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt +# - gomnd # detects magic numbers + - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod + - gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations + - goprintffuncname # checks that printf-like functions are named with f at the end + - gosec # inspects source code for security problems + - lll # reports long lines + - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap) + - makezero # finds slice declarations with non-zero initial length + - mirror # reports wrong mirror patterns of bytes/strings usage + - musttag # enforces field tags in (un)marshaled structs + - nakedret # finds naked returns in functions greater than a specified function length + - nestif # reports deeply nested if statements +# - nilerr # finds the code that returns nil even if it checks that the error is not nil + - nilnil # checks that there is no simultaneous return of nil error and an invalid value + - noctx # finds sending http request without context.Context + - nolintlint # reports ill-formed or insufficient nolint directives +# - nonamedreturns # reports all named returns + - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL + - predeclared # finds code that shadows one of Go's predeclared identifiers + - promlinter # checks Prometheus metrics naming via promlint + - reassign # checks that package variables are not reassigned +# - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint + - rowserrcheck # checks whether Err of rows is checked successfully + - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed + - stylecheck # is a replacement for golint + - tenv # detects using os.Setenv instead of t.Setenv since Go1.17 + - testableexamples # checks if examples are testable (have an expected output) +# - testpackage # makes you use a separate _test package + - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes + - unconvert # removes unnecessary type conversions + - unparam # reports unused function parameters + - usestdlibvars # detects the possibility to use variables/constants from the Go standard library + - wastedassign # finds wasted assignment statements + - whitespace # detects leading and trailing whitespace + + ## you may want to enable + #- decorder # checks declaration order and count of types, constants, variables and functions + #- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized + #- gci # controls golang package import order and makes it always deterministic + #- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega + #- godox # detects FIXME, TODO and other comment keywords + #- goheader # checks is file header matches to pattern + #- interfacebloat # checks the number of methods inside an interface + #- ireturn # accept interfaces, return concrete types + #- prealloc # [premature optimization, but can be used in some cases] finds slice declarations that could potentially be preallocated + #- tagalign # checks that struct tags are well aligned + #- varnamelen # [great idea, but too many false positives] checks that the length of a variable's name matches its scope + #- wrapcheck # checks that errors returned from external packages are wrapped + #- zerologlint # detects the wrong usage of zerolog that a user forgets to dispatch zerolog.Event + + ## disabled + #- containedctx # detects struct contained context.Context field + #- contextcheck # [too many false positives] checks the function whether use a non-inherited context + #- depguard # [replaced by gomodguard] checks if package imports are in a list of acceptable packages + #- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) + #- dupword # [useless without config] checks for duplicate words in the source code + #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted + #- forcetypeassert # [replaced by errcheck] finds forced type assertions + #- goerr113 # [too strict] checks the errors handling expressions + #- gofmt # [replaced by goimports] checks whether code was gofmt-ed + #- gofumpt # [replaced by goimports, gofumports is not available yet] checks whether code was gofumpt-ed + #- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase + #- grouper # analyzes expression groups + #- importas # enforces consistent import aliases + #- maintidx # measures the maintainability index of each function + #- misspell # [useless] finds commonly misspelled English words in comments + #- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity + #- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test + #- tagliatelle # checks the struct tags + #- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers + #- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines + + ## deprecated + #- deadcode # [deprecated, replaced by unused] finds unused code + #- exhaustivestruct # [deprecated, replaced by exhaustruct] checks if all struct's fields are initialized + #- golint # [deprecated, replaced by revive] golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes + #- ifshort # [deprecated] checks that your code uses short syntax for if-statements whenever possible + #- interfacer # [deprecated] suggests narrower interface types + #- maligned # [deprecated, replaced by govet fieldalignment] detects Go structs that would take less memory if their fields were sorted + #- nosnakecase # [deprecated, replaced by revive var-naming] detects snake case of variable naming and function name + #- scopelint # [deprecated, replaced by exportloopref] checks for unpinned variables in go programs + #- structcheck # [deprecated, replaced by unused] finds unused struct fields + #- varcheck # [deprecated, replaced by unused] finds unused global variables and constants + + +issues: + # Maximum count of issues with the same text. + # Set to 0 to disable. + # Default: 3 + max-same-issues: 50 + + exclude-rules: + - source: "(noinspection|TODO)" + linters: [ godot ] + - source: "//noinspection" + linters: [ gocritic ] + - path: "_test\\.go" + linters: + - bodyclose + - dupl + - funlen + - goconst + - gosec + - noctx + - wrapcheck diff --git a/BUILD.bazel b/BUILD.bazel index c08eec1..fe1172c 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,33 +1,47 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") -# load("@bazel_gazelle//:def.bzl", "gazelle") - -# gazelle(name = "gazelle") - load("@gazelle//:def.bzl", "gazelle") +load("@rules_go//go:def.bzl", "go_binary", "go_library") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push", "oci_tarball") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +# gazelle:prefix hello +# gazelle:proto disable_global gazelle(name = "gazelle") -# adding rule to update deps -gazelle( - name = "gazelle-update-repos", - args = [ - "-from_file=go.mod", - "-to_macro=deps.bzl%go_dependencies", - "-prune", - ], - command = "update-repos", +pkg_tar( + name = "tar", + srcs = [":godine"], ) -# gazelle:prefix hello -go_binary( - name = "hello", - embed = [":hello_lib"], - visibility = ["//visibility:public"], + +oci_image( + name = "image", + base = "@alpine", + entrypoint = ["/godine"], + tars = [":tar"], +) + +oci_tarball( + name = "tarball", + image = ":image", + repo_tags = ["ghcr.io/blackhorseya/godine:latest"], +) + +oci_push( + name = "push", + image = ":image", + remote_tags = ["latest"], + repository = "ghcr.io/blackhorseya/godine", ) go_library( name = "hello_lib", - srcs = ["hello.go"], + srcs = ["main.go"], importpath = "hello", visibility = ["//visibility:private"], deps = ["//lib"], ) + +go_binary( + name = "hello", + embed = [":hello_lib"], + visibility = ["//visibility:public"], +) diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ce8b875 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,640 @@ +## 0.5.4 (2024-07-23) + +### Feat + +- implement HTML templates in user RESTful API +- implement tracing for list payments function (#95) +- improve error handling and tracing in payment function +- implement tracing for list payments function + +## 0.5.3 (2024-07-23) + +### Feat + +- consolidate file embedding and path structure +- integrate MongoDB client and payment repository (#94) +- integrate MongoDB client and payment repository + +## 0.5.2 (2024-07-23) + +### Feat + +- integrate Wirex payment adapter into project (#93) +- integrate RESTful payment adapter in start command +- refactor signal handling and testing +- consolidate RESTful API definitions and implementations +- integrate Wirex payment adapter into project +- update dependency management and error handling in MongoDB integration (#92) +- refactor functions for improved error handling +- optimize MongoDB integration with OpenTelemetry tracing +- update dependency management and error handling in MongoDB integration +- create mock payment files for payment repository (#91) +- create mock payment files for payment repository +- refactor payment service and add BUILD file (#90) +- refactor payment service and add BUILD file +- consolidate new files in `biz` package +- implement payment model in Bazel build system (#89) +- implement payment model in Bazel build system +- implement secure logout functionality (#88) +- implement secure logout functionality +- implement user authentication and styling enhancements +- create new user interface template for web page (#87) +- implement IsAuthenticated middleware for user authentication +- update user profile route and template display +- create new user interface template for web page +- integrate new features and dependencies in code base (#86) +- integrate new features and dependencies in code base +- improve user authentication process (#85) +- improve user authentication process +- refactor authentication infrastructure (#84) +- enhance home page functionality and design +- refactor authentication infrastructure in `app/infra/authx` +- refactor MongoDB testing and dependencies + +### Refactor + +- refactor package imports and function signatures +- refactor error handling for missing resources +- refactor user model package imports and function return types +- refactor database package to use GORM instead of MariaDB +- update database driver to postgresqlx throughout the codebase +- refactor code organization and remove unnecessary OpenAPI spec values + +## 0.5.1 (2024-07-18) + +## 0.5.1-rc0 (2024-07-18) + +### Feat + +- refactor response handling and user creation logic (#75) +- refactor response handling and user creation logic + +### Refactor + +- refactor order creation and update process (#80) +- refactor order creation and update process +- improve error handling and test functions (#78) +- improve error handling and test functions +- improve efficiency of order count retrieval (#77) +- improve efficiency of order count retrieval +- refactor error handling in test files (#74) +- refactor error handling in test files +- consolidate error handling logic across files (#73) +- consolidate error handling logic across files + +## 0.5.0 (2024-07-08) + +### Refactor + +- update variable names for clarity + +## 0.4.10 (2024-07-08) + +### Feat + +- refactor database configuration options +- improve error handling and logging across project + +## 0.4.9 (2024-07-07) + +### Feat + +- refactor transaction handling and session creation +- refactor load testing targets and scenarios + +## 0.4.8 (2024-07-07) + +### Feat + +- improve transaction handling and error checking + +## 0.4.7 (2024-07-07) + +### Fix + +- improve transaction isolation handling + +## 0.4.6 (2024-07-06) + +## 0.4.5 (2024-07-06) + +### Feat + +- improve service initialization and error handling (#71) +- improve server shutdown logging for multiple adapters +- implement graceful shutdown for server +- improve service initialization and error handling +- refactor command execution logic in main loop +- introduce new service listing functionality + +### Refactor + +- refactor signal handling and remove otelx references +- refactor and clean up code in multiple adapter packages +- improve error handling and signal handling +- refactor service commands in `start.go` and `cmdx.go` + +## 0.4.4 (2024-07-06) + +### Feat + +- refactor configuration package in `configx` module +- add Configuration Field to Injector Struct (#68) +- improve error handling and dynamic config file path logic +- refactor configuration initialization across multiple files +- add Configuration Field to Injector Struct +- improve transaction handling and error logging (#67) +- improve transaction handling and error logging + +### Fix + +- refactor application initialization for configuration injection +- improve error handling and rollback in mariadb functions + +### Refactor + +- refactor codebase for improved efficiency +- refactor code to remove unnecessary variables +- refactor code to include `app *configx.Application` parameter +- refactor Configuration struct properties (#70) +- refactor Configuration struct properties +- update HTTP client functions to accept config parameter +- refactor configuration handling in external tests +- refactor configuration handling in wire setup +- refactor initialization process to use viper parameter +- refactor initialization process for better parameter passing +- refactor application configuration handling +- refactor initialization and imports in test files +- refactor configuration handling in cmdx package + +## 0.4.3 (2024-07-06) + +### Feat + +- refactor snowflake node ID generation + +### Refactor + +- update order ID values throughout API tests + +## 0.4.2 (2024-07-06) + +### Feat + +- refactor Order struct to include BigIntID field (#66) +- refactor Order struct to include BigIntID field +- implement snowflake node creation and ID generation +- add new field `NewID` to Order struct +- update `orderId` value in API endpoints + +### Refactor + +- refactor order model and error logging +- refactor order ID generation across files +- set default value for order.NewID when not provided + +## 0.4.1 (2024-07-05) + +### Feat + +- update GORM implementation in Order struct (#63) +- update GORM implementation in Order struct +- implement database integration with MariaDB +- improve error handling and tracing throughout codebase +- consolidate default limit and offset handling +- improve error handling and testing for order functions +- improve logging functionality across the codebase +- improve transaction handling for order creation +- update order creation process in domain package +- refactor mariadb module for dependency injection (#60) +- implement logging and tracing in `mariadb.go` +- refactor test setup and configuration handling +- refactor MariaDB external tester configuration +- refactor mariadb module for dependency injection +- optimize MySQL client connection settings +- add support for MariaDB integration +- configure `mariadb` service and volume (#58) +- configure `mariadb` service and volume +- consolidate MySQL configurations in app.go + +### Fix + +- refactor return statements in BeforeSave and AfterFind +- improve error handling and import statements in Mariadb files + +### Refactor + +- optimize database queries in mariadb.go +- refactor struct tags for Order and OrderItem models (#62) +- improve error handling and context in List function +- refactor struct tags for Order and OrderItem models +- refactor order repository to use gorm instead of sqlx + +## 0.4.0 (2024-07-04) + +### Feat + +- refactor database schema and model initialization + +### Refactor + +- update database column types to BIGINT + +## 0.3.7 (2024-07-04) + +### Feat + +- update order and user information in API endpoints + +### Perf + +- optimize MongoDB query performance + +## 0.3.6 (2024-07-03) + +### Feat + +- improve restaurant data handling and caching + +### Refactor + +- convert string IDs to ObjectIDs for MongoDB queries (#56) +- refactor code to use ObjectID for filter operations +- refactor UnmarshalBSON functions in multiple models +- convert string IDs to ObjectIDs for MongoDB queries +- refactor ID generation and imports in MongoDB model files + +## 0.3.5 (2024-07-03) + +### Feat + +- implement caching functionality for restaurant data in Redis (#55) +- implement caching functionality for restaurant data in Redis +- integrate Redis service and configurations across services (#54) +- integrate Redis service and configurations across services +- refactor Redis configuration and dependencies (#52) +- refactor Redis configuration and dependencies + +### Refactor + +- refactor error handling and logging logic across multiple files +- update IDs in test and request files + +## 0.3.4 (2024-07-02) + +### Feat + +- improve network performance and reliability +- optimize connection pool configuration in NewClientWithDSN function +- improve API test suite and assertions + +## 0.3.3 (2024-07-02) + +### Feat + +- optimize connection pool configuration in NewClientWithDSN function + +## 0.3.2 (2024-07-02) + +### Refactor + +- update data type of X-Total-Count header in API endpoints + +## 0.3.1 (2024-06-29) + +## 0.3.0 (2024-06-27) + +### Feat + +- improve error handling and data parsing in API requests +- refactor error handling and implement user list functionality in HTTP client (#47) +- refactor error handling and status code checks +- improve error handling and response parsing in DeleteUser method +- improve user update functionality with tracing and error handling +- refactor error handling and implement user list functionality in HTTP client + +### Fix + +- improve error handling in logistics HTTP client (#48) +- improve error handling in logistics HTTP client + +### Refactor + +- refactor notification service methods +- update error handling in logistics HTTP client files + +## 0.2.3 (2024-06-27) + +### Feat + +- implement new CRUD endpoints and Swagger definitions (#46) +- refactor URL path concatenation using constant variable +- improve error handling and user status functionality +- update user information with error handling and return updated info +- implement new CRUD endpoints and Swagger definitions +- improve error handling and logging in UpdateMenuItem function (#45) +- improve error handling and logging in UpdateMenuItem function +- improve error handling and HTTP request in UpdateRestaurant function (#44) +- refactor restaurant HTTP client for error handling +- implement error handling and HTTP logic for DeleteRestaurant method +- improve error handling and HTTP request in UpdateRestaurant function +- refactor update and delete operations for restaurant model (#43) +- refactor update and delete operations for restaurant model +- improve restaurant entity management and error handling (#42) +- refactor restaurant API delete functionality +- improve restaurant entity management and error handling +- implement PUT and DELETE functionality for items API (#41) +- implement PUT and DELETE functionality for items API +- add restaurant api router +- improve error handling and logging in menu HTTP client (#40) +- improve error handling and logging in menu HTTP client +- implement new delivery status changed handler in biz directory +- consolidate logistics handling functionality (#39) +- refactor delivery status handling in logistics module +- consolidate logistics handling functionality +- implement dependency injection using Wire in handler package (#38) +- implement dependency injection using Wire in handler package +- improve logging in KafkaEventBus +- introduce a new function for creating writers with specified topics +- consolidate topic name usage in Kafka event bus +- integrate MQX event bus into logistics module +- introduce new event handling functionality (#37) +- integrate Kafka event bus into transport and update methods +- implement in-memory event bus with registration and publishing capabilities +- implement MQX transport for event bus integration +- introduce new event handling functionality +- consolidate event handling functionality +- refactor delivery status change methods across services +- implement Kafka message delivery for status updates +- update Kafka configuration and dependencies across files +- integrate Kafka configurations for new broker service + +### Refactor + +- improve context handling in user deletion process +- refactor user model references in http_client.go +- refactor order service methods and interfaces +- standardize error handling with `errorx` package +- standardize span naming conventions across files +- refactor restaurant API URL construction in http client +- standardize field name for page size across restaurant domain +- optimize imports across the codebase +- update `IsOpen` field in restaurant structs +- refactor event bus handling and logging in Kafka integration +- refactor event handling in logistics domain +- refactor event handling in delivery system +- refactor event handling to use topic instead of event type +- refactor error handling and logging in logistics and event bus modules +- refactor restaurant ID field in PostPayload struct +- refactor order handling interfaces +- refactor Kafka topic handling throughout the codebase + +## 0.2.2 (2024-06-26) + +### Feat + +- refactor delivery status handling in logistics service +- update PATCH route and Swagger documentation in logistics API +- improve state transition handling in delivery process (#35) +- improve state transition handling in delivery process +- refactor default status handling in deliveries +- refactor model package and update dependencies +- improve error handling and notifications +- improve error handling and order retrieval in API functions +- refactor API handling for PatchWithStatus functionality +- update order status endpoint and documentation + +### Refactor + +- refactor delivery status handling in `delivery_state.go` files +- refactor delivery status handling in model logic + +## 0.2.1 (2024-06-26) + +### Feat + +- refactor notification creation in order process +- refactor notification HTTP client functionality in Go codebase (#33) +- improve error handling and response parsing +- improve notification handling and error checking +- update notification API functionality (#32) +- update notification API functionality +- refactor notification HTTP client functionality in Go codebase +- implement RESTful API routing for notifications (#31) +- introduce new RESTful notifications API framework +- implement RESTful API routing for notifications +- implement error handling and result count logic across files +- refactor dependency management and notifications in MongoDB integration +- integrate new notification features across files +- introduce notifications functionality into the repo package (#28) +- implement MongoDB notification repository functionality +- introduce notifications functionality into the repo package +- create new notification adapter for wirex integration (#27) +- integrate new `notify_restful` service into compose configuration +- implement real-time notification feature with `notify` module +- integrate new NotifyRestful application configuration +- create new notification adapter for wirex integration +- consolidate notification business logic into separate package + +### Fix + +- improve error handling in GetByID function + +### Refactor + +- update naming convention for notification services +- refactor notification handling to use model.Notification struct +- refactor imports for notification module +- refactor UpdateStatus function and improve error handling +- remove references to notification biz from order adapter + +## 0.2.0 (2024-06-25) + +### Feat + +- integrate OTel collector, Jaeger, and Prometheus services (#24) +- integrate OTel collector, Jaeger, and Prometheus services +- implement NewDelivery method and dependencies (#22) +- improve order creation and update functionality +- refactor order model to include delivery ID +- implement NewDelivery method and dependencies +- integrate logistics business logic into order module (#21) +- refactor error handling and response parsing in GetDelivery method +- consolidate dependencies and implement new method +- integrate logistics business logic into order module +- improve error handling and imports across files (#20) +- improve error handling and context in GetByID function +- improve error handling and documentation in Handle function +- improve error handling and imports across files +- introduce new deliveries API handlers and documentation (#19) +- improve delivery management API endpoints +- introduce new deliveries API handlers and documentation +- refactor filter conditions for driver_id in List function +- improve delivery service functionality (#18) +- improve delivery tracking functionality +- improve delivery service functionality +- implement distributed tracing with otelx package +- add dependencies and implement Create method in mongodb.go (#17) +- refactor MongoDB deliveries Delete method +- implement timeout and filter options in MongoDB list function +- add dependencies and implement Create method in mongodb.go +- introduce RESTful API for logistics service + +### Fix + +- improve database update operations and error handling +- refactor error handling in MongoDB operations + +### Refactor + +- improve code quality and readability in order creation process +- refactor code for improved efficiency +- refactor UpdateDeliveryStatus function + +## 0.1.3 (2024-06-25) + +### Feat + +- consolidate new files for logistics/restful and wirex (#15) +- consolidate new files for logistics/restful and wirex +- integrate new LogisticsRestful application into Configuration struct +- consolidate Bazel build configuration for wirex module +- consolidate logistics domain files into biz directory (#14) +- integrate dependency injection with Wire framework +- consolidate logistics domain files into biz directory +- consolidate logistics business entity files +- consolidate delivery module files into separate directory +- create new structs for delivery entities and addresses (#11) +- create new structs for delivery entities and addresses + +### Refactor + +- refactor delivery methods in `ILogisticsBiz` interface (#13) +- refactor delivery methods in `ILogisticsBiz` interface + +## 0.1.2 (2024-06-25) + +### Feat + +- implement error handling and list orders functionality (#10) +- refactor GetByID function for improved error handling and order information retrieval +- implement error handling and list orders functionality +- refactor API endpoints and Swagger documentation (#9) +- refactor API endpoints and Swagger documentation +- refactor tracing and error handling in order.go (#8) +- refactor tracing and error handling in order.go +- improve error handling and listing logic in functions (#6) +- improve error handling and listing logic in functions +- refactor order status handling and transitions (#5) +- enhance JSON serialization for Order struct +- implement Unmarshal methods for Order struct +- refactor order status handling and transitions +- refactor MongoDB integration in order service +- refactor order creation process (#4) +- enhance payload handling for orders API requests +- refactor order creation process +- update order API payloads and documentation +- refactor order creation process in `order.go` +- generate order items based on menu items and options +- consolidate restaurant menu endpoint logic (#2) +- consolidate restaurant menu endpoint logic +- refactor order business logic across multiple files (#1) +- refactor menuService implementation in NewOrderBiz function +- refactor order business logic across multiple files +- improve error handling and menu retrieval in API +- refactor naming conventions in codebase +- add user level field to API documentation +- refactor order creation process +- refactor HTTP client methods in biz library +- update user struct to include new level field +- update user retrieval functionality and Swagger documentation +- add RESTful API for user management in adapter user module +- integrate user-restful adapter into project +- consolidate user restful API and wirex implementations +- refactor user management and add `IsActive` field +- implement user-based filtering for update and delete operations +- refactor MongoDB list function for better error handling +- refactor user creation logic and data types +- implement Bazel build system and user repository interface +- refactor user methods to accept ID as string +- integrate RESTful order API versioning into system +- refactor order business logic and dependencies +- refactor error handling and API requests in restaurant HTTP client +- integrate UUID library for API endpoint retrieval +- update restaurant library with new HTTP client functions +- consolidate order domain and repository entity files + +### Fix + +- improve error handling and query options in user functions +- improve error handling for HTTP requests + +### Refactor + +- refactor return type of ListOrders to use pointers +- refactor order listing functions and structs (#7) +- refactor order listing functions and structs +- consolidate duplicate code in list functions +- refactor UpdateStatus method across multiple files +- refactor order state handling and add pending state functionality +- refactor API pagination parameters +- refactor parameter naming in CreateOrder function +- update data types from uuid.UUID to string across files (#3) +- update data types from uuid.UUID to string across files +- refactor order item initialization in CreateOrder function +- refactor user business logic across modules +- refactor user model and remove aggregate functionality +- refactor restaurant HTTP client functionality +- refactor data types and variable names in order models + +## 0.1.1 (2024-06-13) + +### Feat + +- introduce Swagger documentation for order restful API +- refactor order wirex adapter configuration and build process +- add new POST method and documentation for menu items +- refactor API endpoints and update Swagger documentation +- create endpoint for posting restaurants and update swagger docs +- integrate v1 restful API for restaurant handling +- implement v1 restful API endpoints with Go_library targets +- improve error handling and update menu logic +- improve error handling and traceability in menu functionality +- refactor menuBiz struct and NewMenuBiz function +- refactor restaurant domain logic and models +- integrate MongoDB options for restaurant listing +- improve error handling and add timeouts to methods +- consolidate MongoDB package functionality +- create initial files for restaurant package and repo +- consolidate new functionality for the biz domain +- implement order-related methods and build file for `biz` package +- consolidate new files into biz directory +- implement CRUD operations for user management in IUserBiz interface +- consolidate business logic and structures +- consolidate new files for `model` package +- introduce new files to the `model` package +- implement restaurant model with necessary files and functions +- refactor health check endpoint and Swagger definitions +- refactor server start command using Cobra +- update Swagger documentation and add Bazel files for restaurant API +- implement dependency injection in restaurant adapter +- consolidate configuration files in app/infra/configx +- consolidate package structure into `pkg/cmdx` folder +- create new `adapterx` package with BUILD.bazel and adapterx.go files +- implement logging package with options and initialization +- implement custom error handling with errorx package + +### Refactor + +- refactor menu API and business logic +- improve error handling and logging for restaurant operations +- refactor restaurant aggregation logic in model files +- refactor struct field names and introduce new module in Bazel build + +## 0.1.0 (2024-06-10) + +### Feat + +- consolidate netx package structure +- introduce new cmd target and go_binary in Bazel files +- update workspace definitions for new project integration diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2293a63 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,78 @@ +# syntax=docker/dockerfile:1 + +# Comments are provided throughout this file to help you get started. +# If you need more help, visit the Dockerfile reference guide at +# https://docs.docker.com/go/dockerfile-reference/ + +# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 + +################################################################################ +# Create a stage for building the application. +ARG GO_VERSION=1.22.3 +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build +WORKDIR /src + +# Download dependencies as a separate step to take advantage of Docker's caching. +# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds. +# Leverage bind mounts to go.sum and go.mod to avoid having to copy them into +# the container. +RUN --mount=type=cache,target=/go/pkg/mod/ \ + --mount=type=bind,source=go.sum,target=go.sum \ + --mount=type=bind,source=go.mod,target=go.mod \ + go mod download -x + +# This is the architecture you’re building for, which is passed in by the builder. +# Placing it here allows the previous steps to be cached across architectures. +ARG TARGETARCH + +# Build the application. +# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds. +# Leverage a bind mount to the current directory to avoid having to copy the +# source code into the container. +RUN --mount=type=cache,target=/go/pkg/mod/ \ + --mount=type=bind,target=. \ + CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server . + +################################################################################ +# Create a new stage for running the application that contains the minimal +# runtime dependencies for the application. This often uses a different base +# image from the build stage where the necessary files are copied from the build +# stage. +# +# The example below uses the alpine image as the foundation for running the app. +# By specifying the "latest" tag, it will also use whatever happens to be the +# most recent version of that image when you build your Dockerfile. If +# reproducability is important, consider using a versioned tag +# (e.g., alpine:3.17.2) or SHA (e.g., alpine@sha256:c41ab5c992deb4fe7e5da09f67a8804a46bd0592bfdf0b1847dde0e0889d2bff). +FROM alpine:latest AS final + +# Install any runtime dependencies that are needed to run your application. +# Leverage a cache mount to /var/cache/apk/ to speed up subsequent builds. +RUN --mount=type=cache,target=/var/cache/apk \ + apk --update add \ + ca-certificates \ + tzdata \ + && \ + update-ca-certificates + +# Create a non-privileged user that the app will run under. +# See https://docs.docker.com/go/dockerfile-user-best-practices/ +ARG UID=10001 +RUN adduser \ + --disabled-password \ + --gecos "" \ + --home "/nonexistent" \ + --shell "/sbin/nologin" \ + --no-create-home \ + --uid "${UID}" \ + appuser +USER appuser + +# Copy the executable from the "build" stage. +COPY --from=build /bin/server /bin/ + +# Expose the port that the application listens on. +EXPOSE 8080 + +# What the container should run when it is started. +ENTRYPOINT [ "/bin/server" ] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/MODULE.bazel b/MODULE.bazel index 54f7c2a..2f1530f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,11 +4,44 @@ # # For more details, please check https://github.com/bazelbuild/bazel/issues/18958 ############################################################################### - +bazel_dep(name = "rules_go", version = "0.48.0") bazel_dep(name = "gazelle", version = "0.37.0") go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//:go.mod") -use_repo( - go_deps, +use_repo(go_deps, "com_github_redis_go_redis_v9") + +bazel_dep(name = "rules_oci", version = "1.4.0") +bazel_dep(name = "rules_pkg", version = "0.9.1") + +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") +oci.pull( + name = "alpine", + digest = "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + image = "docker.io/library/alpine", + platforms = [ + "linux/386", + "linux/amd64", + "linux/arm/v6", + "linux/arm/v7", + "linux/arm64/v8", + "linux/ppc64le", + "linux/s390x", + ], +) +use_repo(oci, "alpine") + +go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") + +# Download an SDK for the host OS & architecture as well as common remote execution platforms. +go_sdk.download(version = "1.22.1") + +# Alternately, download an SDK for a fixed OS/architecture. +go_sdk.download( + goarch = "amd64", + goos = "linux", + version = "1.22.1", ) + +# Register the Go SDK installed on the host. +go_sdk.host() diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 177d2ba..d6d40ff 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -7,15 +7,19 @@ "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", + "https://bcr.bazel.build/modules/aspect_bazel_lib/1.32.0/MODULE.bazel": "67ac1c347f4954603280a4559c2a5b7c4dfdc40950bf15eb9a77d824ef933707", + "https://bcr.bazel.build/modules/aspect_bazel_lib/1.32.0/source.json": "9e7323acbf8d6a7d142e7101165e25ee65514c1e3a231a201401aac6eef79bb5", "https://bcr.bazel.build/modules/bazel_features/1.1.0/MODULE.bazel": "cfd42ff3b815a5f39554d97182657f8c4b9719568eb7fded2b9135f084bf760b", "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/source.json": "082ed5f9837901fada8c68c2f3ddc958bb22b6d654f71dd73f3df30d45d4b749", @@ -24,6 +28,7 @@ "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8", "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350", "https://bcr.bazel.build/modules/gazelle/0.34.0/MODULE.bazel": "abdd8ce4d70978933209db92e436deb3a8b737859e9354fb5fd11fb5c2004c8a", + "https://bcr.bazel.build/modules/gazelle/0.36.0/MODULE.bazel": "e375d5d6e9a6ca59b0cb38b0540bc9a05b6aa926d322f2de268ad267a2ee74c0", "https://bcr.bazel.build/modules/gazelle/0.37.0/MODULE.bazel": "d1327ba0907d0275ed5103bfbbb13518f6c04955b402213319d0d6c0ce9839d4", "https://bcr.bazel.build/modules/gazelle/0.37.0/source.json": "b3adc10e2394e7f63ea88fb1d622d4894bfe9ec6961c493ae9a887723ab16831", "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", @@ -47,24 +52,31 @@ "https://bcr.bazel.build/modules/rules_go/0.41.0/MODULE.bazel": "55861d8e8bb0e62cbd2896f60ff303f62ffcb0eddb74ecb0e5c0cbe36fc292c8", "https://bcr.bazel.build/modules/rules_go/0.42.0/MODULE.bazel": "8cfa875b9aa8c6fce2b2e5925e73c1388173ea3c32a0db4d2b4804b453c14270", "https://bcr.bazel.build/modules/rules_go/0.46.0/MODULE.bazel": "3477df8bdcc49e698b9d25f734c4f3a9f5931ff34ee48a2c662be168f5f2d3fd", - "https://bcr.bazel.build/modules/rules_go/0.46.0/source.json": "fbf0e50e8ed487272e5c0977c0b67c74cbe97e1880b45bbeff44a3338dc8a08e", + "https://bcr.bazel.build/modules/rules_go/0.48.0/MODULE.bazel": "d00ebcae0908ee3f5e6d53f68677a303d6d59a77beef879598700049c3980a03", + "https://bcr.bazel.build/modules/rules_go/0.48.0/source.json": "895dc1698fd7c5959f92868f3a87156ad1ed8d876668bfa918fa0a623fb1eb22", "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", "https://bcr.bazel.build/modules/rules_java/7.6.1/source.json": "8f3f3076554e1558e8e468b2232991c510ecbcbed9e6f8c06ac31c93bcf38362", "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.4/MODULE.bazel": "6a88dd22800cf1f9f79ba32cacad0d3a423ed28efa2c2ed5582eaa78dd3ac1e5", "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", + "https://bcr.bazel.build/modules/rules_oci/1.4.0/MODULE.bazel": "196c231efd494286db1c31fef26a0608d4f8f2fadbc36246aa9a8e8354a27fa9", + "https://bcr.bazel.build/modules/rules_oci/1.4.0/source.json": "130602fc071d128db09b084e56af619e2d66c0890cf996ce24b1033fb154cdcf", "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", + "https://bcr.bazel.build/modules/rules_pkg/0.9.1/MODULE.bazel": "af00144208c4be503bc920d043ba3284fb37385b3f6160b4a4daf4df80b4b823", + "https://bcr.bazel.build/modules/rules_pkg/0.9.1/source.json": "c00cf34b4cfe88fce80245f8ce8532360f787dad9f21462e9b470796d14ffe10", "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", + "https://bcr.bazel.build/modules/rules_proto/6.0.0/MODULE.bazel": "b531d7f09f58dce456cd61b4579ce8c86b38544da75184eadaf0a7cb7966453f", + "https://bcr.bazel.build/modules/rules_proto/6.0.0/source.json": "de77e10ff0ab16acbf54e6b46eecd37a99c5b290468ea1aee6e95eb1affdaed7", "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/stardoc/0.5.0/MODULE.bazel": "f9f1f46ba8d9c3362648eea571c6f9100680efc44913618811b58cc9c02cd678", "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", @@ -104,6 +116,319 @@ ] } }, + "@@aspect_bazel_lib~//lib:extensions.bzl%ext": { + "general": { + "bzlTransitiveDigest": "p64Vq+WdwffjDyEZ5WXkInJbbtXAfNRVWdm2STw49jA=", + "usagesDigest": "S+80MzXBSIVtVYnRlrTKcrUC/KV00Xf0z7YcGK6PJoE=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "expand_template_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_platform_repo", + "attributes": { + "platform": "windows_amd64" + } + }, + "copy_to_directory_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "windows_amd64" + } + }, + "jq": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_host_alias_repo", + "attributes": {} + }, + "jq_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "darwin_amd64", + "version": "1.6" + } + }, + "expand_template_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_platform_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "expand_template_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_platform_repo", + "attributes": { + "platform": "linux_amd64" + } + }, + "copy_to_directory_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "linux_amd64" + } + }, + "coreutils_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "darwin_arm64", + "version": "0.0.16" + } + }, + "coreutils_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "0.0.16" + } + }, + "copy_directory_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_toolchains_repo", + "attributes": { + "user_repository_name": "copy_directory" + } + }, + "copy_to_directory_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "linux_arm64" + } + }, + "yq_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "4.25.2" + } + }, + "copy_to_directory_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "copy_directory_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_platform_repo", + "attributes": { + "platform": "darwin_amd64" + } + }, + "coreutils_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "darwin_amd64", + "version": "0.0.16" + } + }, + "coreutils_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "linux_arm64", + "version": "0.0.16" + } + }, + "coreutils_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_toolchains_repo", + "attributes": { + "user_repository_name": "coreutils" + } + }, + "yq_linux_s390x": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_s390x", + "version": "4.25.2" + } + }, + "yq": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_host_alias_repo", + "attributes": {} + }, + "expand_template_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_platform_repo", + "attributes": { + "platform": "darwin_amd64" + } + }, + "copy_directory_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_platform_repo", + "attributes": { + "platform": "linux_amd64" + } + }, + "jq_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "darwin_arm64", + "version": "1.6" + } + }, + "yq_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "darwin_amd64", + "version": "4.25.2" + } + }, + "copy_directory_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_platform_repo", + "attributes": { + "platform": "linux_arm64" + } + }, + "expand_template_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_platform_repo", + "attributes": { + "platform": "linux_arm64" + } + }, + "jq_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "1.6" + } + }, + "expand_template_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_toolchains_repo", + "attributes": { + "user_repository_name": "expand_template" + } + }, + "yq_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "windows_amd64", + "version": "4.25.2" + } + }, + "copy_to_directory_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "darwin_amd64" + } + }, + "jq_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "windows_amd64", + "version": "1.6" + } + }, + "yq_linux_ppc64le": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_ppc64le", + "version": "4.25.2" + } + }, + "copy_to_directory_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_toolchains_repo", + "attributes": { + "user_repository_name": "copy_to_directory" + } + }, + "jq_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_toolchains_repo", + "attributes": { + "user_repository_name": "jq" + } + }, + "copy_directory_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_platform_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "copy_directory_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_platform_repo", + "attributes": { + "platform": "windows_amd64" + } + }, + "yq_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "darwin_arm64", + "version": "4.25.2" + } + }, + "yq_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_toolchains_repo", + "attributes": { + "user_repository_name": "yq" + } + }, + "coreutils_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "windows_amd64", + "version": "0.0.16" + } + }, + "yq_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_arm64", + "version": "4.25.2" + } + } + }, + "recordedRepoMappingEntries": [ + [ + "aspect_bazel_lib~", + "aspect_bazel_lib", + "aspect_bazel_lib~" + ], + [ + "aspect_bazel_lib~", + "bazel_skylib", + "bazel_skylib~" + ], + [ + "aspect_bazel_lib~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, "@@platforms//host:extension.bzl%host_platform": { "general": { "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", @@ -121,194 +446,429 @@ "recordedRepoMappingEntries": [] } }, - "@@rules_go~//go:extensions.bzl%go_sdk": { - "os:linux,arch:amd64": { - "bzlTransitiveDigest": "JFrCnX1tTDAqjKVGYDdGNiwf4OvEAFVF170rNP7HQPw=", - "usagesDigest": "VnvSRpKEgkzu/TyNxgGH34MO8hBnYNz4OGAbxeR1g3M=", + "@@rules_oci~//oci:extensions.bzl%oci": { + "general": { + "bzlTransitiveDigest": "7pj+ARw21GCTsgeVSwPRCeTjcYufFaNrhLwpVqvpKmA=", + "usagesDigest": "YYR/bse4pcMBYN2f5OrHQ1jsVKO/hKnYhzHZO9kfjVQ=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { - "io_bazel_rules_nogo": { - "bzlFile": "@@rules_go~//go/private:nogo.bzl", - "ruleClassName": "go_register_nogo", - "attributes": { - "nogo": "@io_bazel_rules_go//:default_nogo", - "includes": [ - "'@@//:__subpackages__'" - ], - "excludes": [] - } - }, - "rules_go__download_0_windows_arm64": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.21.1" - } - }, - "rules_go__download_0_linux_arm64": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.21.1" - } - }, - "go_default_sdk": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "experiments": [], - "patches": [], - "patch_strip": 0, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.21.1", - "strip_prefix": "go" - } - }, - "rules_go__download_0_darwin_arm64": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.21.1" - } - }, - "go_host_compatible_sdk_label": { - "bzlFile": "@@rules_go~//go/private:extensions.bzl", - "ruleClassName": "host_compatible_toolchain", - "attributes": { - "toolchain": "@go_default_sdk//:ROOT" - } - }, - "rules_go__download_0_darwin_amd64": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.21.1" - } - }, - "go_toolchains": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_multiple_toolchains", - "attributes": { - "prefixes": [ - "_0000_go_default_sdk_", - "_0001_rules_go__download_0_darwin_amd64_", - "_0002_rules_go__download_0_darwin_arm64_", - "_0003_rules_go__download_0_linux_arm64_", - "_0004_rules_go__download_0_windows_amd64_", - "_0005_rules_go__download_0_windows_arm64_" - ], - "geese": [ - "", - "darwin", - "darwin", - "linux", - "windows", - "windows" - ], - "goarchs": [ - "", - "amd64", - "arm64", - "arm64", - "amd64", - "arm64" - ], - "sdk_repos": [ - "go_default_sdk", - "rules_go__download_0_darwin_amd64", - "rules_go__download_0_darwin_arm64", - "rules_go__download_0_linux_arm64", - "rules_go__download_0_windows_amd64", - "rules_go__download_0_windows_arm64" - ], - "sdk_types": [ - "remote", - "remote", - "remote", - "remote", - "remote", - "remote" - ], - "sdk_versions": [ - "1.21.1", - "1.21.1", - "1.21.1", - "1.21.1", - "1.21.1", - "1.21.1" - ] - } - }, - "rules_go__download_0_windows_amd64": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.21.1" + "alpine_linux_386": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platform": "linux/386", + "target_name": "alpine_linux_386" + } + }, + "oci_crane_registry_toolchains": { + "bzlFile": "@@rules_oci~//oci/private:toolchains_repo.bzl", + "ruleClassName": "toolchains_repo", + "attributes": { + "toolchain_type": "@rules_oci//oci:registry_toolchain_type", + "toolchain": "@oci_crane_{platform}//:registry_toolchain" + } + }, + "copy_to_directory_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "windows_amd64" + } + }, + "jq": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_host_alias_repo", + "attributes": {} + }, + "oci_crane_darwin_amd64": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "darwin_amd64", + "crane_version": "v0.14.0" + } + }, + "jq_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "darwin_amd64", + "version": "1.6" + } + }, + "copy_to_directory_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "linux_amd64" + } + }, + "oci_crane_linux_arm64": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "linux_arm64", + "crane_version": "v0.14.0" + } + }, + "coreutils_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "darwin_arm64", + "version": "0.0.16" + } + }, + "coreutils_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "0.0.16" + } + }, + "yq_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "4.25.2" + } + }, + "copy_to_directory_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "linux_arm64" + } + }, + "oci_crane_linux_armv6": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "linux_armv6", + "crane_version": "v0.14.0" + } + }, + "copy_to_directory_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "oci_crane_linux_amd64": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "linux_amd64", + "crane_version": "v0.14.0" + } + }, + "coreutils_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "darwin_amd64", + "version": "0.0.16" + } + }, + "coreutils_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "linux_arm64", + "version": "0.0.16" + } + }, + "coreutils_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_toolchains_repo", + "attributes": { + "user_repository_name": "coreutils" + } + }, + "yq_linux_s390x": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_s390x", + "version": "4.25.2" + } + }, + "yq": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_host_alias_repo", + "attributes": {} + }, + "oci_crane_darwin_arm64": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "darwin_arm64", + "crane_version": "v0.14.0" + } + }, + "jq_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "darwin_arm64", + "version": "1.6" + } + }, + "yq_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "darwin_amd64", + "version": "4.25.2" + } + }, + "oci_crane_linux_i386": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "linux_i386", + "crane_version": "v0.14.0" + } + }, + "jq_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "1.6" + } + }, + "alpine_linux_arm_v6": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platform": "linux/arm/v6", + "target_name": "alpine_linux_arm_v6" + } + }, + "alpine_linux_arm_v7": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platform": "linux/arm/v7", + "target_name": "alpine_linux_arm_v7" + } + }, + "alpine_linux_ppc64le": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platform": "linux/ppc64le", + "target_name": "alpine_linux_ppc64le" + } + }, + "yq_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "windows_amd64", + "version": "4.25.2" + } + }, + "alpine_linux_arm64_v8": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platform": "linux/arm64/v8", + "target_name": "alpine_linux_arm64_v8" + } + }, + "oci_crane_windows_armv6": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "windows_armv6", + "crane_version": "v0.14.0" + } + }, + "alpine_linux_amd64": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platform": "linux/amd64", + "target_name": "alpine_linux_amd64" + } + }, + "oci_crane_toolchains": { + "bzlFile": "@@rules_oci~//oci/private:toolchains_repo.bzl", + "ruleClassName": "toolchains_repo", + "attributes": { + "toolchain_type": "@rules_oci//oci:crane_toolchain_type", + "toolchain": "@oci_crane_{platform}//:crane_toolchain" + } + }, + "jq_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "windows_amd64", + "version": "1.6" + } + }, + "copy_to_directory_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "darwin_amd64" + } + }, + "yq_linux_ppc64le": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_ppc64le", + "version": "4.25.2" + } + }, + "jq_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_toolchains_repo", + "attributes": { + "user_repository_name": "jq" + } + }, + "copy_to_directory_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_toolchains_repo", + "attributes": { + "user_repository_name": "copy_to_directory" + } + }, + "yq_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "darwin_arm64", + "version": "4.25.2" + } + }, + "yq_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_toolchains_repo", + "attributes": { + "user_repository_name": "yq" + } + }, + "oci_crane_windows_amd64": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "windows_amd64", + "crane_version": "v0.14.0" + } + }, + "alpine": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_alias", + "attributes": { + "target_name": "alpine", + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platforms": { + "@@platforms//cpu:i386": "@alpine_linux_386", + "@@platforms//cpu:x86_64": "@alpine_linux_amd64", + "@@platforms//cpu:armv7": "@alpine_linux_arm_v7", + "@@platforms//cpu:arm64": "@alpine_linux_arm64_v8", + "@@platforms//cpu:ppc": "@alpine_linux_ppc64le", + "@@platforms//cpu:s390x": "@alpine_linux_s390x" + }, + "bzlmod_repository": "alpine", + "reproducible": true + } + }, + "oci_crane_linux_s390x": { + "bzlFile": "@@rules_oci~//oci:repositories.bzl", + "ruleClassName": "crane_repositories", + "attributes": { + "platform": "linux_s390x", + "crane_version": "v0.14.0" + } + }, + "alpine_linux_s390x": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "index.docker.io", + "repository": "library/alpine", + "identifier": "sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b", + "platform": "linux/s390x", + "target_name": "alpine_linux_s390x" + } + }, + "oci_auth_config": { + "bzlFile": "@@rules_oci~//oci/private:auth_config_locator.bzl", + "ruleClassName": "oci_auth_config_locator", + "attributes": {} + }, + "coreutils_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "windows_amd64", + "version": "0.0.16" + } + }, + "yq_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_arm64", + "version": "4.25.2" } } }, "recordedRepoMappingEntries": [ [ - "bazel_features~", - "bazel_features_globals", - "bazel_features~~version_extension~bazel_features_globals" - ], - [ - "bazel_features~", - "bazel_features_version", - "bazel_features~~version_extension~bazel_features_version" - ], - [ - "rules_go~", + "aspect_bazel_lib~", "bazel_tools", "bazel_tools" ], [ - "rules_go~", - "io_bazel_rules_go", - "rules_go~" + "rules_oci~", + "aspect_bazel_lib", + "aspect_bazel_lib~" ], [ - "rules_go~", - "io_bazel_rules_go_bazel_features", - "bazel_features~" + "rules_oci~", + "bazel_skylib", + "bazel_skylib~" ] ] } diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f662ee2 --- /dev/null +++ b/Makefile @@ -0,0 +1,168 @@ +# Makefile for Your Golang Monorepo Project +PROJECT_NAME := $(shell basename $(CURDIR)) + +# Variables +GO := go +BUILD_DIR := build +BIN_DIR := $(BUILD_DIR)/bin +LDFLAGS := -w -s + +VERSION := $(shell git describe --tags --always) + +# Targets +.PHONY: all help version +.PHONY: lint clean + +all: help + +help: ## show help + @grep -hE '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-17s\033[0m %s\n", $$1, $$2}' + +version: ## show version + @echo $(VERSION) + +.PHONY: dev +dev: ## run dev server + docker compose up --build + +lint: ## run golangci-lint + @golangci-lint run ./... + +clean: ## clean build directory + @rm -rf cover.out result.json ./deployments/charts/*.tgz + @rm -rf $(BUILD_DIR) + +.PHONY: gazelle +gazelle: ## run gazelle with bazel + @bazel run //:gazelle + +.PHONY: build +build: ## build go binary + @bazel build //... + +.PHONY: test +test: ## test go binary + @bazel test --verbose_failures //... + +.PHONY: coverage +coverage: ## generate coverage report + @go test -json -coverprofile=cover.out ./... >result.json + +.PHONY: gen-swagger +gen-swagger: ## generate swagger + @swag init -q -g impl.go -d ./adapter/restaurant/restful,./entity,./pkg \ + -o ./api/restaurant/restful --instanceName restaurant_restful --parseDependency + + @swag init -q -g impl.go -d ./adapter/order/restful,./entity,./pkg \ + -o ./api/order/restful --instanceName order_restful --parseDependency + + @swag init -q -g impl.go -d ./adapter/payment/restful,./entity,./pkg \ + -o ./api/payment/restful --instanceName payment_restful --parseDependency + + @swag init -q -g impl.go -d ./adapter/user/restful,./entity,./pkg \ + -o ./api/user/restful --instanceName user_restful --parseDependency + + @swag init -q -g impl.go -d ./adapter/logistics/restful,./entity,./pkg \ + -o ./api/logistics/restful --instanceName logistics_restful --parseDependency + + @swag init -q -g impl.go -d ./adapter/notify/restful,./entity,./pkg \ + -o ./api/notify/restful --instanceName notify_restful --parseDependency + +### testing +.PHONY: test-api-order +test-api-order: ## test api + @k6 run --vus=1 --iterations=1 ./tests/k6/order.api.test.js + +.PHONY: test-api-user +test-api-user: ## test api user + @k6 run --vus=1 --iterations=1 ./tests/k6/user.api.test.js + +.PHONY: test-stress +test-stress: ## test load + @k6 run --env SCENARIO=peak_load ./tests/k6/order.api.test.js --out=cloud + +.PHONY: test-load +test-load: ## test stress + @k6 run --env SCENARIO=average_load ./tests/k6/order.api.test.js --out=cloud + +## docker +.PHONY: docker-push +docker-push: ## push docker image + @bazel run //:push --platforms=@rules_go//go/toolchain:linux_amd64 -- --tag=$(VERSION) + +## deployments +DEPLOY_TO := prod +HELM_REPO_NAME := blackhorseya + +.PHONY: deploy +deploy: deploy-app deploy-storage ## deploy all + +.PHONY: deploy-app +deploy-app: deploy-restaurant-restful deploy-order-restful deploy-payment-restful deploy-user-restful deploy-logistics-restful deploy-notify-restful ## deploy app + +.PHONY: deploy-restaurant-restful +deploy-restaurant-restful: ## deploy restaurant + @helm upgrade $(DEPLOY_TO)-godine-restaurant-restful $(HELM_REPO_NAME)/godine \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-restaurant-restful.yaml + +.PHONY: deploy-payment-restful +deploy-payment-restful: ## deploy payment + @helm upgrade $(DEPLOY_TO)-godine-payment-restful $(HELM_REPO_NAME)/godine \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-payment-restful.yaml + +.PHONY: deploy-order-restful +deploy-order-restful: ## deploy order + @helm upgrade $(DEPLOY_TO)-godine-order-restful $(HELM_REPO_NAME)/godine \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-order-restful.yaml + +.PHONY: deploy-user-restful +deploy-user-restful: ## deploy user + @helm upgrade $(DEPLOY_TO)-godine-user-restful $(HELM_REPO_NAME)/godine \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-user-restful.yaml + +.PHONY: deploy-logistics-restful +deploy-logistics-restful: ## deploy logistics + @helm upgrade $(DEPLOY_TO)-godine-logistics-restful $(HELM_REPO_NAME)/godine \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-logistics-restful.yaml + +.PHONY: deploy-notify-restful +deploy-notify-restful: ## deploy notify + @helm upgrade $(DEPLOY_TO)-godine-notify-restful $(HELM_REPO_NAME)/godine \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-notify-restful.yaml + +.PHONY: deploy-storage +deploy-storage: deploy-mariadb deploy-mongodb deploy-redis ## deploy storage + +.PHONY: deploy-mariadb +deploy-mariadb: ## deploy mariadb + @helm upgrade $(DEPLOY_TO)-godine-mariadb bitnami/mariadb \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-mariadb.yaml + +.PHONY: deploy-mongodb +deploy-mongodb: ## deploy mongodb + @helm upgrade $(DEPLOY_TO)-godine-mongodb bitnami/mongodb \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-mongodb.yaml + +.PHONY: deploy-redis +deploy-redis: ## deploy redis + @helm upgrade $(DEPLOY_TO)-godine-redis bitnami/redis \ + --install --namespace $(PROJECT_NAME) \ + --history-max 3 \ + --values ./deployments/$(DEPLOY_TO)/godine-redis.yaml diff --git a/README.Docker.md b/README.Docker.md new file mode 100644 index 0000000..3bf66ee --- /dev/null +++ b/README.Docker.md @@ -0,0 +1,22 @@ +### Building and running your application + +When you're ready, start your application by running: +`docker compose up --build`. + +Your application will be available at http://localhost:8080. + +### Deploying your application to the cloud + +First, build your image, e.g.: `docker build -t myapp .`. +If your cloud uses a different CPU architecture than your development +machine (e.g., you are on a Mac M1 and your cloud provider is amd64), +you'll want to build the image for that platform, e.g.: +`docker build --platform=linux/amd64 -t myapp .`. + +Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. + +Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) +docs for more detail on building and pushing. + +### References +* [Docker's Go guide](https://docs.docker.com/language/golang/) \ No newline at end of file diff --git a/README.md b/README.md index 59318b6..004c4c5 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,141 @@ -## bazel 的golang示例 +# GoDine -1. 更新依赖命令 -bazel run //:gazelle-update-repos -2. 编译命令 -bazel build //:hello -3. 运行命令 -bazel run //:hello +[![Go](https://hello/workflows/Go/badge.svg)](https://hello/actions?query=workflow:"Go") +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=blackhorseya_godine&metric=coverage)](https://sonarcloud.io/summary/new_code?id=blackhorseya_godine) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=blackhorseya_godine&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=blackhorseya_godine) +[![GitHub release](https://img.shields.io/github/release/blackhorseya/godine?include_prereleases=&sort=semver&color=blue)](https://hello/releases/) +![GitHub License](https://img.shields.io/github/license/blackhorseya/godine) +GoDine is an online food ordering system designed using Golang and following the principles of Domain-Driven Design ( +DDD). The system includes multiple business domains such as User Management, Restaurant Management, Order Management, +Payment Management, and Notification Management. Each domain has clear boundaries and interacts with other domains to +provide a seamless online dining experience. -4. 每一个BUILD.bazel都需要配置单独的deps,内容参考deps.bzl,找不到包申明的可以上github上搜索,找到对应的bazel_deps配置作参考 +## Project Name Explanation + +The name GoDine is derived from combining "Golang" and "Dine", representing an online food ordering system built using +Golang. This name is concise and representative, conveying the core functionality of the project, which is to provide +efficient online dining services using Golang technology. + +## Features + +- **User Management**: User registration, login, profile updates, account deletion. +- **Restaurant Management**: Restaurant information management, menu management. +- **Order Management**: Order creation, order status updates, order queries. +- **Payment Management**: Handling order payments, payment record queries. +- **Notification Management**: Sending notifications to users (e.g., order status updates). + +## Technical Details + +- **Programming Language**: Golang +- **Architecture Pattern**: Domain-Driven Design (DDD) +- **Major Modules**: + - **User Management**: Responsible for user registration, login, profile management, etc. + - **Restaurant Management**: Responsible for restaurant information and menu management. + - **Order Management**: Handles order creation, management, and tracking. + - **Payment Management**: Processes payments and manages payment records. + - **Notification Management**: Sends notifications regarding order status changes to users. + +## System Architecture Diagram + +```mermaid +graph TD + UserManagement[用戶管理] + RestaurantManagement[餐廳管理] + OrderManagement[訂單管理] + PaymentManagement[支付管理] + NotificationManagement[通知管理] + LogisticsManagement[物流管理] + + UserManagement -->|確認用戶身份| OrderManagement + RestaurantManagement -->|確認餐廳和菜單可用性| OrderManagement + OrderManagement -->|確認訂單和金額| PaymentManagement + PaymentManagement -->|通知支付結果| OrderManagement + OrderManagement -->|通知訂單狀態變更| NotificationManagement + OrderManagement -->|安排配送| LogisticsManagement + LogisticsManagement -->|更新配送狀態| OrderManagement + LogisticsManagement -->|通知配送狀態變更| NotificationManagement + + subgraph UserManagement[用戶管理] + UM[User Service] + UM --> U[User] + end + + subgraph RestaurantManagement[餐廳管理] + RM[Restaurant Service] + M[Menu Service] + RM --> R[Restaurant] + M --> MI[MenuItem] + end + + subgraph OrderManagement[訂單管理] + OM[Order Service] + OM --> O[Order] + O --> OI[OrderItem] + end + + subgraph PaymentManagement[支付管理] + PM[Payment Service] + PM --> PR[PaymentRecord] + end + + subgraph NotificationManagement[通知管理] + NM[Notification Service] + NM --> N[Notification] + end + + subgraph LogisticsManagement[物流管理] + + + LM[Logistics Service] + LM --> D[Delivery] + D --> DS[DeliveryStatus] + end +``` + +## Installation + +1. **Clone the repository**: + ```bash + git clone https://hello.git + ``` +2. **Navigate to the project directory**: + ```bash + cd godine + ``` +3. **Install dependencies**: + ```bash + go mod tidy + ``` + +## Usage + +1. **Run the service**: + ```bash + make dev + ``` +2. **Access the service**: + - API documentation is available at `http://localhost:1992/api/docs/index.html`. + +## Contribution + +We welcome contributions to this project. Please follow these steps: + +1. **Fork the repository** +2. **Create your feature branch**: + ```bash + git checkout -b feature-branch + ``` +3. **Commit your changes**: + ```bash + git commit -am 'Add some feature' + ``` +4. **Push to the branch**: + ```bash + git push origin feature-branch + ``` +5. **Create a Pull Request** + +## License + +This project is licensed under the GPL-3.0 License. See the [LICENSE](LICENSE) file for details. diff --git a/WORKSPACE b/WORKSPACE index 2fb1d77..4dddb21 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,35 +1 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "io_bazel_rules_go", - integrity = "sha256-M6zErg9wUC20uJPJ/B3Xqb+ZjCPn/yxFF3QdQEmpdvg=", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.48.0/rules_go-v0.48.0.zip", - "https://github.com/bazelbuild/rules_go/releases/download/v0.48.0/rules_go-v0.48.0.zip", - ], -) - -http_archive( - name = "bazel_gazelle", - integrity = "sha256-12v3pg/YsFBEQJDfooN6Tq+YKeEWVhjuNdzspcvfWNU=", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.37.0/bazel-gazelle-v0.37.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.37.0/bazel-gazelle-v0.37.0.tar.gz", - ], -) - -load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") -load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") -load("//:deps.bzl", "go_dependencies") - - - - -# gazelle:repository_macro deps.bzl%go_dependencies -# go_dependencies() - -go_rules_dependencies() - -go_register_toolchains(version = "1.22.5") - -gazelle_dependencies() +workspace(name = "hello") diff --git a/bazel-bazel_go_test b/bazel-bazel_go_test deleted file mode 120000 index d9d024a..0000000 --- a/bazel-bazel_go_test +++ /dev/null @@ -1 +0,0 @@ -/home/edison/.cache/bazel/_bazel_edison/333b9a668e98faeb0db1e492ecfd95a4/execroot/_main \ No newline at end of file diff --git a/bazel-bin b/bazel-bin deleted file mode 120000 index 8958e88..0000000 --- a/bazel-bin +++ /dev/null @@ -1 +0,0 @@ -/home/edison/.cache/bazel/_bazel_edison/333b9a668e98faeb0db1e492ecfd95a4/execroot/_main/bazel-out/k8-fastbuild/bin \ No newline at end of file diff --git a/bazel-go b/bazel-go deleted file mode 120000 index f02ba4a..0000000 --- a/bazel-go +++ /dev/null @@ -1 +0,0 @@ -/home/edison/.cache/bazel/_bazel_edison/546f64dbc186a8e485ecb66e50d42c8e/execroot/_main \ No newline at end of file diff --git a/bazel-out b/bazel-out deleted file mode 120000 index e518365..0000000 --- a/bazel-out +++ /dev/null @@ -1 +0,0 @@ -/home/edison/.cache/bazel/_bazel_edison/333b9a668e98faeb0db1e492ecfd95a4/execroot/_main/bazel-out \ No newline at end of file diff --git a/bazel-testlogs b/bazel-testlogs deleted file mode 120000 index cd0f871..0000000 --- a/bazel-testlogs +++ /dev/null @@ -1 +0,0 @@ -/home/edison/.cache/bazel/_bazel_edison/333b9a668e98faeb0db1e492ecfd95a4/execroot/_main/bazel-out/k8-fastbuild/testlogs \ No newline at end of file diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..4bd00fa --- /dev/null +++ b/compose.yaml @@ -0,0 +1,153 @@ +# Comments are provided throughout this file to help you get started. +# If you need more help, visit the Docker Compose reference guide at +# https://docs.docker.com/go/compose-spec-reference/ + +# Here the instructions define your application as a service called "server". +# This service is built from the Dockerfile in the current directory. +# You can add other services your application may depend on here, such as a +# database or a cache. For examples, see the Awesome Compose repository: +# https://github.com/docker/awesome-compose +services: + restaurant_restful: + build: + context: . + target: final + command: + - --config=/app/configs/example.yaml + - start + - restaurant-restful + ports: + - 1992:1992 + volumes: + - ./configs/example.yaml:/app/configs/example.yaml + depends_on: + - mongodb + + payment_restful: + build: + context: . + target: final + command: + - --config=/app/configs/example.yaml + - start + - payment-restful + ports: + - 1997:1997 + volumes: + - ./configs/example.yaml:/app/configs/example.yaml + depends_on: + - mongodb + + order_restful: + build: + context: . + target: final + command: + - --config=/app/configs/example.yaml + - start + - order-restful + ports: + - 1993:1993 + volumes: + - ./configs/example.yaml:/app/configs/example.yaml + depends_on: + mariadb: + condition: service_healthy + + user_restful: + build: + context: . + target: final + command: + - --config=/app/configs/example.yaml + - start + - user-restful + ports: + - 1994:1994 + volumes: + - ./configs/example.yaml:/app/configs/example.yaml + depends_on: + - mongodb + - mariadb + + logistics_restful: + build: + context: . + target: final + command: + - --config=/app/configs/example.yaml + - start + - logistics-restful + ports: + - 1995:1995 + volumes: + - ./configs/example.yaml:/app/configs/example.yaml + depends_on: + - mongodb + - mariadb + + notify_restful: + build: + context: . + target: final + command: + - --config=/app/configs/example.yaml + - start + - notify-restful + ports: + - 1996:1996 + volumes: + - ./configs/example.yaml:/app/configs/example.yaml + depends_on: + - mongodb + - mariadb + + mongodb: + image: mongo + restart: always + environment: + MONGO_INITDB_ROOT_USERNAME: admin + MONGO_INITDB_ROOT_PASSWORD: changeme + volumes: + - mongo-data:/data/db + + mariadb: + image: mariadb:latest + restart: always + environment: + MYSQL_ROOT_PASSWORD: changeme + MYSQL_DATABASE: godine + volumes: + - mariadb-data:/var/lib/mysql + healthcheck: + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + start_period: 10s + interval: 10s + timeout: 5s + retries: 3 + + redis: + image: redis:7 + restart: always + + otel-collector: + image: otel/opentelemetry-collector-contrib:latest + command: [ "--config=/etc/otel-collector-config.yaml" ] + volumes: + - ./configs/otel-collector-config.yaml:/etc/otel-collector-config.yaml + + jaeger: + image: jaegertracing/all-in-one:latest + ports: + - 26686:16686 + + prometheus: + image: prom/prometheus:latest + volumes: + - ./configs/prometheus.yml:/etc/prometheus/prometheus.yml + ports: + - 29090:9090 + +volumes: + mongo-data: + mariadb-data: diff --git a/deps.bzl b/deps.bzl deleted file mode 100644 index 21cb9c6..0000000 --- a/deps.bzl +++ /dev/null @@ -1,33 +0,0 @@ -load("@bazel_gazelle//:deps.bzl", "go_repository") - -def go_dependencies(): - go_repository( - name = "com_github_bsm_ginkgo_v2", - importpath = "github.com/bsm/ginkgo/v2", - sum = "h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=", - version = "v2.12.0", - ) - go_repository( - name = "com_github_bsm_gomega", - importpath = "github.com/bsm/gomega", - sum = "h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=", - version = "v1.27.10", - ) - go_repository( - name = "com_github_cespare_xxhash_v2", - importpath = "github.com/cespare/xxhash/v2", - sum = "h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=", - version = "v2.2.0", - ) - go_repository( - name = "com_github_dgryski_go_rendezvous", - importpath = "github.com/dgryski/go-rendezvous", - sum = "h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=", - version = "v0.0.0-20200823014737-9f7001d12a5f", - ) - go_repository( - name = "com_github_redis_go_redis_v9", - importpath = "github.com/redis/go-redis/v9", - sum = "h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4=", - version = "v9.6.1", - ) diff --git a/go.mod b/go.mod index 08faca1..930418c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module hello -go 1.22.5 +go 1.22.3 require github.com/redis/go-redis/v9 v9.6.1 diff --git a/lib/BUILD.bazel b/lib/BUILD.bazel deleted file mode 100644 index f8ebbd2..0000000 --- a/lib/BUILD.bazel +++ /dev/null @@ -1,9 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "lib", - srcs = ["lib.go"], - importpath = "hello/lib", - visibility = ["//visibility:public"], - deps = ["@com_github_redis_go_redis_v9//:go-redis"], -) diff --git a/lib/BUILD.bazel1 b/lib/BUILD.bazel1 deleted file mode 100644 index 5055ac8..0000000 --- a/lib/BUILD.bazel1 +++ /dev/null @@ -1,12 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "lib", - srcs = ["lib.go"], - importpath = "hello/lib", - visibility = ["//visibility:public"], - deps = ["@com_github_redis_go_redis_v9//:go-redis"], - # deps = [ - # # "@com_github_redis_go_redis_v9//:go-redis", - # ], -) diff --git a/lib/lib.go b/lib/lib.go deleted file mode 100644 index f51fd68..0000000 --- a/lib/lib.go +++ /dev/null @@ -1,18 +0,0 @@ -package lib - -import ( - "fmt" - - "github.com/redis/go-redis/v9" -) - -func Lib() { - fmt.Println("lib") - rdb := redis.NewClient(&redis.Options{ - Addr: "localhost:6379", - Password: "", // 没有密码,默认值 - DB: 0, // 默认DB 0 - }) - defer rdb.Close() - -} diff --git a/hello.go b/main.go similarity index 100% rename from hello.go rename to main.go diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..0219ec7 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=blackhorseya_godine +sonar.organization=blackhorseya + +sonar.projectName=godine +sonar.projectVersion=1.0 + +sonar.sources=. +sonar.exclusions=**/*_test.go,**/mock_*.go,**/*_gen.go +sonar.tests=. +sonar.test.inclusions=**/*_test.go + +sonar.sourceEncoding=UTF-8 +sonar.go.coverage.reportPaths=cover.out +sonar.go.tests.reportPaths=result.json