Skip to content

Commit

Permalink
internal, log: remove code for old unsupported go-versions (ethereum#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Nov 15, 2024
1 parent 6141a12 commit 07982a9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 108 deletions.
2 changes: 0 additions & 2 deletions internal/debug/loudpanic.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +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/>.

// +build go1.6

package debug

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

This file was deleted.

2 changes: 0 additions & 2 deletions internal/debug/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +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/>.

//+build go1.5

package debug

import (
Expand Down
31 changes: 0 additions & 31 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)
}
26 changes: 0 additions & 26 deletions log/handler_go13.go

This file was deleted.

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

This file was deleted.

0 comments on commit 07982a9

Please sign in to comment.