text
stringlengths
11
6.3k
embedding
listlengths
768
768
func EchoRestTracerMiddleware(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { req := c.Request() tracer := opentracing.GlobalTracer() operationName := fmt.Sprintf("%s %s%s", req.Method, req.Host, req.URL.Path) var span opentracing.Span var ctx context.Context if spanCtx, err ...
[ -0.2923889458179474, 0.05021696165204048, 1.197669506072998, 0.14989995956420898, -0.4528927206993103, 0.32200127840042114, 0.17178745567798615, -0.7618323564529419, 0.9455371499061584, -0.3420194685459137, -0.25161051750183105, 0.31808245182037354, -0.6362199783325195, 0.5871202349662781,...
func NewReconnectingSFTPClient(dialer func() (CloseableSFTPClient, error)) (*ReconnectingSFTPClient, error) { c := &ReconnectingSFTPClient{ dialer: dialer, } // Check that the dialer works. _, err := c.getClient() if err != nil { return nil, err } return c, nil }
[ -0.5204297304153442, 0.0600726492702961, -0.02343161776661873, 0.4933907687664032, -1.0354645252227783, -1.0940883159637451, -0.04238322749733925, -0.14106540381908417, -0.5772174000740051, -0.6501396298408508, -0.5512116551399231, 0.6828908920288086, -0.02536872774362564, -0.1774287074804...
func (c *ReconnectingSFTPClient) getClient() (SFTPClient, error) { c.mu.Lock() defer c.mu.Unlock() if c.client == nil && c.clientErr != ErrClientClosed { c.client, c.clientErr = c.dialer() } return c.client, c.clientErr }
[ 0.3371800482273102, -0.41946786642074585, 0.6828016042709351, -0.07906560599803925, -0.530651867389679, -0.464213103055954, 0.06002238765358925, -0.2657729685306549, 0.33499133586883545, -1.1355375051498413, 0.14682096242904663, 0.7217022180557251, -0.6270467638969421, -0.28181567788124084...
func (c *ReconnectingSFTPClient) do(fun func(SFTPClient) error) error { client, err := c.getClient() if err != nil { return err } err = fun(client) if err == nil { return nil } // We already have an error, so we don't report if handleErr // returns an error. c.handleError(client, err) return err }
[ 0.6438311338424683, 0.33611059188842773, 0.7595669627189636, -0.36620283126831055, 0.2954014241695404, -0.13170194625854492, -0.3784997761249542, -0.7272471189498901, -0.6519697904586792, 0.08934541791677475, -0.09229541569948196, 1.0013954639434814, -0.04371156543493271, -0.29753452539443...
func (c *ReconnectingSFTPClient) Close() error { c.mu.Lock() defer c.mu.Unlock() c.clientErr = ErrClientClosed if c.client != nil { cc := c.client c.client = nil return cc.Close() } return nil }
[ 0.4396936595439911, 0.18056470155715942, 0.5830041170120239, -0.18131153285503387, -0.5456739664077759, -0.38197579979896545, 0.03179577738046646, -0.6135702729225159, -0.47958382964134216, -1.101121425628662, 0.022832967340946198, 0.3537345230579376, -0.9541483521461487, 0.181438475847244...
func TestMain(t *testing.M) { res := t.Run() mock.DropTables(db) os.Exit(res) }
[ -0.6818144917488098, 0.9502646327018738, 0.595353364944458, 0.5794779062271118, 0.28384169936180115, 1.3918430805206299, 1.0056854486465454, 0.46760571002960205, -0.38558709621429443, 0.4268217384815216, -0.5583944320678711, -0.4385128319263458, -1.072778582572937, 0.22856289148330688, -...
func (d *Dispatcher) Initialize(ctx context.Context, ep *endpoint.Endpoint) error { d.validators = ep.SenderValidators var unicast, multicast ax.MessageTypeSet for mt := range d.Routes { if mt.IsCommand() { unicast = unicast.Add(mt) } else if mt.IsEvent() { multicast = multicast.Add(mt) } else { uni...
[ -0.666886568069458, 0.7337788343429565, 0.8068212866783142, 0.49395468831062317, 0.7574324011802673, -0.5661481022834778, -0.6702353358268738, 0.5240874886512756, 0.3571162819862366, 0.28924164175987244, -0.154447540640831, -0.0938345193862915, -0.17170831561088562, 0.6366038918495178, 0...
func (d *Dispatcher) Accept(ctx context.Context, s endpoint.MessageSink, env endpoint.InboundEnvelope) error { sender := endpoint.SinkSender{ Sink: s, Validators: d.validators, } mctx := ax.NewMessageContext( env.Envelope, opentracing.SpanFromContext(ctx), observability.NewDomainLogger( d.Logger,...
[ -0.4233686625957489, -0.0037594770547002554, 0.751262366771698, -0.12136045843362808, 0.2966364026069641, 0.1607556939125061, 0.9738030433654785, -0.09427322447299957, -0.6536940336227417, -0.03522969409823418, 0.2254735678434372, 0.2731121778488159, 0.44261857867240906, 1.4487437009811401...
func (r *MongoDBRepository) Upsert(ctx context.Context, rating *types.Rating) (bool, error) { s := r.sessions.Clone() idUpdate := uuid.New().String() isNew := false defer s.Close() selector := bson.M{ "target_type": rating.TargetType, "target_id": rating.TargetID, "created_by_id": rating.CreatedByID, ...
[ -1.4746934175491333, 0.3652797341346741, 0.9932548403739929, -0.6316630244255066, 0.3052447438240051, 0.5791943669319153, -0.39672020077705383, -0.18539565801620483, -0.6454290151596069, 1.0971819162368774, -0.5878751873970032, -0.47721970081329346, -1.22440767288208, 0.0821446031332016, ...
func (stat *Statistics) ReadAlfred(data alfred.Data) error { stat.Data = &StatisticsData{} stat.Source = alfred.HardwareAddr(data.Source) return readJSON(data, STATISTICS_PACKETTYPE, STATISTICS_PACKETVERSION, &stat.Data) }
[ 0.7790345549583435, -0.01004684716463089, 0.31396329402923584, -1.634176254272461, -0.6877075433731079, -0.121820367872715, -0.21724702417850494, -1.073069453239441, 0.684131920337677, -0.1748887300491333, 0.23176661133766174, 1.3014533519744873, 0.9117023944854736, 0.8784995079040527, 0...
func (_m *ITaskActions) Cancel() error { ret := _m.Called() var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() } else { r0 = ret.Error(0) } return r0 }
[ 0.26734688878059387, -0.09114774316549301, 0.4531148374080658, 1.194151520729065, -0.2651767134666443, -0.0906638503074646, 1.3788106441497803, 1.28705894947052, -0.34976011514663696, 0.3775547444820404, -0.34148481488227844, -0.12565666437149048, 0.3737754225730896, 0.18551403284072876, ...
func (_m *ITaskActions) Complete(_a0 io.Reader) error { ret := _m.Called(_a0) var r0 error if rf, ok := ret.Get(0).(func(io.Reader) error); ok { r0 = rf(_a0) } else { r0 = ret.Error(0) } return r0 }
[ 0.05886106938123703, -0.6743037700653076, 0.31938430666923523, -0.4762973487377167, -0.3123086392879486, -0.8629739284515381, 1.3635753393173218, 0.5966260433197021, -0.22072523832321167, 1.0644108057022095, 0.16969235241413116, -0.2127976417541504, 0.6111568212509155, 0.6756007671356201, ...
func (_m *ITaskActions) Fail() error { ret := _m.Called() var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() } else { r0 = ret.Error(0) } return r0 }
[ -0.7930375337600708, 0.2828751802444458, 0.37016060948371887, 0.8989259600639343, 0.37484413385391235, -0.3281800448894501, 1.0812045335769653, 0.09932032227516174, -0.527135968208313, 0.10979148745536804, -0.25820255279541016, -0.03550137206912041, -0.19226984679698944, 0.6604101061820984...
func (_m *ITaskActions) Run(_a0 dispatcher.AttackFunc) error { ret := _m.Called(_a0) var r0 error if rf, ok := ret.Get(0).(func(dispatcher.AttackFunc) error); ok { r0 = rf(_a0) } else { r0 = ret.Error(0) } return r0 }
[ -0.29635748267173767, -0.4431508481502533, 0.3048785924911499, -0.1626499891281128, 0.03601313754916191, -0.6915673017501831, 1.6333078145980835, 0.7756749987602234, -0.010142051614820957, 0.17956091463565826, -0.33115074038505554, -0.015782728791236877, 0.46515053510665894, 0.365179002285...
func (_m *ITaskActions) SendUpdate() { _m.Called() }
[ -0.6326994299888611, -0.41407907009124756, 0.3278005123138428, 1.4053575992584229, -0.2722659111022949, 0.5556923151016235, 1.0197019577026367, 0.15539094805717468, 0.15901388227939606, 1.088072419166565, -0.47955626249313354, -0.07859047502279282, 0.20895008742809296, -0.2776067852973938,...
func Base(handler Handler) Handler { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization") w.Header().Set("Content-Type", "application...
[ 0.2717408835887909, -1.0650216341018677, 0.7900697588920593, 0.39788925647735596, -0.9795681238174438, 0.0925683006644249, -0.35512545704841614, -0.29368841648101807, -0.9639736413955688, 0.06291785836219788, -0.23843619227409363, -0.09840041399002075, 0.905387282371521, 0.4993910491466522...
func Post(handler Handler) Handler { return func(w http.ResponseWriter, r *http.Request) { // Only POST requests are authorized if r.Method != "POST" { http.NotFound(w, r) return } handler(w, r) } }
[ 0.0905132070183754, 0.1898413598537445, 0.31237509846687317, 1.3778325319290161, -0.8958419561386108, 0.8495140075683594, -0.306148499250412, -0.245379239320755, -0.2600558400154114, -0.70634925365448, 0.264619916677475, -0.4104659855365753, -0.026437651365995407, 0.9940568804740906, 0.3...
func IndexHandler(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" || r.Method != "GET" { log.Println(r.Method, r.URL, http.StatusNotFound) http.NotFound(w, r) return } log.Println(r.Method, r.URL, http.StatusOK) fmt.Fprintln(w, JsonResponse{"status": "OK"}) }
[ -0.8260893225669861, -0.991212785243988, 0.6035075783729553, 0.2610511779785156, -0.5205305218696594, 0.6060300469398499, 0.9037209153175354, 0.2521858215332031, 0.4849015474319458, 0.051096681505441666, 0.4286549389362335, 0.524479866027832, -0.4378855228424072, 0.03693736717104912, -0....
func DisplayHandler(w http.ResponseWriter, r *http.Request) { if r.URL.Path != DisplayEndpoint { log.Println(r.Method, r.URL, http.StatusNotFound) http.NotFound(w, r) return } log.Println(r.Method, r.URL, http.StatusOK) RenderMapTemplate(w) }
[ 0.23043085634708405, -1.3276406526565552, 0.6984266042709351, 0.27833685278892517, -0.716620683670044, 0.8941001296043396, 0.3026597499847412, 0.1201600506901741, 0.6252375841140747, -0.18109017610549927, 1.3165247440338135, -0.5312712788581848, -0.3679458498954773, 0.6448304653167725, 0...
func TokenHandler(w http.ResponseWriter, r *http.Request) { log.Println(r.Method, r.URL, http.StatusOK) fmt.Fprintln(w, Token_) }
[ -0.26808834075927734, -0.7908501029014587, 0.43968015909194946, -0.9899730682373047, -0.3155488073825836, 0.2335081398487091, 0.3724181354045868, 0.9152919054031372, -0.20072120428085327, -0.6270787119865417, -0.3637499213218689, 0.16020187735557556, 0.4014177918434143, -0.3265003263950348...
func OffersHandler(w http.ResponseWriter, r *http.Request) { if r.FormValue("token") != Token_.Key { w.WriteHeader(http.StatusUnauthorized) fmt.Fprintln(w, JsonResponse{"status": "unauthorized"}) return } if strings.HasSuffix(r.URL.Path, "display") { log.Println(r.Method, r.URL, http.StatusMovedPermanently)...
[ -0.582145094871521, -0.059307221323251724, 0.855563223361969, 0.040477920323610306, -0.9751862287521362, 0.8955639600753784, 0.5273492336273193, -0.28166115283966064, 0.08911027014255524, 0.45019301772117615, 0.8371450304985046, 0.6048718690872192, 0.10931794345378876, 0.41168341040611267,...
func (n *nodeReaderWriter) Write(p []byte) (int, error) { // guarantee that the path exists _, ok := n.repo.Data[n.path] if !ok { n.repo.Data[n.path] = []byte{} } // overwrite the file if we haven't already started writing to it if !n.writing { n.repo.Data[n.path] = make([]byte, 0) n.writing = true } /...
[ -1.0603827238082886, 1.1132558584213257, 0.5470057725906372, -0.8822751641273499, 0.8267272114753723, -0.29131123423576355, 0.3578334450721741, 1.0617337226867676, -0.5818588137626648, 0.3756399154663086, -0.2978440523147583, -0.4951914846897125, -1.0260127782821655, 0.2144978642463684, ...
func (n *nodeReaderWriter) URI() fyne.URI { // discarding the error because this should never fail u, _ := storage.ParseURI(n.repo.scheme + "://" + n.path) return u }
[ -0.22162193059921265, -0.4877263903617859, 0.1394689530134201, 0.398155152797699, 0.7073501348495483, -0.6303438544273376, -0.28414270281791687, 0.8742843866348267, -0.5394850373268127, -0.6914076805114746, 0.6976643204689026, -1.0772784948349, -0.057326771318912506, -0.8042421340942383, ...
func NewInMemoryRepository(scheme string) *InMemoryRepository { return &InMemoryRepository{ Data: make(map[string][]byte), scheme: scheme, } }
[ 0.2868790626525879, -0.5347680449485779, -0.009554842486977577, -1.186231017112732, -1.4900226593017578, -1.0037423372268677, -0.31439730525016785, 0.28673437237739563, 0.4915713369846344, 0.10290702432394028, -0.20306801795959473, 0.42955008149147034, -0.9179221987724304, 0.58842939138412...
func (m *InMemoryRepository) Exists(u fyne.URI) (bool, error) { path := u.Path() if path == "" { return false, fmt.Errorf("invalid path '%s'", path) } _, ok := m.Data[path] return ok, nil }
[ -1.1365249156951904, 0.07751081138849258, 0.5690159201622009, -0.46643561124801636, 0.4516826272010803, 0.11423446238040924, -0.2554273009300232, 0.5481186509132385, -0.16921406984329224, -0.8784498572349548, 0.36840707063674927, -0.11277025938034058, -0.6478679180145264, -0.36646002531051...
func (m *InMemoryRepository) Reader(u fyne.URI) (fyne.URIReadCloser, error) { path := u.Path() if path == "" { return nil, fmt.Errorf("invalid path '%s'", path) } _, ok := m.Data[path] if !ok { return nil, fmt.Errorf("no such path '%s' in InMemoryRepository", path) } return &nodeReaderWriter{path: path, r...
[ -1.051390528678894, -0.18671979010105133, 0.27546852827072144, -0.8435503244400024, -0.7313048243522644, 0.05719165876507759, 0.7937416434288025, 0.27326494455337524, 0.11453660577535629, -0.39066559076309204, 1.5374592542648315, 0.2890206277370453, -0.6982115507125854, -0.2440149486064911...
func (m *InMemoryRepository) CanRead(u fyne.URI) (bool, error) { path := u.Path() if path == "" { return false, fmt.Errorf("invalid path '%s'", path) } _, ok := m.Data[path] return ok, nil }
[ -0.09854763746261597, 0.15751393139362335, 0.6259530186653137, 0.13958704471588135, -0.6206731796264648, 0.8163608312606812, 0.16578787565231323, 0.6799209117889404, -0.3722951412200928, -0.4341212213039398, 1.4947785139083862, 0.3428623676300049, -0.7250528931617737, -0.6372830271720886, ...
func (m *InMemoryRepository) Writer(u fyne.URI) (fyne.URIWriteCloser, error) { path := u.Path() if path == "" { return nil, fmt.Errorf("invalid path '%s'", path) } return &nodeReaderWriter{path: path, repo: m}, nil }
[ -1.2652956247329712, 0.44422397017478943, 0.11426682025194168, -0.06771022826433182, 0.110162653028965, -0.5047076940536499, 1.100271224975586, 0.6777328252792358, 0.25956907868385315, -0.741414487361908, 0.8317671418190002, -0.3984821140766144, -0.17882634699344635, -0.08179184794425964, ...
func (m *InMemoryRepository) CanWrite(u fyne.URI) (bool, error) { if p := u.Path(); p == "" { return false, fmt.Errorf("invalid path '%s'", p) } return true, nil }
[ -0.6166783571243286, 0.21927236020565033, 0.5534769296646118, 0.8344680666923523, 0.19464406371116638, 0.21019406616687775, 0.8854199051856995, 1.0904935598373413, 0.007807860616594553, -0.057498931884765625, 0.6515699028968811, -0.6462656259536743, -0.5597178339958191, 0.00739188771694898...
func (m *InMemoryRepository) Delete(u fyne.URI) error { path := u.Path() _, ok := m.Data[path] if ok { delete(m.Data, path) } return nil }
[ 0.11599991470575333, 0.7994037866592407, 0.33440491557121277, 0.06410911679267883, 0.27043798565864563, -0.17278295755386353, 0.20418088138103485, 0.5640780925750732, 0.22196486592292786, -0.6910391449928284, 0.4637819528579712, 0.10017088055610657, -1.3226943016052246, -0.1285750716924667...
func (m *InMemoryRepository) Parent(u fyne.URI) (fyne.URI, error) { return repository.GenericParent(u) }
[ -0.2724239230155945, 0.9481832981109619, 0.36079251766204834, -0.22960573434829712, -0.42129001021385193, -0.3767182230949402, 0.9362415075302124, -0.16161750257015228, -0.21146880090236664, -0.7896829843521118, 0.5171458125114441, -0.2036852091550827, -0.6000373959541321, 0.21898956596851...
func (m *InMemoryRepository) Child(u fyne.URI, component string) (fyne.URI, error) { return repository.GenericChild(u, component) }
[ 0.23343726992607117, -0.08239594846963882, 0.2220143973827362, -0.7267663478851318, -0.25386229157447815, 0.33069878816604614, 0.13857784867286682, 0.2905382812023163, 0.004908619914203882, -0.9776226282119751, -0.34878218173980713, 0.12928569316864014, 0.38745465874671936, -0.767807364463...
func (m *InMemoryRepository) Copy(source, destination fyne.URI) error { return repository.GenericCopy(source, destination) }
[ -1.041940450668335, 0.5032275319099426, 0.2173171490430832, 0.3394671380519867, -0.5144990682601929, 0.34092721343040466, -0.497004896402359, 0.1507919430732727, -0.22211886942386627, 0.15178950130939484, 0.7989053726196289, 0.40283411741256714, 0.13550913333892822, -0.09486185014247894, ...
func (m *InMemoryRepository) Move(source, destination fyne.URI) error { return repository.GenericMove(source, destination) }
[ -1.4354571104049683, 0.5715500116348267, 0.22613222897052765, 0.082719586789608, 0.2550397217273712, -0.35859352350234985, -0.6001054048538208, 0.012665712274610996, -0.5837394595146179, -0.05168835446238518, 0.39197883009910583, 0.2572970390319824, -0.07514777779579163, -0.177835613489151...
func (m *InMemoryRepository) CanList(u fyne.URI) (bool, error) { return m.Exists(u) }
[ -0.45767897367477417, -0.040749579668045044, 0.3337644040584564, -0.008424991741776466, 0.06830677390098572, 0.24194380640983582, -0.26662564277648926, 0.9072714447975159, 0.5545449256896973, 0.35837942361831665, -0.019408030435442924, 0.09233047068119049, -0.24974045157432556, 0.768728435...
func (m *InMemoryRepository) List(u fyne.URI) ([]fyne.URI, error) { // Get the prefix, and make sure it ends with a path separator so that // HasPrefix() will only find things that are children of it - this // solves the edge case where you have say '/foo/bar' and // '/foo/barbaz'. prefix := u.Path() if len(pref...
[ -0.47244223952293396, -0.3553386628627777, 0.722257673740387, 0.21385550498962402, -0.10900836437940598, -1.0451186895370483, 0.4645920991897583, 1.1391429901123047, 0.5606191754341125, -0.24584920704364777, -0.09359592944383621, -0.8150140643119812, -0.29959776997566223, 0.544470191001892...
func (m *InMemoryRepository) CreateListable(u fyne.URI) error { ex, err := m.Exists(u) if err != nil { return err } path := u.Path() if ex { return fmt.Errorf("cannot create '%s' as a listable path because it already exists", path) } m.Data[path] = []byte{} return nil }
[ 0.12532782554626465, -0.1492965966463089, 0.5319322347640991, -0.05399236083030701, 0.4039631187915802, -0.19765333831310272, -0.039909228682518005, -0.09204649925231934, -0.2954823970794678, -0.3706485629081726, -0.46792668104171753, -0.4949580430984497, -0.668274998664856, 0.048649545758...
func (e StaticFeeEstimator) EstimateFeePerByte(numBlocks uint32) (btcutil.Amount, error) { return e.FeeRate, nil }
[ 0.28737637400627136, 0.1800903081893921, 0.33025097846984863, -0.09604045748710632, -0.31287431716918945, -0.32965126633644104, 0.32187336683273315, -0.4497554302215576, 0.04816517233848572, 0.22553513944149017, -0.4859309196472168, -0.3611334264278412, -1.3133236169815063, 1.7839044332504...
func (e StaticFeeEstimator) EstimateFeePerWeight(numBlocks uint32) (btcutil.Amount, error) { return e.FeeRate / blockchain.WitnessScaleFactor, nil }
[ 0.39464330673217773, 0.21876029670238495, 0.3297080099582672, -0.11757944524288177, -0.644974410533905, -0.9402723908424377, 0.27940666675567627, -0.47575893998146057, -0.6685119867324829, 0.5369831323623657, -0.7157773971557617, -0.21393513679504395, -0.897221028804779, 1.9998419284820557...
func (e StaticFeeEstimator) Start() error { return nil }
[ 0.30160465836524963, -0.19734327495098114, 0.19465206563472748, 0.30916687846183777, 0.17549696564674377, -0.048878129571676254, 0.9507529139518738, 0.5539611577987671, -0.4169715344905853, -0.31346258521080017, -1.2301393747329712, 0.8108109831809998, 0.2811664938926697, 1.422703146934509...
func (e StaticFeeEstimator) Stop() error { return nil }
[ -0.6883992552757263, -0.239437535405159, 0.15013201534748077, -0.2153228372335434, 0.27229779958724976, 0.5228208303451538, 0.9380750060081482, 0.3694932758808136, -0.7031580209732056, -0.035045769065618515, -1.1363270282745361, 0.28070130944252014, -0.06481875479221344, 1.1822084188461304...
func NewBtcdFeeEstimator(rpcConfig rpcclient.ConnConfig, fallBackFeeRate btcutil.Amount) (*BtcdFeeEstimator, error) { rpcConfig.DisableConnectOnNew = true rpcConfig.DisableAutoReconnect = false chainConn, err := rpcclient.New(&rpcConfig, nil) if err != nil { return nil, err } return &BtcdFeeEstimator{ fall...
[ 0.07399459183216095, -0.09137691557407379, 0.19265905022621155, -0.6985706686973572, -0.05575725808739662, -0.7077532410621643, -0.31500324606895447, 0.16722655296325684, -0.5071418285369873, 0.12038996070623398, -0.7733001708984375, 0.6753339171409607, -1.6667579412460327, 0.6964624524116...
func (b *BtcdFeeEstimator) Start() error { if err := b.btcdConn.Connect(20); err != nil { return err } return nil }
[ 0.7578215003013611, 0.2947010099887848, 0.3185366094112396, -0.5298959016799927, 0.8999639749526978, -0.42728766798973083, 0.13468286395072937, 0.7534915804862976, -1.3368357419967651, 0.2005753517150879, -0.65269535779953, 1.2836110591888428, -0.47536760568618774, 0.9601535797119141, 0....
func (b *BtcdFeeEstimator) Stop() error { b.btcdConn.Shutdown() return nil }
[ -0.08170808106660843, 0.4570872485637665, 0.2047712504863739, -0.46503356099128723, 0.862082302570343, 0.06627146154642105, 0.0525175966322422, 0.42521536350250244, -1.4632760286331177, 0.30936986207962036, -0.34070053696632385, 0.3803826868534088, -0.8182282447814941, 0.8203921318054199, ...
func (b *BtcdFeeEstimator) EstimateFeePerByte(numBlocks uint32) (btcutil.Amount, error) { feeEstimate, err := b.fetchEstimatePerByte(numBlocks) switch { // If the estimator doesn't have enough data, or returns an error, then // to return a proper value, then we'll return the default fall back // fee rate. case er...
[ 0.3533175587654114, 0.3335578739643097, 0.45852816104888916, 0.07304809987545013, -0.17918133735656738, -0.6979960799217224, 0.018164273351430893, -0.3177865147590637, -0.11850521713495255, 0.2704041600227356, 0.19526217877864838, -0.21413807570934296, -1.408878207206726, 1.487076044082641...
func (b *BtcdFeeEstimator) EstimateFeePerWeight(numBlocks uint32) (btcutil.Amount, error) { feePerByte, err := b.EstimateFeePerByte(numBlocks) if err != nil { return 0, err } // We'll scale down the fee per byte to fee per weight, as for each raw // byte, there's 1/4 unit of weight mapped to it. satWeight := f...
[ 0.7661881446838379, 0.27782949805259705, 0.5306134819984436, 0.03120991215109825, -0.351504921913147, -1.3132038116455078, -0.007111713290214539, -0.3342461585998535, -0.2774379849433899, 0.3011661767959595, -0.18327206373214722, -0.3780813217163086, -1.0990763902664185, 1.7930667400360107...
func (b *BtcdFeeEstimator) fetchEstimatePerByte(confTarget uint32) (btcutil.Amount, error) { // First, we'll fetch the estimate for our confirmation target. btcPerKB, err := b.btcdConn.EstimateFee(int64(confTarget)) if err != nil { return 0, err } // Next, we'll convert the returned value to satoshis, as it's ...
[ 0.7584192752838135, 0.0974847748875618, 0.6283962726593018, -0.12324871122837067, -0.5258616805076599, -0.3697895407676697, -0.4267767071723938, -0.0854615569114685, -0.5017667412757874, 0.4901094138622284, 0.49955424666404724, -0.04539785161614418, -0.6882766485214233, 0.9314491152763367,...
func NewBitcoindFeeEstimator(rpcConfig rpcclient.ConnConfig, fallBackFeeRate btcutil.Amount) (*BitcoindFeeEstimator, error) { rpcConfig.DisableConnectOnNew = true rpcConfig.DisableAutoReconnect = false rpcConfig.DisableTLS = true rpcConfig.HTTPPostMode = true chainConn, err := rpcclient.New(&rpcConfig, nil) if ...
[ -0.057303138077259064, -0.1701270341873169, 0.09858597069978714, -0.8432309031486511, -0.21568487584590912, -0.5894815921783447, 0.057402610778808594, -0.14108456671237946, -0.4814186990261078, 0.21530118584632874, -0.9010567665100098, 0.635115921497345, -2.0755584239959717, 0.661555409431...
func (b *BitcoindFeeEstimator) Start() error { return nil }
[ 0.7711601257324219, 0.18985122442245483, 0.1728292852640152, -0.13161329925060272, 0.5158110857009888, -0.22404475510120392, 0.8265032768249512, 0.5259811282157898, -0.3311983644962311, -0.2025894671678543, -1.0904961824417114, 1.0432913303375244, -0.8263755440711975, 0.942423939704895, ...
func (b *BitcoindFeeEstimator) Stop() error { return nil }
[ -0.17951375246047974, 0.2592166066169739, 0.13402226567268372, -0.7676084637641907, 0.6226490139961243, 0.3449864685535431, 0.8469640016555786, 0.3164527714252472, -0.6707600951194763, 0.024733543395996094, -0.8761916160583496, 0.3650911748409271, -1.2073465585708618, 0.7187231183052063, ...
func (b *BitcoindFeeEstimator) EstimateFeePerByte(numBlocks uint32) (btcutil.Amount, error) { feeEstimate, err := b.fetchEstimatePerByte(numBlocks) switch { // If the estimator doesn't have enough data, or returns an error, then // to return a proper value, then we'll return the default fall back // fee rate. cas...
[ 0.39339688420295715, 0.2851640582084656, 0.44582661986351013, 0.03632740303874016, -0.18218286335468292, -0.6978161334991455, 0.06539308279752731, -0.33771592378616333, -0.06454087048768997, 0.25970858335494995, 0.18150772154331207, -0.2573360502719879, -1.4475408792495728, 1.4341162443161...
func (b *BitcoindFeeEstimator) EstimateFeePerWeight(numBlocks uint32) (btcutil.Amount, error) { feePerByte, err := b.EstimateFeePerByte(numBlocks) if err != nil { return 0, err } // We'll scale down the fee per byte to fee per weight, as for each raw // byte, there's 1/4 unit of weight mapped to it. satWeight ...
[ 0.7829867601394653, 0.18182432651519775, 0.5334295034408569, 0.06254173815250397, -0.3785049319267273, -1.3428844213485718, 0.05025457963347435, -0.43774130940437317, -0.17850053310394287, 0.18108391761779785, -0.06198703125119209, -0.3316338062286377, -0.9744006395339966, 1.7323077917099,...
func (b *BitcoindFeeEstimator) fetchEstimatePerByte(confTarget uint32) (btcutil.Amount, error) { // First, we'll send an "estimatesmartfee" command as a raw request, // since it isn't supported by btcd but is available in bitcoind. target, err := json.Marshal(uint64(confTarget)) if err != nil { return 0, err } ...
[ 0.35770952701568604, 0.08864591270685196, 0.6902317404747009, -0.43313053250312805, -0.4326309859752655, -0.6905190348625183, -0.5231980085372925, -0.15931089222431183, -0.46440163254737854, 0.36247432231903076, 0.38758063316345215, 0.22212672233581543, -0.6145336627960205, 0.8678914308547...
func NewDefaultApiController(s DefaultApiServicer, m func(http.Handler) http.Handler) Router { return &DefaultApiController{service: s, middleware: m} }
[ -0.5942797660827637, -0.18347063660621643, 0.0468050017952919, -0.2678082585334778, -0.8068307638168335, -0.3422093987464905, -0.24570809304714203, -0.21043404936790466, 0.4265262484550476, -0.15951089560985565, -0.5749077796936035, -0.24880589544773102, -0.3021841049194336, 0.594035208225...
func (c *DefaultApiController) Routes() Routes { return Routes{ { "DataDataIdDelete", http.MethodDelete, "/data/{dataId}", c.DataDataIdDelete, }, { "DataDataIdGet", http.MethodGet, "/data/{dataId}", c.DataDataIdGet, }, { "DataDataIdPost", http.MethodPost, "/data/{dataId}", ...
[ -0.5424826145172119, 0.06515045464038849, 0.29485681653022766, -0.8684080243110657, 0.6100575923919678, 0.1600147783756256, -0.5622355937957764, -0.52027428150177, 0.025206303223967552, -1.1698969602584839, -0.6876423358917236, -0.15241199731826782, 0.2596399188041687, 0.2988986372947693, ...
func (c *DefaultApiController) Middleware() func(http.Handler) http.Handler { return c.middleware }
[ 0.19975662231445312, -0.17361360788345337, 0.2199035882949829, 0.5614387392997742, 0.653953492641449, 0.19914206862449646, -0.08169524371623993, 0.03949626535177231, 0.10785450041294098, -1.1355979442596436, -0.13826242089271545, -0.7805852890014648, -0.6057989597320557, -0.477473348379135...
func (c *DefaultApiController) DataDataIdDelete(w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) dataId, err := parseInt32Parameter(params["dataId"]) if err != nil { w.WriteHeader(http.StatusBadRequest) return } result, err := c.service.DataDataIdDelete(r.Context(), dataId) //If an error occur...
[ -1.0538312196731567, 0.17744654417037964, 0.6055794954299927, -0.8937249779701233, -0.06775763630867004, 0.41130056977272034, -0.25492605566978455, -0.21528717875480652, 0.7489935755729675, 0.1844516098499298, -0.08668293058872223, 1.0737550258636475, -1.0605838298797607, 0.535720586776733...
func (c *DefaultApiController) DataDataIdGet(w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) dataId, err := parseInt32Parameter(params["dataId"]) if err != nil { w.WriteHeader(http.StatusBadRequest) return } result, err := c.service.DataDataIdGet(r.Context(), dataId) //If an error occured, en...
[ -0.6614145636558533, -0.41061705350875854, 0.3420136868953705, -0.9790847897529602, -0.34284576773643494, 0.5113847255706787, -0.35454776883125305, -0.5545284152030945, 0.0958242416381836, -0.31333112716674805, -0.6163931488990784, 1.0536987781524658, -0.14466871321201324, 0.68353998661041...
func (c *DefaultApiController) DataDataIdPost(w http.ResponseWriter, r *http.Request) { params := mux.Vars(r) dataId, err := parseInt32Parameter(params["dataId"]) if err != nil { w.WriteHeader(http.StatusBadRequest) return } inlineObject1 := &InlineObject1{} if err := json.NewDecoder(r.Body).Decode(&inlineOb...
[ -1.3369323015213013, -0.23138058185577393, 0.8193491697311401, -0.444100946187973, -0.6536157727241516, 0.45752832293510437, -0.22774557769298553, -0.22041136026382446, 0.5376813411712646, -0.01975790038704872, -0.608535885810852, 0.6121772527694702, -0.6741772294044495, 0.1680886298418045...
func (c *DefaultApiController) DataGet(w http.ResponseWriter, r *http.Request) { result, err := c.service.DataGet(r.Context()) //If an error occured, encode the error with the status code if err != nil { EncodeJSONResponse(err.Error(), &result.Code, w) return } //If no error, encode the body and the result cod...
[ -0.7092739343643188, 0.11658770591020584, 0.5607439279556274, -0.36069217324256897, 0.2084890455007553, -0.4191652536392212, -0.6901003122329712, -0.12887732684612274, 0.19063490629196167, -0.14798228442668915, -0.12021137028932571, 0.9097321629524231, -0.4830595552921295, 0.33799219131469...
func (c *DefaultApiController) DataPost(w http.ResponseWriter, r *http.Request) { inlineObject := &InlineObject{} if err := json.NewDecoder(r.Body).Decode(&inlineObject); err != nil { w.WriteHeader(http.StatusBadRequest) return } result, err := c.service.DataPost(r.Context(), *inlineObject) //If an error occu...
[ -0.3688620328903198, -0.11613698303699493, 0.7372540831565857, 0.12845835089683533, -0.135258749127388, -0.1665787398815155, -0.22171057760715485, 0.10926683992147446, 0.5821627378463745, -0.040924929082393646, -0.7965890765190125, 0.2289503514766693, -0.7556179165840149, -0.24277159571647...
func New() *OMap { return &OMap{ keys: make([]string, 0), baseMap: make(map[string]interface{}, 0), } }
[ -1.20717453956604, -1.7517343759536743, 0.09644974768161774, -0.2398362010717392, -1.0078378915786743, -0.34335917234420776, -0.13215889036655426, 0.0012052042875438929, -0.05124915763735771, -0.37862423062324524, -0.2717496454715729, -0.07904932647943497, 0.043794941157102585, 0.156812548...
func (m *OMap) Count() int { return len(m.keys) }
[ -0.5654512643814087, -1.0893524885177612, 0.47333717346191406, -0.37265053391456604, -0.8164525628089905, -0.012349174357950687, -0.07854428887367249, -0.23211804032325745, -0.5147973299026489, 0.18937215209007263, -0.27473318576812744, -0.6321424245834351, -0.27587297558784485, 0.62506884...
func (m *OMap) Entries() []Entry { entries := make([]Entry, len(m.keys), 0) for _, k := range m.keys { entry := Entry{Key: k, Value: m.baseMap[k]} entries = append(entries, entry) } return entries }
[ -0.7275588512420654, -0.5134134292602539, 0.14437785744667053, -0.3534800410270691, 0.3598121106624603, 0.11979779601097107, -0.6770883798599243, 0.6558522582054138, 0.10364846140146255, -0.14387887716293335, 0.2555219233036041, 0.09935837239027023, -0.4767589271068573, 0.34089285135269165...
func (m *OMap) HasKey(k string) bool { _, ok := m.baseMap[k] return ok }
[ -0.5670907497406006, -0.17083698511123657, 0.5673985481262207, 0.3875523805618286, -0.11302915215492249, 0.7232570052146912, -0.2160525619983673, 0.719182014465332, -0.04993738606572151, 0.4026695787906647, -0.028683746233582497, -1.2832649946212769, -0.7700151801109314, -0.015252312645316...
func (m *OMap) Key(n int) string { return m.keys[n] }
[ -1.2243309020996094, -0.37628620862960815, 0.032960060983896255, -0.11835815757513046, -0.7357140779495239, 0.6051518321037292, -0.27939972281455994, -1.1066042184829712, 0.32077866792678833, 0.5011923313140869, 0.18432970345020294, -1.0404289960861206, -0.46974945068359375, -0.23905171453...
func (m *OMap) Get(s string) interface{} { if n, ok := m.baseMap[s]; ok { return n } return nil }
[ -0.8051018714904785, -1.1392686367034912, 0.34591031074523926, -0.11878058314323425, -0.5264106392860413, -0.7428238987922668, -0.19149813055992126, -0.32821032404899597, 0.24765007197856903, -0.7518497705459595, 0.12686242163181305, 0.7209300994873047, -0.5907022953033447, -0.931221187114...
func (m *OMap) Add(k string, v interface{}) error { if _, ok := m.baseMap[k]; ok { return ErrorKeyExisting } m.add(k, v) return nil }
[ -0.871291995048523, -0.9761977791786194, 0.41590365767478943, -0.11530113965272903, 0.1610342264175415, 0.5484649538993835, -0.5485184192657471, 0.011525522917509079, 0.3075047433376312, 0.625735878944397, 0.5144449472427368, 0.2185494303703308, -0.4810866415500641, 0.3743477463722229, -...
func (m *OMap) Put(k string, v interface{}) bool { if !m.HasKey(k) { m.add(k, v) return false } // move k to last of m.keys n := indexOf(k, m.keys) m.keys = append(append(m.keys[:n], m.keys[n+1:]...), k) // set v for k in m.baseMap m.baseMap[k] = v return true }
[ -0.8388482928276062, 0.3125510513782501, 0.7206510305404663, -1.225991129875183, -0.8758549690246582, 0.4472879469394684, -0.3274376392364502, 0.07544154673814774, -0.5337616801261902, 0.7166159749031067, -0.3198510706424713, -0.5344171524047852, -1.1894749402999878, -0.49502959847450256, ...
func (m *OMap) Remove(k string) bool { if !m.HasKey(k) { return false } // remove k from m.keys n := indexOf(k, m.keys) m.keys = append(m.keys[:n], m.keys[n+1:]...) // remove v from m.baseMap. delete(m.baseMap, k) return true }
[ -0.9184955358505249, -0.5195962190628052, 0.6781759858131409, -0.6664645671844482, -1.7959703207015991, -0.014742587693035603, -0.36666935682296753, 0.9947276711463928, 0.08014193177223206, 0.774737536907196, -0.5601555705070496, -1.153695821762085, -1.285908818244934, -0.24896040558815002...
func (m *BookingModel) All() ([]models.Booking, error) { // Define variables ctx := context.TODO() b := []models.Booking{} // Find all bookings bookingCursor, err := m.C.Find(ctx, bson.M{}) if err != nil { return nil, err } err = bookingCursor.All(ctx, &b) if err != nil { return nil, err } return b, er...
[ -0.5299283862113953, -0.11530473828315735, 0.5627413988113403, 1.9614548683166504, 0.33385708928108215, 0.976248562335968, -0.01857008785009384, 1.5166147947311401, -1.1411606073379517, 0.5511350631713867, 0.11089753359556198, -0.01648457907140255, -0.5652357339859009, 1.2004914283752441, ...
func (m *BookingModel) FindByID(id string) (*models.Booking, error) { p, err := primitive.ObjectIDFromHex(id) if err != nil { return nil, err } // Find booking by id var booking = models.Booking{} err = m.C.FindOne(context.TODO(), bson.M{"_id": p}).Decode(&booking) if err != nil { // Checks if the booking w...
[ -0.22690396010875702, 0.4970754384994507, 0.23568716645240784, 0.5828508138656616, -0.5313779711723328, 0.6061816811561584, 0.1792682558298111, -0.2041735053062439, -0.08744991570711136, 0.7670896649360657, -0.020824097096920013, -0.6895891427993774, -1.4101165533065796, 1.0696470737457275...
func (m *BookingModel) Insert(booking models.Booking) (*mongo.InsertOneResult, error) { return m.C.InsertOne(context.TODO(), booking) }
[ -2.168509006500244, 1.7319880723953247, 0.3254398703575134, 1.6048203706741333, 0.10119318217039108, 0.7002757787704468, 0.8074951171875, 1.0696238279342651, -0.6421017646789551, 0.1213163286447525, -0.7594223022460938, -1.4294506311416626, -1.7429981231689453, 0.1657608598470688, -0.598...
func (m *BookingModel) Delete(id string) (*mongo.DeleteResult, error) { p, err := primitive.ObjectIDFromHex(id) if err != nil { return nil, err } return m.C.DeleteOne(context.TODO(), bson.M{"_id": p}) }
[ -1.1691515445709229, 0.9672358632087708, 0.6541374921798706, 1.4692344665527344, -0.03919987753033638, 0.7339186668395996, 0.23706084489822388, 0.7352410554885864, -0.19802191853523254, 0.8358200192451477, -0.4868833124637604, -0.8540052175521851, -1.1431277990341187, 0.08947886526584625, ...
func ProgressBar(before string, after string, hook func(loaded float64, speed float64, remain float64), writer io.Writer) func(received int64, readed int64, total int64, start int64, end int64) { var ( startTime = time.Now() lastTime = startTime lastReceived int64 ) return func(received int64, readed in...
[ 0.07072889059782028, -0.22141866385936737, 1.0580461025238037, -0.5644647479057312, -0.35948172211647034, -0.3128090500831604, 1.2081016302108765, -0.3284671902656555, -1.5506178140640259, -0.3657422661781311, 0.5699533224105835, -0.11492791026830673, -0.4606386423110962, 0.546723604202270...
func StringPadding(str string, le int) string { l := le - len(str) if l > 0 { for i := 0; i < l; i++ { str = str + " " } } return str }
[ 0.48791471123695374, 0.34004008769989014, 0.695563554763794, -1.0187782049179077, -0.5155767798423767, 0.4663654863834381, -0.7246232628822327, -0.1275467425584793, 0.3096729815006256, 1.1832177639007568, 0.19897747039794922, -0.41752076148986816, -0.5583142042160034, -0.02689862623810768,...
func DateFormat(times int64) string { return time.Unix(times, 0).Format("2006/01/02 15:04:05") }
[ 0.31926456093788147, 0.047147393226623535, 0.49674883484840393, -0.3913935720920563, -1.2525261640548706, -0.09317152202129364, -0.4197390377521515, -1.1343204975128174, 0.7104211449623108, -0.22421500086784363, 0.3374413847923279, -0.4233923852443695, 0.3243366479873657, 0.424221545457839...
func HasFileSize(fullpath string) int64 { if stat, err := os.Stat(fullpath); err == nil { return stat.Size() } return 0 }
[ 0.42526984214782715, 0.22050359845161438, 0.6515481472015381, -0.16881465911865234, -0.1381007879972458, -0.34918490052223206, 0.4218251705169678, 0.913863480091095, 0.09415282309055328, -0.8839791417121887, -0.7151818871498108, -1.0939584970474243, 0.1985953003168106, 1.2616462707519531, ...
func GetStorePath(urlStr string) (string, error) { var fileName = urlStr dir, err := os.Getwd() if err != nil { return "", err } if IsURL(urlStr, true) { u, err := url.Parse(urlStr) if err != nil { return "", err } fileName = strings.Trim(path.Base(u.Path), " /.") if fileName == "" { fileName = s...
[ -0.3089420795440674, -0.11240503191947937, 0.6967797875404358, 0.6021742224693298, -0.6917259693145752, 0.10482273995876312, 1.6593601703643799, -0.1737900674343109, 0.8617028594017029, -0.18222758173942566, 0.6186380982398987, -0.06260725855827332, -0.5411076545715332, 0.5542336702346802,...
func GetOpenFile(file string) (*os.File, error) { var fullpath = file if !filepath.IsAbs(fullpath) { dir, err := os.Getwd() if err != nil { return nil, err } fullpath = filepath.Join(dir, file) } return os.Open(fullpath) }
[ 0.1437627077102661, 0.3964086174964905, 0.7751888632774353, 0.10736259073019028, -0.5438515543937683, 1.0427265167236328, 1.0615719556808472, 0.4791939854621887, -0.3246251046657562, -0.17679865658283234, 0.6782540678977966, -0.03599486127495766, -0.07738390564918518, 0.11787254363298416, ...
func GetContinue(fullpath string) (*os.File, int64, error) { if stat, err := os.Stat(fullpath); os.IsNotExist(err) { f, err := os.Create(fullpath) return f, 0, err } else if !stat.IsDir() { file, err := os.OpenFile(fullpath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666) return file, stat.Size(), err } return n...
[ 0.5978615880012512, 0.08365599811077118, 1.0375593900680542, 0.4060746133327484, -0.20452407002449036, -0.9088565707206726, 1.2905195951461792, 0.20808055996894836, -0.10376016050577164, -0.04805054888129234, 0.24640429019927979, -0.2879733741283417, -0.14657796919345856, 0.000603209773544...
func IsURL(url string, strict bool) bool { if strict { return urlStrictReg.MatchString(url) } return urlReg.MatchString(url) }
[ -0.39995479583740234, -0.7058054804801941, 0.5921370983123779, 0.16373899579048157, -0.031745921820402145, 0.6341347694396973, -0.7574067115783691, 0.9147893786430359, 0.44450828433036804, 0.08042574673891068, -0.5922772288322449, 0.06653483211994171, -0.8940436244010925, -0.61579930782318...
func IsInt(v string) bool { if _, err := strconv.ParseInt(v, 10, 64); err == nil { return true } return false }
[ 0.044053252786397934, -0.04044478014111519, 0.4991711676120758, -0.4644289016723633, -0.20525582134723663, -0.0756206214427948, -1.0836507081985474, 0.3047957718372345, 0.26181232929229736, 0.42378348112106323, -0.46814122796058655, -0.07275575399398804, -0.7542684078216553, -0.65672785043...
func IsPort(v string) bool { if n, err := strconv.Atoi(v); err == nil { if n > 0 && n < 65535 { return true } } return false }
[ -0.009712825529277325, -0.06176300346851349, 0.5575659275054932, 0.34135323762893677, -0.0490507073700428, 0.051580991595983505, 0.07132846117019653, -0.17642027139663696, 1.2231298685073853, 0.13241064548492432, -0.35554128885269165, 0.20186056196689606, -1.0151731967926025, -0.3039518892...
func IsIPPort(v string) bool { return ipPortReg.MatchString(v) }
[ -0.8004591464996338, -0.4876575767993927, 0.5099184513092041, 0.046979017555713654, -0.7322958111763, -0.023193148896098137, 0.49824175238609314, 0.2111186981201172, 0.9285235404968262, 0.784622848033905, -0.5928975939750671, -0.2514512836933136, -0.892475426197052, -0.9223633408546448, ...
func HasFlag(args []string, flag string) bool { for _, item := range args { if item == flag { return true } } return false }
[ 0.2535856366157532, 0.36377838253974915, 0.2991613745689392, 0.5071814656257629, 0.9149686694145203, 0.192400261759758, -1.0290148258209229, 1.0105112791061401, -1.6298375129699707, -0.5904625654220581, -0.5749145150184631, 0.0019361041486263275, -0.3545040786266327, 1.2249444723129272, ...
func GetParam(args []string, key string) (string, error) { var catched = false for _, item := range args { if catched { return item, nil } if item == key { catched = true } } return "", fmt.Errorf("%s value not found", key) }
[ 0.194112166762352, -0.06714346259832382, 0.7222381234169006, 0.6315319538116455, 0.15657980740070343, -0.1564026027917862, 0.029882395640015602, -0.22879299521446228, -0.621945858001709, 1.2460988759994507, 1.5628701448440552, 0.4843326508998871, 0.15283513069152832, 0.2134532928466797, ...
func CallPlayer(file string) { var player string if runtime.GOOS == "windows" { player = "PotPlayerMini.exe" } else { player = "mpv" } exec.Command(player, file).Start() }
[ -0.08864106237888336, -1.218703031539917, 0.762468695640564, 1.1806498765945435, -0.7439289093017578, 1.1097217798233032, -0.2861291766166687, 0.07616952806711197, 0.1944408416748047, 0.037546556442976, 0.2160317748785019, 0.633251428604126, -0.44082000851631165, 0.7041229009628296, 1.00...
func PathMustHave(p string) (string, error) { pwd, err := os.Getwd() if err != nil { return p, err } if !filepath.IsAbs(p) { p = filepath.Join(pwd, p) } stat, err := os.Stat(p) if err != nil { return p, err } if !stat.Mode().IsDir() { return p, fmt.Errorf("%s is not directory", p) } return p, err }
[ -0.5856115818023682, -0.14487707614898682, 0.8006344437599182, 0.2077178955078125, 0.04906622692942619, 1.310289740562439, 0.6175965666770935, -0.7550116777420044, 0.21100851893424988, 0.6514177918434143, 0.5490971207618713, -0.36903679370880127, -0.2638089060783386, 0.41589638590812683, ...
func GetFileHash(file *os.File, t string) ([]byte, error) { _, err := file.Seek(0, 0) if err != nil { return nil, err } switch t { case "md5": h := md5.New() _, err = io.Copy(h, file) if err != nil { return nil, err } return h.Sum(nil), nil case "sha1": h := sha1.New() _, err = io.Copy(h, file)...
[ 1.1326848268508911, -0.19473505020141602, 1.0621840953826904, 0.46832165122032166, 0.3803900480270386, 0.7907822132110596, 0.08749096840620041, -0.216460719704628, -0.7075672745704651, 0.3329980969429016, -0.2887062430381775, 0.1491258591413498, 0.04308484494686127, -0.04855387657880783, ...
func GetCurIpv4() (*net.IPNet, error) { addrs, err := net.InterfaceAddrs() if err != nil { return nil, err } ip := &net.IPNet{} for _, a := range addrs { if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { if ipnet.IP.To4() != nil { ip = ipnet break } } } return ip, nil }
[ -0.43361663818359375, 0.001759305247105658, 0.7929655909538269, -0.0635223537683487, -0.4499574303627014, -0.8015891313552856, 0.5659067630767822, -0.3938662111759186, -0.03558115288615227, 0.08012358099222183, 0.6570702791213989, 0.23453058302402496, -0.7494966983795166, -0.41495826840400...
func Apply(clusterDir string, state string, templateDir string, extraArgs ...string) (string, error) { stateFileName := fmt.Sprintf("%s.tfstate", state) defaultArgs := []string{ "apply", "-auto-approve", fmt.Sprintf("-state=%s", stateFileName), } extraArgs = append(extraArgs, templateDir) args := append(defa...
[ 0.2939453721046448, 0.3334495425224304, 0.6366061568260193, -0.2726334035396576, -0.2849959433078766, -0.11396040767431259, 0.13631494343280792, 1.4092700481414795, -0.7976087331771851, 0.2672967314720154, 0.6528339385986328, 0.10823370516300201, 0.18197302520275116, 0.5034405589103699, ...
func Destroy(clusterDir, state, templateDir string, extraArgs ...string) error { defaultArgs := []string{ "destroy", "-force", fmt.Sprintf("-state=%s.tfstate", state), } extraArgs = append(extraArgs, templateDir) args := append(defaultArgs, extraArgs...) return terraformExec(clusterDir, args...) }
[ 0.2653888165950775, 0.7542909383773804, 0.43813785910606384, -0.25322872400283813, 0.5901610255241394, -0.3282468616962433, -0.08394533395767212, 0.6634811758995056, -0.4858628213405609, 0.2760469317436218, 0.4031597971916199, -0.01350664533674717, -0.5343549847602844, 0.3959473669528961, ...
func Init(clusterDir, templateDir string) error { return terraformExec(clusterDir, "init", templateDir) }
[ -0.34830766916275024, 0.41730013489723206, 0.18801529705524445, -0.27656087279319763, 0.331769734621048, -0.011396639980375767, 0.5166507363319397, 0.7742148041725159, -1.2507485151290894, -0.1688503623008728, 0.23929889500141144, 1.3869527578353882, 0.413215696811676, 0.4246801733970642, ...
func HasStateFile(stateDir string, stateFile string) bool { stepStateFile := filepath.Join(stateDir, fmt.Sprintf("%s.tfstate", stateFile)) _, err := os.Stat(stepStateFile) return !os.IsNotExist(err) }
[ 0.5910724401473999, -0.36466455459594727, 0.5925064086914062, -0.42014840245246887, 0.16904370486736298, 0.32456690073013306, 0.38705992698669434, 0.8033286929130554, -1.4914880990982056, 0.17896310985088348, -0.09093233197927475, -1.1987788677215576, 0.22020204365253448, 1.330895900726318...
func FindStepTemplates(dir, stepName string, platform config.Platform) (string, error) { stepDir := filepath.Join(dir, stepsBaseDir, stepName) for _, path := range []string{ filepath.Join(stepDir, string(platform)), stepDir} { stat, err := os.Stat(path) if err != nil { if os.IsNotExist(err) { continue...
[ -0.4023958444595337, -0.5873462557792664, 0.7859567999839783, 0.444460928440094, -0.5422938466072083, -0.2485429346561432, 0.6660211682319641, -0.6924682855606079, -0.6709842085838318, 0.3116426467895508, -0.09363032132387161, -1.2975456714630127, -0.5865061283111572, 1.6557408571243286, ...
func BaseLocation() (string, error) { ex, err := os.Executable() if err != nil { return "", fmt.Errorf("undetermined location of own executable: %s", err) } ex = filepath.Dir(ex) // TODO(yifan): Hardcode the parent dir name for now. if filepath.Base(ex) != "installer" { return "", fmt.Errorf("%s executable in...
[ 0.21762822568416595, -0.9113191366195679, 0.7167105078697205, 0.2132544070482254, -0.4923783242702484, 0.14815084636211395, 1.8193141222000122, 0.2432144284248352, -0.05360402539372444, -0.12484711408615112, 1.0788495540618896, 0.06515282392501831, -0.1042863056063652, -0.03719451278448105...
func GetOriginalDST(conn *net.TCPConn) (*net.TCPAddr, error) { return conn.LocalAddr().(*net.TCPAddr), nil }
[ 0.687354326248169, -0.20485514402389526, 0.4826340675354004, -1.0892717838287354, -1.110777497291565, -0.30144017934799194, -0.3619643747806549, 0.829755425453186, -0.09368883073329926, -0.10830492526292801, 0.37866348028182983, 0.6297651529312134, 0.5854646563529968, -0.6568334698677063, ...
func SimpleRemoveDuplicates(arr []int) []int { //.. pocket := make([]int, 0) pocket = append(pocket, arr...) for index, num := range pocket { if contains(pocket, num) == true { fmt.Println("pocket: ", pocket) fmt.Println("pocket[index]: ", pocket[index:]) pocket = pocket[index:] } } // for _, item ...
[ -0.4291505515575409, -1.0312564373016357, 0.9189347624778748, -0.3678351938724518, -0.29635363817214966, -0.006622458808124065, 0.4743346869945526, -0.4051024317741394, 1.0208669900894165, 0.11325075477361679, -0.584170401096344, 0.3955514430999756, -0.49915140867233276, -0.070038743317127...
func New() *Employee { return new(Employee) }
[ 0.2365652620792389, -1.4524441957473755, -0.11233490705490112, 0.44574856758117676, -1.1799287796020508, 0.38042452931404114, -0.5545448660850525, 0.43356257677078247, -0.5991074442863464, -0.8019132018089294, -0.3493867814540863, 0.5145626068115234, 0.13613611459732056, 0.3711050152778625...