text
stringlengths
11
4.05M
package resourcemanager import ( "coffeeMachine/src/entities" "context" "github.com/stretchr/testify/assert" "sync" "testing" ) func TestNew(t *testing.T) { tests := []struct { name string assert func(repository Repository) }{ { name: "success | get repository", assert: func(repository Repository...
/* Copyright 2020 The Skaffold 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, sof...
package odoo import ( "fmt" ) // FetchmailServer represents fetchmail.server model. type FetchmailServer struct { LastUpdate *Time `xmlrpc:"__last_update,omptempty"` ActionId *Many2One `xmlrpc:"action_id,omptempty"` Active *Bool `xmlrpc:"active,omptempty"` Attach *Bool `xmlr...
package sqs import ( "fmt" "strings" "github.com/xidongc/qproxy/rpc" ) const sepChar = "_" const forwardSlash = "/" func QueueIdToName(id *rpc.QueueId) *string { url := strings.Join([]string{id.Namespace, id.Name}, sepChar) return &url } func QueueUrlToQueueId(url string) (*rpc.QueueId, error) { // Example u...
package main //Invalid //Checks if length of expression list in LHS and RHS is equal func f() { var a1, a2 int ; a1, a2 = 3, 4, 5 }
package lc208 import ( "strings" ) type Trie struct { Value string Son *map[string]*Trie End bool // 是否是个单词 } /** Initialize your data structure here. */ func Constructor() Trie { return Trie{Value: "*", Son: &map[string]*Trie{}} } /** Inserts a word into the trie. */ func (this *Trie) Insert(word string) ...
package main import ( "fmt" "syscall" "unsafe" "golang.org/x/sys/windows" ) type NamedPipeNegotiator struct { Name string } func (negotiator NamedPipeNegotiator) Serve() NegotiatorResult { var sd windows.SECURITY_DESCRIPTOR pipeName := "\\\\.\\pipe\\" + negotiator.Name _, _, err := initializeSecurityDescri...
package pipelinetotaskrun import ( "fmt" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ) func getMergedTaskRun(run *v1alpha1.Run, pSpec *v1beta1.PipelineSpec, taskSpecs map[string]*v1beta1.TaskSpec) (*v1beta1.TaskRun, error) { sequence, err := p...
package config import ( "bufio" "os" ) func ReadLineFile(fileName string) []string{ res := make([]string,0) if file, err := os.Open(fileName);err !=nil{ panic(err) }else { scanner := bufio.NewScanner(file) for scanner.Scan(){ res = append(res,scanner.Text()) } } return res }
package network import ( "github.com/johnnyeven/terra/dht" "reflect" ) type PeerManager struct { peers *dht.SyncedMap } func NewPeerManager() *PeerManager { return &PeerManager{ peers: dht.NewSyncedMap(), } } func (pm *PeerManager) Get(peerID []byte) (*Peer, bool) { val, ok := pm.peers.Get(string(peerID)) ...
/* Copyright 2021-2023 ICS-FORTH. 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, software...
package script import ( "bytes" "testing" ) var s = Script([]command{ OP_1, OP_2, OP_2DUP, OP_EQUAL, OP_NOT, OP_VERIFY, OP_SHA1, OP_SWAP, OP_SHA1, OP_EQUAL, }) func TestScriptMarshal(t *testing.T) { buf, _ := s.Marshal() if !bytes.Equal(buf, []byte{10, 81, 82, 110, 135, 145, 105, 167, 124, 167, 135}) {...
package main import ( "binary_tree/tree" "flag" "fmt" "math/rand" "os" "time" ) func main() { graphViz := flag.Bool("g", false, "GraphViz dot output on stdout") n := flag.Int("n", 5, "number of nodes in random tree") nonrandvals := flag.Bool("r", false, "use sequential node values") flag.Parse() rand.Seed...
package main import ( "github.com/kelseyhightower/envconfig" ) // Specification are env variables used by ems // split_words is used by envconfig type Specification struct { MinioAccessKey string `split_words:"true"` MinioSecretKey string `split_words:"true"` MinioEndpoint string `split_words:"true"`...
package main import ( "fmt" "net/http" "github.com/instantup/greeting" ) func main() { http.HandleFunc("/hello", HelloHandler) if err := http.ListenAndServe(":8080", nil); err != nil { fmt.Println(err) } } func HelloHandler(writer http.ResponseWriter, request *http.Request) { query := request.URL.Query() ...
// Copyright 2019 The gVisor 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 agree...
package main import ( "fmt" tree "github.com/adadesions/goalgo/trees/tree" ) func main() { rootNode := tree.Node{Data: 92} left1 := tree.Node{Data: 100} right1 := tree.Node{Data: 108} rootNode.Left = &left1 rootNode.Right = &right1 fmt.Println(rootNode) }
package core import ( "testing" "github.com/sirupsen/logrus" ) type TestService struct{ config *ServiceConfig } func (ts *TestService) Name() string { return "Test-" + ts.config.GetString("key") } func (ts *TestService) Init(_ *Node, config *ServiceConfig) error { ts.config = config return nil } func (ts *TestS...
//go routines package main import ( "fmt" "net/http" "sync" "time" ) func returnType(url string) { fmt.Printf(time.Now().String()) resp, err := http.Get(url) if err != nil { fmt.Printf("error: %s\n", err) return } defer resp.Body.Close() ctype := resp.Header.Get("content-type") fmt.Printf("%s -> %s\n"...
// Copyright 2016 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
package main import "vncproxy/proxy" import "flag" import "vncproxy/logger" import "os" func main() { //create default session if required var tcpPort = flag.String("tcpPort", "", "tcp port") var wsPort = flag.String("wsPort", "", "websocket port") var vncPass = flag.String("vncPass", "", "password on incoming vn...
package main import ( "fmt" "net" "go_code/restudy/netstudy/netstudy03/common/utils" "go_code/restudy/netstudy/netstudy03/common/message" "go_code/restudy/netstudy/netstudy03/server/process" ) func main() { listen, err := net.Listen("tcp", ":8888") if err != nil { fmt.Println("服务器创建监听失败", err) return } f...
package server import ( "net" "time" socket "github.com/mohamedmahmoud97/Zuper-UDP/socket" ) //SR is the algorithm of selective-repeat func SR(packets []socket.Packet, noChunks int, conn *net.UDPConn, addr *net.UDPAddr, window int, plp float32, AckCheck chan uint32) { var ackPack = make(map[int]int) var pckTime...
package main import ( "fmt" "io/ioutil" "log" "os" "path" "path/filepath" "sync" "time" ) func main() { files, err := ioutil.ReadDir(".") if err != nil { log.Fatal(err) } wg := sync.WaitGroup{} for _, file := range files { wg.Add(1) go walk(file.Name(), &wg) } wg.Wait() } func walk(root string,...
package scheduling import ( "testing" "github.com/stretchr/testify/assert" "k8s.io/apimachinery/pkg/api/resource" "github.com/G-Research/armada/internal/common" "github.com/G-Research/armada/pkg/api" ) // 1 cpu per 1 Gb var scarcity = map[string]float64{"cpu": 1, "memory": 1.0 / (1024 * 1024 * 1024)} func Tes...
package bsc import ( commitmenttypes "github.com/bianjieai/tibc-sdk-go/commitment" tibctypes "github.com/bianjieai/tibc-sdk-go/types" ) var _ tibctypes.ClientState = (*ClientState)(nil) func (m ClientState) ClientType() string { return "008-bsc" } func (m ClientState) GetLatestHeight() tibctypes.Height { return...
// Copyright 2019 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, ...
package model // Rate request type Rate struct { User string `json:"user"` Item string `json:"item"` Score float64 `json:"score"` } // Recommendation response type Recommendation struct { Item string `json:"item"` Score float64 `json:"score"` } // Recommendations type type Recommendations struct { User s...
package dynatrace import ( "encoding/json" "fmt" "github.com/keptn-contrib/dynatrace-service/internal/common" "time" ) const sloPath = "/api/v2/slo" type SLOResult struct { ID string `json:"id"` Enabled bool `json:"enabled"` Name string `json:"name"` Descripti...
package arithmetic import ( "fmt" ) // mustBeUnique ensures a label is not registered in the functions, variables or aliases. func mustBeUnique(label string) { if _, ok := functions[label]; ok { panic(fmt.Sprintf("%s already defined as function", label)) } if _, ok := variables[label]; ok { panic(fmt.Sprint...
package model import ( "github.com/jinzhu/gorm" "time" ) //内容 type Content struct { Id int `gorm:"PRIMARY_KEY" json:"id" uri:"id"` //标识 CategoryId int `json:"category_id"` //分类标识 Title string `js...
package models type EntitySummary struct { CatalogItemId string `json:"catalogItemId"` Name string `json:"name"` Links map[string]URI `json:"links"` Id string `json:"id"` Type string `json:"type"` }
package set_test import ( //"testing" "log" "math/rand" "os" "github.com/lleo/go-functional-collections/key" "github.com/lleo/go-functional-collections/set" "github.com/lleo/stringutil" "github.com/pkg/errors" ) func init() { log.SetFlags(log.Lshortfile) var logFileName = "test.log" var logFile, err = os...
package scanner import ( "crypto/sha256" "regexp" "github.com/MagalixCorp/magalix-agent/v2/proto" "github.com/MagalixTechnologies/uuid-go" kv1 "k8s.io/api/core/v1" ) // Entity basic entity structure can be an application, a service or a container type Entity struct { ID uuid.UUID Name string Kind string ...
package models import ( "testing" ) func TestLog(t *testing.T) { Logs().Debug("Testlog debug") Logs().Info("Testlog Info") Logs().Warn("Testlog warning...") Logs().Error("Testlog Error...") }
/** * Copyright (c) 2018-present, MultiVAC Foundation. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package mvvm import ( "math" "github.com/perlin-network/life/compiler" ) var ( // mvvmGasPolicy is the gas policy for MVVM. ...
package odoo import ( "fmt" ) // ImLivechatReportOperator represents im_livechat.report.operator model. type ImLivechatReportOperator struct { LastUpdate *Time `xmlrpc:"__last_update,omptempty"` ChannelId *Many2One `xmlrpc:"channel_id,omptempty"` DisplayName *String `xmlrpc:"display_nam...
package exec import ( "github.com/cockroachdb/cockroach/pkg/sql/coltypes" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/petermattis/opttoy/v4/cat" ) type createTable struct { catalog *cat.Catalog tbl *cat.Table } func (ct *createTable) execute(stmt *tree.CreateTable) *cat.Table { tn, err ...
// Copyright 2020 Humility AI Incorporated, 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 ...
package main import ( "fmt" "sync" ) func return_tls() int64 func return_g() int64 func baseadd(x, y int64) int64 // 全局变量的使用 func getg() uint64 func address(pi *int) int // 解引用 pi 指针,返回值 func t_fp_sp() (int64, int64) // fp 和 sp 的关系 func t_for(a int64) int64 ...
package pipa import "github.com/Shopify/sarama" // -------------------------------------------------------------------- var _ Consumer = &testConsumer{} type testConsumer struct { messages chan *sarama.ConsumerMessage lastMark *sarama.ConsumerMessage } func newTestConsumer(messages ...sarama.ConsumerMessage) *te...
package main import ( "errors" "fmt" "os" "time" "github.com/aws/aws-lambda-go/lambda" "gopkg.in/pipe.v2" ) func runBackup() (string, error) { //Set Path for Lambda to call local executables os.Setenv("PATH", os.Getenv("PATH")+":"+os.Getenv("LAMBDA_TASK_ROOT")) //Set Vars var exitMessage string // Get E...
// Copyright 2019 Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in complian...
package structs import ( "encoding/json" ) // TeamStats holds performance statistics about a particular Team. type TeamStats struct { Streak struct { Series struct { StreakScope // defined in stats.go } `json:"series,omitempty"` Match struct { StreakScope // defined in stats.go } `json:"match,omitempt...
package keycloak import ( "context" "math/rand" "reflect" "strconv" "testing" keycloakv1alpha1 "github.com/agilesolutions/operator/apis/keycloak/v1alpha1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimach...
package server import ( "time" "github.com/elhamza90/lifelog/internal/domain" ) // JSONReqActivity is used to unmarshal a json activity type JSONReqActivity struct { ID domain.ActivityID `json:"id"` Label string `json:"label"` Desc string `json:"desc"` Place string ...
package v1 import ( "github.com/gin-gonic/gin" _ "github.com/hukaixuan/mall-backend/pkg/e" ) // @Summary Get user detail // @Produce json // @Param id path int true "ID" // @Success 200 {string} string 200 // @Failure 500 // @Router /api/v1/users/{id} [get] func GetUser(c *gin.Context) { } func Registe(c *gin.C...
// Copyright (C) 2019-2020 Zilliz. 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 l...
package main import ( "bufio" "fmt" "math" "os" "strconv" ) var in = bufio.NewScanner(os.Stdin) /** * https://open.kattis.com/problems/rationalsequence3 */ func main() { in.Split(bufio.ScanWords) N := NextInt() for i := 1; i <= N; i++ { NextInt() p, q := Solve(NextInt()) fmt.Printf("%d %d/%d\n", i, ...
package ipam import ( "encoding/json" "fmt" "net" "os" "strings" "github.com/nik-johnson-net/rackdirector/pkg/dhcpd" ) type HostAddressInfo struct { Hostname string Address net.IP Network net.IPNet Gateway net.IP DNS []net.IP DomainSearch string } type jsonIpamInterface struc...
package main import ( "path/filepath" "testing" ) func Test_ReadConfig(t *testing.T) { // Path does not exit. if _, err := ReadConfig("path-does-not-exist"); err == nil { t.Error("expect ReadConfig to return error when reading inexistence file") } // Invalid JSON config file files, err := filepath.Glob("tes...
package merge import ( "context" "flag" "log" "os" "strings" "github.com/google/go-github/v28/github" "github.com/variantdev/go-actions" ) type Action struct { BaseURL, UploadURL string Force bool Method string } type Target struct { Owner, Repo string PullRequest *github.PullRequest } func New() *Ac...
package main import ( "fmt" "math/rand" "time" ) func add(c chan int) { sum := 0 t := time.NewTimer(time.Second) for { select { case input := <-c: sum = sum + input // time.NewTimer()를 호출할 때 지정한 시간만큼 차이머의 c 채널을 블록시킴. // 지정된 시간이 만료되면 타이머는 t.C 채널로 값을 보냄. // 그 후 select문에서 이와 관련된 브랜치가 실행되면서 c 채널에 nil...
package main import( "fmt" "math/rand" "time" ) func main(){ rand.Seed(time.Now().UnixNano()) n:=0 for{ n++ i:=rand.Intn(4200) fmt.Println(i) if i%42==0 { break } } fmt.Printf("Saída após %d iterações.\n",n) } /* Quando geramos numeros aleatorios, é sempre importante configurar o valor conhecido ...
package error import "errors" var( ErrReflectNil = errors.New("can't reflect nil pointer") ErrReflectNonSlice = errors.New("can't reflect not slice object") )
package http import ( "net/http" "encoding/json" "io/ioutil" "strings" "fmt" "errors" "time" ) type HttpHandler func(params *Params)*WebResult type Route struct{ Handler HttpHandler Method string Path string Params []string } type Router struct{ RouteMap map[string]*Route } func (router *Router) ServeH...
package server import "github.com/go-playground/validator" type Login struct { Username string `validate:"required"` Knock []int `validate:"required"` } func (l *Login) Validate() error { return validator.New().Struct(l) }
package decider_test import ( "bytes" "encoding/json" "errors" "io" "log" "net/http" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pivotal-cf/brokerapi/v10/domain" "github.com/pivotal-cf/brokerapi/v10/domain/apiresponses" "github.com/pivotal-cf/on-demand-service-broker/broker/decider...
// Package influxunifi provides the methods to turn UniFi measurements into influx // data-points with appropriate tags and fields. package influxunifi import ( "crypto/tls" "fmt" "io/ioutil" "log" "strconv" "strings" "time" influx "github.com/influxdata/influxdb1-client/v2" "github.com/unpoller/poller" "gi...
package main import ( "pika/driver" "pika/pkg/logger" "pika/routers" "github.com/gin-gonic/gin" ) func main() { driver.InitDB() driver.InitRedis() logger.InitLogger() gin.SetMode(gin.ReleaseMode) g := gin.New() g = routers.Load(g) // ginpprof.Wrap(g) if err := g.Run(":8082"); err != nil { logger....
package v1alpha1 import ( "github.com/openshift-knative/knative-openshift-ingress/pkg/apis" networkingv1alpha1 "knative.dev/serving/pkg/apis/networking/v1alpha1" ) func init() { apis.AddToSchemes = append(apis.AddToSchemes, networkingv1alpha1.SchemeBuilder.AddToScheme) }
// Package common contains common utilities and suites to be used in other tests package common import ( "bytes" "encoding/json" "fmt" "io" "io/ioutil" "math/rand" "net/http" "os" "os/exec" "path/filepath" "strconv" "testing" "time" "github.com/cerana/cerana/pkg/kv" _ "github.com/cerana/cerana/pkg/kv/c...
../src0/base_1526__tcpBufMachine__tunnel_local2remote_send.go
package main import ( "context" "crypto/tls" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" pb "grpc-up-and-running/examples/security/oauth2/server/ecommerce" "log" "net" "strings" ) type server ...
// Copyright 2018 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package perf import ( "context" "encoding/json" "io/ioutil" "os" "path/filepath" "reflect" "testing" "chromiumos/tast/errors" "chromiumos/tast/testutil" ) func lo...
// Copyright 2021 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package scanapp import ( "context" "chromiumos/tast/local/bundles/cros/scanapp/scanning" "chromiumos/tast/local/chrome" "chromiumos/tast/local/chrome/uiauto/scanapp" "...
package stack import ( "encoding/json" "fmt" "github.com/CleverTap/cfstack/internal/pkg/aws/cloudformation" "github.com/CleverTap/cfstack/internal/pkg/aws/s3" "github.com/CleverTap/cfstack/internal/pkg/templates" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/fatih/color" "github.com/golang/glog" "os" "p...
/* * Copyright IBM Corporation 2021 * * 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 DbService import ( "fmt" "ledger/DbDao" ) //type workList struct { // WorkId string // WorkName string // PutTime string //} func QueryWorkList(username string) []map[string]string { // QueryResult, _ := DbDao.QueryForMapSlice("select * from tb_Work where owner=? ", owner) QueryResult, _ := DbDao.Quer...
// Copyright 2019 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Package iw contains utility functions to wrap around the iw program. package iw import ( "context" "io" "os" "reflect" "testing" "github.com/google/go-cmp/cmp" ) ...
/* Word Ladder II Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that: Only one letter can be changed at a time Each transformed word must exist in the word list. Note that beginWord is not a transformed word. For exam...
package canvas import ( "fmt" "math" "strings" "github.com/lukeshiner/raytrace/colour" ) // Canvas holds pixel grid data type Canvas struct { Width, Height int Pixels [][]colour.Colour } // WritePixel writes a pixel to the canvas. func (c *Canvas) WritePixel(x, y int, colour colour.Colour) { c.Pixels[...
package spudo import ( "github.com/bwmarrin/discordgo" ) type session struct { *discordgo.Session logger *spudoLogger } func newSession(token string, logger *spudoLogger) (*session, error) { ss := &session{} var err error ss.logger = logger ss.Session, err = discordgo.New("Bot " + token) return ss, err } //...
package keba import ( "io" "net" "strings" "github.com/evcc-io/evcc/util" ) // Sender is a KEBA UDP sender type Sender struct { log *util.Logger addr string conn *net.UDPConn } // NewSender creates KEBA UDP sender func NewSender(log *util.Logger, addr string) (*Sender, error) { addr = util.DefaultPort(addr...
package v1 import v1 "k8s.io/api/core/v1" type Storage struct { // Storage class to use. If not set default will be used StorageClass string `yaml:"storageClass,omitempty" json:"storageClass,omitempty"` // Size. Required if persistence is enabled Size string `yaml:"size,omitempty" json:"size,omitempty"` } type P...
package main import ( "net/http" _ "github.com/mattn/go-sqlite3" "github.com/jmoiron/sqlx" shoe "github.com/shoelick/goserver_example" log "github.com/sirupsen/logrus" ) func main() { log.SetReportCaller(true) // init DB db, err := sqlx.Open("sqlite3", "dummy.db") if err != nil { log.Fatal(err) } //_...
// Copyright 2016 Marc-Antoine Ruel. All rights reserved. // Use of this source code is governed under the Apache License, Version 2.0 // that can be found in the LICENSE file. package main import ( "syscall" "unsafe" ) // SetConsoleTitle sets the console title. func SetConsoleTitle(title string) error { h, err :...
package web import ( "fmt" "net/http" ) func init() { http.HandleFunc("/", root) } func root(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello, world!\n") }
package memory import ( "fmt" color "github.com/fatih/color" tablewriter "github.com/olekukonko/tablewriter" "os" "strconv" "sync" ) type DataMemory struct { sync.RWMutex Memory []int32 } var registers, buffer [32]int64 var flagNegative, flagZero, flagOverflow, flagCarry bool // InitRegisters is a function...
package main import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" . "github.com/onsi/gomega/gstruct" "code.cloudfoundry.org/lager" "github.com/jarcoal/httpmock" m "github.com/alphagov/paas-cf/tools/metrics/pkg/metrics" ) var _ = Describe("Currency", func() { logger ...
package internal import ( "crypto/tls" "io/ioutil" "net" "net/http" "time" "github.com/goodmustache/pt/tracker/terror" ) // ConnectionConfig is for configuring a TrackerConnection. type ConnectionConfig struct { SkipSSLValidation bool } // TrackerConnection represents a connection to the Cloud Controller // ...
package config import ( "fmt" "io/ioutil" "os" homedir "github.com/mitchellh/go-homedir" ) // Source contains information about configuration source file type Source struct { FileName string // File name of configuration file. Can be without extension FileNames []string // Aliases for configuration files ...
package routers import ( "festival/app/common/middleware/auth" "festival/app/common/router" "festival/app/controller/module" ) // 微信用户 // power by 7be.cn func init() { g2 := router.New("admin", "/admin/module", auth.Auth) g2.GET("/members", true, module.ModMemberList) g2.GET("/member/edit", true, module.ModMemb...
package view import ( proj_model "github.com/caos/zitadel/internal/project/model" "github.com/caos/zitadel/internal/project/repository/view" "github.com/caos/zitadel/internal/project/repository/view/model" "github.com/caos/zitadel/internal/view/repository" ) const ( projectRoleTable = "management.project_roles" ...
package api import ( "encoding/json" "net/http" "github.com/kevguy/My-Shitty-Music-Backend/models" "github.com/kevguy/My-Shitty-Music-Backend/util" ) // DeleteSongEndPoint deletes a song func DeleteSongEndPoint(w http.ResponseWriter, r *http.Request) { defer r.Body.Close() var song models.Song if err := json....
package display import ( "strings" "testing" "github.com/AnuchitPrasertsang/roshambo/decide" ) var titleLength = 26 func assertMePosition(title string, t *testing.T) { m := strings.Index(title, "me") if m != 4 { t.Error("me should be at position 4 but got ", m) } } func assertComputerPosition(title string,...
// Copyright (c) 2018, Sylabs Inc. All rights reserved. // This software is licensed under a 3-clause BSD license. Please consult the // LICENSE.md file distributed with the sources of this project regarding your // rights to use or distribute this software. package client import ( "context" "net/http" "reflect" ...
package majiangserver import ( cmn "common" "logger" "math" //"rpc" //"strconv" ) type MaJiangController struct { player *MaJiangPlayer huController *HuController } func NewController(player *MaJiangPlayer) *MaJiangController { controller := new(MaJiangController) controller.player = player controlle...
package testingsuite import ( "context" "fmt" "log" "math/rand" "os" "runtime" "strings" "time" "github.com/transcom/mymove/pkg/random" "github.com/gobuffalo/envy" "github.com/gobuffalo/pop/v5" "github.com/gobuffalo/validate/v3" "github.com/gofrs/flock" // Anonymously import lib/pq driver so it's avai...
package rtmapi import ( "encoding/json" "github.com/oklahomer/golack/v2/event" "strings" "testing" ) func TestMarshalPingEvent(t *testing.T) { ping := &Ping{ OutgoingEvent: OutgoingEvent{ ID: 1, TypedEvent: event.TypedEvent{Type: "ping"}, }, } val, err := json.Marshal(ping) if err != nil { ...
package database import ( "encoding/gob" "log" "os" "sync" ) type Writelog struct { Index map[int64]int64 } type ConcurrentWriteLog struct { // logs and inverted together form a bimap Logs []Writelog Inverted []Writelog Concurrency int64 mutexes []sync.RWMutex } func (ci *ConcurrentWriteLog)...
package adventure import ( "encoding/json" "fmt" "net/http" "os" "strconv" "github.com/labstack/echo/v4" ) type ( Adventure map[string]Arc Arc struct { Title string Story []string Options []ArcOption } ArcOption struct { Text string Arc string } Game struct { Adventure Adventure Cu...
// Copyright (C) 2017 Google 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 t...
package pretend //lint:file-ignore U1000 Ignore all unused code const Assignment = `{ "content_groups": [ [ { "label": "content_group_label", "value": [ "string", "details" ] }, { ...
package controller import ( "github.com/kataras/iris/mvc" "xdream/example/webserver/data/api" "xdream/web" "fmt" "github.com/kataras/iris" "xdream/example/webserver/middleware" "xdream/logger" ) type IndexController struct { BaseController cnt int } func init() { web.RegisterController(new(IndexController...
// Copyright 2021 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package memory import ( "context" "encoding/json" "fmt" "io/ioutil" "path" "regexp" "strconv" "strings" "github.com/shirou/gopsutil/v3/process" "golang.org/x/sync...
package hashy import ( "fmt" "testing" ) var config = Options{ // Input: "./_/short.csv", // Input: "./_/long.csv", // Input: "./_/no_valid.csv", Input: "./_/1gb.csv", KeyColumns: []int{1}, SkipHeader: false, Delimiter: ',', IncludeKeysVa...
package entity type Log struct { Topics []string `json:"topic"` Data []byte `json:"data"` } type Transaction struct { BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` Gas string `json:"gas"` GasPrice string `json:"gasPrice"`...
package utils import ( "github.com/gin-gonic/gin" "github.com/life-assistant-go/middleware" ) // Router global use var Router *gin.Engine func init() { // release mode // gin.SetMode(gin.ReleaseMode) r := gin.New() r.Use(middleware.Logger()) Router = r }
package fs_backup_test import ( "github.com/stretchr/testify/require" "github.com/zucchinidev/fs_backup" "strings" "testing" ) var archiver *TestArchiver func TestMonitor(t *testing.T) { archiver = &TestArchiver{} monitor := &fs_backup.Monitor{ Destination: "test/archive", Paths: map[string]string{ "te...