From 0a049eeb0054aa907c7367512b1a251345f5f814 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Mon, 9 Dec 2019 21:13:41 -0800 Subject: [PATCH] internal/jsre: golint fixes --- internal/jsre/jsre.go | 9 ++++++--- internal/jsre/pretty.go | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/jsre/jsre.go b/internal/jsre/jsre.go index 1b3528a036..8d614cdbe9 100644 --- a/internal/jsre/jsre.go +++ b/internal/jsre/jsre.go @@ -32,7 +32,9 @@ import ( ) var ( + // BignumberJs specifies bignumber.js BignumberJs = deps.MustAsset("bignumber.js") + // Web3Js specifies web3.js Web3Js = deps.MustAsset("web3.js") ) @@ -66,7 +68,8 @@ type evalReq struct { done chan bool } -// runtime must be stopped with Stop() after use and cannot be used after stopping +// New creates a new runtime environment +// Note the runtime must be stopped with Stop() after use and cannot be used after stopping func New(assetPath string, output io.Writer) *JSRE { re := &JSRE{ assetPath: assetPath, @@ -230,7 +233,7 @@ func (re *JSRE) Do(fn func(*otto.Otto)) { <-done } -// stops the event loop before exit, optionally waits for all timers to expire +// Stop stops the event loop before exit, optionally waits for all timers to expire func (re *JSRE) Stop(waitForCallbacks bool) { select { case <-re.closed: @@ -239,7 +242,7 @@ func (re *JSRE) Stop(waitForCallbacks bool) { } } -// Exec(file) loads and runs the contents of a file +// Exec (file) loads and runs the contents of a file // if a relative path is given, the jsre's assetPath is used func (re *JSRE) Exec(file string) error { code, err := ioutil.ReadFile(common.AbsolutePath(re.assetPath, file)) diff --git a/internal/jsre/pretty.go b/internal/jsre/pretty.go index 16fa91b67d..552965d5c8 100644 --- a/internal/jsre/pretty.go +++ b/internal/jsre/pretty.go @@ -33,10 +33,15 @@ const ( ) var ( + // FunctionColor specifies what color to use for functions FunctionColor = color.New(color.FgMagenta).SprintfFunc() + // SpecialColor specifies what color to use for special values SpecialColor = color.New(color.Bold).SprintfFunc() + // NumberColor specifies what color to use for numbers NumberColor = color.New(color.FgRed).SprintfFunc() + // StringColor specifies what color to use for strings StringColor = color.New(color.FgGreen).SprintfFunc() + // ErrorColor specifies what color to use for errors ErrorColor = color.New(color.FgHiRed).SprintfFunc() )