github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/internal/invariants/finalizer_on.go (about)

     1  // Copyright 2021 The LevelDB-Go and Pebble Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  //go:build (invariants && !race) || (tracing && !race)
     6  // +build invariants,!race tracing,!race
     7  
     8  package invariants
     9  
    10  import "runtime"
    11  
    12  // SetFinalizer is a wrapper around runtime.SetFinalizer that is a no-op under
    13  // race builds or if neither the invariants or tracing build tags are
    14  // specified.
    15  func SetFinalizer(obj, finalizer interface{}) {
    16  	runtime.SetFinalizer(obj, finalizer)
    17  }