genv_must.go 588 B

123456789101112131415161718192021
  1. // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package genv
  7. // MustSet performs as Set, but it panics if any error occurs.
  8. func MustSet(key, value string) {
  9. if err := Set(key, value); err != nil {
  10. panic(err)
  11. }
  12. }
  13. // MustRemove performs as Remove, but it panics if any error occurs.
  14. func MustRemove(key ...string) {
  15. if err := Remove(key...); err != nil {
  16. panic(err)
  17. }
  18. }