Skip to content

Commit

Permalink
internal, log: remove code for old unsupported go-versions (#28090)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored Sep 13, 2023
1 parent 766272f commit 43df612
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 114 deletions.
3 changes: 0 additions & 3 deletions internal/debug/loudpanic.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

//go:build go1.6
// +build go1.6

package debug

import "runtime/debug"
Expand Down
25 changes: 0 additions & 25 deletions internal/debug/loudpanic_fallback.go

This file was deleted.

3 changes: 0 additions & 3 deletions internal/debug/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

//go:build go1.5
// +build go1.5

package debug

import (
Expand Down
32 changes: 0 additions & 32 deletions internal/debug/trace_fallback.go

This file was deleted.

19 changes: 19 additions & 0 deletions log/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"reflect"
"sync"
"sync/atomic"

"github.com/go-stack/stack"
)
Expand Down Expand Up @@ -354,3 +355,21 @@ func (m muster) FileHandler(path string, fmtr Format) Handler {
func (m muster) NetHandler(network, addr string, fmtr Format) Handler {
return must(NetHandler(network, addr, fmtr))
}

// swapHandler wraps another handler that may be swapped out
// dynamically at runtime in a thread-safe fashion.
type swapHandler struct {
handler atomic.Value
}

func (h *swapHandler) Log(r *Record) error {
return (*h.handler.Load().(*Handler)).Log(r)
}

func (h *swapHandler) Swap(newHandler Handler) {
h.handler.Store(&newHandler)
}

func (h *swapHandler) Get() Handler {
return *h.handler.Load().(*Handler)
}
27 changes: 0 additions & 27 deletions log/handler_go13.go

This file was deleted.

24 changes: 0 additions & 24 deletions log/handler_go14.go

This file was deleted.

0 comments on commit 43df612

Please sign in to comment.