github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/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  }