mirror of https://github.com/poanetwork/quorum.git
go fmt
This commit is contained in:
parent
3c536c7db7
commit
3df813ec8e
|
@ -53,7 +53,7 @@ var (
|
|||
Value: 6060,
|
||||
}
|
||||
pprofAddrFlag = cli.StringFlag{
|
||||
Name: "pprofaddr",
|
||||
Name: "pprofaddr",
|
||||
Usage: "pprof HTTP server listening interface",
|
||||
Value: "127.0.0.1",
|
||||
}
|
||||
|
|
|
@ -167,17 +167,17 @@ func (dw *dbWrapper) toValue(vm *otto.Otto) otto.Value {
|
|||
// JavascriptTracer provides an implementation of Tracer that evaluates a
|
||||
// Javascript function for each VM execution step.
|
||||
type JavascriptTracer struct {
|
||||
vm *otto.Otto // Javascript VM instance
|
||||
traceobj *otto.Object // User-supplied object to call
|
||||
log map[string]interface{} // (Reusable) map for the `log` arg to `step`
|
||||
logvalue otto.Value // JS view of `log`
|
||||
memory *memoryWrapper // Wrapper around the VM memory
|
||||
memvalue otto.Value // JS view of `memory`
|
||||
stack *stackWrapper // Wrapper around the VM stack
|
||||
stackvalue otto.Value // JS view of `stack`
|
||||
db *dbWrapper // Wrapper around the VM environment
|
||||
dbvalue otto.Value // JS view of `db`
|
||||
err error // Error, if one has occurred
|
||||
vm *otto.Otto // Javascript VM instance
|
||||
traceobj *otto.Object // User-supplied object to call
|
||||
log map[string]interface{} // (Reusable) map for the `log` arg to `step`
|
||||
logvalue otto.Value // JS view of `log`
|
||||
memory *memoryWrapper // Wrapper around the VM memory
|
||||
memvalue otto.Value // JS view of `memory`
|
||||
stack *stackWrapper // Wrapper around the VM stack
|
||||
stackvalue otto.Value // JS view of `stack`
|
||||
db *dbWrapper // Wrapper around the VM environment
|
||||
dbvalue otto.Value // JS view of `db`
|
||||
err error // Error, if one has occurred
|
||||
}
|
||||
|
||||
// NewJavascriptTracer instantiates a new JavascriptTracer instance.
|
||||
|
@ -222,17 +222,17 @@ func NewJavascriptTracer(code string) (*JavascriptTracer, error) {
|
|||
db := &dbWrapper{}
|
||||
|
||||
return &JavascriptTracer{
|
||||
vm: vm,
|
||||
traceobj: jstracer,
|
||||
log: log,
|
||||
logvalue: logvalue,
|
||||
memory: mem,
|
||||
memvalue: mem.toValue(vm),
|
||||
stack: stack,
|
||||
stackvalue: stack.toValue(vm),
|
||||
db: db,
|
||||
dbvalue: db.toValue(vm),
|
||||
err: nil,
|
||||
vm: vm,
|
||||
traceobj: jstracer,
|
||||
log: log,
|
||||
logvalue: logvalue,
|
||||
memory: mem,
|
||||
memvalue: mem.toValue(vm),
|
||||
stack: stack,
|
||||
stackvalue: stack.toValue(vm),
|
||||
db: db,
|
||||
dbvalue: db.toValue(vm),
|
||||
err: nil,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ import (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
Url string `toml:"url"`
|
||||
Port int `toml:"port"`
|
||||
SocketPath string `toml:"socketPath"`
|
||||
OtherNodeUrls []string `toml:"otherNodeUrls"`
|
||||
PublicKeyPath string `toml:"publicKeyPath"`
|
||||
PrivateKeyPath string `toml:"privateKeyPath"`
|
||||
StoragePath string `toml:"storagePath"`
|
||||
Url string `toml:"url"`
|
||||
Port int `toml:"port"`
|
||||
SocketPath string `toml:"socketPath"`
|
||||
OtherNodeUrls []string `toml:"otherNodeUrls"`
|
||||
PublicKeyPath string `toml:"publicKeyPath"`
|
||||
PrivateKeyPath string `toml:"privateKeyPath"`
|
||||
StoragePath string `toml:"storagePath"`
|
||||
}
|
||||
|
||||
func LoadConfig(configPath string) (*Config, error) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package constellation
|
||||
|
||||
import (
|
||||
"github.com/patrickmn/go-cache"
|
||||
"fmt"
|
||||
"github.com/patrickmn/go-cache"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -66,7 +66,7 @@ func New(configPath string) (*Constellation, error) {
|
|||
}
|
||||
return &Constellation{
|
||||
node: n,
|
||||
c: cache.New(5 * time.Minute, 5 * time.Minute),
|
||||
c: cache.New(5*time.Minute, 5*time.Minute),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ func (c *Client) do(path string, apiReq interface{}) (*http.Response, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req, err := http.NewRequest("POST", "http+unix://c/" + path, buf)
|
||||
req, err := http.NewRequest("POST", "http+unix://c/"+path, buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ func NewClient(publicKeyPath string, nodeSocketPath string) (*Client, error) {
|
|||
return nil, err
|
||||
}
|
||||
return &Client{
|
||||
httpClient: unixClient(nodeSocketPath),
|
||||
httpClient: unixClient(nodeSocketPath),
|
||||
b64PublicKey: string(b64PublicKey),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ func newCorsHandler(srv *Server, corsString string) http.Handler {
|
|||
c := cors.New(cors.Options{
|
||||
AllowedOrigins: allowedOrigins,
|
||||
AllowedMethods: []string{"POST", "GET"},
|
||||
MaxAge: 600,
|
||||
MaxAge: 600,
|
||||
})
|
||||
return c.Handler(srv)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
|
||||
/*
|
||||
Tests TreeChunker by splitting and joining a random byte slice
|
||||
*/
|
||||
|
|
|
@ -221,6 +221,7 @@ func findMatch(mux map[string]func(Event), path string) string {
|
|||
return pattern
|
||||
|
||||
}
|
||||
|
||||
// Remove all existing defined Handlers from the map
|
||||
func (es *EvtStream) ResetHandlers() {
|
||||
for Path, _ := range es.Handlers {
|
||||
|
|
|
@ -26,4 +26,4 @@ func extendMatch(src []byte, i, j int) int
|
|||
// encodeBlock has the same semantics as in encode_other.go.
|
||||
//
|
||||
//go:noescape
|
||||
func encodeBlock(dst, src []byte) (d int)
|
||||
func encodeBlock(dst, src []byte) (d int)
|
||||
|
|
|
@ -44,7 +44,6 @@ func NewFunctionalGauge(f func() int64) Gauge {
|
|||
return &FunctionalGauge{value: f}
|
||||
}
|
||||
|
||||
|
||||
// NewRegisteredFunctionalGauge constructs and registers a new StandardGauge.
|
||||
func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge {
|
||||
c := NewFunctionalGauge(f)
|
||||
|
@ -101,6 +100,7 @@ func (g *StandardGauge) Update(v int64) {
|
|||
func (g *StandardGauge) Value() int64 {
|
||||
return atomic.LoadInt64(&g.value)
|
||||
}
|
||||
|
||||
// FunctionalGauge returns value from given function
|
||||
type FunctionalGauge struct {
|
||||
value func() int64
|
||||
|
@ -117,4 +117,4 @@ func (g FunctionalGauge) Snapshot() Gauge { return GaugeSnapshot(g.Value()) }
|
|||
// Update panics.
|
||||
func (FunctionalGauge) Update(int64) {
|
||||
panic("Update called on a FunctionalGauge")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,9 +167,9 @@ func NewPrefixedChildRegistry(parent Registry, prefix string) Registry {
|
|||
|
||||
// Call the given function for each registered metric.
|
||||
func (r *PrefixedRegistry) Each(fn func(string, interface{})) {
|
||||
wrappedFn := func (prefix string) func(string, interface{}) {
|
||||
wrappedFn := func(prefix string) func(string, interface{}) {
|
||||
return func(name string, iface interface{}) {
|
||||
if strings.HasPrefix(name,prefix) {
|
||||
if strings.HasPrefix(name, prefix) {
|
||||
fn(name, iface)
|
||||
} else {
|
||||
return
|
||||
|
@ -184,7 +184,7 @@ func (r *PrefixedRegistry) Each(fn func(string, interface{})) {
|
|||
func findPrefix(registry Registry, prefix string) (Registry, string) {
|
||||
switch r := registry.(type) {
|
||||
case *PrefixedRegistry:
|
||||
return findPrefix(r.underlying, r.prefix + prefix)
|
||||
return findPrefix(r.underlying, r.prefix+prefix)
|
||||
case *StandardRegistry:
|
||||
return r, prefix
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||
//
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
|
@ -13,7 +13,7 @@
|
|||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
|
Loading…
Reference in New Issue