diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 460480d..2bdf49a 100755 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve this project labels: bug-p3 -assignees: mrz1836 +assignees: rohenaz --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index cb3fd96..32357d7 100755 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Feature request about: Suggest an idea for this project labels: idea -assignees: mrz1836 +assignees: rohenaz --- diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index c7f749a..046b60c 100755 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -2,7 +2,7 @@ name: Question about: 'General template for a question ' labels: question -assignees: mrz1836 +assignees: rohenaz --- diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c999cb7..e047aef 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,9 +10,9 @@ updates: # Check for npm updates at 9am UTC (5am EST) time: "10:00" reviewers: - - "mrz1836" + - "rohenaz" assignees: - - "mrz1836" + - "rohenaz" # Labels must be created first labels: - "update" @@ -25,9 +25,9 @@ updates: interval: "weekly" day: "monday" reviewers: - - "mrz1836" + - "rohenaz" assignees: - - "mrz1836" + - "rohenaz" labels: - "chore" open-pull-requests-limit: 10 \ No newline at end of file diff --git a/.github/mergify.yml b/.github/mergify.yml index 921360b..adea3aa 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -8,8 +8,7 @@ pull_request_rules: conditions: - -draft - author~=^dependabot(|-preview)\[bot\]$ - - check-success='test (1.18.x, ubuntu-latest)' - - check-success='test (1.19.x, ubuntu-latest)' + - check-success='test (1.23.x, ubuntu-latest)' - check-success='Analyze (go)' - title~=^Bump [^\s]+ from ([\d]+)\..+ to \1\. actions: @@ -21,13 +20,12 @@ pull_request_rules: - name: Alert on major version detection conditions: - author~=^dependabot(|-preview)\[bot\]$ - - check-success='test (1.18.x, ubuntu-latest)' - - check-success='test (1.19.x, ubuntu-latest)' + - check-success='test (1.23.x, ubuntu-latest)' - check-success='Analyze (go)' - -title~=^Bump [^\s]+ from ([\d]+)\..+ to \1\. actions: comment: - message: "⚠️ @mrz1836: this is a major version bump and requires your attention" + message: "⚠️ @rohenaz: this is a major version bump and requires your attention" # =============================================================================== # AUTOMATIC MERGE (APPROVALS) @@ -38,8 +36,7 @@ pull_request_rules: - "#approved-reviews-by>=1" - "#review-requested=0" - "#changes-requested-reviews-by=0" - - check-success='test (1.18.x, ubuntu-latest)' - - check-success='test (1.19.x, ubuntu-latest)' + - check-success='test (1.23.x, ubuntu-latest)' - check-success='Analyze (go)' - -title~=(?i)wip - label!=work-in-progress @@ -57,7 +54,7 @@ pull_request_rules: - "#assignee=0" actions: assign: - users: [ "mrz1836" ] + users: [ "rohenaz" ] # =============================================================================== # ALERTS @@ -170,7 +167,7 @@ pull_request_rules: - and: - author!=dependabot[bot] - author!=mergify[bot] - - author!=mrz1836 + - author!=rohenaz - author!=rohenaz actions: comment: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0aab0fc..befb0d5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: with: distribution: goreleaser version: latest - args: release --rm-dist --debug + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Syndicate to GoDocs diff --git a/.golangci.yml b/.golangci.yml index 10cda07..ecdbe6a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,7 @@ run: concurrency: 4 # timeout for analysis, e.g. 30s, 5m, default is 1m - timeout: 5m + timeout: 1m # exit code when at least one issue was found, default is 1 issues-exit-code: 1 @@ -19,50 +19,18 @@ run: build-tags: - mytag - # 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 - # from 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: - - .github - - .make - - dist - # default is true. Enables skipping of directories: # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: true - - # 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$" - - lib/bad.go - - # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": - # If invoked with -mod=readonly, the go command is disallowed from the implicit - # automatic updating of go.mod described above. Instead, it fails when any changes - # to go.mod are needed. This setting is most useful to check that go.mod does - # not need updates, such as in a continuous integration and testing system. - # If invoked with -mod=vendor, the go command assumes that the vendor - # directory holds the correct copies of dependencies and ignores - # the dependency descriptions in go.mod. - #modules-download-mode: readonly|release|vendor + # skip-dirs-use-default: true # Allow multiple parallel golangci-lint instances running. # If false (default) - golangci-lint acquires file lock on start. allow-parallel-runners: false - # output configuration options output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number + # formats: + # - colored-line-number # print lines of code with issue, default is true print-issued-lines: true @@ -76,7 +44,6 @@ output: # add a prefix to the output file references; default is no prefix path-prefix: "" - # all available settings of specific linters linters-settings: dogsled: @@ -94,14 +61,11 @@ linters-settings: # default is false: such cases aren't reported by default. check-blank: false - # [deprecated] comma-separated list of pairs of the form pkg:regex - # the regex is used to ignore names within pkg. (default "fmt:.*"). - # see https://github.com/kisielk/errcheck#the-deprecated-method for details - ignore: fmt:.*,io/ioutil:^Read.* + # use exclude-functions instead of ignore + exclude-functions: + - fmt:.* + - io/ioutil:^Read.* - # path to a file containing a list of functions to exclude from checking - # see https://github.com/kisielk/errcheck#excluding-functions for details - #exclude: /path/to/file.txt exhaustive: # indicates that switch statements are to be considered exhaustive if a # 'default' case is present, even if all enum members aren't listed in the @@ -111,10 +75,10 @@ linters-settings: lines: 60 statements: 40 gci: - # put imports beginning with prefix after 3rd-party packages; - # only support one prefix - # if not set, use goimports.local-prefixes - local-prefixes: github.com/org/project + sections: + - Standard + - Default + - Prefix(github.com/org/project) gocognit: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 10 @@ -166,16 +130,16 @@ linters-settings: gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true - goheader: - values: - const: - # define here const type values in format k:v, for example: - # YEAR: 2020 - # COMPANY: MY COMPANY - regexp: - # define here regexp type values, for example - # AUTHOR: .*@mycompany\.com - template: + # goheader: + # values: + # const: + # # define here const type values in format k:v, for example: + # # YEAR: 2020 + # # COMPANY: MY COMPANY + # regexp: + # # define here regexp type values, for example + # # AUTHOR: .*@mycompany\.com + # template: # put here copyright header template for source code files, for example: # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }} # SPDX-License-Identifier: Apache-2.0 @@ -191,20 +155,25 @@ linters-settings: # 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. - template-path: + # template-path: # also as alternative of directive 'template' you may put the path to file with the template source goimports: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes local-prefixes: github.com/org/project - gomnd: - settings: - mnd: - # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. - checks: argument,case,condition,operation,return,assign + # gomnd: + # checks: + # - argument + # - case + # - condition + # - operation + # - return + # - assign + # ignored-numbers: [] # Add numbers here if needed + # ignored-files: [] # Add file patterns to ignore if needed + # ignored-functions: [] # Add function patterns to ignore if needed govet: - # report about shadowed variables - check-shadowing: true + # Removed deprecated `check-shadowing` option # settings per analyzer settings: @@ -219,17 +188,17 @@ linters-settings: enable: - atomicalign enable-all: false - disable: + # disable: #- shadow disable-all: false - depguard: - list-type: blacklist - include-go-root: false - packages: - - github.com/sirupsen/logrus - packages-with-error-message: - # specify an error message to output when a blacklisted package is used - - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" + # depguard: + # list-type: blacklist + # include-go-root: false + # packages: + # - github.com/sirupsen/logrus + # packages-with-error-message: + # # specify an error message to output when a blacklisted package is used + # - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" lll: # max line length, lines longer will be reported. Default is 120. # '\t' is counted as 1 character by default, and can be changed with the tab-width option @@ -260,7 +229,7 @@ linters-settings: # Enable to ensure that nolint directives are all used. Default is true. allow-unused: false # Disable to ensure that nolint directives don't have a leading space. Default is true. - allow-leading-space: true + # allow-leading-space: true # Exclude following linters from requiring an explanation. Default is []. allow-no-explanation: [] # Enable to require an explanation of nonzero length after each nolint directive. Default is false. @@ -279,12 +248,12 @@ linters-settings: # if it's called for subdir of a project it can't find external interfaces. All text editor integrations # with golangci-lint call it on a directory with the changed file. check-exported: false - unused: + # unused: # treat code as a program (not a library) and report unused exported identifiers; default is false. # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find funcs usages. All text editor integrations # with golangci-lint call it on a directory with the changed file. - check-exported: false + # check-exported: false whitespace: multi-if: false # Enforces newlines (or comments) after every multi-line if statement multi-func: false # Enforces newlines (or comments) after every multi-line function signature @@ -305,28 +274,19 @@ linters-settings: force-case-trailing-whitespace: 0 # Force cuddling of err checks with err var assignment force-err-cuddling: false - # Allow leading comments to be separated with empty liens + # Allow leading comments to be separated with empty lines allow-separated-leading-comment: false gofumpt: # Choose whether or not to use the extra rules that are disabled # by default extra-rules: false - # The custom section can be used to define linter plugins to be loaded at runtime. See README doc - # for more info. - custom: - # Each custom linter should have a unique name. - #example: - # The path to the plugin *.so. Can be absolute or local. Required for each custom linter - #path: /path/to/example.so - # The description of the linter. Optional, just for documentation purposes. - #description: This is an example usage of a plugin linter. - # Intended to point to the repo location of the linter. Optional, just for documentation purposes. - #original-url: github.com/golangci/example-linter - +# linters configuration linters: enable: - - megacheck + - gosimple + - staticcheck + - unused - govet - gosec - bodyclose @@ -336,19 +296,20 @@ linters: - misspell - dogsled - prealloc - - exportloopref + - copyloopvar - exhaustive - sqlclosecheck - nolintlint - gci - goconst - lll + # - shadow # Added as per the deprecation notice disable: - gocritic # use this for very opinionated linting - gochecknoglobals - whitespace - wsl - - goerr113 + - err113 - godot - testpackage - nestif @@ -359,12 +320,17 @@ linters: - unused fast: false - +# issues configuration issues: + exclude-files: + - ".*\\.my\\.go$" + - lib/bad.go + exclude-dirs: + - .github + - .make + - dist + # List of regexps of issue texts to exclude, empty list by default. - # But independently from this option we use default exclude patterns, - # it can be disabled by `exclude-use-default: false`. To list all - # excluded by default patterns execute `golangci-lint run --help` exclude: - abcdef @@ -396,7 +362,7 @@ issues: - lll source: "^//go:generate " - # Independently of option `exclude` we use default exclude patterns, + # Independently from option `exclude` we use default exclude patterns, # it can be disabled by this option. To list all # excluded by default patterns execute `golangci-lint run --help`. # Default value for this option is true. @@ -414,38 +380,21 @@ issues: # Show only new issues: if there are unstaged changes or untracked files, # only those changes are analyzed, else only changes in HEAD~ are analyzed. - # It's a super-useful option for integration of golangci-lint into existing - # large codebase. It's not practical to fix all existing issues at the moment - # of integration: much better don't allow issues in new code. # Default is false. new: false # Show only new issues created after git revision `REV` new-from-rev: "" - # Show only new issues created in git patch with set file path. - #new-from-patch: path/to/patch/file - +# severity configuration severity: # Default value is empty string. - # Set the default severity for issues. If severity rules are defined and the issues - # do not match or no severity is provided to the rule this will be the default - # severity applied. Severities should match the supported severity names of the - # selected out format. - # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity - # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity - # - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message default-severity: error # The default value is false. - # If set to true severity-rules regular expressions become case sensitive. case-sensitive: false # Default value is empty list. - # When a list of severity rules are provided, severity information will be added to lint - # issues. Severity rules have the same filtering capability as exclude rules except you - # are allowed to specify one matcher per severity rule. - # Only affects out formats that support setting severity information. rules: - linters: - dupl diff --git a/.goreleaser.yml b/.goreleaser.yml index dabfaef..449477e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,4 +1,7 @@ -# Make sure to check the documentation at http://goreleaser.com +# .goreleaser.yaml + +version: 2 + # --------------------------- # General # --------------------------- @@ -16,31 +19,22 @@ changelog: - '^test:' # --------------------------- -# Publishers +# Builders # --------------------------- -# publishers: -# - name: "Publish GoDocs" -# cmd: make godocs +builds: + - skip: true # --------------------------- -# Builder -# --------------------------- -build: - skip: true - -# --------------------------- -# Github Release +# GitHub Release # --------------------------- release: - prerelease: true - name_template: "Release v{{.Version}}" + prerelease: false + name_template: "Release v{{ .Version }}" # --------------------------- # Announce # --------------------------- announce: - - # See more at: https://goreleaser.com/customization/announce/#slack slack: enabled: false message_template: '{{ .ProjectName }} {{ .Tag }} is out! Changelog: https://github.com/BitcoinSchema/{{ .ProjectName }}/releases/tag/{{ .Tag }}' @@ -49,30 +43,20 @@ announce: # icon_emoji: '' # icon_url: '' - # See more at: https://goreleaser.com/customization/announce/#twitter twitter: enabled: false message_template: '{{ .ProjectName }} {{ .Tag }} is out!' - # See more at: https://goreleaser.com/customization/announce/#discord discord: enabled: false message_template: '{{ .ProjectName }} {{ .Tag }} is out!' - # Defaults to `GoReleaser` - author: '' - # Defaults to `3888754` - the grey-ish from goreleaser - color: '' - # Defaults to `https://goreleaser.com/static/avatar.png` - icon_url: '' + # author: '' + # color: '' + # icon_url: '' - # See more at: https://goreleaser.com/customization/announce/#reddit reddit: enabled: false - # Application ID for Reddit Application application_id: "" - # Username for your Reddit account username: "" - # Defaults to `{{ .GitURL }}/releases/tag/{{ .Tag }}` - # url_template: 'https://github.com/BitcoinSchema/{{ .ProjectName }}/releases/tag/{{ .Tag }}' - # Defaults to `{{ .ProjectName }} {{ .Tag }} is out!` title_template: '{{ .ProjectName }} {{ .Tag }} is out!' + # url_template: 'https://github.com/BitcoinSchema/{{ .ProjectName }}/releases/tag/{{ .Tag }}' \ No newline at end of file diff --git a/.make/go.mk b/.make/go.mk index 765c5e2..5b58827 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -67,15 +67,15 @@ install-go: ## Install the application (Using Native Go) lint: ## Run the golangci-lint application (install if not found) @echo "installing golangci-lint..." @#Travis (has sudo) - @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.3 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.61.0 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi; @#AWS CodePipeline - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.3; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0; fi; @#GitHub Actions - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.53.3; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.61.0; fi; @#Brew - MacOS @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi; @#MacOS Vanilla - @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.53.3; fi; + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.61.0; fi; @echo "running golangci-lint..." @golangci-lint run --verbose diff --git a/README.md b/README.md index 354cdd1..787280c 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ vet Run the Go vet application ## Examples & Tests All unit tests and [examples](examples) run via [GitHub Actions](https://github.com/BitcoinSchema/go-bap/actions) and -uses [Go version 1.18.x](https://golang.org/doc/go1.18). View the [configuration file](.github/workflows/run-tests.yml). +uses [Go version 1.23.x](https://golang.org/doc/go1.23). View the [configuration file](.github/workflows/run-tests.yml). Run all tests (including integration tests) ```shell script