text
stringlengths
3.08k
10.4k
// Package packets make up the MQTT control packets and // their core functionality. package packets import ( "bytes" "encoding/binary" "fmt" "io" "github.com/rs/zerolog/log" ) const MQTT3 = 4 // 0000100 in binary var ( defaultKeepAlive = encodeUint16(60) defaultMessageId = encodeUint16(1) ) // Packet is th...
package world import ( "database/sql" "gonet/base" "gonet/common" "gonet/common/cluster" "gonet/db" "gonet/network" "gonet/rd" "gonet/rpc" "gonet/server/message" "log" "github.com/golang/protobuf/proto" ) type ( ServerMgr struct { m_pService *network.ServerSocket m_pCluster *cluster.Cluster m_p...
// Copyright (c) 2018 Uber Technologies, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law ...
package slowest import ( "fmt" "go/ast" "go/format" "go/parser" "go/token" "os" "strings" "golang.org/x/tools/go/packages" "gotest.tools/gotestsum/log" "gotest.tools/gotestsum/testjson" ) func writeTestSkip(tcs []testjson.TestCase, skipStmt ast.Stmt) error { fset := token.NewFileSet() cfg := packages.Con...
/* Copyright 2016 The Kubernetes Authors All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ag...
package report import ( "encoding/json" "fmt" "os/exec" "sort" "github.com/rancherfederal/security-scan/pkg/kb-summarizer/summarizer" "github.com/sirupsen/logrus" ) type NodeType string const ( NodeTypeEtcd NodeType = "etcd" NodeTypeMaster NodeType = "master" NodeTypeNode NodeType = "node" ) type Stat...
package oidc import ( "encoding/json" "fmt" "time" "gopkg.in/square/go-jose.v2" ) const ( //GrantTypeCode defines the grant_type `authorization_code` used for the Token Request in the Authorization Code Flow GrantTypeCode GrantType = "authorization_code" //GrantTypeRefreshToken defines the grant_type `refres...
/* Copyright © 2021 NAME HERE <EMAIL ADDRESS> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writi...
package pluginaction import ( "io/ioutil" "os" "path/filepath" "sort" "strings" "code.cloudfoundry.org/cli/api/plugin" "code.cloudfoundry.org/cli/util/configv3" "code.cloudfoundry.org/cli/util/generic" "code.cloudfoundry.org/gofileutils/fileutils" ) //go:generate counterfeiter . PluginMetadata type PluginM...
package main //@Author: <NAME> import ( "fmt" "crypto/rand" "crypto/tls" "math/big" "os/exec" "net" "log" "strings" "strconv" "sync" ) //Each nodeId is mapped to one of these structs //Also storageAvailable is in GB type NodeData struct { ip string key string storageAvailable float64 } //Global variabl...
package git // github.com/src-d/go-git import ( "encoding/hex" "fmt" "os" "path" "strings" "golang.org/x/crypto/ssh" gogit "gopkg.in/src-d/go-git.v4" gogitConfig "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/transport" ssh2 "gopkg.in/src-d/go-git....
package v1_test import ( "context" "errors" "fmt" "io" "sort" "strings" "testing" "time" v1 "github.com/authzed/authzed-go/proto/authzed/api/v1" "github.com/authzed/grpcutil" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/authzed/spicedb...
package filecount import ( "fmt" "os" "path/filepath" "time" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal" "github.com/influxdata/telegraf/internal/globpath" "github.com/influxdata/telegraf/plugins/inputs" ) const sampleConfig = ` ## Directory to gather stats about. ## depr...
package views import ( "html/template" "net/http" "github.com/go-martini/martini" "github.com/martini-contrib/binding" "github.com/martini-contrib/cors" "github.com/martini-contrib/csrf" "github.com/martini-contrib/render" "github.com/martini-contrib/sessionauth" "github.com/martini-contrib/sessions" // "gi...
package api import ( "bytes" "errors" "fmt" "strconv" "strings" "time" "encoding/base64" "encoding/json" "io/ioutil" "net/http" "github.com/Sirupsen/logrus" "github.com/emicklei/go-restful" ps "github.com/AcalephStorage/kontinuous/pipeline" "github.com/AcalephStorage/kontinuous/scm" "github.com/Acal...
// Copyright Project Harbor Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed t...
package nrgorm import ( "fmt" "strings" "github.com/jinzhu/gorm" newrelic "github.com/newrelic/go-agent" ) const ( txnGormKey = "newrelicTransaction" startTimeKey = "newrelicStartTime" ) // SetTxnToGorm sets transaction to gorm settings, returns cloned DB func SetTxnToGorm(txn newrelic.Transaction, db *gorm...
package befunge import ( "fmt" "io" "math/rand" "os" "strconv" ) // Runner befunge runner. type Runner struct { Scanner stack []int input io.Reader output io.Writer step func() debug bool errors []error randFunc func(n int) int } // NewRunner create a new befunge codes runner. func NewR...
package zookeeper import ( "context" "errors" "fmt" "math/rand" "strings" "sync" "time" "github.com/hack0072008/go-libs/log" "github.com/samuel/go-zookeeper/zk" ) type ZkConn struct { Addr string conn *zk.Conn } var ( ZkConnPoolMu sync.Mutex ZkConnPool = make(map[string]*ZkConn, 1) ErrInvalidSev =...
package nats import ( "reflect" "strconv" "sync" "time" "github.com/jirenius/timerqueue" nats "github.com/nats-io/go-nats" "github.com/resgateio/resgate/logger" "github.com/resgateio/resgate/server/mq" ) const ( natsChannelSize = 256 ) const logPrefix = "[NATS] " // Client holds a client connection to a n...
// Copyright 2018 ProximaX Limited. All rights reserved. // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. package sdk import ( "fmt" "testing" "github.com/json-iterator/go" "github.com/proximax-storage/go-xpx-utils/mock" "github.com/proximax-storage/go-x...
package os import ( "github.com/goldentigerindia/profiling-agent/util" "log" "strconv" "strings" ) type CpuStat struct { Cores []CoreStat } type CoreStat struct { Core string User int64 Nice int64 System int64 Idle int64 Iowait int64 HardIrq int64 Softirq int...
package types import ( "bytes" "context" "encoding/gob" "net/http" validation "github.com/go-ozzo/ozzo-validation/v4" "gitlab.com/verygoodsoftwarenotvirus/todo/internal/authorization" "gitlab.com/verygoodsoftwarenotvirus/todo/internal/observability/keys" "gitlab.com/verygoodsoftwarenotvirus/todo/internal/obs...
/* Piraeus Operator Copyright 2019 LINBIT USA, LLC. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
// Copyright 2013 M-Lab // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, s...
package mysqldump const ( binary = "mysqldump" ) type Options struct { Flags *Flags AdditionalArgs []string } type Flags struct { BindAddress string `flag:"--bind-address="` CharacterSetsDir string `flag:"--character-sets-dir="` CompressAlgorithms string `flag:"-...
package stringutil import ( "errors" "fmt" "github.com/meshplus/gosdk/kvsql/util/hack" ) // ErrSyntax indicates that a value does not have the right syntax for the target type. var ErrSyntax = errors.New("invalid syntax") const ( // PatMatch is the enumeration value for per-character match. PatMatch = iota + 1 ...
// Copyright 2018 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable ...
package telemetry import ( "encoding/json" "github.com/devtron-labs/devtron/internal/sql/repository" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" util2 "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/cluster" "github.com/devtron-labs/devtron/pkg/us...
// Copyright 2016-2021, Pulumi Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
package cmd import ( "fmt" "github.com/RadhiFadlillah/go-readability" "github.com/s-frostick/shiori/model" "github.com/s-frostick/ytdl" "github.com/spf13/cobra" nurl "net/url" "os" "strings" "time" ) var ( addCmd = &cobra.Command{ Use: "add url", Short: "Bookmark the specified URL", Args: cobra.Exa...
// // Copyright (C) 2021 IOTech Ltd // // SPDX-License-Identifier: Apache-2.0 package transformer import ( "fmt" "math" "testing" "github.com/stretchr/testify/assert" ) func Test_validateWriteMaximum(t *testing.T) { tests := []struct { name string value interface{} max string expec...
package schedule import ( "bytes" "encoding/json" "errors" "math" "time" ) type TaskState uint8 // 所有的任务状态 // 前五种状态为过渡状态, 表示正在从一个状态往另一个状态迁移, 正在等待 TaskBroker 分发. const ( // 新任务加入队列, 等待执行中 TaskStateInitialize TaskState = iota // 任务启动中 TaskStateStarting // 任务停止中 TaskSateStopping // 任务重启中 TaskStateRebootin...
package main import ( "flag" "fmt" "log" "math/rand" "regexp" "strings" "time" "github.com/BurntSushi/toml" ) var help = `rps plays rock-paper-scissors with optional addition weapons. Usage: rps [-h] [game] -h display help. game is a game description file in TOML (https://github.com/mojombo/toml). ...
package miner import ( "math" "sort" "github.com/filecoin-project/go-bitfield" "golang.org/x/xerrors" ) // Maps deadlines to partition maps. type DeadlineSectorMap map[uint64]PartitionSectorMap // Maps partitions to sector bitfields. type PartitionSectorMap map[uint64]bitfield.BitField // Check validates all b...
package horovodjob import ( "fmt" volcanov1alpha1 "github.com/volcano-sh/volcano/pkg/apis/batch/v1alpha1" hykufev1alpha1 "hykufe-operator/pkg/apis/hykufe/v1alpha1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" ) func (r *Reco...
package test import ( "fmt" "github.com/Jeffail/benthos/v3/lib/message" "github.com/Jeffail/benthos/v3/lib/message/metadata" "github.com/Jeffail/benthos/v3/lib/processor" "github.com/Jeffail/benthos/v3/lib/types" yaml "gopkg.in/yaml.v3" ) //----------------------------------------------------------------------...
// Copyright (c) 2015 Monetas. // Copyright 2016 <NAME>. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. package main import ( "sync" "time" "github.com/DanielKrawisz/bmd/database" "github.com/DanielKrawisz/bmd/rpc" pb "github.com/DanielKrawisz/bmd/rpcproto" "...
package irma import ( "log" "sync" "github.com/go-errors/errors" "github.com/jinzhu/gorm" "github.com/privacybydesign/gabi/revocation" "github.com/sirupsen/logrus" ) type ( // sqlRevStorage is a wrapper around gorm, storing any record type in a SQL database, // for use by revocation servers. sqlRevStorage s...
// Copyright 2013-2016 <NAME>. All rights reserved // Use of this source code is governed by the MIT license // that can be found in the LICENSE file. package controllers import ( "math" "net/http" "strconv" "github.com/adampresley/GoHttpService" "github.com/adampresley/logging" "github.com/mailslurper/libmail...
// Copyright 2019 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to i...
package opentelemetrycollector import ( "context" "fmt" monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/go-logr/logr" "github.com/spf13/viper" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "github.c...
// Copyright 2020 <NAME>. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package main import ( "bytes" "flag" "html/template" "io/ioutil" "os" "path/filepath" "strings" "testing" "time" "github.com/derat/htmlpretty" "github.com...
// Package lg provides looking glass methods for selected looking glasses // Cogent Carrier Looking Glass ASN 174 package lg import ( "bufio" "errors" "io/ioutil" "net/http" "net/url" "regexp" "sort" "strings" ) // A Cogent represents a telia looking glass request type Cogent struct { Host string IPv str...
package lmdb /* #include <stdlib.h> #include <stdio.h> #include "lmdb.h" */ import "C" import ( "math" "runtime" "unsafe" ) // Database Flags for OpenDBI. const ( ReverseKey = C.MDB_REVERSEKEY // use reverse string keys DupSort = C.MDB_DUPSORT // use sorted duplicates IntegerKey = C.MDB_INTEGERKEY // num...
package jobsd import ( "database/sql" "sync" "sync/atomic" "testing" "time" "github.com/simpleframeworks/testc" "github.com/sirupsen/logrus" "syreclabs.com/go/faker" ) func TestRunnableLock(test *testing.T) { t := testc.New(test) jobName := "TestRunnableLock" t.Given("a JobsD instance") jd := testSetup...
package timetable import ( "encoding/json" "errors" "github.com/buger/jsonparser" "github.com/julienschmidt/httprouter" "io/ioutil" "mynsb-api/internal/quickerrors" "mynsb-api/internal/sessions" "mynsb-api/internal/util" "net/http" "regexp" "strconv" "path/filepath" ) // Datastructure for holding a c...
package handler import ( "encoding/json" "fmt" "io/ioutil" "log" "net/http" // blank import is for adding swagger docs _ "github.com/amila-ku/shoppingpal/api/docs" "github.com/amila-ku/shoppingpal/pkg/entity" store "github.com/amila-ku/shoppingpal/pkg/store" "github.com/gorilla/mux" swagger "github.com/swa...
// This file is subject to a 1-clause BSD license. // Its contents can be found in the enclosed LICENSE file. package spirv import "fmt" // OpConstantTrue declares a true Boolean-type scalar constant. type OpConstantTrue struct { ResultType Id ResultId Id } func (c *OpConstantTrue) Opcode() uint32 { return opco...
package server import ( "bytes" "context" "encoding/json" "fmt" "io" "log" "os" "strconv" "github.com/Sirupsen/logrus" "github.com/cncd/logging" "github.com/cncd/pipeline/pipeline/rpc" "github.com/cncd/pubsub" "github.com/cncd/queue" "github.com/gin-gonic/gin" "github.com/drone/drone/model" "github.c...
package main import ( "errors" "fmt" "net/http" "strconv" "time" "github.com/devfeel/dotweb" "github.com/devfeel/dotweb/framework/exception" "github.com/devfeel/dotweb/session" ) func main() { defer func() { var errmsg string if err := recover(); err != nil { errmsg = exception.CatchError("main", do...
// Copyright 2021 VMware, Inc. // SPDX-License-Identifier: BSD-2-Clause package main import ( "bufio" "fmt" "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/storage/memory" "log" "os" "os/exec" "path/filepath" "runtime" "sort" "strings" "sync" ) var ( GO...
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ast import "go/token" func filterIdentList(list []*Ident) []*Ident { j := 0; for _, x := range list { if x.IsExported() { list[j] = x; j++;...
package utils import ( "context" "fmt" "time" "github.com/ipfs/go-blockservice" "github.com/ipfs/go-cid" "github.com/ipfs/go-graphsync" gsimpl "github.com/ipfs/go-graphsync/impl" "github.com/ipfs/go-graphsync/network" "github.com/ipfs/go-graphsync/storeutil" blockstore "github.com/ipfs/go-ipfs-blockstore" ...
// Copyright 2018 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License...
package template import "container/list" // LFUCache define type LFUCache struct { nodes map[int]*list.Element lists map[int]*list.List capacity int min int } type node struct { key int value int frequency int } // Constructor define func Constructor(capacity int) LFUCache { return LFUC...
// DO NOT EDIT. Generated by 'gorums' plugin for protoc-gen-go // Source file to edit is: calltype_correctable_prelim_tmpl package dev import ( "io" "sync" "golang.org/x/net/context" ) /* Exported types and methods for correctable prelim method ReadPrelim */ // ReadPrelimReply is a reference to a correctable qu...
package bagins /* "Faithless is he that says farewell when the road darkens." - Gimli */ import ( "fmt" "hash" "io" "os" "path/filepath" "strings" ) // Payloads describes a filepath location to serve as the data directory of // a Bag and methods around managing content inside of it. type Payload struct { d...
// Package server provides rest-like api and serves static assets as well package server import ( "net/http" "path/filepath" "strings" "time" "github.com/didip/tollbooth" "github.com/didip/tollbooth_chi" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" "github.com/go-chi/render" "github.com/pkg/er...
package ilium import "math" type DiffuseAreaLightSamplingMethod int const ( DAL_UNIFORM_SAMPLING DiffuseAreaLightSamplingMethod = iota DAL_COSINE_SAMPLING DiffuseAreaLightSamplingMethod = iota ) type DiffuseAreaLight struct { samplingMethod DiffuseAreaLightSamplingMethod emission Spectrum shapeSet ...
package main import ( "bytes" "encoding/json" "fmt" flags "github.com/jessevdk/go-flags" "io/ioutil" "log" "net/http" "os" "strings" "time" ) var ( version string date string ) type Options struct { Channel string `short:"C" long:"channel" description:"slack channel to post"` UseAttach ...
package sectorbuilder import ( "encoding/binary" "io" "os" "sort" "sync" "unsafe" sectorbuilder "github.com/filecoin-project/go-sectorbuilder" logging "github.com/ipfs/go-log" "github.com/filecoin-project/lotus/chain/address" ) var log = logging.Logger("sectorbuilder") type SectorSealingStatus = sectorbu...
// Code generated by go-swagger; DO NOT EDIT. package routing // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "net/http" "time" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/...
/* Copyright (c) 2018 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed t...
// Copyright (c) 2019 Uber Technologies, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law o...
package yices2 // These are the go versions of the yices_types.h error_code (code <= 100 constants: Errors in type or term construction) const ( NoError ErrorCodeT = iota ErrorInvalidType ErrorInvalidTerm ErrorInvalidConstantIndex ErrorInvalidVarIndex // Not used anymore ErrorInvalidTupleIndex ErrorInvalidRatio...
package projects import ( "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/pagination" ) // List returns a Pager which allows you to iterate over a collection of // projects. func List(c *gophercloud.ServiceClient) pagination.Pager { return pagination.NewPager(c, listURL(c), func(r paginati...
package mssqlclrgeo import ( "bytes" "fmt" ) // http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm // https://github.com/postgis/postgis/blob/2.1.0/doc/ZMSgeoms.txt // http://www.opengeospatial.org/standards/sfs type wkbByteOrder uint8 const ( wkbXDR wkbByteOrder = 0 // Big Endian wkbNDR wk...
package addr import ( "encoding/binary" "fmt" "net" "strconv" "strings" pb "github.com/linkerd/linkerd2-proxy-api/go/net" l5dNetPb "github.com/linkerd/linkerd2/controller/gen/common/net" ) // DefaultWeight is the default address weight sent by the Destination service // to the Linkerd proxies. const DefaultWe...
package token // Token : type that stores dito tokens its string method // converts there int forms into human readable output. type Token uint // Token constants defined by the dito programming language. // Tokens that are included but not currently implemented are // marked with a 'n.a.' const ( EOF Token = io...
package device import ( "fmt" deviceConfig "github.com/lxc/lxd/lxd/device/config" "github.com/lxc/lxd/lxd/instance" "github.com/lxc/lxd/lxd/state" ) // devTypes defines supported top-level device type creation functions. var devTypes = map[string]func(deviceConfig.Device) device{ "nic": nicLoadByType, "...
// +build wasi package syscall // https://github.com/WebAssembly/wasi-libc/blob/main/expected/wasm32-wasi/predefined-macros.txt type Signal int const ( SIGCHLD = 16 SIGINT = 2 SIGKILL = 9 SIGTRAP = 5 SIGQUIT = 3 SIGTERM = 15 ) const ( Stdin = 0 Stdout = 1 Stderr = 2 ) const ( __WASI_OFLAGS_CREAT = 1...
package mvcc import ( "context" "reflect" "sort" "strconv" "testing" "time" "github.com/davecgh/go-spew/spew" "github.com/treeverse/lakefs/catalog" "github.com/treeverse/lakefs/testutil" ) func TestCataloger_GetCommit(t *testing.T) { ctx := context.Background() c := testCataloger(t) defer func() { _ = c....
package main // Fair bit taken from https://github.com/kjk/go-cookbook/blob/master/free-ssl-certificates/main.go (public domain) // To run: // go run main.go // Command-line options: // -production : enables HTTPS on port 443 import ( "context" "crypto/rand" "crypto/tls" "flag" "fmt" "io" "log" "net/http" ...
// Code generated by go-swagger; DO NOT EDIT. package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "strconv" strfmt "github.com/go-openapi/strfmt" "github.com/go-openapi/errors" "github.com/go-openapi/swag" ...
package nodemaintenance import ( "fmt" "math" "time" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/kubernetes/pkg/kubectl/drain" ) func runCordonOrUncordon(r *ReconcileNodeMaintenance, no...
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
package main import ( "fmt" "log" "strings" "github.com/nlopes/slack" ) func joinText(first string, second string, divider string) string { if first == "" { return second } if second == "" { return first } return first + divider + second } func eventHandler(ctx *IrcContext, rtm *slack.RTM) { log.Print...
package driver import ( "encoding/binary" "fmt" "log" "math/rand" "os" "syscall" "time" "unsafe" ) const ( hugePageBits = 21 hugePageSize = 1 << hugePageBits sizePktBufHeadroom = 40 ) //PktBuf bundles the raw byte representation of a buffer with the corresponding mempool ty...
/* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, ...
// Tests for general parse functions. package parse import ( "github.com/stretchr/testify/assert" "github.com/thought-machine/please/src/core" "testing" "time" ) func TestAddDepSimple(t *testing.T) { // Simple case with only one package parsed and one target added state := makeState(true, false) activateTarge...
// cosine palettes, based on // http://www.iquilezles.org/www/articles/palettes/palettes.htm package main import ( "image" "log" "math" "os" "runtime" "github.com/qeedquan/go-media/math/f64" "github.com/qeedquan/go-media/sdl" "github.com/qeedquan/go-media/sdl/sdlimage/sdlcolor" ) const ( W ...
package database //nolint:goimports import ( "context" "fmt" "time" "github.com/google/uuid" "github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/services/serviceaccounts" "github.com/grafana/grafana/pkg/services/sqlstore" "xorm.io/xorm" ) type S...
package syntax import ( "errors" "fmt" "github.com/jrecuero/go-cli/graph" "github.com/jrecuero/go-cli/tools" ) // NSManager represents the namespace manager. // It is in charge to manage the active namespace, it will provides operation // to settle all namespace commands properly and to find commands based on th...
// Copyright (c) Facebook, Inc. and its affiliates. // All rights reserved. // This source code is licensed under the BSD-style license found in the // LICENSE file in the root directory of this source tree. package main import ( "context" "encoding/json" "io/ioutil" "os/exec" "sync" "time" "github.com/golan...
package api import ( "encoding/json" "errors" "github.com/imroc/req" "github.com/patrickmn/go-cache" ) // GetContainerId of uid func (api *WeiboAPI) GetContainerId(uid string) (string, error) { key := "weibo:containerid:" + uid if value, found := api.cache.Get(key); found { return value.(string), nil } res...
package main import ( "log" "time" "capact.io/capact/internal/k8s-engine/policy" "capact.io/capact/internal/graphqlutil" "capact.io/capact/internal/k8s-engine/controller" domaingraphql "capact.io/capact/internal/k8s-engine/graphql" "capact.io/capact/internal/k8s-engine/graphql/namespace" "capact.io/capact/in...
package packet import ( "context" "errors" "math/rand" "time" "github.com/jinzhu/gorm" "github.com/shopspring/decimal" ) type Mode int const ( _ Mode = iota // 普通红包,平均分配 Normal // 手气红包 Luck ) var ( // 红包已抢光 ErrExhausted = errors.New("packet: exhausted") // 单个红包最小金额 // 创建红包的时候需要检查平均金额不能小于这个数 minimu...
package github import ( "context" "fmt" "log" "sync" "github.com/avast/retry-go" api "github.com/google/go-github/v28/github" "github.com/vrutkovs/todohub/pkg/issue" "github.com/vrutkovs/todohub/pkg/storage" "golang.org/x/oauth2" ) // ParallelWorkers is a number of worker threads run in parallel const Paral...
// Copyright 2019 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package hwsec import ( "bytes" "context" "time" apb "chromiumos/system_api/attestation_proto" "chromiumos/tast/common/hwsec" "chromiumos/tast/e...
// Copyright 2013 Masterminds // This package provides the execution context for a Cookoo request. package cookoo import ( "bytes" "log" "reflect" "regexp" "runtime" "testing" ) // An example datasource as can add to our store. type ExampleDatasource struct { name string } // A simple equal function. func eq...
// Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 // protoc v3.17.0 // source: echo.proto package echo import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" ) con...
package herschel import ( "fmt" "image/color" "log" "reflect" ) // Table represents 2 dimension cells. type Table struct { cols int rows int values map[int]map[int]interface{} backgroundColors map[int]map[int]color.Color numberFormats map[int]map[int]string numberFo...
// Copyright (c) 2019 <NAME> <<EMAIL>> // MIT Licence applies http://opensource.org/licenses/MIT // +build mage package main import ( "fmt" "os" "path/filepath" "github.com/deanishe/awgo/util" "github.com/deanishe/awgo/util/build" "github.com/magefile/mage/mg" "github.com/magefile/mage/sh" ) // Default targ...
package main import ( "fmt" m2common "github.com/fclairamb/m2mp/go/m2mp-common" m2log "github.com/fclairamb/m2mp/go/m2mp-log" msg "github.com/fclairamb/m2mp/go/m2mp-messaging" "net" "os" "strconv" "strings" "sync" "time" ) type Server struct { sync.RWMutex listener net.Listener clients *m2comm...
package vo import "github.com/xudai3/feishu-sdk-golang/core/consts" // 消息卡片数据类型定义 // 模块 type CardModuleContent struct { Tag string `json:"tag"` Text *CardObjText `json:"text"` Fields []CardObjField `json:"fields"` Extra interface{} `json:"extra,omitempty"` } type CardModuleHr struct { Tag string `json...
/* Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ package couchdb import ( "bytes" "encoding/hex" "net" "net/http" "net/url" "regexp" "strconv" "strings" "time" "github.com/mcc-github/blockchain/common/metrics" "github.com/mcc-github/blockchain/common/util" "github.com/pk...
// Copyright 2015 Google Inc. All Rights Reserved. // This file is available under the Apache license. package watcher import ( "expvar" "fmt" "os" "path/filepath" "sync" "time" "github.com/fsnotify/fsnotify" "github.com/golang/glog" "github.com/pkg/errors" ) var ( eventCount = expvar.NewMap("log_watcher_...
//go:generate struct-markdown package common import ( "context" "encoding/hex" "errors" "fmt" "strings" "github.com/hashicorp/packer/template/interpolate" ) // By default, Packer will symlink, download or copy image files to the Packer // cache into a "`hash($iso_url+$iso_checksum).$iso_target_extension`" fil...