Source file test/fixedbugs/issue59709.dir/cmem.go

     1  // Copyright 2023 The Go Authors. 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  
     5  package cmem
     6  
     7  import (
     8  	"./aconfig"
     9  	"./bresource"
    10  )
    11  
    12  type MemT *int
    13  
    14  var G int
    15  
    16  type memResource struct {
    17  	x *int
    18  }
    19  
    20  func (m *memResource) initialize(*int) (res *int, err error) {
    21  	return nil, nil
    22  }
    23  
    24  func (m *memResource) teardown() {
    25  }
    26  
    27  func NewResource(cfg *aconfig.Config) *bresource.Resource[*int] {
    28  	res := &memResource{
    29  		x: &G,
    30  	}
    31  
    32  	return bresource.New("Mem", res.initialize, bresource.ResConfig{
    33  		// We always would want to retry the Memcache initialization.
    34  		ShouldRetry: func(error) bool { return true },
    35  		TearDown:    res.teardown,
    36  	})
    37  }
    38  

View as plain text