Skip to content

Commit 43df612

Browse files
authored
internal, log: remove code for old unsupported go-versions (#28090)
1 parent 766272f commit 43df612

File tree

7 files changed

+19
-114
lines changed

7 files changed

+19
-114
lines changed

internal/debug/loudpanic.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
//go:build go1.6
18-
// +build go1.6
19-
2017
package debug
2118

2219
import "runtime/debug"

internal/debug/loudpanic_fallback.go

Lines changed: 0 additions & 25 deletions
This file was deleted.

internal/debug/trace.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
//go:build go1.5
18-
// +build go1.5
19-
2017
package debug
2118

2219
import (

internal/debug/trace_fallback.go

Lines changed: 0 additions & 32 deletions
This file was deleted.

log/handler.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"reflect"
99
"sync"
10+
"sync/atomic"
1011

1112
"github.com/go-stack/stack"
1213
)
@@ -354,3 +355,21 @@ func (m muster) FileHandler(path string, fmtr Format) Handler {
354355
func (m muster) NetHandler(network, addr string, fmtr Format) Handler {
355356
return must(NetHandler(network, addr, fmtr))
356357
}
358+
359+
// swapHandler wraps another handler that may be swapped out
360+
// dynamically at runtime in a thread-safe fashion.
361+
type swapHandler struct {
362+
handler atomic.Value
363+
}
364+
365+
func (h *swapHandler) Log(r *Record) error {
366+
return (*h.handler.Load().(*Handler)).Log(r)
367+
}
368+
369+
func (h *swapHandler) Swap(newHandler Handler) {
370+
h.handler.Store(&newHandler)
371+
}
372+
373+
func (h *swapHandler) Get() Handler {
374+
return *h.handler.Load().(*Handler)
375+
}

log/handler_go13.go

Lines changed: 0 additions & 27 deletions
This file was deleted.

log/handler_go14.go

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)