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

*: ~gofmt

parent 0399d7ad
......@@ -22,13 +22,12 @@
// usage: `go tool trace -d <trace.out> |gmigrate`
package main
import (
"bufio"
"errors"
"fmt"
"io"
"log"
"fmt"
"os"
"regexp"
"sort"
......@@ -76,7 +75,7 @@ func main() {
in := bufio.NewReader(os.Stdin)
tstart, tend, tprev := -1, -1, -1
for lineno := 1;; lineno++{
for lineno := 1; ; lineno++ {
bad := func(err error) {
log.Fatalf("%d: %v", lineno, err)
}
......
......@@ -112,6 +112,7 @@ func Raisef(format string, a ...interface{}) {
// Raiseif raises if err != nil.
//
// NOTE err can be != nil even if typed obj = nil:
//
// var obj *T;
// err = obj
// err != nil is true
......
......@@ -20,6 +20,7 @@
// 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
// so it is not possible to verify we will get what we've just put there.
//go:build !race
// +build !race
package mem
......
......@@ -37,8 +37,8 @@ import (
type Command struct {
Name string
Summary string
Usage func (w io.Writer)
Main func (argv []string)
Usage func(w io.Writer)
Main func(argv []string)
}
// CommandRegistry is ordered collection of Commands.
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race
package race
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race
package race
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build race
package xruntime
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race
package xruntime
......
......@@ -79,7 +79,7 @@ func TestStartStopTheWorld(t *testing.T) {
:= 0
tstart := time.Now()
for time.Now().Sub(tstart) < time.Second {
for i := 0; i < 100 ; i++ {
for i := 0; i < 100; i++ {
xnext = atomic.LoadInt32(&x)
if xnext != xprev {
+= 1
......
......@@ -37,7 +37,7 @@ var (
//
// The goroutine which sent the message will wait for Ack before continue.
type _Msg struct {
Event interface {}
Event interface{}
ack chan<- error // nil on Ack; !nil on nak
}
......
......@@ -104,12 +104,12 @@ package tracetest
import (
"fmt"
"path/filepath"
"sort"
"strings"
"sync"
"reflect"
"runtime"
"runtime/debug"
"sort"
"strings"
"sync"
"testing"
"time"
......
......@@ -20,7 +20,7 @@
/*
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
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:
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
attached, is called whenever event is signalled in the context which triggered
......@@ -100,7 +100,7 @@ Three ways particularly are well-understood and handy:
- synchronous tracing
Recording events stream
# Recording events stream
To get better understanding of what happens when it is possible to record
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
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
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
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
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
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
regular API and internal trace events usually have different stability
......@@ -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
generated for them. Whenever a package uses any //trace: directive,
......
......@@ -22,7 +22,6 @@ package xbufio
import (
"io"
//"log"
)
......@@ -31,6 +30,7 @@ import (
// Both forward, backward and interleaved forward/backward access patterns are supported
//
// NOTE SeqReaderAt is not safe to use from multiple goroutines concurrently.
//
// Strictly speaking this goes against io.ReaderAt interface but sequential
// workloads usually mean sequential processing. It would be a pity to
// add mutex for nothing.
......
......@@ -232,7 +232,7 @@ func TestSeqReaderAt(t *testing.T) {
}
// 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))
}
}
......
......@@ -19,7 +19,7 @@
// 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
// whenever any of 2 contexts becomes done. This frequently arises with service
......
......@@ -19,8 +19,7 @@
// Package xerr provides addons for error-handling.
//
//
// Error context
// # Error context
//
// Context and Contextf are handy to concisely add context to returned error,
// for example:
......@@ -37,8 +36,7 @@
// returned error. Please see package github.com/pkg/errors for details on
// this topic.
//
//
// Error vector
// # Error vector
//
// 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
......
......@@ -187,7 +187,7 @@ func AppendHex016(b []byte, x uint64) []byte {
b = xbytes.Grow(b, 16)
bb := b[l:]
for i := 15; i >= 0; i-- {
bb[i] = hexdigits[x & 0xf]
bb[i] = hexdigits[x&0xf]
x >>= 4
}
return b
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !go1.9
// +build !go1.9
package xmath
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build go1.9
// +build go1.9
// Package xmath provides addons to std math package.
......
......@@ -27,8 +27,7 @@
// Package virtnet provides infrastructure for using and implementing such
// TCP-like virtual networks.
//
//
// Using virtnet networks
// # Using virtnet networks
//
// Addresses on a virtnet network are host:port pairs represented by Addr.
// A network conceptually consists of several SubNetworks each being home for
......@@ -49,8 +48,7 @@
// lab.nexedi.com/kirr/go123/xnet/pipenet for particular well-known
// virtnet-based networks.
//
//
// Implementing virtnet networks
// # Implementing virtnet networks
//
// To implement a virtnet-based network one need to implement Engine and Registry.
//
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build !race
// +build !race
// Package race complements standard package runtime/race.
......
......@@ -17,6 +17,7 @@
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
//go:build race
// +build 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