diff --git a/Makefile b/Makefile index ed48a481..130422ad 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,7 @@ FABRIC_TOOLS_VERSION ?= 2.0.0-alpha FABRIC_TOOLS_TAG ?= $(ARCH)-$(FABRIC_TOOLS_VERSION) -depend: version - @scripts/dependencies.sh - -checks: version depend license lint +checks: version license lint lint: @scripts/check_lint.sh diff --git a/scripts/check_lint.sh b/scripts/check_lint.sh index f0223988..5b304fb3 100755 --- a/scripts/check_lint.sh +++ b/scripts/check_lint.sh @@ -8,18 +8,7 @@ set -e -GOLANGCI_LINT_CMD=golangci-lint +DOCKER_CMD=docker -PWD=`pwd` -echo "Running golangci-lint :: pwd" $PWD -$GOLANGCI_LINT_CMD run -c "$GOPATH/src/github.com/trustbloc/fabric-peer-ext/.golangci.yml" - -cd ./mod/peer -echo "extensions project path" `pwd` - -$GOLANGCI_LINT_CMD run -c "$GOPATH/src/github.com/trustbloc/fabric-peer-ext/.golangci.yml" - -cd $PWD - -echo "golangci-lint finished successfully :: pwd" $PWD +${DOCKER_CMD} run --rm -e GOPROXY=${GOPROXY} -v $(pwd):/goapp -e RUN=1 -e REPO=github.com/trustbloc/bloc-node golangci/build-runner goenvbuild diff --git a/scripts/dependencies.sh b/scripts/dependencies.sh deleted file mode 100755 index 725ee72f..00000000 --- a/scripts/dependencies.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# Copyright SecureKey Technologies Inc. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -set -e -GO_CMD="${GO_CMD:-go}" -GOPATH="${GOPATH:-${HOME}/go}" - - -function installGolangCiLint { - echo "Installing golangci-lint..." - - declare repo="github.com/golangci/golangci-lint/cmd/golangci-lint" - declare revision="v1.16.0" - declare pkg="github.com/golangci/golangci-lint/cmd/golangci-lint" - - installGoPkg "${repo}" "${revision}" "" "golangci-lint" - cp -f ${BUILD_TMP}/bin/* ${GOPATH}/bin/ - rm -Rf ${GOPATH}/src/${pkg} - mkdir -p ${GOPATH}/src/${pkg} - cp -Rf ${BUILD_TMP}/src/${repo}/* ${GOPATH}/src/${pkg}/ -} - -function installGoPkg { - declare repo=$1 - declare revision=$2 - declare pkgPath=$3 - shift 3 - declare -a cmds=$@ - echo "Installing ${repo}@${revision} to $GOPATH/bin ..." - GO111MODULE=off GOBIN=${BUILD_TMP}/bin GOPATH=${BUILD_TMP} go get -d ${repo} - tag=$(cd ${BUILD_TMP}/src/${repo} && git tag -l | sort -V --reverse | head -n 1 | grep "${revision}" || true) - if [ ! -z "${tag}" ]; then - revision=${tag} - echo " using tag ${revision}" - fi - (cd ${BUILD_TMP}/src/${repo} && git reset --hard ${revision}) - echo " Checking $GOPATH ..." - GO111MODULE=off GOBIN=${BUILD_TMP}/bin GOPATH=${BUILD_TMP} go install -i ${repo}/${pkgPath} - mkdir -p ${GOPATH}/bin - for cmd in ${cmds[@]} - do - echo "Copying ${cmd} to ${GOPATH}/bin" - cp -f ${BUILD_TMP}/bin/${cmd} ${GOPATH}/bin/ - done -} - -function installDependencies { - echo "Installing dependencies ..." - BUILD_TMP=`mktemp -d 2>/dev/null || mktemp -d -t 'fabricpeerext'` - installGolangCiLint - - rm -Rf ${BUILD_TMP} -} - -installDependencies