assume-no-moving-gc.go 805 B

12345678910111213141516171819202122
  1. // Copyright 2020 Brad Fitzpatrick. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package go4.org/unsafe/assume-no-moving-gc exists so you can depend
  5. // on it from unsafe code that wants to declare that it assumes that
  6. // the Go runtime does not using a moving garbage colllector.
  7. //
  8. // This package is then updated for new Go versions when that
  9. // is still the case and explodes at runtime with a failure
  10. // otherwise, unless an environment variable overrides it.
  11. //
  12. // To use:
  13. //
  14. // import _ "go4.org/unsafe/assume-no-moving-gc"
  15. //
  16. // There is no API.
  17. //
  18. // The GitHub repo is at https://github.com/go4org/unsafe-assume-no-moving-gc
  19. package assume_no_moving_gc
  20. const env = "ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH"