diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0f616b4..420ebcc 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -13,7 +13,8 @@ jobs: flags: [ "", "-race" ] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + - run: git fetch origin master - name: Check if must run id: check @@ -45,7 +46,8 @@ jobs: needs: goTest runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + - run: git fetch origin master - name: Check if must run id: check diff --git a/.github/workflows/gomobile.yml b/.github/workflows/gomobile.yml index 1643811..8ac95c1 100644 --- a/.github/workflows/gomobile.yml +++ b/.github/workflows/gomobile.yml @@ -17,11 +17,11 @@ jobs: id: build run: | mkdir -p /tmp/builds - docker pull ed255/gomobile-android:latest + docker pull ed255/gomobile-android:API29-noemu docker run \ --mount type=bind,source=$PWD,target=/root/iden3-mobile,readonly \ --mount type=bind,source=/tmp/builds,target=/builds \ - ed255/gomobile-android:latest \ + ed255/gomobile-android:API29-noemu \ /bin/bash -c 'set -ex && \ cd /root/iden3-mobile/go/iden3mobile && \ mkdir /tmp/build && \ diff --git a/.github/workflows/lint-go.yml b/.github/workflows/lint-go.yml new file mode 100644 index 0000000..9982d58 --- /dev/null +++ b/.github/workflows/lint-go.yml @@ -0,0 +1,31 @@ +on: [ pull_request ] +name: Lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git fetch origin master + + - name: Check if must run + id: check + run: | + git diff origin/master -- go > changes + if [ -s changes ]; then + echo ::set-output name=shouldRun::yes + echo "The Go code has changed. The linter will be executed." + else + echo "The Go code has NOT changed. The linter will NOT be executed." + fi + + - name: Install Go + if: steps.check.outputs.shouldRun == 'yes' + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + + - name: Lint + if: steps.check.outputs.shouldRun == 'yes' + run: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0 + cd go && $(go env GOPATH)/bin/golangci-lint run diff --git a/go/iden3mobile/mobilearrays.go b/go/iden3mobile/mobilearrays.go index 3b0c113..53b9eb6 100644 --- a/go/iden3mobile/mobilearrays.go +++ b/go/iden3mobile/mobilearrays.go @@ -1,18 +1,10 @@ package iden3mobile -import ( - "github.com/iden3/go-iden3-core/merkletree" -) - // TODO. HAVE A LOOK AT CODE GEN type BytesArray struct { array [][]byte } -type byteEntrier struct { - entry *merkletree.Entry -} - func NewBytesArray() *BytesArray { return &BytesArray{ array: make([][]byte, 0), @@ -30,7 +22,3 @@ func (ba *BytesArray) Get(i int) []byte { func (ba *BytesArray) Append(bs []byte) { ba.array = append(ba.array, bs) } - -func (e *byteEntrier) Entry() *merkletree.Entry { - return e.entry -}