From 4a117476704b9e42c643d3bf2b5a4949fb232ea4 Mon Sep 17 00:00:00 2001 From: Andres Osorio Date: Tue, 16 Jan 2024 09:21:25 -0500 Subject: [PATCH] Revert "Increase package version to v2" This reverts commit eae74b2532ed6432d60895b2ad4846c9c31f196a. --- .golangci.yml | 2 +- Makefile | 2 +- README.md | 8 +- dcontext/callee_example_test.go | 2 +- dcontext/debug_test.go | 2 +- dcontext/hardsoft.go | 31 +++--- dcontext/hardsoft_example_test.go | 4 +- dcontext/polling_example_test.go | 2 +- derrgroup/errgroup.go | 15 ++- derrgroup/errgroup_example_md5all_test.go | 2 +- derrgroup/errgroup_test.go | 2 +- derrgroup/name_test.go | 2 +- derror/multierror.go | 28 ++--- derror/multierror_test.go | 2 +- derror/panic_test.go | 2 +- dexec/borrowed_bench_test.go | 2 +- dexec/borrowed_example_test.go | 2 +- dexec/borrowed_exec_linux_test.go | 1 - dexec/borrowed_exec_posix_test.go | 1 - dexec/borrowed_exec_test.go | 8 +- dexec/borrowed_read3.go | 3 +- dexec/cmd.go | 10 +- dexec/cmd_posix.go | 1 - dexec/hardsoft_test.go | 4 +- dexec/internal/testenv/borrowed_testenv.go | 8 +- dexec/logging_test.go | 4 +- dexec/supervisor_test.go | 4 +- dgroup/errgroup_example_md5all_test.go | 2 +- dgroup/errgroup_test.go | 2 +- dgroup/example_other_test.go | 1 - dgroup/example_test.go | 122 ++++++++++----------- dgroup/group.go | 50 ++++----- dgroup/name.go | 2 +- dhttp/server.go | 92 ++++++++-------- dhttp/server_http2.go | 21 ++-- dhttp/server_http2_test.go | 6 +- dhttp/server_test.go | 6 +- dlog/dlog_test.go | 2 +- dlog/logger.go | 6 +- dlog/logger_logrus.go | 2 +- dtime/dtime_example_test.go | 2 +- dtime/faketime_test.go | 2 +- dtime/sleepwithcontext.go | 8 +- dtime/sleepwithcontext_test.go | 6 +- dutil/http_server.go | 10 +- dutil/http_server_test.go | 6 +- dutil/panic.go | 2 +- dutil/panic_test.go | 2 +- example_test.go | 14 +-- go.mod | 2 +- internal/sigint/sigint_unix.go | 1 - 51 files changed, 259 insertions(+), 264 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 50cb738..a3ab4c0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,7 @@ linters-settings: gofmt: simplify: true goimports: - local-prefixes: github.com/datawire/dlib/v2 + local-prefixes: github.com/datawire/dlib errcheck: exclude: "./.circleci/errcheck-exclude.txt" nolintlint: diff --git a/Makefile b/Makefile index 28d052d..8369d0e 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ GOVERSION ?= 1.21.6 -e '/MODIFIED: META:/d' \ -e '/MODIFIED: ADDED/d' \ -e 's,.*// MODIFIED: FROM:,,' | \ - .circleci/goimports -local github.com/datawire/dlib/v2 \ + .circleci/goimports -local github.com/datawire/dlib \ >$@ borrowed.patch: FORCE $(MAKE) $(addsuffix .unmod,$(shell git ls-files ':*borrowed_*')) diff --git a/README.md b/README.md index e92a710..816b32e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # dlib - Small independent-but-complementary Context-oriented Go libraries -[![PkgGoDev](https://pkg.go.dev/badge/github.com/datawire/dlib/v2)](https://pkg.go.dev/github.com/datawire/dlib/v2) -[![Go Report Card](https://goreportcard.com/badge/github.com/datawire/dlib/v2)](https://goreportcard.com/report/github.com/datawire/dlib/v2) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/datawire/dlib)](https://pkg.go.dev/github.com/datawire/dlib) +[![Go Report Card](https://goreportcard.com/badge/github.com/datawire/dlib)](https://goreportcard.com/report/github.com/datawire/dlib) [![CircleCI](https://circleci.com/gh/datawire/dlib.svg)](https://circleci.com/gh/datawire/dlib) [![Coverage Status](https://coveralls.io/repos/github/datawire/dlib/badge.svg)](https://coveralls.io/github/datawire/dlib) @@ -46,7 +46,7 @@ to it, and states one of the design principles: The API of `dexec` is minimal; it's just that of stdlib `os/exec` that people already know (with one function removed, at that). The size of the interface is mostly just typing - `github.com/datawire/dlib/v2/dexec` instead of `os/exec`. + `github.com/datawire/dlib/dexec` instead of `os/exec`. Explicitly not part of the way we use "small" is "small in implementation". Despite the small API of `dexec`, it has by @@ -181,4 +181,4 @@ about having to adjust their program to that package's opinions Everything is complementary, and so if you drink the Kool-Aid and want to see how to use everything together, check out [the example in -`example_test.go`](https://pkg.go.dev/github.com/datawire/dlib/v2) +`example_test.go`](https://pkg.go.dev/github.com/datawire/dlib) diff --git a/dcontext/callee_example_test.go b/dcontext/callee_example_test.go index 1e45520..25e57f7 100644 --- a/dcontext/callee_example_test.go +++ b/dcontext/callee_example_test.go @@ -4,7 +4,7 @@ package dcontext_test import ( "context" - "github.com/datawire/dlib/v2/dcontext" + "github.com/datawire/dlib/dcontext" ) // This example shows a simple 'exampleCallee' that is a worker function that diff --git a/dcontext/debug_test.go b/dcontext/debug_test.go index 9acfb60..a459eae 100644 --- a/dcontext/debug_test.go +++ b/dcontext/debug_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/dcontext" + "github.com/datawire/dlib/dcontext" ) func TestDebug(t *testing.T) { diff --git a/dcontext/hardsoft.go b/dcontext/hardsoft.go index 97da665..06f3b4a 100644 --- a/dcontext/hardsoft.go +++ b/dcontext/hardsoft.go @@ -3,22 +3,22 @@ // // Given // -// softCtx := WithSoftness(hardCtx) +// softCtx := WithSoftness(hardCtx) // // then // -// // The soft Context being done signals the end of "normal -// // operation", and the program should initiate a graceful -// // shutdown; a "soft shutdown". In other words, it means, "You -// // should start shutting down now." -// <-softCtx.Done() +// // The soft Context being done signals the end of "normal +// // operation", and the program should initiate a graceful +// // shutdown; a "soft shutdown". In other words, it means, "You +// // should start shutting down now." +// <-softCtx.Done() // -// // The hard Context being done signals that the time for a -// // graceful shutdown has passed and that the program should -// // terminate *right now*, not-so-gracefully; a "hard shutdown". -// // In other words, it means, "If you haven't finished shutting -// // down yet, then you should hurry it up." -// <-HardContext(softCtx).Done() +// // The hard Context being done signals that the time for a +// // graceful shutdown has passed and that the program should +// // terminate *right now*, not-so-gracefully; a "hard shutdown". +// // In other words, it means, "If you haven't finished shutting +// // down yet, then you should hurry it up." +// <-HardContext(softCtx).Done() // // When writing code that makes use of a Context, which Context should you use, // the soft Context or the hard Context? @@ -33,7 +33,8 @@ // post-shutdown-initiated grace-period, it may be appropriate to use the hard // Context. // -// # Design principles +// +// Design principles // // - The lifetimes of the various stages (normal operation, shutdown) should be // signaled with Contexts, rather than with bare channels. Because each stage @@ -71,7 +72,9 @@ // drain). Simple code with simple roughly instantaneous shutdown logic need // not be concerned about hard Contexts and shutdown getting cut short. // -// # Interfacing dcontext-aware code with dcontext-unaware code +// +// +// Interfacing dcontext-aware code with dcontext-unaware code // // When dcontext-aware code passes the soft Context to dcontext-unaware code, // then that callee code will shutdown at the beginning of the shutdown grace diff --git a/dcontext/hardsoft_example_test.go b/dcontext/hardsoft_example_test.go index da67fcb..73e7db2 100644 --- a/dcontext/hardsoft_example_test.go +++ b/dcontext/hardsoft_example_test.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dhttp" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dhttp" ) // This should be a very simple example of a parent caller function, showing how diff --git a/dcontext/polling_example_test.go b/dcontext/polling_example_test.go index aaed1b6..6b7b2ea 100644 --- a/dcontext/polling_example_test.go +++ b/dcontext/polling_example_test.go @@ -4,7 +4,7 @@ package dcontext_test import ( "context" - "github.com/datawire/dlib/v2/dcontext" + "github.com/datawire/dlib/dcontext" ) // This example shows a simple 'examplePollingCallee' that is a worker function that diff --git a/derrgroup/errgroup.go b/derrgroup/errgroup.go index ba61835..e8eb21c 100644 --- a/derrgroup/errgroup.go +++ b/derrgroup/errgroup.go @@ -15,14 +15,13 @@ // top of errgroup without duplicating and doubling up on all of // errgroup's synchronization/locking. Anything that can reasonably // be implemented *on top of* derrgroup is not included in derrgroup: -// - Managing `context.Contexts`s (this is something that errgroup -// kind of does, but derrgroup ripped out, because it can trivially -// be implemented on top of derrgroup) -// - Signal handling -// - Logging -// - Hard/soft cancellation -// - Having `Wait()` timeout on a shutdown that takes too long -// +// - Managing `context.Contexts`s (this is something that errgroup +// kind of does, but derrgroup ripped out, because it can trivially +// be implemented on top of derrgroup) +// - Signal handling +// - Logging +// - Hard/soft cancellation +// - Having `Wait()` timeout on a shutdown that takes too long // Those are all good and useful things to have. But they should be // implemented in a layer *on top of* derrgroup. "derrgroup.Group" was // originally called "llGroup" for "low-level group"; it is diff --git a/derrgroup/errgroup_example_md5all_test.go b/derrgroup/errgroup_example_md5all_test.go index 8735f54..adb4911 100644 --- a/derrgroup/errgroup_example_md5all_test.go +++ b/derrgroup/errgroup_example_md5all_test.go @@ -14,7 +14,7 @@ import ( "os" "path/filepath" - errgroup "github.com/datawire/dlib/v2/derrgroup" + errgroup "github.com/datawire/dlib/derrgroup" ) // Pipeline demonstrates the use of a Group to implement a multi-stage diff --git a/derrgroup/errgroup_test.go b/derrgroup/errgroup_test.go index a80efb5..584c18e 100644 --- a/derrgroup/errgroup_test.go +++ b/derrgroup/errgroup_test.go @@ -14,7 +14,7 @@ import ( "os" "testing" - errgroup "github.com/datawire/dlib/v2/derrgroup" + errgroup "github.com/datawire/dlib/derrgroup" ) var ( diff --git a/derrgroup/name_test.go b/derrgroup/name_test.go index d618870..d2d0839 100644 --- a/derrgroup/name_test.go +++ b/derrgroup/name_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/derrgroup" + "github.com/datawire/dlib/derrgroup" ) func TestNameCollision(t *testing.T) { diff --git a/derror/multierror.go b/derror/multierror.go index f9926d3..0c86e28 100644 --- a/derror/multierror.go +++ b/derror/multierror.go @@ -11,29 +11,29 @@ import ( // Yes, another one. What's wrong with all of the existing ones? Looking at the ones that Emissary // already imports: // -// - `github.com/asaskevich/govalidator.Errors` : (1) Doesn't implement .Is(). (2) Output is all -// on one line and hard to read. +// - `github.com/asaskevich/govalidator.Errors` : (1) Doesn't implement .Is(). (2) Output is all +// on one line and hard to read. // -// - `github.com/getkin/kin-openapi/openapi3.MultiError` : Output is all on one line and hard to -// read. +// - `github.com/getkin/kin-openapi/openapi3.MultiError` : Output is all on one line and hard to +// read. // -// - `github.com/prometheus/client_golang/prometheus.MultiError` : (1) Doesn't implement .Is(). -// (2) Output is pretty good, but doesn't handle child errors having newlines in them. +// - `github.com/prometheus/client_golang/prometheus.MultiError` : (1) Doesn't implement .Is(). +// (2) Output is pretty good, but doesn't handle child errors having newlines in them. // -// - `google.golang.org/appengine.MultiError` : (1) Doesn't implement .Is(). (2) Output is -// "helpfully" summarized to only print the first error and then say "(and X other errors)". +// - `google.golang.org/appengine.MultiError` : (1) Doesn't implement .Is(). (2) Output is +// "helpfully" summarized to only print the first error and then say "(and X other errors)". // -// - `k8s.io/apimachinery/pkg/util/errors.Aggregate` : (1) Output is all on one line and hard to -// read. (2) Isn't a simple []error type, and so is clunky to work with. +// - `k8s.io/apimachinery/pkg/util/errors.Aggregate` : (1) Output is all on one line and hard to +// read. (2) Isn't a simple []error type, and so is clunky to work with. // -// - `sigs.k8s.io/controller-tools/pkg/loader.ErrList` : (1) Doesn't implement .Is(). (2) Output -// is all on one line and hard to read. +// - `sigs.k8s.io/controller-tools/pkg/loader.ErrList` : (1) Doesn't implement .Is(). (2) Output +// is all on one line and hard to read. // // Note that (like k8s.io/apimachinery/pkg/util/errors.Aggregate) we don't implement .As(), because // we buy in to the same justification: // -// // Errors.As() is not supported, because the caller presumably cares about a -// // specific error of potentially multiple that match the given type. +// // Errors.As() is not supported, because the caller presumably cares about a +// // specific error of potentially multiple that match the given type. type MultiError []error func (errs MultiError) Error() string { diff --git a/derror/multierror_test.go b/derror/multierror_test.go index e85c5db..a3bac25 100644 --- a/derror/multierror_test.go +++ b/derror/multierror_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/derror" + "github.com/datawire/dlib/derror" ) func TestMultiError(t *testing.T) { diff --git a/derror/panic_test.go b/derror/panic_test.go index 6011be7..c06b94c 100644 --- a/derror/panic_test.go +++ b/derror/panic_test.go @@ -9,7 +9,7 @@ import ( pkgerrors "github.com/pkg/errors" - "github.com/datawire/dlib/v2/derror" + "github.com/datawire/dlib/derror" ) var thispackage, thisfile = func() (string, string) { diff --git a/dexec/borrowed_bench_test.go b/dexec/borrowed_bench_test.go index 0bce1b2..672534d 100644 --- a/dexec/borrowed_bench_test.go +++ b/dexec/borrowed_bench_test.go @@ -10,7 +10,7 @@ package dexec // MODIFIED: FROM: package exec import ( "testing" - "github.com/datawire/dlib/v2/dlog" // MODIFIED: ADDED + "github.com/datawire/dlib/dlog" // MODIFIED: ADDED ) func BenchmarkExecHostname(b *testing.B) { diff --git a/dexec/borrowed_example_test.go b/dexec/borrowed_example_test.go index 02babba..5cb369c 100644 --- a/dexec/borrowed_example_test.go +++ b/dexec/borrowed_example_test.go @@ -12,7 +12,7 @@ import ( "context" "encoding/json" "fmt" - exec "github.com/datawire/dlib/v2/dexec" // MODIFIED: FROM: "os/exec" + exec "github.com/datawire/dlib/dexec" // MODIFIED: FROM: "os/exec" "io" "io/ioutil" "log" diff --git a/dexec/borrowed_exec_linux_test.go b/dexec/borrowed_exec_linux_test.go index 842a060..ce7abb2 100644 --- a/dexec/borrowed_exec_linux_test.go +++ b/dexec/borrowed_exec_linux_test.go @@ -5,7 +5,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build linux && cgo // +build linux,cgo // On systems that use glibc, calling malloc can create a new arena, diff --git a/dexec/borrowed_exec_posix_test.go b/dexec/borrowed_exec_posix_test.go index 2220964..0356d24 100644 --- a/dexec/borrowed_exec_posix_test.go +++ b/dexec/borrowed_exec_posix_test.go @@ -5,7 +5,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package dexec_test // MODIFIED: FROM: package exec_test diff --git a/dexec/borrowed_exec_test.go b/dexec/borrowed_exec_test.go index a919fb6..4f6b66f 100644 --- a/dexec/borrowed_exec_test.go +++ b/dexec/borrowed_exec_test.go @@ -15,6 +15,9 @@ import ( "bytes" "context" "fmt" + exec "github.com/datawire/dlib/dexec" // MODIFIED: FROM: "os/exec" + "github.com/datawire/dlib/dexec/internal/poll" // MODIFIED: FROM: "internal/poll" + "github.com/datawire/dlib/dexec/internal/testenv" // MODIFIED: FROM: "internal/testenv" "io" "io/ioutil" "log" @@ -29,10 +32,7 @@ import ( "testing" "time" - exec "github.com/datawire/dlib/v2/dexec" // MODIFIED: FROM: "os/exec" - "github.com/datawire/dlib/v2/dexec/internal/poll" // MODIFIED: FROM: "internal/poll" - "github.com/datawire/dlib/v2/dexec/internal/testenv" // MODIFIED: FROM: "internal/testenv" - "github.com/datawire/dlib/v2/dlog" // MODIFIED: ADDED + "github.com/datawire/dlib/dlog" // MODIFIED: ADDED ) // haveUnexpectedFDs is set at init time to report whether any diff --git a/dexec/borrowed_read3.go b/dexec/borrowed_read3.go index be115c1..2c2d3d8 100644 --- a/dexec/borrowed_read3.go +++ b/dexec/borrowed_read3.go @@ -5,7 +5,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build ignore // +build ignore // This is a test program that verifies that it can read from @@ -18,7 +17,7 @@ package main import ( "fmt" - "github.com/datawire/dlib/v2/dexec/internal/poll" // MODIFIED: FROM: "internal/poll" + "github.com/datawire/dlib/dexec/internal/poll" // MODIFIED: FROM: "internal/poll" "io/ioutil" "os" "os/exec" diff --git a/dexec/cmd.go b/dexec/cmd.go index 438da6f..1a30ab9 100644 --- a/dexec/cmd.go +++ b/dexec/cmd.go @@ -12,7 +12,7 @@ // // The logger used is configured in the context.Context passed to // CommandContext by calling -// github.com/datawire/dlib/v2/dlog.WithLogger. +// github.com/datawire/dlib/dlog.WithLogger. // // A Cmd logs when it starts, its exit status, and everything read // from or written to .Stdin, .Stdout, and .Stderr if they aren't an @@ -53,9 +53,9 @@ import ( // we'll use it are situations where stacktraces will be useful. "github.com/pkg/errors" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dlog" - "github.com/datawire/dlib/v2/internal/sigint" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dlog" + "github.com/datawire/dlib/internal/sigint" ) // Error is returned by LookPath when it fails to classify a file as an @@ -104,7 +104,7 @@ type Cmd struct { // // 1. To kill the process (by calling os.Process.Kill) if the context // becomes done before the command completes on its own. -// 2. For logging (see github.com/datawire/dlib/v2/dlog). +// 2. For logging (see github.com/datawire/dlib/dlog). // // See the os/exec.Command and os/exec.CommandContext documentation // for more information. diff --git a/dexec/cmd_posix.go b/dexec/cmd_posix.go index 7fc0502..1526b85 100644 --- a/dexec/cmd_posix.go +++ b/dexec/cmd_posix.go @@ -1,4 +1,3 @@ -//go:build !windows // +build !windows package dexec diff --git a/dexec/hardsoft_test.go b/dexec/hardsoft_test.go index 18750f1..4465b53 100644 --- a/dexec/hardsoft_test.go +++ b/dexec/hardsoft_test.go @@ -14,8 +14,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dexec" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dexec" ) type lineBuffer struct { diff --git a/dexec/internal/testenv/borrowed_testenv.go b/dexec/internal/testenv/borrowed_testenv.go index 01160d1..8147512 100644 --- a/dexec/internal/testenv/borrowed_testenv.go +++ b/dexec/internal/testenv/borrowed_testenv.go @@ -15,8 +15,8 @@ package testenv import ( "errors" - exec "github.com/datawire/dlib/v2/dexec" // MODIFIED: FROM: "os/exec" - "github.com/datawire/dlib/v2/dexec/internal/cfg" // MODIFIED: FROM: "internal/cfg" + exec "github.com/datawire/dlib/dexec" // MODIFIED: FROM: "os/exec" + "github.com/datawire/dlib/dexec/internal/cfg" // MODIFIED: FROM: "internal/cfg" "os" "path/filepath" "runtime" @@ -24,7 +24,7 @@ import ( "testing" ) -// HasGoBuild reports whether the current system can build programs with “go build” +// HasGoBuild reports whether the current system can build programs with ``go build'' // and then run them with os.StartProcess or exec.Command. func HasGoBuild() bool { if os.Getenv("GO_GCFLAGS") != "" { @@ -45,7 +45,7 @@ func HasGoBuild() bool { return true } -// MustHaveGoBuild checks that the current system can build programs with “go build” +// MustHaveGoBuild checks that the current system can build programs with ``go build'' // and then run them with os.StartProcess or exec.Command. // If not, MustHaveGoBuild calls t.Skip with an explanation. func MustHaveGoBuild(t testing.TB) { diff --git a/dexec/logging_test.go b/dexec/logging_test.go index c19eac4..6a26f83 100644 --- a/dexec/logging_test.go +++ b/dexec/logging_test.go @@ -13,8 +13,8 @@ import ( "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/dexec" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dexec" + "github.com/datawire/dlib/dlog" ) type logWriter struct { diff --git a/dexec/supervisor_test.go b/dexec/supervisor_test.go index 4743e31..96009b8 100644 --- a/dexec/supervisor_test.go +++ b/dexec/supervisor_test.go @@ -12,8 +12,8 @@ import ( "github.com/sirupsen/logrus" - exec "github.com/datawire/dlib/v2/dexec" - "github.com/datawire/dlib/v2/dlog" + exec "github.com/datawire/dlib/dexec" + "github.com/datawire/dlib/dlog" ) func TestMustCapture(t *testing.T) { diff --git a/dgroup/errgroup_example_md5all_test.go b/dgroup/errgroup_example_md5all_test.go index f0afcc2..650aa61 100644 --- a/dgroup/errgroup_example_md5all_test.go +++ b/dgroup/errgroup_example_md5all_test.go @@ -14,7 +14,7 @@ import ( "os" "path/filepath" - errgroup "github.com/datawire/dlib/v2/dgroup" + errgroup "github.com/datawire/dlib/dgroup" ) // Pipeline demonstrates the use of a Group to implement a multi-stage diff --git a/dgroup/errgroup_test.go b/dgroup/errgroup_test.go index c3bf34d..b6215a3 100644 --- a/dgroup/errgroup_test.go +++ b/dgroup/errgroup_test.go @@ -14,7 +14,7 @@ import ( "os" "testing" - errgroup "github.com/datawire/dlib/v2/dgroup" + errgroup "github.com/datawire/dlib/dgroup" ) var ( diff --git a/dgroup/example_other_test.go b/dgroup/example_other_test.go index e5229bb..93418ee 100644 --- a/dgroup/example_other_test.go +++ b/dgroup/example_other_test.go @@ -1,4 +1,3 @@ -//go:build !windows // +build !windows package dgroup_test diff --git a/dgroup/example_test.go b/dgroup/example_test.go index 0cadb07..363daff 100644 --- a/dgroup/example_test.go +++ b/dgroup/example_test.go @@ -7,10 +7,10 @@ import ( "github.com/sirupsen/logrus" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dgroup" - "github.com/datawire/dlib/v2/dlog" - "github.com/datawire/dlib/v2/internal/sigint" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dgroup" + "github.com/datawire/dlib/dlog" + "github.com/datawire/dlib/internal/sigint" ) func baseContext() context.Context { @@ -206,19 +206,19 @@ runtime/pprof.writeGoroutine(0x6575e0, 0xc0003803c0, 0x2, 0x203000, 0xc) /usr/lib/go/src/runtime/pprof/pprof.go:682 +0x45 runtime/pprof.(*Profile).WriteTo(0x7770c0, 0x6575e0, 0xc0003803c0, 0x2, 0xc000380340, 0xc00038a4d0) /usr/lib/go/src/runtime/pprof/pprof.go:331 +0x3f2 -github.com/datawire/dlib/v2/dgroup.logGoroutineTraces(0x659e80, 0xc000392300, 0x61b619, 0x16, 0x629ca0) +github.com/datawire/dlib/dgroup.logGoroutineTraces(0x659e80, 0xc000392300, 0x61b619, 0x16, 0x629ca0) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:109 +0xba -github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func4(0x659e80, 0xc00017c330, 0xc0001586b0, 0xc0000357c0) +github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func4(0x659e80, 0xc00017c330, 0xc0001586b0, 0xc0000357c0) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:305 +0x4e5 -github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c330, 0xc0000b7920) +github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c330, 0xc0000b7920) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0 -created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx +created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88 goroutine 1 [select]: -github.com/datawire/dlib/v2/dgroup.(*Group).Wait(0xc000153e30, 0x616a5c, 0x6) +github.com/datawire/dlib/dgroup.(*Group).Wait(0xc000153e30, 0x616a5c, 0x6) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:418 +0x139 -github.com/datawire/dlib/v2/dgroup_test.Example_signalHandling3() +github.com/datawire/dlib/dgroup_test.Example_signalHandling3() /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/example_test.go:233 +0x125 testing.runExample(0x61ba2a, 0x17, 0x629c90, 0x6245c4, 0x491, 0x0, 0x0) /usr/lib/go/src/testing/run_example.go:62 +0x209 @@ -252,19 +252,19 @@ created by testing.runExample /usr/lib/go/src/testing/run_example.go:35 +0x176 goroutine 1404 [chan receive]: -github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func3(0x659e80, 0xc00017c270, 0xc0000a5d70, 0xd) +github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func3(0x659e80, 0xc00017c270, 0xc0000a5d70, 0xd) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:271 +0x4a -github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c270, 0xc0000b7900) +github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c270, 0xc0000b7900) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0 -created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx +created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88 goroutine 1403 [select]: -github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func2(0x659e80, 0xc00017c1b0, 0xc0000a5d80, 0x9) +github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func2(0x659e80, 0xc00017c1b0, 0xc0000a5d80, 0x9) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:255 +0x254 -github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c1b0, 0xc000158870) +github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c1b0, 0xc000158870) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0 -created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx +created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88 goroutine 1443 [syscall]: @@ -276,13 +276,13 @@ created by os/signal.Notify.func1.1 /usr/lib/go/src/os/signal/signal.go:150 +0x45 goroutine 1406 [select (no cases)]: -github.com/datawire/dlib/v2/dgroup_test.Example_signalHandling3.func2(0x659e80, 0xc00017c3f0, 0x0, 0x0) +github.com/datawire/dlib/dgroup_test.Example_signalHandling3.func2(0x659e80, 0xc00017c3f0, 0x0, 0x0) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/example_test.go:230 +0x2ab -github.com/datawire/dlib/v2/dgroup.(*Group).goWorkerCtx.func1(0x0, 0x0) +github.com/datawire/dlib/dgroup.(*Group).goWorkerCtx.func1(0x0, 0x0) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:354 +0x9f -github.com/datawire/dlib/v2/derrgroup.(*Group).Go.func2(0xc00017c420, 0xc00012fbc0, 0xc0000a5de5, 0x7) +github.com/datawire/dlib/derrgroup.(*Group).Go.func2(0xc00017c420, 0xc00012fbc0, 0xc0000a5de5, 0x7) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:131 +0x2b -created by github.com/datawire/dlib/v2/derrgroup.(*Group).Go +created by github.com/datawire/dlib/derrgroup.(*Group).Go /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:129 +0x12d goroutine 1407 [semacquire]: @@ -290,11 +290,11 @@ sync.runtime_Semacquire(0xc00012fbcc) /usr/lib/go/src/runtime/sema.go:56 +0x45 sync.(*WaitGroup).Wait(0xc00012fbcc) /usr/lib/go/src/sync/waitgroup.go:130 +0x65 -github.com/datawire/dlib/v2/derrgroup.(*Group).Wait(...) +github.com/datawire/dlib/derrgroup.(*Group).Wait(...) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:99 -github.com/datawire/dlib/v2/dgroup.(*Group).Wait.func1(0xc00015e840, 0xc000153e30) +github.com/datawire/dlib/dgroup.(*Group).Wait.func1(0xc00015e840, 0xc000153e30) /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:413 +0x48 -created by github.com/datawire/dlib/v2/dgroup.(*Group).Wait +created by github.com/datawire/dlib/dgroup.(*Group).Wait /home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:412 +0x85 ` @@ -412,19 +412,19 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/runtime/pprof/pprof.go:682 +0x45" THREAD=":signal_handler:2" // level=error msg=" runtime/pprof.(*Profile).WriteTo(0x7770c0, 0x6575e0, 0xc0003803c0, 0x2, 0xc000380340, 0xc00038a4d0)" THREAD=":signal_handler:2" // level=error msg=" \t/usr/lib/go/src/runtime/pprof/pprof.go:331 +0x3f2" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.logGoroutineTraces(0x659e80, 0xc000392300, 0x61b619, 0x16, 0x629ca0)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.logGoroutineTraces(0x659e80, 0xc000392300, 0x61b619, 0x16, 0x629ca0)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:109 +0xba" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func4(0x659e80, 0xc00017c330, 0xc0001586b0, 0xc0000357c0)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func4(0x659e80, 0xc00017c330, 0xc0001586b0, 0xc0000357c0)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:305 +0x4e5" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c330, 0xc0000b7920)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c330, 0xc0000b7920)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0" THREAD=":signal_handler:2" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx" THREAD=":signal_handler:2" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88" THREAD=":signal_handler:2" // level=error msg=" " THREAD=":signal_handler:2" // level=error msg=" goroutine 1 [select]:" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).Wait(0xc000153e30, 0x616a5c, 0x6)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).Wait(0xc000153e30, 0x616a5c, 0x6)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:418 +0x139" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup_test.Example_signalHandling3()" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup_test.Example_signalHandling3()" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/example_test.go:233 +0x125" THREAD=":signal_handler:2" // level=error msg=" testing.runExample(0x61ba2a, 0x17, 0x629c90, 0x6245c4, 0x491, 0x0, 0x0)" THREAD=":signal_handler:2" // level=error msg=" \t/usr/lib/go/src/testing/run_example.go:62 +0x209" THREAD=":signal_handler:2" @@ -458,19 +458,19 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/testing/run_example.go:35 +0x176" THREAD=":signal_handler:2" // level=error msg=" " THREAD=":signal_handler:2" // level=error msg=" goroutine 1404 [chan receive]:" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func3(0x659e80, 0xc00017c270, 0xc0000a5d70, 0xd)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func3(0x659e80, 0xc00017c270, 0xc0000a5d70, 0xd)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:271 +0x4a" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c270, 0xc0000b7900)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c270, 0xc0000b7900)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0" THREAD=":signal_handler:2" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx" THREAD=":signal_handler:2" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88" THREAD=":signal_handler:2" // level=error msg=" " THREAD=":signal_handler:2" // level=error msg=" goroutine 1403 [select]:" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func2(0x659e80, 0xc00017c1b0, 0xc0000a5d80, 0x9)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func2(0x659e80, 0xc00017c1b0, 0xc0000a5d80, 0x9)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:255 +0x254" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c1b0, 0xc000158870)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c1b0, 0xc000158870)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0" THREAD=":signal_handler:2" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx" THREAD=":signal_handler:2" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88" THREAD=":signal_handler:2" // level=error msg=" " THREAD=":signal_handler:2" // level=error msg=" goroutine 1443 [syscall]:" THREAD=":signal_handler:2" @@ -482,13 +482,13 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/os/signal/signal.go:150 +0x45" THREAD=":signal_handler:2" // level=error msg=" " THREAD=":signal_handler:2" // level=error msg=" goroutine 1406 [select (no cases)]:" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup_test.Example_signalHandling3.func2(0x659e80, 0xc00017c3f0, 0x0, 0x0)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup_test.Example_signalHandling3.func2(0x659e80, 0xc00017c3f0, 0x0, 0x0)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/example_test.go:230 +0x2ab" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goWorkerCtx.func1(0x0, 0x0)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goWorkerCtx.func1(0x0, 0x0)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:354 +0x9f" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/derrgroup.(*Group).Go.func2(0xc00017c420, 0xc00012fbc0, 0xc0000a5de5, 0x7)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/derrgroup.(*Group).Go.func2(0xc00017c420, 0xc00012fbc0, 0xc0000a5de5, 0x7)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:131 +0x2b" THREAD=":signal_handler:2" - // level=error msg=" created by github.com/datawire/dlib/v2/derrgroup.(*Group).Go" THREAD=":signal_handler:2" + // level=error msg=" created by github.com/datawire/dlib/derrgroup.(*Group).Go" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:129 +0x12d" THREAD=":signal_handler:2" // level=error msg=" " THREAD=":signal_handler:2" // level=error msg=" goroutine 1407 [semacquire]:" THREAD=":signal_handler:2" @@ -496,11 +496,11 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/runtime/sema.go:56 +0x45" THREAD=":signal_handler:2" // level=error msg=" sync.(*WaitGroup).Wait(0xc00012fbcc)" THREAD=":signal_handler:2" // level=error msg=" \t/usr/lib/go/src/sync/waitgroup.go:130 +0x65" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/derrgroup.(*Group).Wait(...)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/derrgroup.(*Group).Wait(...)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:99" THREAD=":signal_handler:2" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).Wait.func1(0xc00015e840, 0xc000153e30)" THREAD=":signal_handler:2" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).Wait.func1(0xc00015e840, 0xc000153e30)" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:413 +0x48" THREAD=":signal_handler:2" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).Wait" THREAD=":signal_handler:2" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).Wait" THREAD=":signal_handler:2" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:412 +0x85" THREAD=":signal_handler:2" // level=info msg=" final goroutine statuses:" THREAD=":shutdown_status" // level=info msg=" /worker : running" THREAD=":shutdown_status" @@ -513,19 +513,19 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/runtime/pprof/pprof.go:682 +0x45" THREAD=":shutdown_status" // level=error msg=" runtime/pprof.(*Profile).WriteTo(0x7770c0, 0x6575e0, 0xc0003803c0, 0x2, 0xc000380340, 0xc00038a4d0)" THREAD=":shutdown_status" // level=error msg=" \t/usr/lib/go/src/runtime/pprof/pprof.go:331 +0x3f2" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.logGoroutineTraces(0x659e80, 0xc000392300, 0x61b619, 0x16, 0x629ca0)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.logGoroutineTraces(0x659e80, 0xc000392300, 0x61b619, 0x16, 0x629ca0)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:109 +0xba" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func4(0x659e80, 0xc00017c330, 0xc0001586b0, 0xc0000357c0)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func4(0x659e80, 0xc00017c330, 0xc0001586b0, 0xc0000357c0)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:305 +0x4e5" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c330, 0xc0000b7920)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c330, 0xc0000b7920)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0" THREAD=":shutdown_status" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx" THREAD=":shutdown_status" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88" THREAD=":shutdown_status" // level=error msg=" " THREAD=":shutdown_status" // level=error msg=" goroutine 1 [select]:" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).Wait(0xc000153e30, 0x616a5c, 0x6)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).Wait(0xc000153e30, 0x616a5c, 0x6)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:418 +0x139" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup_test.Example_signalHandling3()" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup_test.Example_signalHandling3()" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/example_test.go:233 +0x125" THREAD=":shutdown_status" // level=error msg=" testing.runExample(0x61ba2a, 0x17, 0x629c90, 0x6245c4, 0x491, 0x0, 0x0)" THREAD=":shutdown_status" // level=error msg=" \t/usr/lib/go/src/testing/run_example.go:62 +0x209" THREAD=":shutdown_status" @@ -559,19 +559,19 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/testing/run_example.go:35 +0x176" THREAD=":shutdown_status" // level=error msg=" " THREAD=":shutdown_status" // level=error msg=" goroutine 1404 [chan receive]:" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func3(0x659e80, 0xc00017c270, 0xc0000a5d70, 0xd)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func3(0x659e80, 0xc00017c270, 0xc0000a5d70, 0xd)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:271 +0x4a" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c270, 0xc0000b7900)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c270, 0xc0000b7900)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0" THREAD=":shutdown_status" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx" THREAD=":shutdown_status" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88" THREAD=":shutdown_status" // level=error msg=" " THREAD=":shutdown_status" // level=error msg=" goroutine 1403 [select]:" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).launchSupervisors.func2(0x659e80, 0xc00017c1b0, 0xc0000a5d80, 0x9)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).launchSupervisors.func2(0x659e80, 0xc00017c1b0, 0xc0000a5d80, 0x9)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:255 +0x254" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c1b0, 0xc000158870)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx.func1(0xc000153e30, 0x659e80, 0xc00017c1b0, 0xc000158870)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:396 +0xb0" THREAD=":shutdown_status" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).goSupervisorCtx" THREAD=":shutdown_status" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).goSupervisorCtx" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:384 +0x88" THREAD=":shutdown_status" // level=error msg=" " THREAD=":shutdown_status" // level=error msg=" goroutine 1443 [syscall]:" THREAD=":shutdown_status" @@ -583,13 +583,13 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/os/signal/signal.go:150 +0x45" THREAD=":shutdown_status" // level=error msg=" " THREAD=":shutdown_status" // level=error msg=" goroutine 1406 [select (no cases)]:" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup_test.Example_signalHandling3.func2(0x659e80, 0xc00017c3f0, 0x0, 0x0)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup_test.Example_signalHandling3.func2(0x659e80, 0xc00017c3f0, 0x0, 0x0)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/example_test.go:230 +0x2ab" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).goWorkerCtx.func1(0x0, 0x0)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).goWorkerCtx.func1(0x0, 0x0)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:354 +0x9f" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/derrgroup.(*Group).Go.func2(0xc00017c420, 0xc00012fbc0, 0xc0000a5de5, 0x7)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/derrgroup.(*Group).Go.func2(0xc00017c420, 0xc00012fbc0, 0xc0000a5de5, 0x7)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:131 +0x2b" THREAD=":shutdown_status" - // level=error msg=" created by github.com/datawire/dlib/v2/derrgroup.(*Group).Go" THREAD=":shutdown_status" + // level=error msg=" created by github.com/datawire/dlib/derrgroup.(*Group).Go" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:129 +0x12d" THREAD=":shutdown_status" // level=error msg=" " THREAD=":shutdown_status" // level=error msg=" goroutine 1407 [semacquire]:" THREAD=":shutdown_status" @@ -597,11 +597,11 @@ func Example_signalHandling3() { // level=error msg=" \t/usr/lib/go/src/runtime/sema.go:56 +0x45" THREAD=":shutdown_status" // level=error msg=" sync.(*WaitGroup).Wait(0xc00012fbcc)" THREAD=":shutdown_status" // level=error msg=" \t/usr/lib/go/src/sync/waitgroup.go:130 +0x65" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/derrgroup.(*Group).Wait(...)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/derrgroup.(*Group).Wait(...)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/derrgroup/errgroup.go:99" THREAD=":shutdown_status" - // level=error msg=" github.com/datawire/dlib/v2/dgroup.(*Group).Wait.func1(0xc00015e840, 0xc000153e30)" THREAD=":shutdown_status" + // level=error msg=" github.com/datawire/dlib/dgroup.(*Group).Wait.func1(0xc00015e840, 0xc000153e30)" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:413 +0x48" THREAD=":shutdown_status" - // level=error msg=" created by github.com/datawire/dlib/v2/dgroup.(*Group).Wait" THREAD=":shutdown_status" + // level=error msg=" created by github.com/datawire/dlib/dgroup.(*Group).Wait" THREAD=":shutdown_status" // level=error msg=" \t/home/lukeshu/src/github.com/datawire/apro/ambassador/pkg/dgroup/group.go:412 +0x85" THREAD=":shutdown_status" // level=error msg="exiting with error: failed to shut down within the 1s shutdown timeout; some goroutines are left running" } diff --git a/dgroup/group.go b/dgroup/group.go index a41f67c..1750288 100644 --- a/dgroup/group.go +++ b/dgroup/group.go @@ -10,11 +10,11 @@ // does not have a notion of dependencies. Not having a notion of // dependencies implies a few things: // -// - it does not have a notion of "readiness", as it doesn't have any -// dependents that would block on a goroutine becoming ready -// - it launches worker goroutines right away when you call .Go(), as -// it doesn't have any dependencies that would block the worker -// from starting +// - it does not have a notion of "readiness", as it doesn't have any +// dependents that would block on a goroutine becoming ready +// - it launches worker goroutines right away when you call .Go(), as +// it doesn't have any dependencies that would block the worker +// from starting // // So, if you need to enforce ordering requirements during goroutine // startup and shutdown, then (for now, anyway) you'll need to @@ -35,10 +35,10 @@ import ( "github.com/pkg/errors" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/derrgroup" - "github.com/datawire/dlib/v2/derror" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/derrgroup" + "github.com/datawire/dlib/derror" + "github.com/datawire/dlib/dlog" ) // A Group is a collection of goroutines working on subtasks that are @@ -47,15 +47,15 @@ import ( // bog-standard "golang.org/x/sync/errgroup.Group"), the things that // make dgroup attractive are: // -// - (optionally) handles SIGINT and SIGTERM -// - (configurable) manages Context for you -// - (optionally) adds hard/soft cancellation -// - (optionally) does panic recovery -// - (optionally) does some minimal logging -// - (optionally) adds configurable shutdown timeouts -// - a concept of goroutine names -// - adds a way to call to the parent group, making it possible to -// launch a "sibling" goroutine +// - (optionally) handles SIGINT and SIGTERM +// - (configurable) manages Context for you +// - (optionally) adds hard/soft cancellation +// - (optionally) does panic recovery +// - (optionally) does some minimal logging +// - (optionally) adds configurable shutdown timeouts +// - a concept of goroutine names +// - adds a way to call to the parent group, making it possible to +// launch a "sibling" goroutine // // A zero Group is NOT valid; a Group must be created with NewGroup. // @@ -396,13 +396,13 @@ func (g *Group) goWorkerCtx(ctx context.Context, fn func(ctx context.Context) er // "supervisor" goroutines have a few important differences and // additional requirements: // -// - They MUST monitor the g.waitFinished channel, and MUST finish -// quickly after that channel is closed. -// - They MUST not panic, as we don't bother to set up panic recovery -// for them. -// - The cfg.WorkerContext() callback is not called. -// - Being a "systems" thing, they must be robust and CANNOT fail; so -// they don't get to return an error. +// - They MUST monitor the g.waitFinished channel, and MUST finish +// quickly after that channel is closed. +// - They MUST not panic, as we don't bother to set up panic recovery +// for them. +// - The cfg.WorkerContext() callback is not called. +// - Being a "systems" thing, they must be robust and CANNOT fail; so +// they don't get to return an error. func (g *Group) goSupervisor(name string, fn func(ctx context.Context)) { ctx := WithGoroutineName(g.baseCtx, ":"+name) g.goSupervisorCtx(ctx, fn) diff --git a/dgroup/name.go b/dgroup/name.go index a27a232..df99b09 100644 --- a/dgroup/name.go +++ b/dgroup/name.go @@ -3,7 +3,7 @@ package dgroup import ( "context" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dlog" ) type goroutineNameKey struct{} diff --git a/dhttp/server.go b/dhttp/server.go index fdce2d7..80f1988 100644 --- a/dhttp/server.go +++ b/dhttp/server.go @@ -45,9 +45,9 @@ import ( "golang.org/x/net/http2" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dgroup" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dgroup" + "github.com/datawire/dlib/dlog" ) // connContextFn is just a convenience type alias because the type signature for concatConnContext @@ -82,65 +82,65 @@ type testHookContextKey struct{} // // This is better than http.Server because: // -// - It natively supports "h2c" (HTTP/2 over cleartext). +// - It natively supports "h2c" (HTTP/2 over cleartext). // -// - Its "h2c" support is better than http.Server with golang.org/x/net/http2/h2c.NewHandler, -// because it properly shuts down idle h2c connections when shutdown is initiated, rather than -// allowing h2c connections to sit around forever. +// - Its "h2c" support is better than http.Server with golang.org/x/net/http2/h2c.NewHandler, +// because it properly shuts down idle h2c connections when shutdown is initiated, rather than +// allowing h2c connections to sit around forever. // -// - It uses Context cancellation as a simple and composable shutdown mechanism; supporting -// dcontext hard/soft contexts, rather than awkward relationship between the Shutdown and Close -// methods. +// - It uses Context cancellation as a simple and composable shutdown mechanism; supporting +// dcontext hard/soft contexts, rather than awkward relationship between the Shutdown and Close +// methods. // -// Rather than having to set up a tree of cleanup functions calling each other down through your -// program and dealing with having to call .Shutdown() and .Close() from another goroutine (and -// having to understand the relationship between .Shutdown() and .Close() and when to call each, -// which is a bigger task than you might think), the "(ListenAnd)?Serve(TLS)?" methods simply -// take a Context and perform cleanup when the Context becomes Done. In order to differentiate -// between whether you want it to hard-shutdown or graceful-shutdown, you may use the dcontext -// hard/soft mechanism; if you don't use dcontext then it will be a hard-shutdown. +// Rather than having to set up a tree of cleanup functions calling each other down through your +// program and dealing with having to call .Shutdown() and .Close() from another goroutine (and +// having to understand the relationship between .Shutdown() and .Close() and when to call each, +// which is a bigger task than you might think), the "(ListenAnd)?Serve(TLS)?" methods simply +// take a Context and perform cleanup when the Context becomes Done. In order to differentiate +// between whether you want it to hard-shutdown or graceful-shutdown, you may use the dcontext +// hard/soft mechanism; if you don't use dcontext then it will be a hard-shutdown. // -// - When shutting down, it properly blocks when waiting for the workers of hijacked connections. +// - When shutting down, it properly blocks when waiting for the workers of hijacked connections. // -// Hijacked connections are connections for which the .Handler said to the server "you know what, -// stop doing HTTP and let me use the raw TCP socket" (as when having negotiated an upgrade from -// HTTP/1 to WebSockets or from HTTP/1 to HTTP/2). It is a design deficiency in net/http.Server -// that the net/http.Server totally just stops tracking connections when they get hijacked; -// failing to close them when you call net/http.Server.Close() and failing to wait for them when -// you call net/http.Server.Shutdown(); and unfortunately that design deficiency is locked-in to -// *http.Server because of backward compatibility promises. +// Hijacked connections are connections for which the .Handler said to the server "you know what, +// stop doing HTTP and let me use the raw TCP socket" (as when having negotiated an upgrade from +// HTTP/1 to WebSockets or from HTTP/1 to HTTP/2). It is a design deficiency in net/http.Server +// that the net/http.Server totally just stops tracking connections when they get hijacked; +// failing to close them when you call net/http.Server.Close() and failing to wait for them when +// you call net/http.Server.Shutdown(); and unfortunately that design deficiency is locked-in to +// *http.Server because of backward compatibility promises. // -// - If you use dlog, you don't have to manually configure the logging for the server to do the -// right thing. +// - If you use dlog, you don't have to manually configure the logging for the server to do the +// right thing. // // Breaking changes from http.Server to ServerConfig that will stop your old code from compiling: // -// - Obviously, the name is different. -// - The "Addr" member field is removed; it is replaced by an "addr" argument to the -// "ListenAndServe(TLS)?" methods. -// - The "BaseContext" member field is removed; it is replaced by a "ctx" argument to the -// "(ListenAnd)?Serve(TLS)?" methods. -// - The "RegisterOnShutdown" is removed; it is replaced by an "OnShutdown" member field. -// - The "SetKeepAlivesEnabled", "Shutdown", and "Close" methods are removed; they are conceptually -// replaced by using Context cancellation for lifecycle management. Use dcontext soft -// cancellation for the graceful shutdown that "Shutdown" allowed. +// - Obviously, the name is different. +// - The "Addr" member field is removed; it is replaced by an "addr" argument to the +// "ListenAndServe(TLS)?" methods. +// - The "BaseContext" member field is removed; it is replaced by a "ctx" argument to the +// "(ListenAnd)?Serve(TLS)?" methods. +// - The "RegisterOnShutdown" is removed; it is replaced by an "OnShutdown" member field. +// - The "SetKeepAlivesEnabled", "Shutdown", and "Close" methods are removed; they are conceptually +// replaced by using Context cancellation for lifecycle management. Use dcontext soft +// cancellation for the graceful shutdown that "Shutdown" allowed. // // Breaking changes from http.Server to ServerConfig that will maybe make your old code incorrect: // -// - The semantics of the "TLSNextProto" member field are slightly different. -// - The semantics of the "Error" member field are slightly different. -// - The structure is deep-copied by each of the "(ListenAnd)?Serve(TLS)?" methods; mutating the -// config structure while a server is running will not affect the running server. -// - HTTP/2 support (both "h2" and "h2c") is built-in, so if your code configures HTTP/2 manually, -// you're going to need to set "DisableHTTP2: true" to stop ServerConfig from stomping over your -// code's work. +// - The semantics of the "TLSNextProto" member field are slightly different. +// - The semantics of the "Error" member field are slightly different. +// - The structure is deep-copied by each of the "(ListenAnd)?Serve(TLS)?" methods; mutating the +// config structure while a server is running will not affect the running server. +// - HTTP/2 support (both "h2" and "h2c") is built-in, so if your code configures HTTP/2 manually, +// you're going to need to set "DisableHTTP2: true" to stop ServerConfig from stomping over your +// code's work. // // Arguably-breaking changes from http.Server that to ServerConfig that I'd say are bugfixes, but // could conceivably[2] make someone's old code incorrect: // -// - *http.Server.ServeTLS won't close the Listener if .ServeTLS returns early during setup due to -// having been passed invalid cert or key files; ServerConfig.ServeTLS will always close the -// Listener before returning; matching the "Serve" method. +// - *http.Server.ServeTLS won't close the Listener if .ServeTLS returns early during setup due to +// having been passed invalid cert or key files; ServerConfig.ServeTLS will always close the +// Listener before returning; matching the "Serve" method. // // The reason for creating a new type and having breaking changes (rather than writing a few utility // functions that take an *http.Server as an argument) is that it became increasingly clear that the diff --git a/dhttp/server_http2.go b/dhttp/server_http2.go index c6d3f83..a245673 100644 --- a/dhttp/server_http2.go +++ b/dhttp/server_http2.go @@ -13,22 +13,21 @@ import ( // // The HTTP/2 configuration 'conf' may be nil. // -// - This is better than golang.org/x/net/http2.ConfigureServer because this also handles "h2c", -// not just "h2". -// - This is better than the default net/http.Server HTTP/2 support, as the default support is -// exactly equivalent to golang.org/x/net/http2.ConfigureServer (it uses a vendor'ed copy of -// golang.org/x/net/http2). -// - This is better than golang.org/x/net/http2/h2c.NewHandler because this will properly shut down -// idle h2c connections when server.Shutdown is called, rather than allowing h2c connections to -// sit around forever. +// - This is better than golang.org/x/net/http2.ConfigureServer because this also handles "h2c", +// not just "h2". +// - This is better than the default net/http.Server HTTP/2 support, as the default support is +// exactly equivalent to golang.org/x/net/http2.ConfigureServer (it uses a vendor'ed copy of +// golang.org/x/net/http2). +// - This is better than golang.org/x/net/http2/h2c.NewHandler because this will properly shut down +// idle h2c connections when server.Shutdown is called, rather than allowing h2c connections to +// sit around forever. // // This must be called before server starts serving, as this will mutate server.TLSConfig, // server.TLSNextProto, and server.Handler. // // However, this has some limitations (that I believe all other alternatives also share): -// - h2c connections are not closed by server.Close(). -// - server.Shutdown() may return early before all h2c connections have been shutdown. -// +// - h2c connections are not closed by server.Close(). +// - server.Shutdown() may return early before all h2c connections have been shutdown. // These limitations can be solved with configureHijackTracking. func configureHTTP2(server *http.Server, conf *http2.Server) error { if server == nil { diff --git a/dhttp/server_http2_test.go b/dhttp/server_http2_test.go index 5a7c09f..9a7b8e0 100644 --- a/dhttp/server_http2_test.go +++ b/dhttp/server_http2_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dhttp" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dhttp" + "github.com/datawire/dlib/dlog" ) func TestContext(t *testing.T) { diff --git a/dhttp/server_test.go b/dhttp/server_test.go index df96066..0c356bb 100644 --- a/dhttp/server_test.go +++ b/dhttp/server_test.go @@ -15,9 +15,9 @@ import ( "github.com/stretchr/testify/assert" "golang.org/x/net/http2" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dhttp" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dhttp" + "github.com/datawire/dlib/dlog" ) func httpScenarios(t *testing.T, diff --git a/dlog/dlog_test.go b/dlog/dlog_test.go index 9693a4b..22801db 100644 --- a/dlog/dlog_test.go +++ b/dlog/dlog_test.go @@ -15,7 +15,7 @@ import ( "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dlog" ) var logPos struct { diff --git a/dlog/logger.go b/dlog/logger.go index 6d46ccd..8227602 100644 --- a/dlog/logger.go +++ b/dlog/logger.go @@ -101,9 +101,9 @@ type OptimizedLogger interface { // 2. A concern about performance degradation in existing implementations // when checks like: // -// if opt, ok := l.(OptimizedLogger); ok { -// ... -// } +// if opt, ok := l.(OptimizedLogger); ok { +// ... +// } // // no longer detect implementations that lack the MaxLevel method and // silently choose a non-optimized approach. diff --git a/dlog/logger_logrus.go b/dlog/logger_logrus.go index 97e715f..9e95031 100644 --- a/dlog/logger_logrus.go +++ b/dlog/logger_logrus.go @@ -112,7 +112,7 @@ func (logrusFixCallerHook) Fire(entry *logrus.Entry) error { } const ( - dlogPackage = "github.com/datawire/dlib/v2/dlog" + dlogPackage = "github.com/datawire/dlib/dlog" logrusPackage = "github.com/sirupsen/logrus" maximumCallerDepth int = 25 minimumCallerDepth int = 2 // runtime.Callers + getCaller diff --git a/dtime/dtime_example_test.go b/dtime/dtime_example_test.go index ccf2965..e08023a 100644 --- a/dtime/dtime_example_test.go +++ b/dtime/dtime_example_test.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/datawire/dlib/v2/dtime" + "github.com/datawire/dlib/dtime" ) // This example uses a dtime.FakeTime to change the behavior of diff --git a/dtime/faketime_test.go b/dtime/faketime_test.go index ac30b00..d50cfc2 100644 --- a/dtime/faketime_test.go +++ b/dtime/faketime_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/datawire/dlib/v2/dtime" + "github.com/datawire/dlib/dtime" ) func check(t *testing.T, ft *dtime.FakeTime, what string, wantedSec int) { diff --git a/dtime/sleepwithcontext.go b/dtime/sleepwithcontext.go index fb32a8e..46222a6 100644 --- a/dtime/sleepwithcontext.go +++ b/dtime/sleepwithcontext.go @@ -15,10 +15,10 @@ var sleepTestHook func() // // You may be thinking, why not just do: // -// select { -// case <-ctx.Done(): -// case <-time.After(d): -// } +// select { +// case <-ctx.Done(): +// case <-time.After(d): +// } // // well, time.After can't get garbage collected until the timer // expires, even if the Context is done. What this function provides diff --git a/dtime/sleepwithcontext_test.go b/dtime/sleepwithcontext_test.go index 5ace177..7904712 100644 --- a/dtime/sleepwithcontext_test.go +++ b/dtime/sleepwithcontext_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/dlog" + "github.com/datawire/dlib/dlog" ) func assertDurationEq(t testing.TB, expected, actual, slop time.Duration, msgAndArgs ...interface{}) bool { @@ -60,10 +60,10 @@ func TestSleep(t *testing.T) { actual := time.Since(start) slop := 10 * time.Millisecond - switch runtime.GOOS { + switch runtime.GOOS { case "darwin": slop *= 15 // Perhaps just CircleCI being bad, not darwin in general? - case "windows": + case "windows" : slop *= 10 // Be forgiving of running in a VM } assertDurationEq(t, tcinfo.Expected, actual, slop) diff --git a/dutil/http_server.go b/dutil/http_server.go index df4c540..4d3b52c 100644 --- a/dutil/http_server.go +++ b/dutil/http_server.go @@ -9,7 +9,7 @@ import ( "github.com/pkg/errors" - "github.com/datawire/dlib/v2/dhttp" + "github.com/datawire/dlib/dhttp" ) func serverConfig(server *http.Server) (*dhttp.ServerConfig, error) { @@ -44,7 +44,7 @@ func serverConfig(server *http.Server) (*dhttp.ServerConfig, error) { // ListenAndServeHTTPWithContext is DEPRECATED; even with this function helping you out, there are // enough historical "gotchas" with http.Server, that you should consider using -// github.com/datawire/dlib/v2/dhttp instead. +// github.com/datawire/dlib/dhttp instead. // // ListenAndServeHTTPWithContext runs server.ListenAndServe() on an http.Server, but properly calls // server.Shutdown when the Context is canceled. @@ -66,7 +66,7 @@ func ListenAndServeHTTPWithContext(ctx context.Context, server *http.Server) err // ListenAndServeHTTPSWithContext is DEPRECATED; even with this function helping you out, there are // enough historical "gotchas" with http.Server, that you should consider using -// github.com/datawire/dlib/v2/dhttp instead. +// github.com/datawire/dlib/dhttp instead. // // ListenAndServeHTTPSWithContext runs server.ListenAndServeTLS() on an http.Server, but properly // calls server.Shutdown when the Context is canceled. @@ -88,7 +88,7 @@ func ListenAndServeHTTPSWithContext(ctx context.Context, server *http.Server, ce // ServeHTTPWithContext is DEPRECATED; even with this function helping you out, there are enough // historical "gotchas" with http.Server, that you should consider using -// github.com/datawire/dlib/v2/dhttp instead. +// github.com/datawire/dlib/dhttp instead. // // ServeHTTPWithContext(ln) runs server.Serve(ln) on an http.Server, but properly calls // server.Shutdown when the Context is canceled. @@ -110,7 +110,7 @@ func ServeHTTPWithContext(ctx context.Context, server *http.Server, ln net.Liste // ServeHTTPSWithContext is DEPRECATED; even with this function helping you out, there are enough // historical "gotchas" with http.Server, that you should consider using -// github.com/datawire/dlib/v2/dhttp instead. +// github.com/datawire/dlib/dhttp instead. // // ServeHTTPSWithContext runs server.ServeTLS() on an http.Server, but properly calls // server.Shutdown when the Context is canceled. diff --git a/dutil/http_server_test.go b/dutil/http_server_test.go index 26ab033..fb18ad5 100644 --- a/dutil/http_server_test.go +++ b/dutil/http_server_test.go @@ -9,9 +9,9 @@ import ( "github.com/stretchr/testify/assert" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/dlog" - "github.com/datawire/dlib/v2/dutil" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/dlog" + "github.com/datawire/dlib/dutil" ) // TestHTTPHardShutdown checks to make sure that the TCP connection gets forcefully closed when the diff --git a/dutil/panic.go b/dutil/panic.go index 76144fc..73e5124 100644 --- a/dutil/panic.go +++ b/dutil/panic.go @@ -1,7 +1,7 @@ package dutil import ( - "github.com/datawire/dlib/v2/derror" + "github.com/datawire/dlib/derror" ) // PanicToError is a legacy alias for derror.PanicToError. diff --git a/dutil/panic_test.go b/dutil/panic_test.go index e70597a..49e890f 100644 --- a/dutil/panic_test.go +++ b/dutil/panic_test.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" - "github.com/datawire/dlib/v2/dutil" + "github.com/datawire/dlib/dutil" ) var thispackage, thisfile = func() (string, string) { diff --git a/example_test.go b/example_test.go index 21e87bf..f2a4a7b 100644 --- a/example_test.go +++ b/example_test.go @@ -8,13 +8,13 @@ import ( "github.com/sirupsen/logrus" - "github.com/datawire/dlib/v2/dcontext" - "github.com/datawire/dlib/v2/derror" - "github.com/datawire/dlib/v2/dexec" - "github.com/datawire/dlib/v2/dgroup" - "github.com/datawire/dlib/v2/dhttp" - "github.com/datawire/dlib/v2/dlog" - "github.com/datawire/dlib/v2/dtime" + "github.com/datawire/dlib/dcontext" + "github.com/datawire/dlib/derror" + "github.com/datawire/dlib/dexec" + "github.com/datawire/dlib/dgroup" + "github.com/datawire/dlib/dhttp" + "github.com/datawire/dlib/dlog" + "github.com/datawire/dlib/dtime" ) // This is an example main() program entry-point that shows how all the pieces of dlib can fit diff --git a/go.mod b/go.mod index 260c706..7e66553 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/datawire/dlib/v2 +module github.com/datawire/dlib go 1.21 diff --git a/internal/sigint/sigint_unix.go b/internal/sigint/sigint_unix.go index 83c3a0b..b5b2ced 100644 --- a/internal/sigint/sigint_unix.go +++ b/internal/sigint/sigint_unix.go @@ -1,4 +1,3 @@ -//go:build !windows // +build !windows package sigint