From 61a25a818976128c8c23fd7a6f9d6d74921c5f4d Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Tue, 21 Dec 2021 12:13:40 -0500 Subject: [PATCH 1/6] Upgraded deps --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e40fd2e..d966685 100644 --- a/go.mod +++ b/go.mod @@ -9,5 +9,5 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/libsv/go-bt v1.0.4 github.com/stretchr/testify v1.7.0 - golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b // indirect + golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect ) diff --git a/go.sum b/go.sum index 69342ad..3fce8d2 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b h1:QAqMVf3pSa6eeTsuklijukjXBlj7Es2QQplab+/RbQ4= -golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 h1:0es+/5331RGQPcXlMfP+WrnIIS6dNnNRe0WB02W0F4M= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From c9abdeb51fe0f7665c3cfa396f720e7d562d71a1 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Tue, 21 Dec 2021 12:13:46 -0500 Subject: [PATCH 2/6] Fixed comments --- hd_key.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hd_key.go b/hd_key.go index 2de9c7a..0954d79 100644 --- a/hd_key.go +++ b/hd_key.go @@ -154,7 +154,7 @@ func GetAddressStringFromHDKey(hdKey *hdkeychain.ExtendedKey) (string, error) { } // GetPublicKeysForPath gets the PublicKeys for a given derivation path -// Uses the standard m/0/0 (internal) and m/0/1 (external) paths +// Uses the standard m/0/0 (external) and m/0/1 (internal) paths // Reference: https://en.bitcoin.it/wiki/BIP_0032#The_default_wallet_layout func GetPublicKeysForPath(hdKey *hdkeychain.ExtendedKey, num uint32) (pubKeys []*bsvec.PublicKey, err error) { @@ -164,7 +164,7 @@ func GetPublicKeysForPath(hdKey *hdkeychain.ExtendedKey, num uint32) (pubKeys [] return } - // Get the internal pubkey from m/0/x + // Get the external pubkey from m/0/x var pubKey *bsvec.PublicKey if pubKey, err = childM0x.ECPubKey(); err != nil { // Should never error since the previous method ensures a valid hdKey @@ -179,7 +179,7 @@ func GetPublicKeysForPath(hdKey *hdkeychain.ExtendedKey, num uint32) (pubKeys [] return } - // Get the external pubkey from m/1/x + // Get the internal pubkey from m/1/x if pubKey, err = childM1x.ECPubKey(); err != nil { // Should never error since the previous method ensures a valid hdKey return From 44e18f9965a68b9a4284fc68fe061e898f827f1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Dec 2021 22:09:28 +0000 Subject: [PATCH 3/6] Bump actions/setup-go from 2.1.4 to 2.1.5 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.4 to 2.1.5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v2.1.4...v2.1.5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- .github/workflows/run-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f9e052..50d50ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2.1.4 + uses: actions/setup-go@v2.1.5 with: go-version: 1.17 - name: Run GoReleaser diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 16a3c84..53db5a2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,7 +22,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2.1.4 + uses: actions/setup-go@v2.1.5 with: go-version: ${{ matrix.go-version }} - name: Checkout code From 3005ac533cabfa773342d7abf820c772c150a323 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jan 2022 22:11:56 +0000 Subject: [PATCH 4/6] Bump goreleaser/goreleaser-action from 2.8.0 to 2.8.1 Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 2.8.0 to 2.8.1. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/v2.8.0...v2.8.1) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50d50ce..23db438 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: with: go-version: 1.17 - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2.8.0 + uses: goreleaser/goreleaser-action@v2.8.1 with: distribution: goreleaser version: latest From 8abd175387ad4dbd765338115b21fe7d151e0be0 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Fri, 28 Jan 2022 12:01:49 -0500 Subject: [PATCH 5/6] Fixed deps --- go.mod | 10 ++++++++-- go.sum | 9 ++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index e0358aa..15d147c 100644 --- a/go.mod +++ b/go.mod @@ -2,11 +2,17 @@ module github.com/bitcoinschema/go-bitcoin/v2 go 1.17 +require ( + github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 + github.com/bitcoinsv/bsvutil v0.0.0-20181216182056-1d77cf353ea9 + github.com/libsv/go-bt v1.0.4 + github.com/stretchr/testify v1.7.0 +) + require ( github.com/bitcoinsv/bsvlog v0.0.0-20181216181007-cb81b076bf2e // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/libsv/go-bk v0.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b // indirect + golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/go.sum b/go.sum index ad2cfa0..561041f 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,6 @@ github.com/bitcoinsv/bsvutil v0.0.0-20181216182056-1d77cf353ea9/go.mod h1:p44KuN github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/libsv/go-bk v0.1.5 h1:fqbWy8nwVM/ayM8Nxe+lM7fN0FaUMMD1w5MCpwit7XQ= -github.com/libsv/go-bk v0.1.5/go.mod h1:xbDkeFFpP0uyFaPLnP6TwaLpAsHaslZ0LftTdWlB6HI= github.com/libsv/go-bt v1.0.4 h1:2Css5lfomk/J97tM5Gk56Lp+tTK6xWYnmHNc/fGO6lE= github.com/libsv/go-bt v1.0.4/go.mod h1:AfXoLFYEbY/TvCq/84xTce2xGjPUuC5imokHmcykF2k= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -18,11 +16,9 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b h1:QAqMVf3pSa6eeTsuklijukjXBlj7Es2QQplab+/RbQ4= -golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8 h1:kACShD3qhmr/3rLmg1yXyt+N4HcwutKyPRB93s54TIU= +golang.org/x/crypto v0.0.0-20220126234351-aa10faf2a1f8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -32,7 +28,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= From 381f2985a6d63e970c1c562bc21ecff30f4cbdab Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Fri, 28 Jan 2022 12:02:02 -0500 Subject: [PATCH 6/6] Updated makefile --- .make/go.mk | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/.make/go.mk b/.make/go.mk index 8ee8004..d06a368 100644 --- a/.make/go.mk +++ b/.make/go.mk @@ -13,15 +13,21 @@ DARWIN=$(BINARY_NAME)-darwin LINUX=$(BINARY_NAME)-linux WINDOWS=$(BINARY_NAME)-windows.exe +## Define the binary name +TAGS= +ifdef GO_BUILD_TAGS + override TAGS=-tags $(GO_BUILD_TAGS) +endif + .PHONY: test lint vet install generate bench: ## Run all benchmarks in the Go application @echo "running benchmarks..." - @go test -bench=. -benchmem + @go test -bench=. -benchmem $(TAGS) build-go: ## Build the Go application (locally) @echo "building go app..." - @go build -o bin/$(BINARY_NAME) + @go build -o bin/$(BINARY_NAME) $(TAGS) clean-mods: ## Remove all the Go mod cache @echo "cleaning mods..." @@ -29,11 +35,11 @@ clean-mods: ## Remove all the Go mod cache coverage: ## Shows the test coverage @echo "creating coverage report..." - @go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out + @go test -coverprofile=coverage.out ./... $(TAGS) && go tool cover -func=coverage.out $(TAGS) generate: ## Runs the go generate command in the base of the repo @echo "generating files..." - @go generate -v + @go generate -v $(TAGS) godocs: ## Sync the latest tag with GoDocs @echo "syndicating to GoDocs..." @@ -45,59 +51,59 @@ godocs: ## Sync the latest tag with GoDocs install: ## Install the application @echo "installing binary..." - @go build -o $$GOPATH/bin/$(BINARY_NAME) + @go build -o $$GOPATH/bin/$(BINARY_NAME) $(TAGS) install-go: ## Install the application (Using Native Go) @echo "installing package..." - @go install $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME) + @go install $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME) $(TAGS) 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.43.0 && 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.44.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.43.0; 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.44.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.43.0; 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.44.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.43.0; 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.44.0; fi; @echo "running golangci-lint..." @golangci-lint run --verbose test: ## Runs lint and ALL tests @$(MAKE) lint @echo "running tests..." - @go test ./... -v + @go test ./... -v $(TAGS) test-unit: ## Runs tests and outputs coverage @echo "running unit tests..." - @go test ./... -race -coverprofile=coverage.txt -covermode=atomic + @go test ./... -race -coverprofile=coverage.txt -covermode=atomic $(TAGS) test-short: ## Runs vet, lint and tests (excludes integration tests) @$(MAKE) lint @echo "running tests (short)..." - @go test ./... -v -test.short + @go test ./... -v -test.short $(TAGS) test-ci: ## Runs all tests via CI (exports coverage) @$(MAKE) lint @echo "running tests (CI)..." - @go test ./... -race -coverprofile=coverage.txt -covermode=atomic + @go test ./... -race -coverprofile=coverage.txt -covermode=atomic $(TAGS) test-ci-no-race: ## Runs all tests via CI (no race) (exports coverage) @$(MAKE) lint @echo "running tests (CI - no race)..." - @go test ./... -coverprofile=coverage.txt -covermode=atomic + @go test ./... -coverprofile=coverage.txt -covermode=atomic $(TAGS) test-ci-short: ## Runs unit tests via CI (exports coverage) @$(MAKE) lint @echo "running tests (CI - unit tests only)..." - @go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic + @go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic $(TAGS) test-no-lint: ## Runs just tests @echo "running tests..." - @go test ./... -v + @go test ./... -v $(TAGS) uninstall: ## Uninstall the application (and remove files) @echo "uninstalling go application..." @@ -119,4 +125,4 @@ update-linter: ## Update the golangci-lint package (macOS only) vet: ## Run the Go vet application @echo "running go vet..." - @go vet -v ./... + @go vet -v ./... $(TAGS)