diff --git a/Makefile b/Makefile index 76995ce12..e6bf429dc 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,8 @@ statusgo-cross: statusgo-android statusgo-ios statusgo-android: ##@cross-compile Build status-go for Android @echo "Building status-go for Android..." - gomobile init + export GO111MODULE=off; \ + gomobile init; \ gomobile bind -v \ -target=android -ldflags="-s -w" \ $(BUILD_FLAGS_MOBILE) \ @@ -123,7 +124,8 @@ statusgo-android: ##@cross-compile Build status-go for Android statusgo-ios: ##@cross-compile Build status-go for iOS @echo "Building status-go for iOS..." - gomobile init + export GO111MODULE=off; \ + gomobile init; \ gomobile bind -v \ -target=ios -ldflags="-s -w" \ $(BUILD_FLAGS_MOBILE) \ @@ -202,14 +204,42 @@ endif docker push $(BOOTNODE_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG) docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_CUSTOM_TAG) -install-os-dependencies: +setup: ##@setup Install all tools +setup: setup-build setup-dev tidy + +setup-dev: ##@setup Install all necessary tools for development +setup-dev: install-lint install-mock install-modvendor install-protobuf tidy install-os-deps + +setup-build: ##@setup Install all necessary build tools +setup-build: install-lint install-release install-gomobile + +install-os-deps: ##@install Operating System Dependencies _assets/scripts/install_deps.sh -setup-dev: lint-install mock-install modvendor-install gen-install tidy install-os-dependencies ##@other Prepare project for development +install-gomobile: install-xtools +install-gomobile: ##@install Go Mobile Build Tools + GO111MODULE=on go install golang.org/x/mobile/cmd/...@5d9a3325 + GO111MODULE=on go mod download golang.org/x/exp@ec7cb31e + GO111MODULE=off go get -d golang.org/x/mobile/cmd/gobind -setup-build: lint-install release-install gomobile-install ##@other Prepare project for build +install-lint: ##@install Install Linting Tools + GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.33.0 -setup: setup-build setup-dev tidy ##@other Prepare project for development and building +install-mock: ##@install Install Module Mocking Tools + GO111MODULE=on go install github.com/golang/mock/mockgen@v1.4.4 + +install-modvendor: ##@install Install Module Vendoring Tool + GO111MODULE=on go install github.com/goware/modvendor@v0.4.0 + +install-protobuf: ##@install Install Protobuf Generation Tools + GO111MODULE=on go install github.com/kevinburke/go-bindata/go-bindata@v3.13.0 + GO111MODULE=on go install github.com/golang/protobuf/protoc-gen-go@v1.3.4 + +install-release: ##@install Install Github Release Tools + GO111MODULE=on go install github.com/c4milo/github-release@v1.1.0 + +install-xtools: ##@install Install Miscellaneous Go Tools + GO111MODULE=on go install golang.org/x/tools/go/packages/...@v0.1.5 generate: ##@other Regenerate assets and other auto-generated stuff go generate ./static ./static/mailserver_db_migrations ./t ./multiaccounts/... ./appdatabase/... ./protocol/... @@ -261,29 +291,6 @@ release: check-existing-release echo "Aborting." && exit 1; \ fi -gomobile-install: xtools-install - go get golang.org/x/mobile/cmd/gomobile - -release-install: - go get -u github.com/c4milo/github-release - -gen-install: - go get github.com/kevinburke/go-bindata/go-bindata@v3.13.0 - go get github.com/golang/protobuf/protoc-gen-go@v1.3.4 - -xtools-install: - # special fix for gomobile issues - go get golang.org/x/tools/go/packages - -modvendor-install: - # a tool to vendor non-go files - # TODO: switch to original repo when https://github.com/goware/modvendor/pull/13 is merged - GO111MODULE=off go get -u github.com/adambabik/modvendor - -mock-install: ##@other Install mocking tools - # keep in sync with go.mod and github.com/golang/mock - go get github.com/golang/mock/mockgen@v1.4.1 - mock: ##@other Regenerate mocks mockgen -package=fake -destination=transactions/fake/mock.go -source=transactions/fake/txservice.go mockgen -package=status -destination=services/status/account_mock.go -source=services/status/service.go @@ -317,10 +324,6 @@ canary-test: node-canary # TODO: uncomment that! #_assets/scripts/canary_test_mailservers.sh ./config/cli/fleet-eth.prod.json -lint-install: - @# The following installs a specific version of golangci-lint, which is appropriate for a CI server to avoid different results from build to build - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=$(GOLANGCI_BINARY) bash -s -- -d -b $(GOPATH)/bin v1.33.0 - lint: @echo "lint" @golangci-lint --exclude=SA1019 run ./... --deadline=5m diff --git a/_assets/ci/Jenkinsfile.android b/_assets/ci/Jenkinsfile.android index ba967ff82..ce045409a 100644 --- a/_assets/ci/Jenkinsfile.android +++ b/_assets/ci/Jenkinsfile.android @@ -31,7 +31,6 @@ pipeline { environment { /* fix for gomobile complaining about missing packages */ CGO_ENABLED = "1" - GO111MODULE = "off" /* Other stuff */ TARGET = 'android' GOPATH = "${env.WORKSPACE}" @@ -54,12 +53,12 @@ pipeline { } } } } stage('Setup') { steps { dir(env.STATUS_PATH) { - sh 'make setup-build modvendor-install' + sh 'make setup-build install-modvendor' } } } stage('Vendoring check') { steps { dir(env.STATUS_PATH) { /* fail build if vendoring hasn't been done */ - sh 'GO111MODULE=on make vendor' + sh 'make vendor' sh 'git diff --exit-code --no-color --stat vendor/' } } } diff --git a/_assets/ci/Jenkinsfile.ios b/_assets/ci/Jenkinsfile.ios index 3fb753bb9..b0df87530 100644 --- a/_assets/ci/Jenkinsfile.ios +++ b/_assets/ci/Jenkinsfile.ios @@ -31,7 +31,6 @@ pipeline { environment { /* fix for gomobile complaining about missing packages */ CGO_ENABLED = "1" - GO111MODULE = "off" /* Other stuff */ TARGET = 'ios' GOPATH = "${env.WORKSPACE}" diff --git a/_assets/ci/Jenkinsfile.tests b/_assets/ci/Jenkinsfile.tests index 838373c70..7c09cc6d1 100644 --- a/_assets/ci/Jenkinsfile.tests +++ b/_assets/ci/Jenkinsfile.tests @@ -38,12 +38,13 @@ pipeline { } } } } stage('Setup') { steps { dir(env.STATUS_PATH) { - sh 'GO111MODULE=off make setup-build modvendor-install' + sh 'make setup-build install-modvendor' } } } stage('Vendoring check') { steps { dir(env.STATUS_PATH) { - // fail build if vendoring hasn't been done - sh 'GO111MODULE=on make vendor && git diff --exit-code --no-color --stat vendor/' + /* fail build if vendoring hasn't been done */ + sh 'make vendor' + sh 'git diff --exit-code --no-color --stat vendor/' } } } stage('Lint') { steps { dir(env.STATUS_PATH) { diff --git a/go.mod b/go.mod index e8f91ec37..64c16a995 100644 --- a/go.mod +++ b/go.mod @@ -63,6 +63,7 @@ require ( go.uber.org/zap v1.15.0 golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb + golang.org/x/tools v0.1.2 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/validator.v9 v9.31.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 diff --git a/go.sum b/go.sum index 37eec0d45..83a06242e 100644 --- a/go.sum +++ b/go.sum @@ -1193,6 +1193,7 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -1344,6 +1345,7 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1438,8 +1440,10 @@ golang.org/x/sys v0.0.0-20210301091718-77cc2087c03b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= @@ -1518,8 +1522,9 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=