From ff950e2a2ce187011de68c6e4945a10bd3b49aa3 Mon Sep 17 00:00:00 2001 From: Aurora Gaffney Date: Thu, 7 Sep 2023 10:27:31 -0500 Subject: [PATCH] fix: linter issues --- .github/workflows/golangci-lint.yml | 3 ++- machine.go | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index e08d4e6..2b53c88 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -30,7 +30,8 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.53.3 # current version at time of commit - args: --timeout=10m + # We disable the 'unused' linter check to avoid annoying linter warnings during initial development + args: --timeout=10m --disable unused only-new-issues: true - name: go-test run: go test ./... diff --git a/machine.go b/machine.go index 2a7aaf4..87b2683 100644 --- a/machine.go +++ b/machine.go @@ -213,19 +213,21 @@ func CreateMachine(slippage uint32) Machine { func (m *Machine) Run(term *Term[NamedDeBruijn]) (Term[NamedDeBruijn], error) { startupBudget := m.costs.machineCosts.startup - m.spendBudget(startupBudget) + if err := m.spendBudget(startupBudget); err != nil { + return nil, err + } var state MachineState = Compute{ctx: NoFrame{}, env: make([]Value, 0), term: term} var err error for { - switch state.(type) { + switch v := state.(type) { case Compute: state, err = m.compute() case Return: state, err = m.returnCompute() case Done: - return state.(Done).term, nil + return v.term, nil } if err != nil {