text
stringlengths
3.08k
10.4k
package golang import ( "bufio" "context" "fmt" "os" "path/filepath" "strings" skexec "go.skia.org/infra/go/exec" "go.skia.org/infra/go/test2json" "go.skia.org/infra/task_driver/go/lib/dirs" "go.skia.org/infra/task_driver/go/lib/log_parser" "go.skia.org/infra/task_driver/go/lib/os_steps" "go.skia.org/infr...
package weather import ( "encoding/json" "fmt" "io/ioutil" "net/http" "sync" "github.com/vic999/pirrigo/logging" "github.com/vic999/pirrigo/settings" "go.uber.org/zap" ) var instance *Weather var once sync.Once // Weather is the mechanism by which weather is returned via WeatherUnderground's API type Weathe...
/* Copyright 2011 The Perkeep 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 main import ( "debug/elf" "debug/pe" "flag" "fmt" "io/ioutil" "log" "os" "strings" "github.com/qeedquan/go-media/debug" "github.com/qeedquan/go-media/debug/elfutil" "github.com/qeedquan/go-media/debug/peutil" ) var ( errUnsupportedArch = fmt.Errorf("unsupported architecture") errSectionNotFound ...
package chain import ( "gitlab.com/accumulatenetwork/accumulate/internal/database" "gitlab.com/accumulatenetwork/accumulate/internal/errors" "gitlab.com/accumulatenetwork/accumulate/internal/url" "gitlab.com/accumulatenetwork/accumulate/protocol" ) type CreateIdentity struct{} var _ SignerValidator = (*CreateIde...
/* * Copyright 2018 Crimson AS <<EMAIL>> * Author: <NAME> <<EMAIL>> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of...
package deribit import ( "context" "net/http" "net/url" "time" "github.com/NadiaSama/ccexgo/exchange" "github.com/pkg/errors" "github.com/shopspring/decimal" ) type ( InstrumentsRequest struct { currency string kind string expired bool } InstrumentResult struct { TickSize decimal.D...
package flygo import ( "github.com/billcoding/flygo/context" "github.com/billcoding/flygo/middleware" "github.com/billcoding/flygo/session" "github.com/billcoding/flygo/util" "regexp" ) type defaultMWState struct { header bool recovery bool recoveryHandler func(ctx *context.Context) recove...
package promcheck import ( "fmt" "regexp" "time" prometheusv1 "github.com/prometheus/client_golang/api/prometheus/v1" "github.com/prometheus/prometheus/model/labels" promql "github.com/prometheus/prometheus/promql/parser" ) // PrometheusRulesCheckerConfig represents PrometheusRulesChecker configuration. type ...
// Copyright (c) <NAME> and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for details. package iostream import ( "bufio" "bytes" "encoding/binary" "errors" "io" "reflect" "unsafe" ) // MaxVarintLenN is the maximum length of a varint-encoded N-bit in...
// +build !windows // Copyright 2014-2016 Amazon.com, Inc. or its affiliates. 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. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // //...
// Copyright 2021 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package cmd import ( "time" "github.com/spf13/cobra" "github.com/vmware-tanzu/tanzu-framework/pkg/v1/tkg/constants" "github.com/vmware-tanzu/tanzu-framework/pkg/v1/tkg/utils" ) type createClusterOptions struct { cluster...
/* * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * 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/license...
package inference // Disease is the representation of the diseases data in this Expert System. type Disease struct { ID string `json:"id"` // Disease ID Name string `json:"name"` // Name of the disease Description string `json:"description"` // Description ...
package websocket import ( log "github.com/Sirupsen/logrus" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" "github.com/soprasteria/intools-engine/common/utils" ) const ( defaultChannelLength = 100 ) var ( appclient = &AppClient{ Clients: make(map[*websocket.Conn]*Client), } wsupgrader = websocke...
// Package parse implements parsing of Go structs in files and runtime. // // This package, despite containing exported types, methods and functions, // is an internal part of implementation of 'reform' command, also used by generated files, // and not a part of public stable API. package parse import ( "fmt" "strco...
package malgova import ( "fmt" "math" "sort" "gonum.org/v1/gonum/stat" ) type tradeData struct { algoName string symbol string orders []orderEntry score AlgoScore trades []tradeEntry } // AlgoScore struct type AlgoScore struct { AlgoName string Symbol string // stats and scores OrdersCount ...
package storage import ( "path/filepath" Settings "github.com/MidSmer/goTorrent/settings" "github.com/asdine/storm" "github.com/gorilla/websocket" "github.com/sirupsen/logrus" ) //Logger is the global Logger that is used in all packages var Logger *logrus.Logger //Conn is the global websocket connection used t...
package main /* * Link Shortener, with a Redis backend. * * Released under and MIT License, please see the LICENSE.md file. * * <NAME> * */ import ( "github.com/johnnye/short/utils" "github.com/garyburd/redigo/redis" "encoding/json" "io/ioutil" "net/http" "strings" "flag" "fmt" "log" ) var host = flag.Strin...
package testgridconversion import ( "testing" testgridv1 "github.com/openshift/sippy/pkg/apis/testgrid/v1" "github.com/openshift/sippy/pkg/testgridanalysis/testgridanalysisapi" "github.com/stretchr/testify/assert" ) func TestProcessJobDetails(t *testing.T) { // need to generate JobDetails with a mix of expected...
// Code generated by protoc-gen-go. DO NOT EDIT. // source: wsn.proto package wsn import ( fmt "fmt" proto "github.com/golang/protobuf/proto" math "math" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time a...
package horse import ( "time" "github.com/lindsaygelle/nook" "github.com/lindsaygelle/nook/animal" "github.com/lindsaygelle/nook/character" "github.com/lindsaygelle/nook/gender" "github.com/lindsaygelle/nook/personality" "golang.org/x/text/language" ) var ( papiBirthday = nook.Birthday{ Day: 10, Month:...
// +build integration package naturallanguageclassifierv1_test /** * (C) Copyright IBM Corp. 2018, 2020. * * 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.or...
package ng import ( "bytes" "fmt" "strings" "sync" "time" "strconv" "github.com/colt3k/nglog/internal/pkg/enum" "github.com/colt3k/nglog/internal/pkg/util" ) var ( baseTimestamp time.Time ) func init() { baseTimestamp = time.Now() } type Layout interface { Format(*LogMsg, bool) ([]byte, error) Descrip...
package ldvalue import ( "encoding/json" "reflect" "strconv" "gopkg.in/launchdarkly/go-sdk-common.v2/jsonstream" ) // OptionalInt represents an int that may or may not have a value. This is similar to using an // int pointer to distinguish between a zero value and nil, but it is safer because it does not // expo...
package persist import ( "context" "database/sql/driver" "encoding/json" "fmt" ) // NFT represents an nft throughout the application type NFT struct { Version NullInt64 `bson:"version" json:"version"` // schema version for this model ID DBID `bson:"_id" ...
/* Copyright 2015 Gravitational, 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 in writing, soft...
/* common function calls */ package common import ( "encoding/json" "fmt" "log" "math/rand" "net/http" "os" "regexp" "strconv" "strings" "time" "github.com/asaskevich/govalidator" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "github.com/sharingio/pair/apps/cluster-api-manager/types" ) // misc ...
package scrape import ( "encoding/json" "fmt" "io/ioutil" "net/http" "strings" "github.com/blang/semver" ) const ( LOL_BASEURL = "https://ddragon.leagueoflegends.com" LOL_VERSIONS_URI = "/api/versions.json" LOL_CHAMPIONS_URI = "/cdn/%s/data/en_US/champion.json" ) type ChampionsMeta struct { Type ...
//go:build go1.16 // +build go1.16 package echo import ( "fmt" "io/fs" "net/http" "net/url" "os" "path/filepath" "runtime" "strings" ) type filesystem struct { // Filesystem is file system used by Static and File handlers to access files. // Defaults to os.DirFS(".") // // When dealing with `embed.FS` us...
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package vpcaccess import ( "github.com/pkg/errors" "github.com/pulumi/pulumi/sdk/go/pulumi" ) // > This content is derived from https://github.c...
// // Documentation Last Review: 06.10.2020 // package tree import ( "math" "sync" "go.dedis.ch/dela/mino" "golang.org/x/xerrors" ) const minNumChildren = float64(5) // Tree is the interface used by the router to determine the routes. type Tree interface { // GetMaxHeight returns the maximum height for this t...
package field_test import ( "reflect" "testing" "github.com/andrewwphillips/eggql/internal/field" ) func TestSplitNested(t *testing.T) { splitNestedData := map[string]struct { in string exp []string desc string }{ "Empty": {"", []string{""}, ""}, "DoubleEmpty": {",", []string{"", ""}, ""}...
package types // ----- ---- --- -- - // Copyright 2019, 2020 The Axiom Foundation. All Rights Reserved. // // Licensed under the Apache License 2.0 (the "License"). You may not use // this file except in compliance with the License. You can obtain a copy // in the file LICENSE in the source distribution or at // htt...
// cubebit provides an API for doing stuff with the Cube:Bit from 4tronix. package cubebit import ( "image/color" "github.com/9600org/go-rpi-ws281x" ) // Cubebit represents an instance of the Cube:Bit hardware. type Cubebit struct { canvas *ws281x.Canvas sizeX int sizeY int sizeZ int } // New creates a new...
package output import ( "errors" "fmt" "net/url" "testing" "time" "github.com/benchttp/runner/config" "github.com/benchttp/runner/output/export" "github.com/benchttp/runner/requester" ) func TestReport_Export(t *testing.T) { t.Cleanup(mockExportFuncs(false, false)) testcases := []struct { label str...
// Code generated by protoc-gen-go. DO NOT EDIT. // source: pkg/apis/istio/v1alpha1/operator_crd.proto package v1alpha1 import ( fmt "fmt" math "math" proto "github.com/golang/protobuf/proto" v11 "k8s.io/apimachinery/pkg/apis/meta/v1" "istio.io/api/operator/v1alpha1" ) // Reference imports to suppress errors ...
package render import ( "context" "strings" "github.com/weaveworks/scope/report" ) // KubernetesVolumesRenderer is a Renderer which combines all Kubernetes // volumes components such as stateful Pods, Persistent Volume, Persistent Volume Claim, Storage Class. var KubernetesVolumesRenderer = MakeReduce( VolumesRe...
/* * Copyright 2018 <NAME> * * 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...
package buffer import ( "fmt" "math/rand" "testing" "time" "github.com/pion/rtp" "github.com/stretchr/testify/require" ) func getPacket(sn uint16, ts uint32, payloadSize int) *rtp.Packet { return &rtp.Packet{ Header: rtp.Header{ SequenceNumber: sn, Timestamp: ts, }, Payload: make([]byte, payl...
// Copyright 2013-Present Couchbase, Inc. // // Use of this software is governed by the Business Source License included in // the file licenses/BSL-Couchbase.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 Lic...
// 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 // distributed ...
// Copyright 2020 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...
// Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of the // License is located at // // http://aws.amazon.com/apache2.0/ // // or in the "license"...
// Copyright (c) 2018-2022, 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. // Includes code from https://github.com/containers/pod...
// Copyright 2016 // 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 // d...
package internal import ( "fmt" aepb "github.com/remko/dsbackups/internal/aepb" pb "google.golang.org/genproto/googleapis/datastore/v1" "google.golang.org/genproto/googleapis/type/latlng" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" ) func UnmarshalAEEntity(b []byte) ...
package loqui import ( "bufio" "bytes" "crypto/tls" "errors" "io" "io/ioutil" "net" "net/http" "net/url" "strings" "sync" "time" ) const defaultHandshakeTimeout = 10 * time.Second // ErrBadHandshake is returned when the server response to opening handshake is invalid. var ErrBadHandshake = errors.New("lo...
//go:build avr // +build avr package runtime import ( "device/avr" "machine" "runtime/interrupt" "runtime/volatile" "unsafe" ) const BOARD = "arduino" // timeUnit in nanoseconds type timeUnit int64 // Watchdog timer periods. These can be off by a large margin (hence the jump // between 64ms and 125ms which is...
// Copyright © 2018 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 ...
package buildpack import ( "bytes" "io/ioutil" "os" "os/exec" "path/filepath" "syscall" "github.com/BurntSushi/toml" "github.com/pkg/errors" "github.com/buildpacks/lifecycle/api" ) const ( EnvBuildpackDir = "CNB_BUILDPACK_DIR" EnvPlatformDir = "CNB_PLATFORM_DIR" EnvBuildPlanPath = "CNB_BUILD_PLAN_PAT...
package interpreters_test import ( "testing" "github.com/inkyblackness/hacked/ss1/content/interpreters" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" ) type InstanceSuite struct { suite.Suite data []byte inst *interpreters.Instance } func Te...
/* This file is part of copyondemand. * * Copyright © 2020 Datto, Inc. * Author: <NAME> <<EMAIL>> * * Licensed under the Apache Software License, Version 2.0 * Fedora-License-Identifier: ASL 2.0 * SPDX-2.0-License-Identifier: Apache-2.0 * SPDX-3.0-License-Identifier: Apache-2.0 * * copyondemand is free softwa...
package config import ( "github.com/beyondblog/k8s-web-terminal/Godeps/_workspace/src/github.com/imdario/mergo" ) // Default values for base Iris conf const ( DefaultDisablePathCorrection = false DefaultDisablePathEscape = false ) type ( // Iris configs for the station // All fields can be changed before se...
// Package mcache provides a global memory cache which can be // used to store necessary data in local memory. It // uses freecache as underlying engine. // For more details about freecache, please refer to // https://github.com/coocood/freecache package mcache import ( "fmt" "runtime/debug" "strconv" "github.com...
package crdb import ( "context" "errors" "fmt" "github.com/jackc/pgconn" "github.com/jackc/pgx/v4" "github.com/prometheus/client_golang/prometheus" "github.com/rs/zerolog/log" ) const ( // https://www.cockroachlabs.com/docs/stable/common-errors.html#restart-transaction crdbRetryErrCode = "40001" // https:/...
package main import ( "strings" "github.com/xyproto/vt100" ) var gitRebasePrefixes = []string{"p", "pick", "f", "fixup", "r", "reword", "d", "drop", "e", "edit", "s", "squash", "x", "exec", "b", "break", "l", "label", "t", "reset", "m", "merge"} // nextGitRebaseKeywords takes the first word and increase it to the...
// Code generated by entc, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "github.com/facebook/ent/dialect/sql/sqlgraph" "github.com/facebook/ent/schema/field" "github.com/kallydev/privacy/ent/sfmodel" ) // SFModelCreate is the builder for creating a SFModel entity. type SFModelCreate struct { co...
/* Copyright NetFoundry, 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
package beep import ( "fmt" "io/ioutil" "os" "path/filepath" "sort" "strings" ) // Sheet - music sheet type Sheet struct { ID int Name string Dir string Notation string file *os.File } // NewSheet returns new music sheet func NewSheet(name, dir, notation string) *Sheet { s := &Sheet{ ...
// Code generated by go-swagger; DO NOT EDIT. package things // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "net/http" "time" "golang.org/x/net/context" "github.com/go-openapi/errors" "github.com/go-openapi/runtime"...
package main import ( "fmt" "testing" ) func TestAgainstWall(t *testing.T) { b3x3 := Board{3, 3, []Coord{}, []Snake{}} b5x5 := Board{5, 5, []Coord{}, []Snake{}} var tests = []struct { s Snake b Board want bool }{ {Snake{Body: []Coord{{0, 0}}}, b3x3, true}, {Snake{Body: []Coord{{1, 0}}}, b3x3, t...
package iop import ( "context" "crypto/ecdsa" "fmt" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" log "github.com/sirupsen/logrus" "go.dedis.ch/kyber/v3/pairing" "go.dedis.ch/kyber/v3/share" "go.dedis.ch/kyber/v3/sign/...
package utils import ( "os" "path/filepath" "strings" "unicode" "unicode/utf8" "github.com/VKCOM/noverify/src/ir" "github.com/VKCOM/noverify/src/ir/irutil" ) // NameNodeToString converts nodes of *name.Name, and *node.Identifier to string. // This function is a helper function to aid printing function names, ...
package test import ( "io/ioutil" "net/http" "net/url" "testing" "github.com/aoisensi/oguth" "golang.org/x/oauth2" ) const ( LOGIN_URL = "http://localhost:1919/login" REDIRECT_URL = "http://localhost:1919/redirect" AUTH_URL = "http://localhost:1919/authorize" TOKEN_URL = "http://localhost:1919/to...
package logsend import ( "bytes" "encoding/json" "net/http" "sync" "text/template" "time" ) var ( newRelicConfig = &NewRelicConfig{} ) func init() { RegisterNewSender("newrelic", InitNewRelic, NewNewRelicSender) } type NewRelicConfig struct { Host string Key string Name string Duration uint...
package alphafoxtrot import ( "encoding/csv" "io" "log" "math" "os" "sort" ) // https://ourairports.com/help/data-dictionary.html // "id","filename","ident","name","type","frequency_khz","latitude_deg","longitude_deg","elevation_ft","iso_country","dme_frequency_khz","dme_channel","dme_latitude_deg","dme_longitu...
package timePredicates import ( "fmt" "time" ) // a location is a point in 3-D space with a heading, though not used in the // interval-based temporal logic type Location struct { // [x,y,z] coordinates x float64 y float64 z float64 // heading: angle in radians/degrees theta float64 } type Locationer interfa...
package main import ( "encoding/json" "math/rand" "time" "github.com/NinesStack/memberlist" "github.com/NinesStack/sidecar/catalog" "github.com/NinesStack/sidecar/service" metrics "github.com/armon/go-metrics" "github.com/pquerna/ffjson/ffjson" log "github.com/sirupsen/logrus" ) const ( MAX_PENDING_LENGTH ...
package parser import ( "bufio" "bytes" "fmt" "github.com/djherbis/times" "github.com/whosonfirst/go-whosonfirst-markdown" "github.com/whosonfirst/go-whosonfirst-markdown/jekyll" "io" _ "log" "os" "path/filepath" "regexp" "strings" "time" ) type ParseOptions struct { FrontMatter bool Body bool }...
package main import ( "encoding/gob" "fmt" "os" "runtime" "testing" "time" "github.com/willauld/utils/hashdictionary" ) func init() { createSource() } func createSource() { fmt.Println("Golang Version:", runtime.Version()) src := os.TempDir() fmt.Printf("TempDir: %s\n", src) } func deleteSource() { }...
// misc-func.go /* CLI version Copyright ©2020 H.F.M - Hash Me v1.0 github.com/hfmrow/hash-me This program comes with absolutely no warranty. See the The MIT License (MIT) for details: https://opensource.org/licenses/mit-license.php */ package main import ( "fmt" "os" "path/filepath" "strings" ) func chkCmd...
package goassert import ( "fmt" "reflect" "regexp" "runtime" ) // TestingTB is an interface mimicking testing.TB (except for Skip*) interface which prevents users to implement itself. // See testing.TB for details. type TestingTB interface { Error(args ...interface{}) Errorf(format string, args ...interface{}) ...
/* Copyright 2020 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 post import ( "context" "github.com/pkg/errors" "github.com/minipkg/log" "github.com/minipkg/selection_condition" "go.mongodb.org/mongo-driver/mongo" "redditclone/internal/domain/comment" "redditclone/internal/domain/vote" "redditclone/internal/pkg/apperror" ) const MaxLIstLimit = 1000 // IService...
// Package hexwidget implements a 7-segment style hexadecimal display package hexwidget import ( "image" "image/color" "fyne.io/fyne/v2" "fyne.io/fyne/v2/canvas" "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" ) // size in pixels of the hex widget var hexHeight float32 = 75.0 var hexWidth float32 = hexHeight ...
package parser import ( "github.com/antlr/antlr4/runtime/Go/antlr" "github.com/phf/go-queue/queue" ) type DenterHelper struct { dentsBuffer *queue.Queue indentations *queue.Queue nlToken int identToken int dedentToken int reachedEof bool BaseLexer *antlr.BaseLexer } func NewDenter(nlToken, ident...
package main import ( "fmt" "math/rand" "os" "os/signal" "time" "github.com/TheThingsNetwork/api/gateway" "github.com/TheThingsNetwork/api/protocol" "github.com/TheThingsNetwork/api/protocol/lorawan" "github.com/TheThingsNetwork/api/router" "github.com/TheThingsNetwork/ttn/core/types" "github.com/eclipse/p...
package main import ( "fmt" "log" ) func main() { example_immediately() example_Closures() example_ValueOutside() example_AccessVariable() example_Func() example_ReturnFunc() example_VariadicFuncSameType() example_VariadicFuncDifferentType() example_Person() example_Anonymous() example_HighOrder() examp...
package main import ( "fmt" "github.com/creativesoftwarefdn/weaviate/client/actions" "github.com/creativesoftwarefdn/weaviate/models" spew "github.com/davecgh/go-spew/spew" "github.com/go-openapi/strfmt" "strconv" "time" ) func createActions() { for _, action := range demoDataset.Actions { className := acti...
package run import ( "bytes" "context" "fmt" "io" "os" "os/signal" "syscall" "github.com/cilium/ebpf/rlimit" "github.com/pkg/errors" "github.com/pterm/pterm" "github.com/solo-io/bumblebee/pkg/cli/internal/options" "github.com/solo-io/bumblebee/pkg/decoder" "github.com/solo-io/bumblebee/pkg/loader" "gith...
/* Copyright AppsCode Inc. and Contributors 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 ( "bytes" "context" "encoding/json" "errors" "fmt" "io/ioutil" "log" "net/http" "os" "strconv" "strings" "time" ) var ( apiTokens []string ) func mustGetenv(ctx context.Context, k string) string { v := os.Getenv(k) if v == "" { log.Printf("%s environment variable not set.", k) }...
package polarismesh import ( "context" "fmt" "github.com/golang/protobuf/proto" "github.com/polarismesh/polaris-go/api" "github.com/polarismesh/polaris-go/pkg/model" "github.com/tsingsun/woocoo/pkg/conf" "github.com/tsingsun/woocoo/rpc/grpcx/registry" "google.golang.org/grpc" "google.golang.org/grpc/attribute...
// Copyright (c) 2020-2021 C4 Project // // This file is part of c4t. // Licenced under the MIT licence; see `LICENSE`. package id_test import ( "fmt" "testing" "github.com/c4-project/c4t/internal/helper/testhelp" "github.com/c4-project/c4t/internal/id" ) // ExampleFromString is a runnable example for FromStri...
package main import ( "bytes" "crypto/tls" "fmt" "io/ioutil" "log" "net" "net/http" "os" "os/exec" "testing" "time" "github.com/stretchr/testify/assert" ) type tWriter struct { t *testing.T } func (t *tWriter) Write(b []byte) (int, error) { t.t.Log(string(bytes.TrimRight(b, "\r\n"))) return len(b), ...
package main import ( "bufio" "bytes" "fmt" "log" "os" "path/filepath" "strings" "sync" "time" "github.com/Tonkpils/snag/vow" "github.com/shiena/ansicolor" fsn "gopkg.in/fsnotify.v1" ) var mtimes = map[string]time.Time{} var clearBuffer = func() { fmt.Print("\033c") } type Bob struct { w *fsn.W...
package slack import ( _ "embed" "fmt" "github.com/Sho2010/cinderella-simple/domain/model" "github.com/Sho2010/cinderella-simple/domain/repository" "github.com/slack-go/slack" ) // NOTE PublishView の引数に関して // - hash // A string that represents view state to protect against possible race conditions. // - Callb...
package memberlist import ( "encoding/json" "fmt" "github.com/hashicorp/memberlist" "github.com/journeymidnight/nentropy/helper" "github.com/pborman/uuid" "log" "net" "os" "strconv" ) const ( MEMBER_LIST_CHAN_EVENT_NUM = 16 ) type MemberEventType int const ( MemberJoin MemberEventType = iota MemberLeave...
package main import ( "expvar" "io" "net" "net/http" "strings" "sync" "time" cb "github.com/couchbaselabs/go-couchbase" _ "github.com/couchbase/gomemcached/debug" "github.com/samuel/go-metrics/metrics" ) const minRecordRate = 4096 var ( taskDurations = map[string]metrics.Histogram{} writeBytes = metr...
package challenges import ( "fmt" "strings" ) func init() { Challenges[502] = Challenge{ Title: "Counting Castles", Correct: false, Callback: C502, ID: 502, } } type c502Permutation []int func (p *c502Permutation) Blocks() int { ret := 0 for _, size := range *p { if size > 0 { ret++ }...
// Copyright 2018 Google 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 ...
package poseidon import ( "github.com/stretchr/testify/assert" "testing" ) func TestCalcRoundNum(t *testing.T) { tests := []struct { t int s bool want struct { rf, rp int } }{ {3, true, struct{ rf, rp int }{rf: 8, rp: 55}}, {4, true, struct{ rf, rp int }{rf: 8, rp: 56}}, {5, true, struct{ r...
// Copyright (c) 2017, Oracle and/or its affiliates. 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 router import ( "fmt" "net/http" "net/url" "strings" "time" "sync" "github.com/matt-deboer/mpp/pkg/locator" "github.com/matt-deboer/mpp/pkg/selector" "github.com/matt-deboer/mpp/pkg/version" log "github.com/sirupsen/logrus" "github.com/vulcand/oxy/buffer" "github.com/vulcand/oxy/forward" ) // Ro...
/******************************************************************************* * Copyright 2019 Dell 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/licen...
package main import ( "encoding/json" "io" "net/http" "strconv" _ "github.com/go-sql-driver/mysql" "github.com/gorilla/mux" "github.com/jinzhu/gorm" "github.com/rs/cors" log "github.com/sirupsen/logrus" ) var db, _ = gorm.Open("mysql", "root:root@(localhost:4211)/todolist?charset=utf8mb4&parseTime=True&loc=...
/* * 纸喵软件 * Copyright (c) 2017~2020 http://zhimiao.org All rights reserved. * Author: 倒霉狐狸 <<EMAIL>> * Date: 2020/3/3 下午4:26 */ package api import ( "fmt" "github.com/zhi-miao/wechat/common" "github.com/zhi-miao/wechat/common/utils" _ "github.com/zhi-miao/wechat/docs" "github.com/zhi-miao/wechat/req" "gith...
package parquet import ( "fmt" "io" "runtime" "sort" "sync" "github.com/segmentio/parquet-go/compress" "github.com/segmentio/parquet-go/compress/brotli" "github.com/segmentio/parquet-go/compress/gzip" "github.com/segmentio/parquet-go/compress/lz4" "github.com/segmentio/parquet-go/compress/snappy" "github.c...
package hcl2template import ( "fmt" "github.com/hashicorp/go-cty-funcs/cidr" "github.com/hashicorp/go-cty-funcs/collection" "github.com/hashicorp/go-cty-funcs/crypto" "github.com/hashicorp/go-cty-funcs/encoding" "github.com/hashicorp/go-cty-funcs/filesystem" "github.com/hashicorp/go-cty-funcs/uuid" "github.co...