Skip to content

Commit

Permalink
More linting workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
ordishs committed Nov 11, 2022
1 parent 00c9231 commit 548edc8
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 17 deletions.
1 change: 1 addition & 0 deletions bscript/address.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package bscript comment
package bscript

import (
Expand Down
18 changes: 10 additions & 8 deletions bscript/interpreter/debug/debugger.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package debug comment
package debug

import "github.com/libsv/go-bt/v2/bscript/interpreter"
Expand Down Expand Up @@ -66,14 +67,15 @@ type debugger struct {
// functions.
//
// Example usage:
// debugger := debug.NewDebugger()
// debugger.AttachBeforeExecuteOpcode(func (state *interpreter.State) {
// fmt.Println(state.DataStack)
// })
// debugger.AttachAfterStackPush(func (state *interpreter.State, data []byte) {
// fmt.Println(hex.EncodeToString(data))
// })
// engine.Execute(interpreter.WithDebugger(debugger))
//
// debugger := debug.NewDebugger()
// debugger.AttachBeforeExecuteOpcode(func (state *interpreter.State) {
// fmt.Println(state.DataStack)
// })
// debugger.AttachAfterStackPush(func (state *interpreter.State, data []byte) {
// fmt.Println(hex.EncodeToString(data))
// })
// engine.Execute(interpreter.WithDebugger(debugger))
func NewDebugger(oo ...DebuggerOptionFunc) DefaultDebugger {
opts := &debugOpts{}
for _, o := range oo {
Expand Down
9 changes: 5 additions & 4 deletions bscript/interpreter/errs/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

// Package errs comment
package errs

import (
Expand Down Expand Up @@ -405,10 +406,10 @@ func (e ErrorCode) String() string {

// Error identifies a script-related error. It is used to indicate three
// classes of errors:
// 1) Script execution failures due to violating one of the many requirements
// imposed by the script engine or evaluating to false
// 2) Improper API usage by callers
// 3) Internal consistency check failures
// 1. Script execution failures due to violating one of the many requirements
// imposed by the script engine or evaluating to false
// 2. Improper API usage by callers
// 3. Internal consistency check failures
//
// The caller can use type assertions on the returned errors to access the
// ErrorCode field to ascertain the specific reason for the error. As an
Expand Down
1 change: 1 addition & 0 deletions bscript/interpreter/scriptflag/scriptflag.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package scriptflag comment
package scriptflag

// Flag is a bitmask defining additional operations or tests that will be
Expand Down
1 change: 1 addition & 0 deletions sighash/flag.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package sighash comment
package sighash

// Flag represents hash type bits at the end of a signature.
Expand Down
1 change: 1 addition & 0 deletions testing/data/data.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package data comment
package data

import (
Expand Down
13 changes: 8 additions & 5 deletions tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func (tx *Tx) ReadFrom(r io.Reader) (int64, error) {
*tx = Tx{}
var bytesRead int64

var n64 int64
var err error

version := make([]byte, 4)
n, err := io.ReadFull(r, version)
bytesRead += int64(n)
Expand All @@ -105,7 +108,8 @@ func (tx *Tx) ReadFrom(r io.Reader) (int64, error) {
extended := false

var inputCount VarInt
n64, err := inputCount.ReadFrom(r)

n64, err = inputCount.ReadFrom(r)
bytesRead += n64
if err != nil {
return bytesRead, err
Expand All @@ -117,9 +121,8 @@ func (tx *Tx) ReadFrom(r io.Reader) (int64, error) {
if inputCount == 0 {
// The next bytes are either 0xEF or a varint that specifies the number of outputs
// Read 1 more byte to see if this is in extended format...
var o64 int64
o64, err = outputCount.ReadFrom(r)
bytesRead += o64
n64, err = outputCount.ReadFrom(r)
bytesRead += n64
if err != nil {
return bytesRead, err
}
Expand All @@ -139,7 +142,7 @@ func (tx *Tx) ReadFrom(r io.Reader) (int64, error) {

extended = true

n64, err := inputCount.ReadFrom(r)
n64, err = inputCount.ReadFrom(r)
bytesRead += n64
if err != nil {
return bytesRead, err
Expand Down
1 change: 1 addition & 0 deletions unlocker/simple.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package unlocker comment
package unlocker

import (
Expand Down

0 comments on commit 548edc8

Please sign in to comment.