From bfa256965713789e6d050545d9ad018b586e3f96 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Wed, 28 Oct 2020 11:31:51 -0400 Subject: [PATCH] Base repo template for go package --- .github/FUNDING.yml | 4 + .github/IMAGES/github-share-image.png | Bin 0 -> 16481 bytes .github/ISSUE_TEMPLATE/bug_report.md | 23 ++ .github/ISSUE_TEMPLATE/feature_request.md | 19 + .github/ISSUE_TEMPLATE/question.md | 13 + .github/PULL_REQUEST_TEMPLATE/general.md | 7 + .github/workflows/codeql-analysis.yml | 71 ++++ .gitignore | 35 ++ .golangci.yml | 464 ++++++++++++++++++++++ .goreleaser.yml | 27 ++ .make/Makefile.common | 72 ++++ .make/Makefile.go | 90 +++++ .travis.yml | 29 ++ CODE_OF_CONDUCT.md | 52 +++ CODE_STANDARDS.md | 34 ++ CONTRIBUTING.md | 17 + LICENSE | 21 + Makefile | 28 ++ SECURITY.md | 13 + 19 files changed, 1019 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/IMAGES/github-share-image.png create mode 100755 .github/ISSUE_TEMPLATE/bug_report.md create mode 100755 .github/ISSUE_TEMPLATE/feature_request.md create mode 100755 .github/ISSUE_TEMPLATE/question.md create mode 100755 .github/PULL_REQUEST_TEMPLATE/general.md create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .gitignore create mode 100644 .golangci.yml create mode 100644 .goreleaser.yml create mode 100644 .make/Makefile.common create mode 100644 .make/Makefile.go create mode 100644 .travis.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CODE_STANDARDS.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 SECURITY.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..579f5ae --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +github: BitcoinSchema +custom: https://gobitcoinsv.com/#sponsor \ No newline at end of file diff --git a/.github/IMAGES/github-share-image.png b/.github/IMAGES/github-share-image.png new file mode 100644 index 0000000000000000000000000000000000000000..aacc03506bf298d0bb6e9be768c5a992a59f4f1a GIT binary patch literal 16481 zcmcJ1Ra6~Oll8^n;!bb~?k*u0cS&$}cMa}-ad+3??he7--Q7uWXPEC{{`IeUo`>#w z=(TGd>D5)IYVQt{{~>`4#0LTZ0AwjiQN>UD_w%}fhy1*YG*3nV0D?49qC(1UtLL4r zsoE>fByLlk%&I6^P6csJc#}w+{s!WN@x_t~{!QkJGj$U`R~J@iPuJ`|cB?w#T`wAq z={0&6rRg0-FIc1!Q$q}R{*2%O0+BfUV5fPNe=x6m-g{oDaF;2ma85_r-gXqA3;c3b z>C}37zijQstPTSAqv?gm;F9BQLzX)Xb`9Rzb6ANPzx2!;+G%Tx&xj2}8quo3%0qp<0Q8l&^f5 z$C3T3lp3DXjg6?s7qkb$rk1z6XclM7VaPw1W<`^Y-*K=a z5eGsIyc}#N|5eX+%d7zjNGa&Yw6q8oM(oG9c&o$6O?>vdH@PWF&B!2bS3c_(gtW9} zczQmvpdF)}05&VPp{T67I)TEKHS>o-y7}h4k{uv4TlX6M3n-6v1oG&Z%*M!FNLkPs zv-_dU>aY|A;4=JcLZ!V#>w|rf4fm38khDxgt6y&%!NRS;C{YTiWk58 zgRas2i-;t{VpR}S_;J#aNQxeY3aZ3KPUZ*MaHYLx=~e1X(;P}8Pp)2ZBsw~cOam(H zpRme`N^e0sde*4fJQPXZmh0H zBCMzeb`2o}D52hc>7#eYD+l(KP-V@FBu&!U*;b|a1-Tq(fi>FA_^*_jR&%NU zFxBC|C%;Xq_;f-cEC8n|A&d7ls?4}&m|rAEYbbe8d7gHKIHNKgHo5^tG8I}=n>9hQ@7m0{YfW?s z+*6kR<}|DL@RXPJXP=AY601mdPZ87b~I)+d59YVq<(uIT~e%C_V zz7=M^;|qEz)L97*SlzTJHj56Itw|-#cLx$KPn_3I6?k%@RlC?F*|7n4`wUN>Y@@&t z+#77b_i-4ID688bs^cw&gw*#mRVS|7EHjt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DE`Q0Z2(MisbokP50hKP0` zV_c!5U0~lz-Fg5Q2KWGe_m(0M&68QV1d9vRJjuqF8?!xs=!WJXtnJ^Z6br6iV_g2J zNRlL51P^J0ophs>xu~Wxi@1|T;Z(juRVEUW&+|JJfV*l&Z$Hl4fNWcYVFA|$%BpV6 z*3g0s=ldy?XY);Q{8daD@KjD(29svIPVstvpJ;9XT{0o*t^ZYLP>{TVjB46Hpim#B z3QMre>L$+J&^^Vv*x#8Bl)7L;1#{)iiE8bRYn)UQIv)5405++Hw0-fLI#(;A{P!Ar zoRJkoMkTY78d`3m0a~T_!;lK?t z$m`Oo(BEyFFsQkPuviyH)s1r5Sjr(LTUl$#`7o}a=l4mSmpl7;iG3*4-=IW@3h7T7uRr+?;|wOVjZti(glKKDU7aQr@xxVBP3{ z^mZw1PI7rGjj1KuJL{Ej5q8jsn2{NBmx59XL(DnE-Cm1B2T%yd(K>K<_DJbB`hF27 zC9DLArLxU!(c+@8qA41wxROrXoaE&4_>s*nSD@X!YyVqE^WN#boL5;})3VI5%;&)^ z>AG38xvPz(g!Ps5(!UkGzatKR&1BQ5^BT#B8h7-V38#2`b(B#50lS|{HDO_6X2*?3 zNG=`jaa#yHYfa~{&asszD1_2Ow%@Ck1HUr(5pPg))|n&xvXt>Eq%vw+1m8%k0pLVagc1@%W!g55)3Zxs zD_76AMhuJy4|Y#jgLJ~S{c1|jg%MwAFWQIBp5)=Nq14PektfoI)F#TA21|*fT*9QJ zlOGNZ@i0UgMng}hCTfUvV_IaK9AW$~NT#ef)X1`Ds%A~xZ}YfP@q^QSZZfI$fzH41 zD}_wt=APN}E|do%*=A_Pe@oz3Fn0O=djDUl=j+n0Ki~j>kB@@~ezwaWQr(}w4gg4r Leae=F^#lG3HQydx literal 0 HcmV?d00001 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100755 index 0000000..460480d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,23 @@ +--- +name: Bug report +about: Create a report to help us improve this project +labels: bug-p3 +assignees: mrz1836 + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100755 index 0000000..cb3fd96 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +labels: idea +assignees: mrz1836 + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100755 index 0000000..c7f749a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,13 @@ +--- +name: Question +about: 'General template for a question ' +labels: question +assignees: mrz1836 + +--- + +**What's your question?** +A clear and concise question using references to specific regions of code if applicable. + +**Additional context** +Add any other context or information. diff --git a/.github/PULL_REQUEST_TEMPLATE/general.md b/.github/PULL_REQUEST_TEMPLATE/general.md new file mode 100755 index 0000000..4030f6f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/general.md @@ -0,0 +1,7 @@ +Fixes # + +## Proposed Changes + + - + - + - diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..bdbb1cd --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,71 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [master] + pull_request: + # The branches below must be a subset of the branches above + branches: [master] + schedule: + - cron: '0 23 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ['go'] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb29953 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# OS files +*.db +*.DS_Store + +# Jetbrains +.idea/ + +# Eclipse +.project + +# Notes +todo.md +paymail-notes.md + +# Releases +*.tar.gz + +# Generated binaries +dist + +# Converage +coverage.txt \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..a637738 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,464 @@ +# This file contains all available configuration options +# with their default values. + +# options for analysis running +run: + # default concurrency is a available CPU number + concurrency: 4 + + # timeout for analysis, e.g. 30s, 5m, default is 1m + timeout: 1m + + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + + # include test files or not, default is true + tests: true + + # list of build tags, all linters use it. Default is empty list. + 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 + + # 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 + + # print lines of code with issue, default is true + print-issued-lines: true + + # print linter name in the end of issue text, default is true + print-linter-name: true + + # make issues output unique by line, default is true + uniq-by-line: true + + # add a prefix to the output file references; default is no prefix + path-prefix: "" + + +# all available settings of specific linters +linters-settings: + dogsled: + # checks assignments with too many blank identifiers; default is 2 + max-blank-identifiers: 2 + dupl: + # tokens count to trigger issue, 150 by default + threshold: 100 + errcheck: + # report about not checking of errors in type assertions: `a := b.(MyStruct)`; + # default is false: such cases aren't reported by default. + check-type-assertions: false + + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; + # 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.* + + # 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 + # switch + default-signifies-exhaustive: false + funlen: + 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 + gocognit: + # minimal code complexity to report, 30 by default (but we recommend 10-20) + min-complexity: 10 + nestif: + # minimal complexity of if statements to report, 5 by default + min-complexity: 4 + goconst: + # minimal length of string constant, 3 by default + min-len: 3 + # minimal occurrences count to trigger, 3 by default + min-occurrences: 3 + gocritic: + # Which checks should be enabled; can't be combined with 'disabled-checks'; + # See https://go-critic.github.io/overview#checks-overview + # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` + # By default list of stable checks is used. + #enabled-checks: + # - rangeValCopy + + # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty + disabled-checks: + - regexpMust + + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". + enabled-tags: + - performance + disabled-tags: + - experimental + + settings: # settings passed to gocritic + captLocal: # must be valid enabled check name + paramsOnly: true + rangeValCopy: + sizeThreshold: 32 + gocyclo: + # minimal code complexity to report, 30 by default (but we recommend 10-20) + min-complexity: 10 + godot: + # check all top-level comments, not only declarations + check-all: false + godox: + # report any comments starting with keywords, this is useful for TODO or FIXME comments that + # might be left in the code accidentally and should be resolved before merging + keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting + - NOTE + - OPTIMIZE # marks code that should be optimized before merging + - HACK # marks hack-arounds that should be removed before merging + 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: + # put here copyright header template for source code files, for example: + # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }} + # SPDX-License-Identifier: Apache-2.0 + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at: + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # 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. + 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 + golint: + # minimal confidence for issues, default is 0.8 + min-confidence: 0.8 + 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 + govet: + # report about shadowed variables + check-shadowing: true + + # settings per analyzer + settings: + printf: # analyzer name, run `go tool vet help` to see all analyzers + funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer + - (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 + + # enable or disable analyzers by name + enable: + - atomicalign + enable-all: false + 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" + 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 + line-length: 120 + # tab width in spaces. Default to 1. + tab-width: 1 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true + misspell: + # Correct spellings using locale preferences for US or UK. + # Default is to use a neutral variety of English. + # Setting locale to US will correct the British spelling of 'colour' to 'color'. + locale: US + ignore-words: + - bsv + - bitcoin + nakedret: + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 + max-func-lines: 30 + prealloc: + # XXX: we don't recommend using this linter before doing performance profiling. + # For most programs usage of prealloc will be a premature optimization. + + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. + # True by default. + simple: true + range-loops: true # Report preallocation suggestions on range loops, true by default + for-loops: false # Report preallocation suggestions on for loops, false by default + nolintlint: + # 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 + # 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. + require-explanation: true + # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. + require-specific: true + rowserrcheck: + packages: + - github.com/jmoiron/sqlx + testpackage: + # regexp pattern to skip files + skip-regexp: (export|internal)_test\.go + unparam: + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: + # 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: + # 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 + 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 + wsl: + # If true append is only allowed to be cuddled if appending value is + # matching variables, fields or types on line above. Default is true. + strict-append: true + # Allow calls and assignments to be cuddled as long as the lines have any + # matching variables, fields or types. Default is true. + allow-assign-and-call: true + # Allow multiline assignments to be cuddled. Default is true. + allow-multiline-assign: true + # Allow declarations (var) to be cuddled. + allow-cuddle-declarations: true + # Allow trailing comments in ending of blocks + allow-trailing-comment: false + # Force newlines in end of case at this limit (0 = never). + 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-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: + enable: + - megacheck + - govet + - gosec + - bodyclose + - golint + - unconvert + - dupl + - maligned + - misspell + - dogsled + - prealloc + - exportloopref + - exhaustive + - sqlclosecheck + - nolintlint + - gci + - goconst + - lll + disable: + - gocritic # use this for very opinionated linting + - gochecknoglobals + - whitespace + - wsl + - goerr113 + - godot + - testpackage + - nestif + - nlreturn + disable-all: false + presets: + - bugs + - unused + fast: false + + +issues: + # 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 + + # Excluding configuration per-path, per-linter, per-text and per-source + exclude-rules: + # Exclude some linters from running on tests files. + - path: _test\.go + linters: + - gocyclo + - errcheck + - dupl + - gosec + - maligned + - lll + + # Exclude known linters from partially hard-vendored code, + # which is impossible to exclude via "nolint" comments. + - path: internal/hmac/ + text: "weak cryptographic primitive" + linters: + - gosec + + # Exclude some staticcheck messages + - linters: + - staticcheck + text: "SA1019:" + + # Exclude lll issues for long lines with go:generate + - linters: + - lll + source: "^//go:generate " + + # 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. + exclude-use-default: false + + # The default value is false. If set to true exclude and exclude-rules + # regular expressions become case sensitive. + exclude-case-sensitive: false + + # The list of ids of default excludes to include or disable. By default it's empty. + include: + - EXC0002 # disable excluding of issues about comments from golint + + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + max-issues-per-linter: 0 + + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + max-same-issues: 0 + + # 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: + # 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 + severity: info \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..7580a49 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,27 @@ +# Make sure to check the documentation at http://goreleaser.com +# --------------------------- +# GENERAL +# --------------------------- +before: + hooks: + - make all +snapshot: + name_template: "{{ .Tag }}" +changelog: + sort: asc + filters: + exclude: + - '^.github:' + - '^test:' + +# --------------------------- +# BUILDER +# --------------------------- +build: + skip: true +# --------------------------- +# Github Release +# --------------------------- +release: + prerelease: true + name_template: "Release v{{.Version}}" \ No newline at end of file diff --git a/.make/Makefile.common b/.make/Makefile.common new file mode 100644 index 0000000..9b24ae7 --- /dev/null +++ b/.make/Makefile.common @@ -0,0 +1,72 @@ +## Default repository domain name +ifndef GIT_DOMAIN + override GIT_DOMAIN=github.com +endif + +## Set if defined (alias variable for ease of use) +ifdef branch + override REPO_BRANCH=$(branch) + export REPO_BRANCH +endif + +## Do we have git available? +HAS_GIT := $(shell command -v git 2> /dev/null) + +ifdef HAS_GIT + ## Do we have a repo? + HAS_REPO := $(shell git rev-parse --is-inside-work-tree 2> /dev/null) + ifdef HAS_REPO + ## Automatically detect the repo owner and repo name (for local use with Git) + REPO_NAME=$(shell basename "$(shell git rev-parse --show-toplevel 2> /dev/null)") + OWNER=$(shell git config --get remote.origin.url | sed 's/git@$(GIT_DOMAIN)://g' | sed 's/\/$(REPO_NAME).git//g') + REPO_OWNER=$(shell echo $(OWNER) | tr A-Z a-z) + VERSION_SHORT=$(shell git describe --tags --always --abbrev=0) + export REPO_NAME, REPO_OWNER, VERSION_SHORT + endif +endif + +## Set the distribution folder +ifndef DISTRIBUTIONS_DIR + override DISTRIBUTIONS_DIR=./dist +endif +export DISTRIBUTIONS_DIR + +help: ## Show this help message + @egrep -h '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#' + +release:: ## Full production release (creates release in Github) + @test $(github_token) + @export GITHUB_TOKEN=$(github_token) && goreleaser --rm-dist + +release-test: ## Full production test release (everything except deploy) + @goreleaser --skip-publish --rm-dist + +release-snap: ## Test the full release (build binaries) + @goreleaser --snapshot --skip-publish --rm-dist + +replace-version: ## Replaces the version in HTML/JS (pre-deploy) + @test $(version) + @test "$(path)" + @find $(path) -name "*.html" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \; + @find $(path) -name "*.js" -type f -exec sed -i '' -e "s/{{version}}/$(version)/g" {} \; + +tag: ## Generate a new tag and push (tag version=0.0.0) + @test $(version) + @git tag -a v$(version) -m "Pending full release..." + @git push origin v$(version) + @git fetch --tags -f + +tag-remove: ## Remove a tag if found (tag-remove version=0.0.0) + @test $(version) + @git tag -d v$(version) + @git push --delete origin v$(version) + @git fetch --tags + +tag-update: ## Update an existing tag to current commit (tag-update version=0.0.0) + @test $(version) + @git push --force origin HEAD:refs/tags/v$(version) + @git fetch --tags -f + +update-releaser: ## Update the goreleaser application + @brew update + @brew upgrade goreleaser diff --git a/.make/Makefile.go b/.make/Makefile.go new file mode 100644 index 0000000..132fc07 --- /dev/null +++ b/.make/Makefile.go @@ -0,0 +1,90 @@ +## Default to the repo name if empty +ifndef BINARY_NAME + override BINARY_NAME=app +endif + +## Define the binary name +ifdef CUSTOM_BINARY_NAME + override BINARY_NAME=$(CUSTOM_BINARY_NAME) +endif + +## Set the binary release names +DARWIN=$(BINARY_NAME)-darwin +LINUX=$(BINARY_NAME)-linux +WINDOWS=$(BINARY_NAME)-windows.exe + +.PHONY: test lint vet install + +bench: ## Run all benchmarks in the Go application + @go test -bench=. -benchmem + +build-go: ## Build the Go application (locally) + @go build -o bin/$(BINARY_NAME) + +clean-mods: ## Remove all the Go mod cache + @go clean -modcache + +coverage: ## Shows the test coverage + @go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out + +godocs: ## Sync the latest tag with GoDocs + @test $(GIT_DOMAIN) + @test $(REPO_OWNER) + @test $(REPO_NAME) + @test $(VERSION_SHORT) + @curl https://proxy.golang.org/$(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME)/@v/$(VERSION_SHORT).info + +install: ## Install the application + @go build -o $$GOPATH/bin/$(BINARY_NAME) + +install-go: ## Install the application (Using Native Go) + @go install $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME) + +lint: ## Run the golangci-lint application (install if not found) + @#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.31.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.31.0; fi; + @#Brew - MacOS + @if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi; + @echo "running golangci-lint..." + @golangci-lint run + +test: ## Runs vet, lint and ALL tests + @$(MAKE) lint + @echo "running tests..." + @go test ./... -v + +test-short: ## Runs vet, lint and tests (excludes integration tests) + @$(MAKE) lint + @echo "running tests (short)..." + @go test ./... -v -test.short + +test-travis: ## Runs all tests via Travis (also exports coverage) + @$(MAKE) lint + @echo "running tests..." + @go test ./... -race -coverprofile=coverage.txt -covermode=atomic + +test-travis-short: ## Runs unit tests via Travis (also exports coverage) + @$(MAKE) lint + @echo "running tests (short)..." + @go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic + +uninstall: ## Uninstall the application (and remove files) + @test $(BINARY_NAME) + @test $(GIT_DOMAIN) + @test $(REPO_OWNER) + @test $(REPO_NAME) + @go clean -i $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME) + @rm -rf $$GOPATH/src/$(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME) + @rm -rf $$GOPATH/bin/$(BINARY_NAME) + +update: ## Update all project dependencies + @go get -u ./... && go mod tidy + +update-linter: ## Update the golangci-lint package (macOS only) + @brew upgrade golangci-lint + +vet: ## Run the Go vet application + @echo "running go vet..." + @go vet -v ./... \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..abd6f1c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,29 @@ +# Fast runner (trick from @y0ssar1an) (out-dated) +sudo: false + +# Language of deployment +language: go + +# Version +go: + - 1.15.x + +# Environment variables +env: + - GO111MODULE=on + +# Only clone the most recent commit +git: + depth: 1 + +# Notifications off +notifications: + email: false + +# Run all scripts +script: + - make test-travis + +# After build success +after_success: + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..be4bcd0 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,52 @@ +# Code of Merit + +1. The project creators, lead developers, core team, constitute +the managing members of the project and have final say in every decision +of the project, technical or otherwise, including overruling previous decisions. +There are no limitations to this decisional power. + +2. Contributions are an expected result of your membership on the project. +Don't expect others to do your work or help you with your work forever. + +3. All members have the same opportunities to seek any challenge they want +within the project. + +4. Authority or position in the project will be proportional +to the accrued contribution. Seniority must be earned. + +5. Software is evolutive: the better implementations must supersede lesser +implementations. Technical advantage is the primary evaluation metric. + +6. This is a space for technical prowess; topics outside of the project +will not be tolerated. + +7. Non technical conflicts will be discussed in a separate space. Disruption +of the project will not be allowed. + +8. Individual characteristics, including but not limited to, +body, sex, sexual preference, race, language, religion, nationality, +or political preferences are irrelevant in the scope of the project and +will not be taken into account concerning your value or that of your contribution +to the project. + +9. Discuss or debate the idea, not the person. + +10. There is no room for ambiguity: Ambiguity will be met with questioning; +further ambiguity will be met with silence. It is the responsibility +of the originator to provide requested context. + +11. If something is illegal outside the scope of the project, it is illegal +in the scope of the project. This Code of Merit does not take precedence over +governing law. + +12. This Code of Merit governs the technical procedures of the project not the +activities outside of it. + +13. Participation on the project equates to agreement of this Code of Merit. + +14. No objectives beyond the stated objectives of this project are relevant +to the project. Any intent to deviate the project from its original purpose +of existence will constitute grounds for remedial action which may include +expulsion from the project. + +This document is the Code of Merit (`http://code-of-merit.org`), version 1.0. \ No newline at end of file diff --git a/CODE_STANDARDS.md b/CODE_STANDARDS.md new file mode 100644 index 0000000..5f0b66b --- /dev/null +++ b/CODE_STANDARDS.md @@ -0,0 +1,34 @@ +# Code Standards + +This project uses the following code standards and specifications from: +- [effective go](https://golang.org/doc/effective_go.html) +- [go benchmarks](https://golang.org/pkg/testing/#hdr-Benchmarks) +- [go examples](https://golang.org/pkg/testing/#hdr-Examples) +- [go tests](https://golang.org/pkg/testing/) +- [godoc](https://godoc.org/golang.org/x/tools/cmd/godoc) +- [gofmt](https://golang.org/cmd/gofmt/) +- [golangci-lint](https://golangci-lint.run/) +- [report card](https://goreportcard.com/) + +### *effective go* standards +View the [effective go](https://golang.org/doc/effective_go.html) standards documentation. + +### *golangci-lint* specifications +The package [golangci-lint](https://golangci-lint.run/usage/quick-start) runs several linters in one package/cmd. + +View the active linters in the [configuration file](.golangci.yml). + +Install via macOS: +```shell +brew install golangci-lint +``` + +Install via Linux and Windows: +```shell +# binary will be $(go env GOPATH)/bin/golangci-lint +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0 +golangci-lint --version +``` + +### *godoc* specifications +All code is written with documentation in mind. Follow the best practices with naming, examples and function descriptions. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2c1c075 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,17 @@ +# How to contribute + +Please send a GitHub Pull Request to with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)). The more tests the merrier. Please follow the coding conventions (below) and make sure all of your commits are atomic (one feature per commit). + +## Testing + +All tests follow the standard Go testing pattern. +- [Go Tests](https://golang.org/pkg/testing/) +- [Go Examples](https://golang.org/pkg/testing/#hdr-Examples) +- [Go Benchmarks](https://golang.org/pkg/testing/#hdr-Benchmarks) + +## Coding conventions + +This project follows [effective Go standards](https://golang.org/doc/effective_go.html) and uses additional convention tools: +- [godoc](https://godoc.org/golang.org/x/tools/cmd/godoc) +- [golangci-lint](https://golangci-lint.run/) +- [GoReportCard.com](https://goreportcard.com/) \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b7839bf --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 @BitcoinSchema + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9ee2a54 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +# Common makefile commands & variables between projects +include .make/Makefile.common + +# Common Golang makefile commands & variables between projects +include .make/Makefile.go + +## Not defined? Use default repo name which is the application +ifeq ($(REPO_NAME),) + REPO_NAME="go-aip" +endif + +## Not defined? Use default repo owner +ifeq ($(REPO_OWNER),) + REPO_OWNER="bitcoinschema" +endif + +.PHONY: clean + +all: ## Runs multiple commands + @$(MAKE) test + +clean: ## Remove previous builds and any test cache data + @go clean -cache -testcache -i -r + @test $(DISTRIBUTIONS_DIR) + @if [ -d $(DISTRIBUTIONS_DIR) ]; then rm -r $(DISTRIBUTIONS_DIR); fi + +release:: ## Runs common.release then runs godocs + @$(MAKE) godocs \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..6492683 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported & Maintained Versions + +| Version | Supported | +| ------- | ------------------ | +| 0.x.x | :white_check_mark: | + +## Reporting a Vulnerability + +Individuals or organizations that are experiencing a product security issue are strongly encouraged to contact the [project maintainers](mailto:security@bitcoinschema.org). +We welcome reports from independent researchers, industry organizations, vendors, customers, and other sources concerned with our project security. +The minimal data needed for reporting a security issue is a description of the potential vulnerability. \ No newline at end of file