mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-29 13:49:10 +08:00
12 lines
16 KiB
Go
12 lines
16 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
package testutils ;import (_af "crypto/md5";_ad "encoding/hex";_d "encoding/json";_bef "errors";_gec "fmt";_dg "github.com/stretchr/testify/require";_dgb "golang.org/x/image/font";_bbg "golang.org/x/image/font/opentype";_dd "golang.org/x/image/math/fixed";_ge "image";_dc "image/color";_gb "image/draw";_be "image/png";_da "io";_b "io/ioutil";_gg "math";_e "os";_a "os/exec";_aff "path/filepath";_g "strings";_bb "sync";_f "testing";_cb "time";);func (_fg *ReferenceFile )updateMap (_agd *ReferenceMap )int {var _fb int ;if _fg .Map ._ed ==nil {_fg .Map ._ed =map[string ]ReferenceEntry {};};for _db ,_afg :=range _agd ._ed {_adc ,_bbd :=_fg .Map ._ed [_db ];if !_bbd {_fg .Map ._ed [_db ]=_afg ;_fb ++;continue ;};if string (_adc .Value )!=string (_afg .Value ){_fg .Map ._ed [_db ]=_afg ;_fb ++;};};for _ae :=range _fg .Map ._ed {if _ ,_fe :=_agd ._ed [_ae ];!_fe {delete (_fg .Map ._ed ,_ae );_fb ++;};};return _fb ;};func RunRenderTest (t *_f .T ,pdfPath ,outputDir ,baselineRenderPath string ,saveBaseline bool ,currentHashMap *ReferenceMap ,refFile *ReferenceFile ){_bcg :=_g .TrimSuffix (_aff .Base (pdfPath ),_aff .Ext (pdfPath ));t .Run ("\u0072\u0065\u006e\u0064\u0065\u0072",func (_edab *_f .T ){_fdgg :=_aff .Join (outputDir ,_bcg );_ada :=_fdgg +"\u002d%\u0064\u002e\u0070\u006e\u0067";if _dceb :=RenderPDFToPNGs (pdfPath ,0,_ada );_dceb !=nil {_edab .Skip (_dceb );};_fge :=_bcg +"\u002em\u0073\u0077\u006f\u0072\u0064";_bccd :=_aff .Join (outputDir ,_fge );_agb :=_bccd +"\u002d%\u0064\u002e\u0070\u006e\u0067";_aec :=false ;if saveBaseline {_eea :=_aff .Dir (pdfPath );_ggg :=_aff .Join (_eea ,_fge +"\u002e\u0070\u0064\u0066");if _ ,_bce :=_e .Stat (_ggg );_bce ==nil {_edab .Logf ("\u0052\u0065\u006e\u0064er\u0020\u004d\u0053\u0020\u0057\u006f\u0072\u0064\u0020\u0050\u0044\u0046\u003a\u0020%\u0076",_ggg );if _dgbd :=RenderPDFToPNGs (_ggg ,0,_agb );_dgbd !=nil {_edab .Skip (_dgbd );};_aec =true ;};};for _fgb :=1;true ;_fgb ++{_cgd :=_gec .Sprintf ("\u0025s\u002d\u0025\u0064\u002e\u0070\u006eg",_fdgg ,_fgb );_bde :=_aff .Join (baselineRenderPath ,_gec .Sprintf ("\u0025\u0073\u002d\u0025\u0064\u005f\u0065\u0078\u0070\u002e\u0070\u006e\u0067",_bcg ,_fgb ));if _ ,_afa :=_e .Stat (_cgd );_afa !=nil {break ;};_edab .Logf ("\u0025\u0073",_bde );if saveBaseline {_edab .Logf ("\u0043\u006fp\u0079\u0069\u006eg\u0020\u0025\u0073\u0020\u002d\u003e\u0020\u0025\u0073",_cgd ,_bde );_aac :=CopyFile (_cgd ,_bde );if _aac !=nil {_edab .Fatalf ("\u0045\u0052\u0052OR\u0020\u0063\u006f\u0070\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0025\u0073\u003a\u0020\u0025\u0076",_bde ,_aac );};if _aec {_bbb :=_gec .Sprintf ("\u0025s\u002d\u0025\u0064\u002e\u0070\u006eg",_bccd ,_fgb );_gac :=_aff .Join (baselineRenderPath ,_gec .Sprintf ("\u0025\u0073\u002d\u0025\u0064\u005f\u0065\u0078\u0070\u002e\u0070\u006e\u0067",_fge ,_fgb ));_edab .Logf ("\u0043\u006f\u0070\u0079\u0069\u006e\u0067\u0020\u004d\u0053\u0020\u0057\u006f\u0072\u0064 \u0072e\u0073\u0075\u006c\u0074\u0073\u0020\u0025\u0073\u0020\u002d\u003e\u0020\u0025\u0073",_bbb ,_gac );_dge :=CopyFile (_bbb ,_gac );if _dge !=nil {_edab .Fatalf ("\u0045\u0052\u0052OR\u0020\u0063\u006f\u0070\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0025\u0073\u003a\u0020\u0025\u0076",_gac ,_dge );};_edab .Logf ("\u0043\u006f\u006d\u0062\u0069\u006e\u0069\u006e\u0067\u0020\u0055\u006e\u0069\u004f\u0066\u0066\u0069\u0063e\u0020\u0072\u0065\u0073\u0075\u006c\u0074s\u0020\u0077\u0069\u0074\u0068\u0020\u004d\u0053\u0020\u0057\u006fr\u0064\u0020\u0025\u0073\u0020\u0061\u006e\u0064\u0020\u0025\u0073",_bde ,_gac );_bg ,_dge :=CombinePNGFiles (_bde ,_gac );if _e .IsNotExist (_dge ){_edab .Fatal ("\u0069m\u0061g\u0065\u0020\u0066\u0069\u006ce\u0020\u006di\u0073\u0073\u0069\u006e\u0067");}else if !_bg {_edab .Fatal ("\u0055n\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0063\u006f\u006db\u0069\u006e\u0065\u0020\u0069\u006d\u0061\u0067\u0065\u0073");};_edab .Logf ("Cr\u0065\u0061t\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065 \u0064\u0069\u0066\u0066\u0020\u0055\u006e\u0069\u004f\u0066\u0066\u0069\u0063\u0065\u0020\u0072\u0065\u0073\u0075\u006c\u0074\u0073\u0020\u0077\u0069\u0074\u0068\u0020M\u0053 \u0057\u006f\u0072\u0064\u0020\u0025\u0073\u0020a\u006ed\u0020\u0025s",_bde ,_gac );_bg ,_age ,_abc ,_dcb ,_dge :=CreatePNGDiff (_bde ,_gac );if _dge !=nil &&_dge !=ErrImageSizeNotMatch {_edab .Fatalf ("\u0045\u0072\u0072\u006fr\u0020\u006f\u006e\u0020\u0063\u0072\u0065\u0061\u0074\u0065 \u0050N\u0047\u0020\u0044\u0069\u0066\u0066\u003a \u0025\u0076",_dge );};if _bg {_edab .Logf ("\u0049\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073\u000a",_age );_edab .Logf ("D\u0069\u0066\u0066\u0020Pe\u0072c\u0065\u006e\u0074\u003a\u0020%\u0032\u002e\u0066\u0025\u0025\u000a",_abc );_edab .Logf ("\u0044i\u0066f\u0020\u0054\u006f\u0074\u0061\u006c\u003a\u0020\u0025\u0066\u000a",_dcb );_ffa :=_aff .Base (_age );if _cbd ,_gbfb :=currentHashMap .Read (_ffa );_gbfb {if _cbd .DiffPercent < _abc ||_cbd .DiffTotal < _dcb {_edab .Fatalf ("\u004e\u0065\u0077\u0020\u0072\u0065\u0073\u0075\u006c\u0074\u0073\u0020\u0068\u0061\u0076\u0069\u006e\u0067 h\u0069g\u0068\u0065\u0072\u0020\u0064\u0069\u0066\u0066\u0065\u0072\u0065\u006ec\u0065\u0020\u0070\u0065\u0072\u0063\u0065\u006e\u0074\u003a\u0020\u0025\u0066\u0020\u0061\u006e\u0064 \u0074\u006f\u0074\u0061\u006c\u0020\u0025\u0066\u000a",_abc ,_dcb );};};_cbg ,_aeee :=HashFile (_age );_dg .NoError (_edab ,_aeee );_ade :=ReferenceEntry {Timestamp :_cb .Now ().UTC ().Unix (),Value :_cbg ,ResultSize :_feg (_edab ,_age ),DiffPercent :_abc ,DiffTotal :_dcb };currentHashMap .Write (_ffa ,_ade );if _aeee =refFile .Update (currentHashMap );_aeee !=nil {_edab .Logf ("\u0055\u0070\u0064\u0061\u0074\u0065\u0020\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063e\u0020f\u0069\u006c\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0076",_aeee );};};};continue ;};_edab .Run (_gec .Sprintf ("\u0070\u0061\u0067\u0065\u0025\u0064",_fgb ),func (_fdad *_f .T ){_fdad .Logf ("\u0043o\u006dp\u0061\u0072\u0069\u006e\u0067 \u0025\u0073 \u0076\u0073\u0020\u0025\u0073",_cgd ,_bde );_efc ,_bed :=ComparePNGFiles (_cgd ,_bde );if _e .IsNotExist (_bed ){_fdad .Fatal ("\u0069m\u0061g\u0065\u0020\u0066\u0069\u006ce\u0020\u006di\u0073\u0073\u0069\u006e\u0067");}else if !_efc {_fdad .Fatal ("\u0077\u0072\u006f\u006eg \u0070\u0061\u0067\u0065\u0020\u0072\u0065\u006e\u0064\u0065\u0072\u0065\u0064");};});};});};func (_ab *ReferenceMap )Write (key string ,entry ReferenceEntry ){_ab .Lock ();defer _ab .Unlock ();if _ab ._ed ==nil {_ab ._ed =map[string ]ReferenceEntry {};};_ab ._ed [key ]=entry ;};func RenderPDFToPNGs (pdfPath string ,dpi int ,outpathTpl string )error {if dpi <=0{dpi =100;};if _ ,_cbf :=_a .LookPath ("\u0067\u0073");_cbf !=nil {return ErrRenderNotSupported ;};return _a .Command ("\u0067\u0073","\u002d\u0073\u0044\u0045\u0056\u0049\u0043\u0045\u003d\u0070\u006e\u0067a\u006c\u0070\u0068\u0061","\u002d\u006f",outpathTpl ,_gec .Sprintf ("\u002d\u0072\u0025\u0064",dpi ),pdfPath ).Run ();};func ComparePNGFiles (file1 ,file2 string )(bool ,error ){_daff ,_edc :=HashFile (file1 );if _edc !=nil {return false ,_edc ;};_fgg ,_edc :=HashFile (file2 );if _edc !=nil {return false ,_edc ;};if _daff ==_fgg {return true ,nil ;};_aaf ,_edc :=ReadPNG (file1 );if _edc !=nil {return false ,_edc ;};_dbb ,_edc :=ReadPNG (file2 );if _edc !=nil {return false ,_edc ;};if _aaf .Bounds ()!=_dbb .Bounds (){return false ,nil ;};return CompareImages (_aaf ,_dbb );};func HashFile (file string )(string ,error ){_de ,_aed :=_e .Open (file );if _aed !=nil {return "",_aed ;};defer _de .Close ();_ece :=_af .New ();if _ ,_aed =_da .Copy (_ece ,_de );_aed !=nil {return "",_aed ;};return _ad .EncodeToString (_ece .Sum (nil )),nil ;};func _feg (_fc *_f .T ,_gcf string )int64 {_aea ,_gafc :=_e .Stat (_gcf );_dg .NoError (_fc ,_gafc );return _aea .Size ();};func _fgd (_aee ,_cd _ge .Rectangle )bool {return _aee .Min .X ==_cd .Min .X &&_aee .Min .Y ==_cd .Min .Y &&_aee .Max .X ==_cd .Max .X &&_aee .Max .Y ==_cd .Max .Y ;};func CombinePNGFiles (file1 ,file2 string )(bool ,error ){_bbca ,_daec :=ReadPNG (file1 );if _daec !=nil {return false ,_daec ;};_afd ,_daec :=ReadPNG (file2 );if _daec !=nil {return false ,_daec ;};_aad :=_ge .Point {_bbca .Bounds ().Dx (),0};_adb :=_ge .Rectangle {_aad ,_aad .Add (_afd .Bounds ().Size ())};_dbea :=_ge .Rectangle {_ge .Point {0,0},_adb .Max };_gecd :=_ge .NewRGBA (_dbea );_gb .Draw (_gecd ,_bbca .Bounds (),_bbca ,_ge .Point {0,0},_gb .Src );_gb .Draw (_gecd ,_adb ,_afd ,_ge .Point {0,0},_gb .Src );_df :=_aff .Dir (file1 );_dbbf :=_g .TrimSuffix (_aff .Base (file1 ),_aff .Ext (file1 ));_fdg ,_daec :=_e .Create (_df +"\u002f"+_dbbf +"\u002d\u0063\u006f\u006d\u0062\u0069\u006e\u0065\u0064\u002e\u0070\u006e\u0067");if _daec !=nil {return false ,_daec ;};defer _fdg .Close ();if _cbb :=_be .Encode (_fdg ,_gecd );_cbb !=nil {return false ,_cbb ;};return true ,nil ;};func (_gc *ReferenceFile )Update (currentMap *ReferenceMap )error {if _gc ._fd ==""{return nil ;};_ac :=_gc .updateMap (currentMap );if _ac ==0{return nil ;};_ag ,_acg :=_e .OpenFile (_gc ._fd ,_e .O_CREATE |_e .O_TRUNC |_e .O_WRONLY ,0664);if _acg !=nil {return _acg ;};defer _ag .Close ();_gc .Timestamp =_cb .Now ().UTC ();_ef :=_d .NewEncoder (_ag );_ef .SetIndent ("","\u0009");return _ef .Encode (_gc );};func _agf (_eb ,_eeb _dc .Color )bool {_fee ,_cec ,_deed ,_gfe :=_eb .RGBA ();_geaf ,_fea ,_cgb ,_gagg :=_eeb .RGBA ();return _fee ==_geaf &&_cec ==_fea &&_deed ==_cgb &&_gfe ==_gagg ;};var (ErrRenderNotSupported =_bef .New ("\u0072\u0065\u006e\u0064\u0065r\u0069\u006e\u0067\u0020\u0050\u0044\u0046\u0020\u0066\u0069\u006c\u0065\u0073 \u0069\u0073\u0020\u006e\u006f\u0074\u0020\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u006f\u006e\u0020\u0074\u0068\u0069\u0073\u0020\u0073\u0079\u0073\u0074\u0065m");ErrImageSizeNotMatch =_bef .New ("\u0069\u006d\u0061ge\u0020\u0073\u0069\u007a\u0065\u0073\u0020\u0064\u006f\u006e\u0027\u0074\u0020\u006d\u0061\u0074\u0063\u0068"););func (_bee *ReferenceMap )Len ()int {return len (_bee ._ed )};func CompareImages (img1 ,img2 _ge .Image )(bool ,error ){_fgf :=img1 .Bounds ();_ddb :=0;for _gaf :=0;_gaf < _fgf .Size ().X ;_gaf ++{for _eca :=0;_eca < _fgf .Size ().Y ;_eca ++{_dbc ,_bd ,_bab ,_ :=img1 .At (_gaf ,_eca ).RGBA ();_bbc ,_bdg ,_dae ,_ :=img2 .At (_gaf ,_eca ).RGBA ();if _dbc !=_bbc ||_bd !=_bdg ||_bab !=_dae {_ddb ++;};};};_bc :=float64 (_ddb )/float64 (_fgf .Dx ()*_fgf .Dy ());if _bc > 0.0001{_gec .Printf ("\u0064\u0069\u0066f \u0066\u0072\u0061\u0063\u0074\u0069\u006f\u006e\u003a\u0020\u0025\u0076\u0020\u0028\u0025\u0064\u0029\u000a",_bc ,_ddb );return false ,nil ;};return true ,nil ;};func CopyFile (src ,dst string )error {_dbe ,_fed :=_e .Open (src );if _fed !=nil {return _fed ;};defer _dbe .Close ();_cf ,_fed :=_e .Create (dst );if _fed !=nil {return _fed ;};defer _cf .Close ();_ ,_fed =_da .Copy (_cf ,_dbe );return _fed ;};func _aadc (_dafc *_ge .RGBA ,_ggd string ,_gbe string ,_bccb ,_dgbab int )error {_fda ,_dfa :=_b .ReadFile (_ggd );if _dfa !=nil {return _dfa ;};_dbf ,_dfa :=_bbg .Parse (_fda );if _dfa !=nil {return _dfa ;};_fggb ,_dfa :=_bbg .NewFace (_dbf ,&_bbg .FaceOptions {Size :18,DPI :72,Hinting :_dgb .HintingNone });if _dfa !=nil {return _dfa ;};_dad :=&_dgb .Drawer {Dst :_dafc ,Src :_ge .NewUniform (_dc .RGBA {200,100,0,255}),Face :_fggb ,Dot :_dd .P (_bccb ,_dgbab )};_dad .DrawString (_gbe );return nil ;};type ReferenceFile struct{Timestamp _cb .Time `json:"timestamp"`;Map *ReferenceMap `json:"map,omitempty"`;_fd string ;};func CreatePNGDiff (src ,dst string )(bool ,string ,float64 ,float64 ,error ){_aaa ,_gf :=ReadPNG (src );if _gf !=nil {return false ,"",0,0,_gf ;};_bcc ,_gf :=ReadPNG (dst );if _gf !=nil {return false ,"",0,0,_gf ;};_fedg :=_aaa .Bounds ();_edb :=_bcc .Bounds ();if !_fgd (_fedg ,_edb ){return false ,"",0,0,ErrImageSizeNotMatch ;};_acga :=_ge .NewRGBA (_ge .Rect (0,0,_fedg .Max .X ,_fedg .Max .Y ));var (_dcee float64 ;_ff float64 ;);for _gag :=_fedg .Min .Y ;_gag < _fedg .Max .Y ;_gag ++{for _ce :=_fedg .Min .X ;_ce < _fedg .Max .X ;_ce ++{_fga ,_fbb ,_dcc ,_aaaa :=_bcc .At (_ce ,_gag ).RGBA ();_acga .Set (_ce ,_gag ,_dc .RGBA {uint8 (_fga ),uint8 (_fbb ),uint8 (_dcc ),64});_bae ,_efd ,_cca ,_gbf :=_aaa .At (_ce ,_gag ).RGBA ();if !_agf (_aaa .At (_ce ,_gag ),_bcc .At (_ce ,_gag )){_acga .Set (_ce ,_gag ,_dc .RGBA {uint8 (_bae ),uint8 (_efd ),uint8 (_cca ),uint8 (_gbf )});_cfd :=float64 (_bae )+float64 (_efd )+float64 (_cca )+float64 (_gbf )-float64 (_fga )+float64 (_fbb )+float64 (_dcc )+float64 (_aaaa );_gef :=_gg .Sqrt (_gg .Pow (_cfd /float64 (_fedg .Dx ()*_fedg .Dy ()),2));_ff +=_gef ;_dcee ++;};};};_gbb :=_dcee /float64 (_fedg .Dx ()*_fedg .Dy ())*100;_dee :=_aff .Dir (src );_eda :=_g .TrimSuffix (_aff .Base (src ),_aff .Ext (src ));_ggb ,_gf :=_e .Create (_dee +"\u002f"+_eda +"\u002dd\u0069\u0066\u0066\u002e\u0070\u006eg");if _gf !=nil {return false ,"",0,0,_gf ;};defer _ggb .Close ();_bbe :=_g .Replace (_dee ,"\u0072\u0065\u006e\u0064\u0065\u0072","\u0066\u006f\u006et\u0073",1)+"\u002f\u0043\u0061l\u0069\u0062\u0072\u0069\u002e\u0074\u0074\u0066";_daed :=_gec .Sprintf ("\u0044\u0069f\u0066\u0065\u0072e\u006e\u0063\u0065\u003a\u0020\u0025\u0066\u0025\u0025",_gbb );_gf =_aadc (_acga ,_bbe ,_daed ,15,22);if _gf !=nil {return false ,"",0,0,_gf ;};_daed =_gec .Sprintf ("T\u006ft\u0061\u006c\u0020\u0044\u0069\u0066\u0066\u0065r\u0065\u006e\u0063\u0065: \u0025\u0066",_ff );_gf =_aadc (_acga ,_bbe ,_daed ,15,44);if _gf !=nil {return false ,"",0,0,_gf ;};if _dbee :=_be .Encode (_ggb ,_acga );_dbee !=nil {return false ,"",0,0,_dbee ;};return true ,_ggb .Name (),_gbb ,_ff ,nil ;};func (_afb *ReferenceMap )MarshalJSON ()([]byte ,error ){return _d .Marshal (_afb ._ed )};type ReferenceMap struct{_bb .Mutex ;_ed map[string ]ReferenceEntry ;};func (_ec *ReferenceMap )Keys ()(_feb []string ){_feb =make ([]string ,len (_ec ._ed ));var _ca int ;for _agdf :=range _ec ._ed {_feb [_ca ]=_agdf ;_ca ++;};return _feb ;};func (_ea *ReferenceMap )UnmarshalJSON (data []byte )error {return _d .Unmarshal (data ,&_ea ._ed )};type ReferenceEntry struct{Timestamp int64 `json:"timestamp"`;Value string `json:"value"`;ResultSize int64 `json:"resultSize,omitempty"`;DiffPercent float64 `json:"diffPercent,omitempty"`;DiffTotal float64 `json:"diffValue,omitempty"`;Invalid bool `json:"markedInvalid,omitempty"`;};func ReadPNG (file string )(_ge .Image ,error ){_gba ,_gcg :=_e .Open (file );if _gcg !=nil {return nil ,_gcg ;};defer _gba .Close ();return _be .Decode (_gba );};func ReadFile (dirPath ,testName string ,createEmpty bool )(*ReferenceFile ,error ){if dirPath ==""&&createEmpty {return &ReferenceFile {Map :&ReferenceMap {}},nil ;};if dirPath ==""{return nil ,_e .ErrNotExist ;};_ee :=_aff .Join (dirPath ,testName +"\u005fr\u0065f\u0065\u0072\u0065\u006e\u0063\u0065\u002e\u006a\u0073\u006f\u006e");_bf :=&ReferenceFile {_fd :_ee };_cc ,_fef :=_e .Open (_ee );if _bef .Is (_fef ,_e .ErrNotExist )&&createEmpty {_bf .Timestamp =_cb .Now ().UTC ();_bf .Map =&ReferenceMap {};return _bf ,nil ;};if _fef !=nil {return nil ,_fef ;};defer _cc .Close ();if _gbg :=_d .NewDecoder (_cc ).Decode (_bf );_gbg !=nil {if _gbg .Error ()=="i\u006c\u006c\u0065\u0067\u0061\u006c \u0062\u0061\u0073\u0065\u0036\u0034 \u0064\u0061\u0074\u0061\u0020\u0061\u0074 \u0069\u006e\u0070\u0075\u0074\u0020\u0062\u0079\u0074\u0065 \u0030"&&createEmpty {return _bf ,nil ;};return nil ,_gbg ;};return _bf ,nil ;};func (_ba *ReferenceMap )Copy ()*ReferenceMap {_gea :=ReferenceMap {_ed :make (map[string ]ReferenceEntry ,len (_ba ._ed ))};for _dce ,_gd :=range _ba ._ed {_gea ._ed [_dce ]=_gd ;};return &_gea ;};func (_fa *ReferenceMap )Read (key string )(ReferenceEntry ,bool ){_fa .Lock ();defer _fa .Unlock ();if _fa ._ed ==nil {return ReferenceEntry {},false ;};_dgba ,_cg :=_fa ._ed [key ];return _dgba ,_cg ;}; |