diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..9dcdb94 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,24 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Environment** +- Version: [e.g. v1.0.0] +- OS: [e.g. CentOS8] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md new file mode 100644 index 0000000..5971fd6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -0,0 +1,10 @@ +--- +name: Documentation +about: Improvements or additions to documentation +title: '' +labels: documentation +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..88e0925 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**What is the feature you want to add?** + +**Why do you want to add this feature?** + +**How to implement this feature?** + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/q-a.md b/.github/ISSUE_TEMPLATE/q-a.md new file mode 100644 index 0000000..46b249b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/q-a.md @@ -0,0 +1,10 @@ +--- +name: Q&A +about: Please tell me your questions +title: '' +labels: question +assignees: '' + +--- + + diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..ae5830d --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,62 @@ +# Tencent is pleased to support the open source community by making Polaris available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# +# Licensed under the BSD 3-Clause License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://opensource.org/licenses/BSD-3-Clause +# +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +name: golangci-lint +on: + push: + branches: + - main + - release* + pull_request: + branches: + - main + - release* + - feature/** + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + tags: + description: 'Tags' + required: false + type: boolean + environment: + description: 'Environment to run tests against' + type: environment + required: false + +jobs: + golangci: + strategy: + matrix: + go-version: [ "1.21.5" ] + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3.6.0 + with: + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + version: latest + args: --timeout=30m diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml new file mode 100644 index 0000000..e73a6e9 --- /dev/null +++ b/.github/workflows/integration.yaml @@ -0,0 +1,187 @@ +# Tencent is pleased to support the open source community by making Polaris available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# +# Licensed under the BSD 3-Clause License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://opensource.org/licenses/BSD-3-Clause +# +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +name: Integration + +on: + push: + branches: + - main + - release* + pull_request: + branches: + - main + - release* + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + tags: + description: 'Tags' + required: false + type: boolean + environment: + description: 'Environment to run tests against' + type: environment + required: false + +permissions: + contents: write + +# Always force the use of Go modules +env: + GO111MODULE: on + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-latest ] + goarch: [ amd64 ] + goos: [ linux ] + include: + - os: ubuntu-latest + goos: linux + goarch: amd64 + vert: 1 + exclude: + - os: ubuntu-latest + goos: windows + - os: ubuntu-latest + goos: darwin + - os: windows-latest + goos: linux + - os: windows-latest + goos: darwin + - os: macos-latest + goos: windows + - os: macos-latest + goos: linux + + runs-on: ${{ matrix.os }} + services: + # Label used to access the service container + redis: + # Docker Hub image + image: redis + # Set health checks to wait until redis has started + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps port 6379 on service container to the host + - 6379:6379 + steps: + # Setup the environment. + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: "1.21.5" + # Checkout latest code + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Initialize database + env: + MYSQL_DB_USER: root + MYSQL_DB_PWD: root + MYSQL_DATABASE: polaris_server + run: | + sudo systemctl start mysql.service + mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }} + mysql -e "ALTER USER '${{ env.MYSQL_DB_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }} + + # Compile + - name: Build And Test + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + MYSQL_DB_USER: root + MYSQL_DB_PWD: root + REDIS_ADDR: 127.0.0.1:6379 + REDIS_PWD: + run: | + workir=$(pwd) + export STORE_MODE=sqldb + export MYSQL_DB_USER=${{ env.MYSQL_DB_USER }} + export MYSQL_DB_PWD=${{ env.MYSQL_DB_PWD }} + echo "cur STORE MODE=${STORE_MODE}" + polaris_server_tag=v1.18.0-beta.1 + # 设置严格模式 + mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "set sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'"; + # 清空数据 + mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "DROP DATABASE IF EXISTS polaris_server"; + # 初始化 polaris 数据库 + mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" < store/mysqlopt/scripts/polaris_server.sql + # 临时放开 DB 的最大连接数 + mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "set GLOBAL max_connections = 3000;" + + ## 清理之前的临时资源 + rm -rf build_resource + + ## 准备临时构建资源文件夹 + mkdir build_resource + cp plugin_store_mysql_opt.go.temp ./build_resource + cd build_resource + + git clone https://github.com/polarismesh/polaris.git + cd polaris + if [ "${polaris_server_tag}" != "" ]; then + git checkout ${polaris_server_tag} + fi + + cat ../plugin_store_mysql_opt.go.temp >plugin_store_mysql_opt.go + + go clean --modcache + go get github.com/polaris-contrib/store-mysqlopt + go mod tidy + + make build VERSION=${polaris_server_tag} + + # 找构建好的 server 安装目录 + server_install_dir=$(ls | grep polaris-server-release | sed -n '1p') + echo "server_install_dir is $server_install_dir" + + cp -rf ${workir}/test/data/polaris-server.yaml ${workir}/build_resource/polaris/${server_install_dir} + cd ${workir}/build_resource/polaris/${server_install_dir} + + ls -alR + chmod +x ./tool/*.sh + ./tool/start.sh + + sleep 120s + ls -alR + + cd .. + ls -lstrh + # 先测试普通的集成测试 + pushd ${workir}/build_resource/polaris/test/integrate + echo "[INTEGRATION TEST] begin" + curl http://127.0.0.1:8090 + go test -count=1 -v -tags integration -timeout 60m + echo "[INTEGRATION TEST] end" + popd + cd ${workir}/build_resource/polaris/${server_install_dir} + ./tool/stop.sh + cd .. \ No newline at end of file diff --git a/.github/workflows/licence-checker.yml b/.github/workflows/licence-checker.yml new file mode 100644 index 0000000..5f2a5d3 --- /dev/null +++ b/.github/workflows/licence-checker.yml @@ -0,0 +1,59 @@ +# Tencent is pleased to support the open source community by making Polaris available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# +# Licensed under the BSD 3-Clause License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://opensource.org/licenses/BSD-3-Clause +# +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +name: License checker + +on: + push: + branches: + - main + - release* + pull_request: + branches: + - main + - release* + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + tags: + description: 'Tags' + required: false + type: boolean + environment: + description: 'Environment to run tests against' + type: environment + required: false + +jobs: + check-license: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Check License Header + uses: apache/skywalking-eyes@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + log: info + config: .licenserc.yaml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..b6ca18c --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,376 @@ +# Tencent is pleased to support the open source community by making Polaris available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# +# Licensed under the BSD 3-Clause License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://opensource.org/licenses/BSD-3-Clause +# +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +## This file contains all available configuration options +## with their default values. + +# See https://github.com/golangci/golangci-lint#config-file +# See https://golangci-lint.run/usage/configuration/ + +# Options for analysis running. +run: + # Exit code when at least one issue was found. + # Default: 1 + issues-exit-code: 2 + + # Include test files or not. + # Default: true + tests: false + + # Which dirs to skip: issues from them won't be reported. + # Can use regexp here: `generated.*`, regexp is applied on full path. + # Default value is empty list, + # but default dirs are skipped independently of this option's value (see skip-dirs-use-default). + # "/" will be replaced by current OS file path separator to properly work on Windows. + skip-dirs: + - pkg/model/pb + - .*~ + - test + + # Which files to skip: they will be analyzed, but issues from them won't be reported. + # Default value is empty list, + # but there is no need to include all autogenerated files, + # we confidently recognize autogenerated files. + # If it's not please let us know. + # "/" will be replaced by current OS file path separator to properly work on Windows. + skip-files: + - ".*\\.my\\.go$" + - ".*\\.pb\\.go$" + - ".*_test\\.go$" + - ".*\\.yaml$" + - ".*\\.yml$" + + +# Main linters configurations. +# See https://golangci-lint.run/usage/linters +linters: + # Disable all default enabled linters. + disable-all: true + # Custom enable linters we want to use. + enable: + - errcheck # Errcheck is a program for checking for unchecked errors in go programs. + - 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. + - funlen # Tool for detection of long functions + - gci # Gci controls golang package import order and makes it always deterministic. + - goconst # Finds repeated strings that could be replaced by a constant + - gocritic # Provides diagnostics that check for bugs, performance and style issues. + - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification + - gosimple # Linter for Go source code that specializes in simplifying code + - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string + - misspell # Finds commonly misspelled English words in comments + - nolintlint # Reports ill-formed or insufficient nolint directives + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. + - staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. + - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code + - usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. + - lll + #- whitespace # Tool for detection of leading and trailing whitespace + + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + exclude-rules: + # helpers in tests often (rightfully) pass a *testing.T as their first argument + - path: _test\.go + text: "context.Context should be the first parameter of a function" + linters: + - revive + # Yes, they are, but it's okay in a test + - path: _test\.go + text: "exported func.*returns unexported type.*which can be annoying to use" + linters: + - revive + # https://github.com/go-critic/go-critic/issues/926 + - linters: + - gocritic + text: "unnecessaryDefer:" + + +# https://golangci-lint.run/usage/linters +linters-settings: + # https://golangci-lint.run/usage/linters/#misspell + misspell: + locale: US + ignore-words: + - cancelled + + # https://golangci-lint.run/usage/linters/#revive + revive: + ignore-generated-header: true + severity: error + rules: + - name: atomic + - name: line-length-limit + severity: error + arguments: [ 480 ] + - name: unhandled-error + severity: warning + disabled: true + arguments: [ "fmt.Printf", "myFunction" ] + - name: var-naming + severity: warning + disabled: true + arguments: + - [ "ID","URL","IP","HTTP","JSON","API","UID","Id","Api","Uid","Http","Json","Ip","Url" ] # AllowList + - [ "VM" ] # DenyList + - name: string-format + severity: warning + disabled: false + arguments: + - - 'core.WriteError[1].Message' + - '/^([^A-Z]|$)/' + - must not start with a capital letter + - - 'fmt.Errorf[0]' + - '/(^|[^\.!?])$/' + - must not end in punctuation + - - panic + - '/^[^\n]*$/' + - must not contain line breaks + - name: function-result-limit + severity: warning + disabled: false + arguments: [ 5 ] + - name: import-shadowing + severity: warning + disabled: false + arguments: [ "github.com/polaris-contrib/store-mysqlopt","namespace" ] + - name: waitgroup-by-value + severity: warning + disabled: false + - name: max-public-structs + severity: warning + disabled: false + arguments: [ 35 ] + - name: indent-error-flow + severity: warning + disabled: false + - name: function-length + severity: warning + disabled: false + arguments: [ 80,0 ] + - name: file-header + arguments: [ "Tencent is pleased to support the open source community by making Polaris available." ] + - name: exported + severity: warning + disabled: true + - name: errorf + severity: warning + disabled: false + - name: error-naming + severity: warning + disabled: false + + # https://golangci-lint.run/usage/linters/#funlen + funlen: + # Checks the number of lines in a function. + # If lower than 0, disable the check. + # Default: 60 + lines: 230 + # Checks the number of statements in a function. + # If lower than 0, disable the check. + # Default: 40 + statements: -1 + + # https://golangci-lint.run/usage/linters/#lll + lll: + # Max line length, lines longer will be reported. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option. + # Default: 120. + line-length: 120 + # Tab width in spaces. + # Default: 1 + tab-width: 1 + + # https://golangci-lint.run/usage/linters/#goconst + goconst: + # Minimal length of string constant. + # Default: 3 + min-len: 2 + # Minimum occurrences of constant string count to trigger issue. + # Default: 3 + # For subsequent optimization, the value is reduced. + min-occurrences: 60 + # Ignore test files. + # Default: false + ignore-tests: true + # Look for existing constants matching the values. + # Default: true + match-constant: false + # Search also for duplicated numbers. + # Default: false + numbers: true + # Minimum value, only works with goconst.numbers + # Default: 3 + min: 5 + # Maximum value, only works with goconst.numbers + # Default: 3 + max: 20 + # Ignore when constant is not used as function argument. + # Default: true + ignore-calls: false + + # https://golangci-lint.run/usage/linters/#gocritic + gocritic: + disabled-checks: + - ifElseChain + - assignOp + - appendAssign + - singleCaseSwitch + - regexpMust + - typeSwitchVar + - elseif + - badCall + + # https://golangci-lint.run/usage/linters/#gosimple + gosimple: + # Select the Go version to target. + # Default: 1.13 + # Deprecated: use the global `run.go` instead. + go: "1.15" + # Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks + # Default: ["*"] + checks: [ + "all", "-S1000", "-S1001", "-S1002", "-S1008", "-S1009", "-S1016", "-S1023", "-S1025", "-S1029", "-S1034", "-S1040","-S1019" + ] + + # https://golangci-lint.run/usage/linters/#govet + govet: + # Report about shadowed variables. + # Default: false + check-shadowing: true + # Settings per analyzer. + settings: + # Analyzer name, run `go tool vet help` to see all analyzers. + printf: + # Comma-separated list of print function names to check (in addition to default, see `go tool vet help printf`). + # Default: [] + funcs: + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + # shadow: + # Whether to be strict about shadowing; can be noisy. + # Default: false + # strict: false + unusedresult: + # Comma-separated list of functions whose results must be used + # (in addition to defaults context.WithCancel,context.WithDeadline,context.WithTimeout,context.WithValue, + # errors.New,fmt.Errorf,fmt.Sprint,fmt.Sprintf,sort.Reverse) + # Default [] + funcs: + - pkg.MyFunc + - context.WithCancel + - context.WithDeadline + - context.WithTimeout + - context.WithValue + - sort.Reverse + # Comma-separated list of names of methods of type func() string whose results must be used + # (in addition to default Error,String) + # Default [] + stringmethods: + - MyMethod + # Enable all analyzers. + # Default: false + enable-all: true + # Disable analyzers by name. + # Run `go tool vet help` to see all analyzers. + # Default: [] + disable: + - asmdecl + - assign + - atomic + - atomicalign + - bools + - buildtag + - cgocall + - composites + - copylocks + - deepequalerrors + - errorsas + - fieldalignment + - findcall + - framepointer + - httpresponse + - ifaceassert + - loopclosure + - lostcancel + - nilfunc + - nilness + - reflectvaluecompare + - shift + - shadow + - sigchanyzer + - sortslice + - stdmethods + - stringintconv + - structtag + - testinggoroutine + - tests + - unmarshal + - unreachable + - unsafeptr + - unusedwrite + + # https://golangci-lint.run/usage/linters/#staticcheck + staticcheck: + # Select the Go version to target. + # Default: "1.13" + # Deprecated: use the global `run.go` instead. + go: "1.15" + # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks + # Default: ["*"] + checks: [ "all","-SA1019","-SA4015","-SA1029","-SA1016","-SA9003","-SA4006","-SA6003","-SA1004","-SA4009","-SA6002","-SA4017","-SA4021","-SA1006","-SA4010" ] + + # https://golangci-lint.run/usage/linters/#gofmt + gofmt: + # Simplify code: gofmt with `-s` option. + # Default: true + simplify: true + # Apply the rewrite rules to the source before reformatting. + # https://pkg.go.dev/cmd/gofmt + # Default: [] + rewrite-rules: [ ] + + # https://golangci-lint.run/usage/linters/#gci + gci: + # Section configuration to compare against. + # Section names are case-insensitive and may contain parameters in (). + # The default order of sections is `standard > default > custom > blank > dot`, + # If `custom-order` is `true`, it follows the order of `sections` option. + # Default: ["standard", "default"] + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - prefix(github.com/polaris-contrib/store-mysqlopt) # Custom section: groups all imports with the specified Prefix. + #- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. + #- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. + # Skip generated files. + # Default: true + skip-generated: true + # Enable custom order of sections. + # If `true`, make the section order the same as the order of `sections`. + # Default: false + custom-order: true + + # https://golangci-lint.run/usage/linters/#whitespace + whitespace: + # Enforces newlines (or comments) after every multi-line if statement. + # Default: false + multi-if: false + # Enforces newlines (or comments) after every multi-line function signature. + # Default: false + multi-func: false \ No newline at end of file diff --git a/.licenserc.yaml b/.licenserc.yaml new file mode 100644 index 0000000..98ff06b --- /dev/null +++ b/.licenserc.yaml @@ -0,0 +1,90 @@ +# Tencent is pleased to support the open source community by making Polaris available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# +# Licensed under the BSD 3-Clause License (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://opensource.org/licenses/BSD-3-Clause +# +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. + +header: # `header` section is configurations for source codes license header. + license: + spdx-id: BSD-3-Clause # the spdx id of the license, it's convenient when your license is standard SPDX license. + copyright-owner: Tencent # the copyright owner to replace the [owner] in the `spdx-id` template. + content: + | # `license` will be used as the content when `fix` command needs to insert a license header. + Tencent is pleased to support the open source community by making Polaris available. + + Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + + Licensed under the BSD 3-Clause License (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://opensource.org/licenses/BSD-3-Clause + + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + # `pattern` is optional regexp if all the file headers are the same as `license` or the license of `spdx-id` and `copyright-owner`. + pattern: | + Tencent is pleased to support the open source community by making Polaris available. + + Copyright \(C\) 2019 THL A29 Limited, a Tencent company. All rights reserved. + + Licensed under the BSD 3-Clause License \(the "License"\); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://opensource.org/licenses/BSD-3-Clause + + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + paths: # `paths` are the path list that will be checked (and fixed) by license-eye, default is ['**']. + - "**" + + paths-ignore: # `paths-ignore` are the path list that will be ignored by license-eye. + # folder + - "common/api/protoc" + - "deploy" + - "release" + - "test/data/xds" + + # single file + - "LICENSE" + - ".gitignore" + - "Makefile" + - "Dockerfile" + - "version" + - ".golangci.yml" + - ".github" + - "logo.svg" + - "**/*.pb.go" + - "**/*_mock.go" + - "**/*.proto" + - "**/*.md" + - "**/go.mod" + - "**/go.sum" + comment: on-failure # on what condition license-eye will comment on the pull request, `on-failure`, `always`, `never`. + + # license-location-threshold specifies the index threshold where the license header can be located, + # after all, a "header" cannot be TOO far from the file start. + license-location-threshold: 80 + language: + Go: + extensions: + - ".go" + comment_style_id: SlashAsterisk + +dependency: + files: + - go.mod