Commit 155506a9 authored by Kirill Smelkov's avatar Kirill Smelkov

*: ~gofmt

parent 0399d7ad
...@@ -22,13 +22,12 @@ ...@@ -22,13 +22,12 @@
// usage: `go tool trace -d <trace.out> |gmigrate` // usage: `go tool trace -d <trace.out> |gmigrate`
package main package main
import ( import (
"bufio" "bufio"
"errors" "errors"
"fmt"
"io" "io"
"log" "log"
"fmt"
"os" "os"
"regexp" "regexp"
"sort" "sort"
...@@ -76,7 +75,7 @@ func main() { ...@@ -76,7 +75,7 @@ func main() {
in := bufio.NewReader(os.Stdin) in := bufio.NewReader(os.Stdin)
tstart, tend, tprev := -1, -1, -1 tstart, tend, tprev := -1, -1, -1
for lineno := 1;; lineno++{ for lineno := 1; ; lineno++ {
bad := func(err error) { bad := func(err error) {
log.Fatalf("%d: %v", lineno, err) log.Fatalf("%d: %v", lineno, err)
} }
......
...@@ -112,6 +112,7 @@ func Raisef(format string, a ...interface{}) { ...@@ -112,6 +112,7 @@ func Raisef(format string, a ...interface{}) {
// Raiseif raises if err != nil. // Raiseif raises if err != nil.
// //
// NOTE err can be != nil even if typed obj = nil: // NOTE err can be != nil even if typed obj = nil:
//
// var obj *T; // var obj *T;
// err = obj // err = obj
// err != nil is true // err != nil is true
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
// As of go19 sync.Pool under race-detector randomly drops items on the floor // As of go19 sync.Pool under race-detector randomly drops items on the floor
// https://github.com/golang/go/blob/ca360c39/src/sync/pool.go#L92 // https://github.com/golang/go/blob/ca360c39/src/sync/pool.go#L92
// so it is not possible to verify we will get what we've just put there. // so it is not possible to verify we will get what we've just put there.
//go:build !race
// +build !race // +build !race
package mem package mem
......
...@@ -37,8 +37,8 @@ import ( ...@@ -37,8 +37,8 @@ import (
type Command struct { type Command struct {
Name string Name string
Summary string Summary string
Usage func (w io.Writer) Usage func(w io.Writer)
Main func (argv []string) Main func(argv []string)
} }
// CommandRegistry is ordered collection of Commands. // CommandRegistry is ordered collection of Commands.
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race // +build race
package race package race
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race // +build !race
package race package race
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race // +build race
package xruntime package xruntime
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race // +build !race
package xruntime package xruntime
......
...@@ -79,7 +79,7 @@ func TestStartStopTheWorld(t *testing.T) { ...@@ -79,7 +79,7 @@ func TestStartStopTheWorld(t *testing.T) {
:= 0 := 0
tstart := time.Now() tstart := time.Now()
for time.Now().Sub(tstart) < time.Second { for time.Now().Sub(tstart) < time.Second {
for i := 0; i < 100 ; i++ { for i := 0; i < 100; i++ {
xnext = atomic.LoadInt32(&x) xnext = atomic.LoadInt32(&x)
if xnext != xprev { if xnext != xprev {
+= 1 += 1
......
...@@ -37,7 +37,7 @@ var ( ...@@ -37,7 +37,7 @@ var (
// //
// The goroutine which sent the message will wait for Ack before continue. // The goroutine which sent the message will wait for Ack before continue.
type _Msg struct { type _Msg struct {
Event interface {} Event interface{}
ack chan<- error // nil on Ack; !nil on nak ack chan<- error // nil on Ack; !nil on nak
} }
......
...@@ -104,12 +104,12 @@ package tracetest ...@@ -104,12 +104,12 @@ package tracetest
import ( import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"sort"
"strings"
"sync"
"reflect" "reflect"
"runtime" "runtime"
"runtime/debug" "runtime/debug"
"sort"
"strings"
"sync"
"testing" "testing"
"time" "time"
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* /*
Package tracing provides usage and runtime support for Go tracing facilities. Package tracing provides usage and runtime support for Go tracing facilities.
Trace events # Trace events
A Go package can define several events of interest to trace via special A Go package can define several events of interest to trace via special
comments. With such definition a tracing event becomes associated with trace comments. With such definition a tracing event becomes associated with trace
...@@ -40,7 +40,7 @@ function that is used to signal when the event happens. For example: ...@@ -40,7 +40,7 @@ function that is used to signal when the event happens. For example:
By default using trace function does nothing and has very small overhead(*). By default using trace function does nothing and has very small overhead(*).
Probes # Probes
However it is possible to attach probing functions to events. A probe, once However it is possible to attach probing functions to events. A probe, once
attached, is called whenever event is signalled in the context which triggered attached, is called whenever event is signalled in the context which triggered
...@@ -100,7 +100,7 @@ Three ways particularly are well-understood and handy: ...@@ -100,7 +100,7 @@ Three ways particularly are well-understood and handy:
- synchronous tracing - synchronous tracing
Recording events stream # Recording events stream
To get better understanding of what happens when it is possible to record To get better understanding of what happens when it is possible to record
events into a stream and later either visualize or postprocess them. events into a stream and later either visualize or postprocess them.
...@@ -117,7 +117,7 @@ understood by chromium trace-viewer: https://github.com/catapult-project/catapul ...@@ -117,7 +117,7 @@ understood by chromium trace-viewer: https://github.com/catapult-project/catapul
NOTE there is also talk/work to implement user events for runtime/trace: https://golang.org/issues/16619. NOTE there is also talk/work to implement user events for runtime/trace: https://golang.org/issues/16619.
Profiling # Profiling
A profile is aggregate summary of collection of stack traces showing the call sequences that led A profile is aggregate summary of collection of stack traces showing the call sequences that led
to instances of a particular event. One could create runtime/pprof.Profile and to instances of a particular event. One could create runtime/pprof.Profile and
...@@ -131,7 +131,7 @@ XXX Profile.Add needs unique value for each invocation - how do we do? Provide N ...@@ -131,7 +131,7 @@ XXX Profile.Add needs unique value for each invocation - how do we do? Provide N
XXX should tracing provide more tight integration with runtime/pprof.Profile? XXX should tracing provide more tight integration with runtime/pprof.Profile?
Synchronous tracing # Synchronous tracing
For testing purposes it is sometimes practical to leverage the property that For testing purposes it is sometimes practical to leverage the property that
probes pause original code execution until the probe run is finished. That probes pause original code execution until the probe run is finished. That
...@@ -149,7 +149,7 @@ a set of goroutines in tested code in question ...@@ -149,7 +149,7 @@ a set of goroutines in tested code in question
Please see package lab.nexedi.com/kirr/go123/tracing/tracetest for details. Please see package lab.nexedi.com/kirr/go123/tracing/tracetest for details.
Cross package tracing # Cross package tracing
Trace events are not part of exported package API with rationale that package's Trace events are not part of exported package API with rationale that package's
regular API and internal trace events usually have different stability regular API and internal trace events usually have different stability
...@@ -172,7 +172,7 @@ available as regular functions prefixed with imported package name: ...@@ -172,7 +172,7 @@ available as regular functions prefixed with imported package name:
... ...
Gotrace # Gotrace
The way //trace:event and //trace:import work is via additional code being The way //trace:event and //trace:import work is via additional code being
generated for them. Whenever a package uses any //trace: directive, generated for them. Whenever a package uses any //trace: directive,
......
...@@ -22,7 +22,6 @@ package xbufio ...@@ -22,7 +22,6 @@ package xbufio
import ( import (
"io" "io"
//"log" //"log"
) )
...@@ -31,6 +30,7 @@ import ( ...@@ -31,6 +30,7 @@ import (
// Both forward, backward and interleaved forward/backward access patterns are supported // Both forward, backward and interleaved forward/backward access patterns are supported
// //
// NOTE SeqReaderAt is not safe to use from multiple goroutines concurrently. // NOTE SeqReaderAt is not safe to use from multiple goroutines concurrently.
//
// Strictly speaking this goes against io.ReaderAt interface but sequential // Strictly speaking this goes against io.ReaderAt interface but sequential
// workloads usually mean sequential processing. It would be a pity to // workloads usually mean sequential processing. It would be a pity to
// add mutex for nothing. // add mutex for nothing.
......
...@@ -232,7 +232,7 @@ func TestSeqReaderAt(t *testing.T) { ...@@ -232,7 +232,7 @@ func TestSeqReaderAt(t *testing.T) {
} }
// verify buffer state // verify buffer state
if !(rb.pos == tt.bufPos && len(rb.buf) == tt.bufLen){ if !(rb.pos == tt.bufPos && len(rb.buf) == tt.bufLen) {
t.Fatalf("%v: -> unexpected buffer state @%v #%v", tt, rb.pos, len(rb.buf)) t.Fatalf("%v: -> unexpected buffer state @%v #%v", tt, rb.pos, len(rb.buf))
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// Package xcontext provides addons to std package context. // Package xcontext provides addons to std package context.
// //
// Merging contexts // # Merging contexts
// //
// Merge could be handy in situations where spawned job needs to be canceled // Merge could be handy in situations where spawned job needs to be canceled
// whenever any of 2 contexts becomes done. This frequently arises with service // whenever any of 2 contexts becomes done. This frequently arises with service
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
// Package xerr provides addons for error-handling. // Package xerr provides addons for error-handling.
// //
// // # Error context
// Error context
// //
// Context and Contextf are handy to concisely add context to returned error, // Context and Contextf are handy to concisely add context to returned error,
// for example: // for example:
...@@ -37,8 +36,7 @@ ...@@ -37,8 +36,7 @@
// returned error. Please see package github.com/pkg/errors for details on // returned error. Please see package github.com/pkg/errors for details on
// this topic. // this topic.
// //
// // # Error vector
// Error vector
// //
// Sometimes there are several operations performed and we want to collect // Sometimes there are several operations performed and we want to collect
// errors from them all. For this Errorv could be used which is vector of // errors from them all. For this Errorv could be used which is vector of
......
...@@ -187,7 +187,7 @@ func AppendHex016(b []byte, x uint64) []byte { ...@@ -187,7 +187,7 @@ func AppendHex016(b []byte, x uint64) []byte {
b = xbytes.Grow(b, 16) b = xbytes.Grow(b, 16)
bb := b[l:] bb := b[l:]
for i := 15; i >= 0; i-- { for i := 15; i >= 0; i-- {
bb[i] = hexdigits[x & 0xf] bb[i] = hexdigits[x&0xf]
x >>= 4 x >>= 4
} }
return b return b
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build !go1.9
// +build !go1.9 // +build !go1.9
package xmath package xmath
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build go1.9
// +build go1.9 // +build go1.9
// Package xmath provides addons to std math package. // Package xmath provides addons to std math package.
......
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
// Package virtnet provides infrastructure for using and implementing such // Package virtnet provides infrastructure for using and implementing such
// TCP-like virtual networks. // TCP-like virtual networks.
// //
// // # Using virtnet networks
// Using virtnet networks
// //
// Addresses on a virtnet network are host:port pairs represented by Addr. // Addresses on a virtnet network are host:port pairs represented by Addr.
// A network conceptually consists of several SubNetworks each being home for // A network conceptually consists of several SubNetworks each being home for
...@@ -49,8 +48,7 @@ ...@@ -49,8 +48,7 @@
// lab.nexedi.com/kirr/go123/xnet/pipenet for particular well-known // lab.nexedi.com/kirr/go123/xnet/pipenet for particular well-known
// virtnet-based networks. // virtnet-based networks.
// //
// // # Implementing virtnet networks
// Implementing virtnet networks
// //
// To implement a virtnet-based network one need to implement Engine and Registry. // To implement a virtnet-based network one need to implement Engine and Registry.
// //
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race // +build !race
// Package race complements standard package runtime/race. // Package race complements standard package runtime/race.
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race // +build race
package race package race
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment