Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #97 from iden3/feature/golinter
Browse files Browse the repository at this point in the history
Add github action for Go linting
  • Loading branch information
ed255 committed Apr 23, 2020
2 parents 71bccb9 + bc341ec commit f6f32c3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gomobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/lint-go.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 0 additions & 12 deletions go/iden3mobile/mobilearrays.go
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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
}

0 comments on commit f6f32c3

Please sign in to comment.