Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 12 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,80 +10,39 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: lib/go/iinft
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v6
with:
go-version: 1.22
go-version: '1.25'

- name: Checkout code
uses: actions/checkout@v2

- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"

- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
uses: actions/checkout@v5

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
uses: golangci/golangci-lint-action@v8
with:
args: "--out-${NO_FUTURE}format colored-line-number --timeout 5m"
# working-directory: lib/go/iinft
skip-pkg-cache: true
skip-build-cache: true
version: v2.8

tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.22
- uses: actions/cache@v3
uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: '1.25'
- uses: zencargo/github-action-go-mod-tidy@v1
with:
# path: lib/go/iinft
go-version: 1.22
go-version: '1.25'

test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Set up Cache
uses: actions/cache@v3
uses: actions/setup-go@v6
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: '1.25'
- name: Test
run: make test
98 changes: 52 additions & 46 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,79 @@
linters-settings:
errcheck:
check-type-assertions: false
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
govet:
enable:
# report about shadowed variables
- shadowing
nolintlint:
require-explanation: false
require-specific: true
funlen:
lines: 100
statements: 40
revive:
rules:
- name: unused-parameter
disabled: true

version: "2"
run:
go: "1.25"
issues-exit-code: 1
linters:
disable-all: true
default: none
enable:
- asciicheck
- bodyclose
- contextcheck
- copyloopvar
# - depguard
- dogsled
# - dupl
- errcheck
- errorlint
- exhaustive
- goconst
# - gocritic
- gofmt
- goimports
# - gomnd
- gocyclo
- gosec
- gosimple
- govet
- importas
- ineffassign
- misspell
- nolintlint
- nakedret
- nolintlint
- prealloc
- predeclared
- revive
- staticcheck
- stylecheck
- thelper
- typecheck
- unconvert
- unparam
- unused
- wastedassign

run:
issues-exit-code: 1
go: '1.22'
issues:
exclude-dirs:
- examples/demo
settings:
errcheck:
check-type-assertions: false
funlen:
lines: 100
statements: 40
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
nolintlint:
require-explanation: false
require-specific: true
revive:
rules:
- name: unused-parameter
disabled: true
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- examples/demo
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- examples/demo
- third_party$
- builtin$
- examples$
26 changes: 26 additions & 0 deletions emulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type EmulatorGateway struct {
emulatorOptions []emulator.Option
}

var _ gateway.Gateway = (*EmulatorGateway)(nil)

func UnwrapStatusError(err error) error {
return errors.New(status.Convert(err).Message())
}
Expand Down Expand Up @@ -147,6 +149,30 @@ func (g *EmulatorGateway) GetTransactionsByBlockID(ctx context.Context, id flow.
return txr, nil
}

func (g *EmulatorGateway) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, u uint64) (*flow.Account, error) {
acct, err := g.adapter.GetAccountAtBlockHeight(ctx, address, u)
if err != nil {
return nil, UnwrapStatusError(err)
}
return acct, nil
}

func (g *EmulatorGateway) GetSystemTransaction(ctx context.Context, blockID flow.Identifier) (*flow.Transaction, error) {
return nil, nil
}

func (g *EmulatorGateway) GetSystemTransactionResult(ctx context.Context, blockID flow.Identifier) (*flow.TransactionResult, error) {
return nil, nil
}

func (g *EmulatorGateway) GetSystemTransactionWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.Transaction, error) {
return nil, nil
}

func (g *EmulatorGateway) GetSystemTransactionResultWithID(ctx context.Context, blockID flow.Identifier, systemTxID flow.Identifier) (*flow.TransactionResult, error) {
return nil, nil
}

func (g *EmulatorGateway) Ping() error {
ctx := context.Background()
err := g.adapter.Ping(ctx)
Expand Down
2 changes: 1 addition & 1 deletion event.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func PrintEvents(events []flow.Event, ignoreFields map[string][]string) {

// FormatEvents
func FormatEvents(blockEvents []flow.BlockEvents, ignoreFields map[string][]string) []*FormatedEvent {
var events []*FormatedEvent
var events []*FormatedEvent //nolint:prealloc

for _, blockEvent := range blockEvents {
for _, event := range blockEvent.Events {
Expand Down
Loading