internal/jsre: golint fixes

This commit is contained in:
Mike Kinney 2019-12-09 21:13:41 -08:00
parent 40c5796084
commit 0a049eeb00
2 changed files with 11 additions and 3 deletions

View file

@ -32,7 +32,9 @@ import (
) )
var ( var (
// BignumberJs specifies bignumber.js
BignumberJs = deps.MustAsset("bignumber.js") BignumberJs = deps.MustAsset("bignumber.js")
// Web3Js specifies web3.js
Web3Js = deps.MustAsset("web3.js") Web3Js = deps.MustAsset("web3.js")
) )
@ -66,7 +68,8 @@ type evalReq struct {
done chan bool 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 { func New(assetPath string, output io.Writer) *JSRE {
re := &JSRE{ re := &JSRE{
assetPath: assetPath, assetPath: assetPath,
@ -230,7 +233,7 @@ func (re *JSRE) Do(fn func(*otto.Otto)) {
<-done <-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) { func (re *JSRE) Stop(waitForCallbacks bool) {
select { select {
case <-re.closed: case <-re.closed:

View file

@ -33,10 +33,15 @@ const (
) )
var ( var (
// FunctionColor specifies what color to use for functions
FunctionColor = color.New(color.FgMagenta).SprintfFunc() FunctionColor = color.New(color.FgMagenta).SprintfFunc()
// SpecialColor specifies what color to use for special values
SpecialColor = color.New(color.Bold).SprintfFunc() SpecialColor = color.New(color.Bold).SprintfFunc()
// NumberColor specifies what color to use for numbers
NumberColor = color.New(color.FgRed).SprintfFunc() NumberColor = color.New(color.FgRed).SprintfFunc()
// StringColor specifies what color to use for strings
StringColor = color.New(color.FgGreen).SprintfFunc() StringColor = color.New(color.FgGreen).SprintfFunc()
// ErrorColor specifies what color to use for errors
ErrorColor = color.New(color.FgHiRed).SprintfFunc() ErrorColor = color.New(color.FgHiRed).SprintfFunc()
) )