blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
f5aa88ea885fa4c530039aa8a21c41c6ad789821 | 138faded96fca1fe95d26a1d3e67d49afcc24777 | FlashbackSRS/flashback | /vendor/github.com/flimzy/kivik/errors/errors_test.go | Go | go | 2,381 | permissive | package errors
import (
"encoding/json"
"errors"
"net/http"
"testing"
"github.com/flimzy/diff"
)
func TestErrors(t *testing.T) {
type errTest struct {
Name string
Func func() error
ExpectedStatus int
ExpectedMsg string
}
tests := []errTest{
{
Name: "Statusf",
... |
a92c02dc4fdf3340b5c02a194504cc11e6e748da | 806791ddc06239e08580c2a12afd2c966726018a | chunhui-shi/cortex | /pkg/lib/cron/cron.go | Go | go | 1,552 | permissive | /*
Copyright 2019 Cortex Labs, 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, softwa... |
cf00f39d50dbccaa3a0e5d966b128ee0bdf77b93 | 632a5d0f982834f950a08abb7be9a0e7f5446265 | corrieb/vm-operator | /pkg/conditions/matcher_test.go | Go | go | 10,034 | permissive | // +build !integration
/*
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 o... |
620522672bab1ead5464e994b3d75fe877e557ba | af105e3094ac3874ee6dbe7a5320c3ae876c8a39 | bmc-toolbox/redgopher | /openapi/model_health_data.go | Go | go | 933 | no_license | /*
* Redfish API
*
* This contains the definition of a Redfish service.
*
* API version: 2018.3
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// This type describes the health information of the memory.
type HealthData struct {
AlarmTrips AlarmTrips `json:"AlarmTrips,om... |
dcf6e4658c9c333af91eff75f657123df0079b46 | db5242f8692fbbd27a737f7500cefc0abef8252d | d5rovic84/pod | /pkg/coding/gcs/gcsbench_test.go | Go | go | 2,847 | permissive | package gcs_test
import (
"encoding/binary"
"math/rand"
"testing"
"github.com/p9c/pod/pkg/coding/gcs"
)
func genRandFilterElements(numElements uint) ([][]byte, error) {
testContents := make([][]byte, numElements)
for i := range contents {
randElem := make([]byte, 32)
if _, err := rand.Read(randElem); err !... |
e045a88b50328323483a74c5abe896f09911c12e | 9115a2d4f483a4a8e54a9de53848a2143b8fb002 | gmlewis/sdfx | /examples/pillar_holder/main.go | Go | go | 1,791 | permissive | //-----------------------------------------------------------------------------
/*
Pillar Holder
*/
//-----------------------------------------------------------------------------
package main
import (
"github.com/gmlewis/sdfx/render"
"github.com/gmlewis/sdfx/sdf"
v2 "github.com/gmlewis/sdfx/vec/v2"
v3 "github.... |
7d95c44ef467e8e7b4297e7f116fa3e7b383f178 | 94f0734b5a3605879ac3d76d9ec8178ae4d052c2 | xychen5/go-MS | /my1/controllers/index.go | Go | go | 783 | no_license | package controllers
import (
"fmt"
"github.com/astaxie/beego"
)
type MainController struct {
beego.Controller
}
func (c *MainController) Get() {
c.TplName = "index.tpl"
return
}
func (c *MainController) MyPost() {
fmt.Println("of course, main Post is called")
idType := c.GetString("idChooser")
// Chec... |
4f3f977a05588887467cd64ba54a9c705f01f86b | 7f70b9f7938f9cb308ad144681120e0e2fa3a57d | bm0/icq-bot-api | /bot.go | Go | go | 6,106 | permissive | package icqbotapi
import (
"context"
"net/http"
"time"
"github.com/mailru/easyjson"
"github.com/bm0/icq-bot-api/event"
)
const (
icqAPIBaseURL = "https://api.icq.net/bot/v1"
agentAPIBaseURL = "https://agent.mail.ru/bot/v1"
tokenQueryParam = "token"
)
type apiType int
const (
APITypeICQ apiType = iota
... |
22cf868c38bc5c70e3b3c08b8e1f0fa148c4db35 | f707b1a15bcde546aa542ff881f0a6f1676d419c | aleks-fofanov/faas-netes | /handlers/deploy_test.go | Go | go | 4,847 | permissive | // Copyright 2019 OpenFaaS Author(s)
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
package handlers
import (
"testing"
"github.com/openfaas/faas-netes/k8s"
types "github.com/openfaas/faas-provider/types"
"k8s.io/client-go/kubernetes/fake"
apiv1 "k8s.io/ap... |
5ff94e854f58df835eec2250b6464fa81f2841b4 | f832c4dedaf4e88437e5bb55450bdde4aebca97e | ZhongAnTech/Annchain.OG | /poc/tendermint/client_test.go | Go | go | 2,613 | permissive | package tendermint
import (
"github.com/sirupsen/logrus"
"net/http"
_ "net/http/pprof"
"testing"
"time"
)
var BlockTime = time.Millisecond * 1
func init() {
Formatter := new(logrus.TextFormatter)
//Formatter.ForceColors = false
Formatter.DisableColors = true
Formatter.TimestampFormat = "15:04:05.000000"
Fo... |
f7f10bbaa3a22c50a675196755e8c3eff01b0a17 | 45658209bf7af70939d3f1b72431d090e195b02f | geckoboard/sql-dataset | /models/dataset_test.go | Go | go | 12,260 | permissive | package models
import (
"fmt"
"reflect"
"testing"
)
func TestBuildSchemaFields(t *testing.T) {
testCases := []struct {
in *Dataset
out *Dataset
err string
}{
{
// Field name unaltered
in: &Dataset{
Name: "users.count",
Fields: []Field{
{
Name: "count",
Type: "datetime",
... |
f9361c5188aff90b057158eda702f11ce6c22e9f | bf0952dd526b89c3fb9bf41ac8572f3fa4ed0a6d | mike-nguyen/mantle | /kola/tests/systemd/sysusers.go | Go | go | 2,414 | permissive | // Copyright 2016 CoreOS, 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... |
aa567d6b6ba0b0f0fd0d60693ef68257d67e5123 | 8757204468ef6e8ca10846e5d39b1c36d5a2f0ce | amanchik3007/currencyAPI | /config/config.go | Go | go | 512 | no_license | package config
import (
"encoding/json"
"os"
)
type Config struct {
Database struct {
ConnectionString string `json:"connectionString"`
} `json:"database"`
Port string `json:"port"`
}
func LoadConfiguration(file string) (Config, error) {
var config Config
configFile, err := os.Open(file)
defer configFile.C... |
ec06e04c8529a6defda9f94293608a37b4f3aadb | 97cacdd25265e08bd58a500da0ff0bc972a087b8 | cclives789/caddyserver-caddy_v1.0.3 | /caddyhttp/status/setup.go | Go | go | 2,514 | permissive | // Copyright 2015 Light Code Labs, 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 agre... |
93306cea666fe4947fb24358f4d5c8e9f1d87c13 | bda2c06167d01b6d1bd4ab4656418daba37934fa | programming-kubernetes/pizza-apiserver | /vendor/golang.org/x/tools/imports/mod_test.go | Go | go | 14,069 | permissive | // +build go1.11
package imports
import (
"archive/zip"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
"sync"
"testing"
"golang.org/x/tools/internal/module"
"golang.org/x/tools/internal/txtar"
)
// Tests that we handle a nested module. This is different from other tests
// where the module is ... |
4658887e51c1cb6063516740c7e72adba0df3e26 | 1d1224a9da8712a93c56dc3a7567e0fc2ca7b4df | ChrystianDuarte/kogito-cloud-operator | /cmd/kogito/command/shared/install_operator_test.go | Go | go | 2,247 | permissive | // Copyright 2019 Red Hat, Inc. and/or its affiliates
//
// 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 applic... |
9ae619fd2b4e5e010a342ffa071c2e73b04eba59 | 0703d9cc94ee49f4ed548c92b13782e9a41f81d2 | nilhost/overnet | /testing/scenarios/socks_test.go | Go | go | 9,847 | permissive | package scenarios
import (
"testing"
"time"
xproxy "golang.org/x/net/proxy"
socks4 "h12.io/socks"
"github.com/nilhost/overnet"
"github.com/nilhost/overnet/app/proxyman"
"github.com/nilhost/overnet/app/router"
"github.com/nilhost/overnet/common"
"github.com/nilhost/overnet/common/net"
"github.com/nilhost/ov... |
3964334013137e246796f1e907b89f438a3028e6 | 50f9bfc88bc74eeaa37794a721b87c785467db2b | morrell/pulumi-azure-native | /sdk/go/azure/web/v20180201/getWebAppSiteExtension.go | Go | go | 2,575 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20180201
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Site Extension Information.
func LookupWebAppSiteExtension(ctx *pulumi.Context, args ... |
14a96e4df851e4859e3f64e8582d124461f22904 | 48068b4d2c17eeecdaca63b3c366a4dd08432dfa | siddontang/tidb | /expression/builtin_string.go | Go | go | 117,522 | permissive | // Copyright 2015 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... |
ba8bd1629bae192f0294d59d6a8738643e029e71 | b38674fc1e27a65460007b008f0f0a81972b489a | upsight/ron | /doc.go | Go | go | 8,625 | permissive | /*
Package ron provides a command line interface to common build tasks.
$ ron
Usage: ron <command>
Available commands are:
b, bash_completion Print the bash completion script.
burgundy Stay classy.
cmd Run a command with optional restart and watch for changes to res... |
7c4cce39b79d412769804b328e5d58455fc3f682 | 9ac4bf7bbf2dca670b3728d95c91c69487d242a7 | muhammadisa/bareksanews | /repository/sql/queries.go | Go | go | 2,487 | no_license | package sql
const (
queryWriteBulkNewsTags = `INSERT INTO news_tags(id, news_id, tag_id, created_at, updated_at) VALUES %s`
queryReadNewsTags = `SELECT news_tags.tag_id, tags.tag FROM news_tags LEFT JOIN tags ON tags.id = news_tags.tag_id WHERE news_tags.news_id = ?`
queryRemoveNewsTagsBy... |
c9ce474d80657dd331c829379d725afab0836c52 | a8820dec9e389bdb1d3cdca62166189142e4bdc2 | michaelbannister/istio | /pilot/pkg/serviceregistry/mcp/controller.go | Go | go | 9,401 | permissive | // Copyright 2018 Istio 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 i... |
c7172d8a73ecfaa05a3bf0eec4ffc05ade6a02eb | 8db5c014763f803322ce6bb12085797096026047 | glabrego/glabrego-codes | /go/go-by-example/methods.go | Go | go | 475 | no_license | package main
import "fmt"
type rectangle struct {
height, width int
}
func (rect *rectangle) area() int {
return rect.width * rect.height
}
func (rect rectangle) perimeter() int {
return 2*rect.width + 2*rect.height
}
func main() {
rect := rectangle{width: 10, height: 5}
fmt.Println("Area: ", rect.area())
fm... |
1ab814e05dffe520204629404d1295715058acde | 65a1417a9581c87527a4d262ba6798d36d7019dc | llddyy123wf/MyFirstGoLangDemo | /src/mytest/func/mainentry.go | Go | go | 1,833 | no_license | package main
import (
"fmt"
"time"
)
func main() {
testMultyPara(1, 2, 3)
//测试任意类型多参数传递
var v1 int = 1
var v2 int64 = 234
var v3 string = "hello"
var v4 float64 = 1.234
v5 := 5
testMultyTypeMultyPara(v1, v2, v3, v4, v5)
//测试匿名函数,赋给变量直接调用
f := func(a, b int, c float64) bool {
return a*b < int(c)
}
fmt.... |
be26635dfeec66919626166dde3314f6e87eed46 | 3b994206f5dcfcd87e3c6523eeb06aefb4f43a2e | bborbe/world | /configuration/service/cron_test.go | Go | go | 1,526 | permissive | // Copyright (c) 2020 Benjamin Borbe All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package service_test
import (
"context"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/bborbe/world/configuration/service"
)
var _... |
f19b6038ac4382d15bc1e1cea81d44737ad8b44b | bef0deeda29d223740b5eebacb69b5ebc7388321 | skycoin/skycoin-exchange | /vendor/github.com/btcsuite/btcd/wire/msgblock_test.go | Go | go | 17,848 | permissive | // Copyright (c) 2013-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package wire
import (
"bytes"
"io"
"reflect"
"testing"
"time"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/davecgh/go-spew/spew"
)
// TestBlock te... |
f7d0efcbc618d9912defee63b475eeb73dee330b | eb7542fecf08adffc7bf6ed0ef5610882014dee2 | edesoft/nanoserver | /cmd/mahjong/game/rest_api.go | Go | go | 423 | permissive | package game
import (
"nanoserver/protocol"
)
// TODO: conc
func Kick(uid int64) error {
defaultManager.chKick <- uid
return nil
}
func BroadcastSystemMessage(message string) {
defaultManager.group.Broadcast("onBroadcast", &protocol.StringMessage{Message: message})
}
func Reset(uid int64) {
defaultManager.chRe... |
46ab8111da4aa376b5e8f719e0c5772f7f7e82d2 | 0a9a22a3c8939f0a507cfc77cad915c32ec729dc | sapcc/hermes-etl | /main.go | Go | go | 2,084 | no_license | package main
import (
"flag"
"fmt"
"os"
"log"
//"github.com/sapcc/hermes-etl/sink"
"github.com/sapcc/hermes-etl/source"
"github.com/spf13/viper"
)
func main() {
// Handle Config options, command line support for config location
configPath := parseCmdFlags()
setDefaultConfig()
readConfig(configPath)
//UR... |
448abe196d62dff8fb1ef38b6254a83ac38a3319 | 8b2e0d08940826f62b131c34943bc57481edf59e | prattmic/emgo | /egroot/src/arch/cortexm/scb/xgen_actlr.go | Go | go | 1,937 | permissive | package scb
// DO NOT EDIT THIS FILE. GENERATED BY xgen.
import (
"bits"
"mmio"
"unsafe"
)
type AUX_Periph struct {
ACTLR RACTLR
}
func (p *AUX_Periph) BaseAddr() uintptr {
return uintptr(unsafe.Pointer(p))
}
//emgo:const
var AUX = (*AUX_Periph)(unsafe.Pointer(uintptr(0xe000e008)))
type ACTLR uint32
func (b... |
41bd4089579cd497056b3a81e3d4d492502c3ad9 | 864808cee4c8117eb47c816c78ff53af3e5f2dcf | Shivkb/contiv-vpp | /mock/vppagent/handler/interface.go | Go | go | 2,857 | permissive | // Copyright (c) 2019 Bell Canada, Pantheon Technologies and/or its affiliates.
//
// 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
//
//... |
590253f3d2b3fb6a7bec958bfc07b289112379fe | ae630c52f4a932da214fb6520da717bd9bb0e1ab | zhangbo0528/yjgov2 | /app/model/system/role_dept/role_dept_entity.go | Go | go | 1,563 | permissive | package role_dept
import (
"xorm.io/core"
"yj-app/app/yjgframe/db"
)
type Entity struct {
RoleId int64 `json:"role_id" xorm:"not null pk comment('角色ID') BIGINT(20)"`
DeptId int64 `json:"dept_id" xorm:"not null pk comment('部门ID') BIGINT(20)"`
}
//映射数据表
func TableName() string {
return "sys_role_dept"
}
// 插入数据
... |
403c0f4619a941a64a964356873d3a897d281c80 | c43d750592a5a6fc14de078e9b09f63ec97945bd | besiano15/Go-7 | /paracalc/main.go | Go | go | 464 | no_license | // paracalc project main.go
package main
import (
"fmt"
)
func sum(values []int, resultChan chan int) {
sum := 0
for _, value := range values {
sum += value
}
resultChan <- sum
}
func main() {
values := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
resultChan := make(chan int, 2)
go sum(values[:len(values)/2], resu... |
97c7c8c86dd561397f3296e5396841f77f70c96d | 301aadf176abb9e06f1f539f68a5ec9113fac7a5 | tcirstea/magma | /lte/cloud/go/services/cellular/utils/lte_bands.go | Go | go | 2,090 | permissive | /*
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 utils
import "fmt"
// LTEBand struct for converting EARFCN to Band
type LTEBand struct {
ID ui... |
b0e5d531fd50f68e5634001493ae1fa5a8fb96ee | 9b6d6390abeb13481bad3acb53d04a124260a8ad | harishgr2602/DS_and_Algorithm | /sorts/circular_linked_list.go | Go | go | 472 | no_license | package main
import "fmt"
type CircularLinkedList struct {
tail *Node
count int
}
type Node struct {
value int
next *Node
}
func (list *CircularLinkedList) Size() int {
return list.count
}
func (list *CircularLinkedList) IsEmpty() bool {
return list.count == 0
}
func (list *CircularL... |
4339fda952311a8691eef65c35cccb405d390ae2 | 4881c8a1ac649d15d85b3cfe2ec456ed030f8963 | sapcc/vice-jockey | /pkg/jockey/verify.go | Go | go | 1,666 | permissive | package jockey
import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"
"net"
"path/filepath"
"time"
"github.com/golang/glog"
)
func Validate(configFile string) error {
config, err := loadConfig(configFile)
if err != nil {
return fmt.Errorf("Could read config-file: %v", err)
}
glog.Info("=============... |
abdb935cf4228bccaa79ff4308bb6009c63d9a55 | 5ac31174c27ff267e8300fc479baa97302f1145e | lkygithub/StringSetGoImplementation | /sets_test.go | Go | go | 1,975 | no_license | package sets
import (
"testing"
)
func TestInsert(t *testing.T) {
ss := NewString()
// Insert 1 item\
ss.Insert("a")
if !ss.Has("a") {
t.Errorf("Insert failed.")
}
// Insert several items
ss.Insert("a", "bb", "ccc", "dddd")
if !ss.HasAll("a", "bb", "ccc", "dddd") || ss.Len() != 4 {
t.Errorf("Insert... |
fe4ef1125a3bf513849babb0ca7cda9522581359 | bba617818a4a9c201f0b7a27c2a3a1de20b106b1 | bivas/rivi | /vendor/github.com/go-kit/kit/examples/apigateway/main.go | Go | go | 8,998 | permissive | package main
import (
"bytes"
"context"
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/gorilla/mux"
"github.com/hashicorp/consul/api"
stdopentracing "github.com/opentracing/opentracing-go"
"github.com/go-kit/kit/endpoint"
... |
c6399b5bdbd0bac17e6817645934f03e6bb7cf60 | 2dacd48c37f14477bb5ae6ef00019a6b6be8ff22 | kentliuqiao/hst | /example/main.go | Go | go | 2,085 | permissive | package main
import (
"fmt"
"html/template"
"os"
"strings"
"time"
"github.com/ohko/hst"
)
func main() {
s := hst.New(nil)
// 禁止显示Route日志
// s.DisableRouteLog = true
// HTML模版
s.SetDelims("{[{", "}]}")
s.SetTemplateFunc(template.FuncMap{"json": func(x string) string { return "JSON:" + x }})
// s.ParseG... |
821268b76d9cd628eb19f3b9d0bb156e3dbd6142 | 5cf03043420b8b80387d501076732d58e768f880 | zhanggbj/bosh-cli | /deployment/disk/mocks/mocks.go | Go | go | 3,358 | permissive | // Automatically generated by MockGen. DO NOT EDIT!
// Source: github.com/cloudfoundry/bosh-cli/deployment/disk (interfaces: Disk,Manager)
package mocks
import (
disk "github.com/cloudfoundry/bosh-cli/deployment/disk"
manifest "github.com/cloudfoundry/bosh-cli/deployment/manifest"
ui "github.com/cloudfoundry/bosh-... |
25a9b11cf3ab6bf7438bda80292b390a1c666a35 | b07862f04d3f50709fc942dd1365be285d50536c | Wikia/konfigurator | /vendor/golang.org/x/net/route/route_openbsd.go | Go | go | 762 | permissive | // Copyright 2016 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 route
func (*wireFormat) parseRouteMessage(_ RIBType, b []byte) (Message, error) {
if len(b) < 40 {
return nil, errMessageTooShort
}
l := int(nati... |
02bf86ffbf50552006d23dc1b710f83fe439d992 | 6cc993b50e53a572ca992c57ed532d8976c0024a | YongYuIT/Go-Stu | /hello_kettle/tools/tableTools.go | Go | go | 4,465 | no_license | package tools
import (
"fmt"
"github.com/beevik/etree"
"github.com/jinzhu/gorm"
"strings"
)
func GetConnStrForMySql(mysql_conf_info map[string]interface{}) string {
return fmt.Sprintf("%s:%s@(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local",
mysql_conf_info["user_name"].(string),
mysql_conf_info["pwd"].(stri... |
aa71c39dfa6a8d9f0a41e5f0554df088a272240d | 5b611fd051b17c814760ef7ed30a098ee9b5d0b5 | brunotm/tact | /collector/oracle/wait.go | Go | go | 1,050 | permissive | package oracle
import (
"time"
"github.com/brunotm/rexon"
"github.com/brunotm/tact"
"github.com/brunotm/tact/collector/client/oracle"
)
const (
waitClassQuery = `select wait_class, total_waits as total_waits_avg,
time_waited/10 as time_waited_ms_avg from v$system_wait_class where wait_class != 'Idle'`
)
// in... |
449ff02ab13e04bfc3786ffa7f8a01c98410893d | 9b35379846bab77f107747eac7c7c61b50474ec7 | jahau/go-client | /msgpack/pack_test.go | Go | go | 2,800 | permissive | package msgpack
import (
"encoding/hex"
"fmt"
"reflect"
"testing"
)
var packTests = []struct {
v interface{}
h string
}{
{int64(0x0), "00"},
{int64(0x1), "01"},
{int64(0x7f), "7f"},
{int64(0x80), "cc80"},
{int64(0x7fff), "cd7fff"},
{int64(0x8000), "cd8000"},
{int64(0x7fffffff), "ce7fffffff"},
{int64(0x8... |
a78d869aca34cb8c3c3042b1fa38bb6a5c3ed432 | cdaa1ef306aac93d2de8aa4a7399942c8720c0fe | rdterner/go-ipfs | /core/commands/add.go | Go | go | 12,823 | permissive | package commands
import (
"fmt"
"io"
"path"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/cheggaaa/pb"
ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
syncds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
cxt "github.com/ipfs/go... |
a1ae1095ed70962d46ff1b66df62a75f8ec982da | 3a3f2dd1667d525de5202e5d3e8ab2f8284d283c | scalingdata/gomega | /matchers/be_true_matcher.go | Go | go | 608 | permissive | package matchers
import (
"fmt"
"github.com/scalingdata/gomega/format"
)
type BeTrueMatcher struct {
}
func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) {
if !isBool(actual) {
return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1))
}
return actual.(... |
c82467ef7ca8eb27fb3bb3ad98d2fbf7068b11d5 | 1c5fb9027a6845ba59762e6e5e47774853cf97f9 | mchmarny/ktest | /utils/uuid.go | Go | go | 229 | permissive | package utils
import (
"log"
"github.com/google/uuid"
)
// NewID returns UUID v4
func NewID() string {
id, err := uuid.NewRandom()
if err != nil {
log.Fatalf("Error while getting id: %v\n", err)
}
return id.String()
}
|
f2ab21eb8c4342ffbd5c34e3e708051d280f61ab | 68842a13a18644fdaf4c58cd093494d03aafb2a1 | EdsonF/skaffold | /pkg/skaffold/gcp/projectid_test.go | Go | go | 1,436 | permissive | /*
Copyright 2019 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... |
6396ecdd89f611b3b4307adac149fbe0545180e5 | 6022acbfa5c57d37c1a49d41bb323a8e8a5e19f0 | BartoszBurgiel/kanbanBoard | /server/stateAction.go | Go | go | 2,008 | no_license | package server
import (
"fmt"
"net/http"
"strconv"
)
// editState updates a given state
func (s *Server) handleEditState(w http.ResponseWriter, r *http.Request) {
// Fetch variables
newName := r.FormValue("newName")
newLimit := r.FormValue("newLimit")
newPosition := r.FormValue("newPosition")
stateID := r.Fo... |
72238c7831a84a5f3df7462bd71ee0c11a96bdf9 | f462f650136d013e5893331b9c7544e0b7e2efc2 | Darma-digital-solutions/manual_api | /src/modules/search/model/search.go | Go | go | 245 | permissive | package model
import (
"github.com/iamJune20/dds/src/modules/content/model"
)
type SearchOne struct {
AppCode string
AppName string
AppLogo string
CountContent int
Content model.Contents
}
type SearchAll []SearchOne
|
b9d989211982032fa82c7aad365326a427f4619b | 5b12c798b914f2ea3fe8bbbc9db3792d7162679f | maxzhang/alipay-jb | /wap_test.go | Go | go | 508 | permissive | package alipay_test
import (
"github.com/JeffreyBool/alipay"
"testing"
)
func TestAliPay_TradeWapPay(t *testing.T) {
t.Log("========== TradeWapPay ==========")
var p = alipay.TradeWapPay{}
p.NotifyURL = "http://203.86.24.181:3000/alipay"
p.ReturnURL = "http://203.86.24.181:3000"
p.Subject = "修正了中文的 Bug"
p.Out... |
da7a127a6e4105a073a087e33d9094381eb884f4 | 4ad7a8538cf73e9ec9680881fb2e1f6656dcea5f | wyb1/gardener | /pkg/client/kubernetes/scaling_test.go | Go | go | 4,776 | permissive | // Copyright (c) 2020 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 compliance with the Lice... |
dd64e8da177fa48a711ed0a43a393f15c6b041c9 | 4816d091551c3e8347c106e79addfe56a617dddc | getlantern/goexpr | /noop.go | Go | go | 363 | permissive | package goexpr
// noop is an expression that does nothing (always returns nil)
type noop struct{}
func (e *noop) Eval(params Params) interface{} {
return nil
}
func (e *noop) WalkParams(cb func(string)) {
}
func (e *noop) WalkOneToOneParams(cb func(string)) {
}
func (e *noop) WalkLists(cb func(List)) {
}
func (e... |
b1a501cd419eb9d333ad879562e7d941e9110b77 | 3a9d7a062f351630810688311595d6cee38a7098 | xDuck/webview | /webview.go | Go | go | 9,135 | permissive | package webview
/*
#cgo linux openbsd freebsd CXXFLAGS: -DWEBVIEW_GTK -std=c++11
#cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0
#cgo darwin CXXFLAGS: -DWEBVIEW_COCOA -std=c++11
#cgo darwin LDFLAGS: -framework WebKit
#cgo windows CXXFLAGS: -std=c++11
#cgo windows,amd64 LDFLAGS: -L./dll/x64 -lwebview -... |
c663c989ef01c87e234a9f89f6886e4d5d4eead2 | 4a41e5f7163d6f2bbea5f8d69e43b65a05f7ed2b | vmware/vsphere-automation-sdk-go | /services/nsxt/global_infra/TraceflowsTypes.go | Go | go | 8,622 | permissive | // Copyright © 2019-2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
// Auto generated code. DO NOT EDIT.
// Data type definitions file for service: Traceflows.
// Includes binding types of a structures and enumerations defined in the service.
// Shared by client-side stubs and server-s... |
9d87206a19e0900a3033df5ceee4badecd857aed | aa606774442287e3dcc4234f260d30b76b41bb61 | DevOps8012/kubebench | /controller/kubebench-operator/pkg/client/listers/kubebenchjob/v1/kubebenchjob.go | Go | go | 3,354 | permissive | /*
Copyright 2018 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, ... |
0211bc8237d8b02d199b67795cbeba6b0462a1b8 | 56387f8b53ad70423791392e1a1416ecbc2ce9a0 | nathansenn/lotus | /chain/events/state/predicates_test.go | Go | go | 6,073 | permissive | package state
import (
"context"
"testing"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/ipfs/go-hamt-ipld"
"github.com/filecoin-project/go-amt-ipld/v2"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
ds "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datast... |
887c1e92d7f2a7f7fea3de5758909a0882bd2fe9 | 0d6f0450e022412fb6aa7f259fcb644bb2b0b8e7 | CodeFreezr/gobyes | /corpus/golangsam/AnyType/chan/ssss/basic/type/IsInteger/ChanInt8.dot.go | Go | go | 8,454 | permissive | // Copyright 2017 Andreas Pannewitz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package IsInteger
// This file was generated with dotgo
// DO NOT EDIT - Improve the pattern!
// MakeInt8Chan returns a new open channel
// (simply a 'chan... |
a34c5f248810cbcd567aaecd000547bc9818c5dd | 19c6c6cf7b7d12d51b652ddd8c8138bbffa50025 | droslean/ci-tools | /cmd/pj-rehearse/main_test.go | Go | go | 15,991 | permissive | package main
import (
"context"
"fmt"
"sort"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/sirupsen/logrus"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes/scheme"
prowconfig... |
4b365a5e96389c55f073107f561b1a8ead3cee3e | 6f8c725045db0a0be5ee5c0d49bab7b4782f2409 | naruhide/profitCaluculation | /calc/calc.go | Go | go | 2,770 | no_license | // calc package includes calculation of investment result simulation.
package calc
import "fmt"
const (
domesticFeesPerTransaction float64 = 0.45 // Represented by percentage.
maxDomesticFees float64 = 20 // Dollar.
localTransactionCostsPerOneContractPrice float64... |
b3a71f44819986f26394c79b9d688a0d5e689bb3 | 4df66a715abf8c6580e064441d1db633402fd639 | damiendube/advent2020 | /cmd/day81.go | Go | go | 1,596 | permissive | /*
Copyright © 2020 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... |
e4d568ac186fd4dae38aa32f8406cb1bc17be1ca | 71350241be77163d2f4b507842aac82c1b1a2721 | crain9412/gocastle | /src/stack/string_stack_test.go | Go | go | 933 | no_license | package stack
import "testing"
func Test_StringStack_Push(t *testing.T) {
want := "[world] -> [hello]"
stack := new(StringStack)
stack.Push("hello")
stack.Push("world")
if got := stack.Print(); got != want {
t.Errorf("Stack contained %q, want %q", got, want)
}
}
func Test_StringStack_Pop(t *testing.T) {
wan... |
e14f7efd41dccbef474582de33c4d16c9977759b | b8950109d4aa2fb9f12e1f116a4a96793269b27b | go-gts/gts | /cmd/gts/length.go | Go | go | 1,565 | permissive | package main
import (
"bufio"
"fmt"
"io"
"os"
"github.com/go-gts/flags"
"github.com/go-gts/gts"
"github.com/go-gts/gts/cmd"
"github.com/go-gts/gts/seqio"
)
func init() {
flags.Register("length", "report the length of the sequence(s)", lengthFunc)
}
func lengthFunc(ctx *flags.Context) error {
pos, opt := f... |
d7ffce29a64b22fba2e832ea51bb1314af4d1858 | bc26919e904900841d5dac9a2422e1074bb58abd | jerry-tom/bk-bcs | /bcs-services/bcs-networkpolicy/controller/node.go | Go | go | 3,463 | permissive | /*
* Modifications Copyright (C) 2019 THL A29 Limited, a Tencent company. 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/LI... |
a4be50996f07d9c9319103927a40e365c344eedc | 4a0076b0354a0425e371e06feb516df261a3ad6b | saeed617/swarmtool | /s3.go | Go | go | 807 | permissive | package swarmtool
import (
"context"
"github.com/minio/minio-go/v7"
"log"
"strings"
)
type (
// S3Client amazon s3 compatible methods.
S3Client interface {
Upload(ctx context.Context, bucketName, filePath string) error
}
// MinIOClient implements S3Client.
MinIOClient struct {
Client *minio.Client
}
)
... |
5141950a410172a7a5465ad6435455641d2c9e46 | 27c963694712027f2f5bd1c19fb93f869cd64bc3 | lizhenggan/TwentyFour | /01_Language/01_Functions/go/src/functions/getimagesizefromstring_test.go | Go | go | 335 | permissive | package functions
import (
"fmt"
"io/ioutil"
"log"
"os"
"testing"
)
func TestGetimagesizefromstring(t *testing.T) {
file, err := os.Open("test.gif")
if err != nil {
log.Fatal(err)
}
defer file.Close()
bytes, err := ioutil.ReadAll(file)
if err != nil {
log.Fatal(err)
}
fmt.Println(Getimagesizefromst... |
01767c4f0b7245e339a3974a206c2cefba5c5c0f | 22003fcd119970329e35f91d68bd052f8f3299ae | jutionck/enigma-api | /config/db.go | Go | go | 762 | no_license | package config
import (
"database/sql"
"fmt"
"github.com/jutionck/enigma-bank-api/utils"
"log"
//for connection mysql db
_ "github.com/go-sql-driver/mysql"
)
var (
dbUser, dbPass, dbHost, dbPort, schemaName string
)
func ConfigDb() (*sql.DB, error) {
dbUser = utils.ViperGetEnv("DB_USER", "root")
dbPass = u... |
1ca93e09e665f21697c16ba69ab2b462b6a1fd13 | 837f7d7afbcbd5565c4e79d6a2d6010153dbbabf | gtsigner/go-gtcache | /gt_cache_test.go | Go | go | 460 | no_license | package cacher
import (
"fmt"
"github.com/go-redis/redis/v7"
"testing"
)
func TestNewGtCache(t *testing.T) {
var rds = NewGtCache(&redis.Options{
Addr: "127.0.0.1:6379",
Password: "zhaojunlike",
DB: 1,
})
rds.Client.Subscribe()
err := rds.Client.Close()
... |
c4204bebc1744a8b7f943a137a6e12c09054ffec | ca0ddb2c5f8c53ef82ac29dd17fb917c754f7138 | sqweek/sqribe | /score/scale.go | Go | go | 5,325 | no_license | package score
import (
"github.com/sqweek/sqribe/midi"
)
type KeySig int
type Clef struct {
Name string
Origin uint8 // unaltered midi pitch of center note
tone int // tone index of center note (relative to C scale)
}
var TrebleClef Clef = Clef{"Treble", midi.PitchB5, 6}
var BassClef Clef = Clef{"Bass", midi.Pi... |
8f969df546868f4b683d81c689b1624c0a2b0d53 | 5573e58352aaeab06e58ac3dda623d677dc44b5f | rmaftei/playground | /golang/algorithms/insertsort/main.go | Go | go | 1,043 | no_license | package main
import "fmt"
func main() {
numbers := [100]int{
82, 2, 35, 86, 51, 27, 50, 57, 89, 17, 30, 67,
2, 57, 22, 60, 5, 96, 26, 26, 51, 44, 69, 34,
87, 79, 13, 63, 25, 39, 13, 59, 86, 75, 31,
84, 42, 59, 43, 10, 68, 64, 91, 39, 52, 11,
27, 25, 65, 99, 70, 39, 54, 21, 40, 39, 48,
35, 68, 32, 94, 15,... |
eca8bcb206eeca662aedb849faf982bcb6ee0009 | 1bbedc26bbdbb28edce46eea61e67e9517bb164b | xtreme-jon-ji/leftovers | /gcp/compute/fakes/vpn_tunnels_client.go | Go | go | 937 | permissive | package fakes
import gcpcompute "google.golang.org/api/compute/v1"
type VpnTunnelsClient struct {
ListVpnTunnelsCall struct {
CallCount int
Receives struct {
Region string
}
Returns struct {
Output []*gcpcompute.VpnTunnel
Error error
}
}
DeleteVpnTunnelCall struct {
CallCount int
Receives... |
bc7f8ac706eded083940e5d517afe9d778ae0671 | cd9993519b09d38e931cf8e208fff28c1c0d09ab | sohanlaxmicoin/go | /services/orbit/internal/resource/transaction.go | Go | go | 1,840 | permissive | package resource
import (
"context"
"fmt"
"strings"
"time"
"github.com/guregu/null"
"github.com/rover/go/services/orbit/internal/db2/history"
"github.com/rover/go/services/orbit/internal/httpx"
"github.com/rover/go/services/orbit/internal/render/hal"
)
// Populate fills out the details
func (res *Transaction... |
e7b74d3937490d518630dd827584d8eb724dedb4 | 056c01af8f9c6a48df60664fedb45afce6ce10c7 | marioarranzr/learning-go | /go-fundamentals/10-test-read-file/main.go | Go | go | 341 | no_license | package main
import (
"fmt"
"log"
"os"
)
func main() {
filename := os.Args[1]
file, err := os.Open(filename)
if err != nil {
fmt.Println("Error:", err)
os.Exit(1)
}
data := make([]byte, 1000000)
count, err := file.Read(data)
if err != nil {
log.Fatal(err)
}
if count > 0 {
fmt.Println(string(d... |
9aa73fbda1ee90deec6ed88edf52b385262fb782 | 0237dd1400ccfae474ab7f64768461fc851a1ff7 | danielnorberg/kubernetes | /pkg/registry/etcd_registry_test.go | Go | go | 18,730 | permissive | /*
Copyright 2014 Google 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 to in ... |
eb98528b8c0e40ee1407d3b03baba8005f9350fe | 82636f4df50c9296ee866778a52a0bea43726bd2 | iamslash/learntocode | /leetcode2/KidsWiththeGreatestNumberofCandies/a.go | Go | go | 490 | no_license | /* Copyright (C) 2020 by iamslash */
package main
// 0ms 100.00% 2.3MB 82.11%
// brute force
// O(N) O(N)
func max(a, b int) int {
if a > b {
return a
}
return b
}
func kidsWithCandies(candies []int, extraCandies int) []bool {
ans := make([]bool, len(candies))
maxCandy := 0
for _, c := range c... |
28281928a825ea134f55e04b7547c5fdf978e677 | 9a47e2faf140c0ccb9703f6408317c0efb029a46 | backendservice/todo | /simpledb_service.go | Go | go | 2,485 | permissive | package main
import (
"fmt"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/simpledb"
)
var (
trueValue = true
titleName = "title"
completedName = "completed"
createdAtName = "created_at"
)
// SimpleDBService provides persistence layer via AWS SimpleDB
ty... |
6b1db3f4d33b750b0bab03e2cfa2a51f7f618f99 | e3344692fa3298c126ccfd03a82cb585093897fc | RichardRod/beam | /sdks/go/pkg/beam/runners/universal/universal.go | Go | go | 2,168 | permissive | // 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 not... |
15a5b63693d13a9d13f3c79c9d33f6910b11852b | 60e1d0b30643697f44038a01f1de1ff264c1aa9d | alorentiar/dhammer | /hammer/hammer.go | Go | go | 7,208 | permissive | package hammer
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"sync"
"time"
"github.com/ipchama/dhammer/config"
"github.com/ipchama/dhammer/generator"
"github.com/ipchama/dhammer/handler"
"github.com/ipchama/dhammer/socketeer"
"github.com/ipchama/dhammer/stats"
"github.com/corneldamia... |
e17d8fcdd05685ff6df0175a31b951a2c217cdc8 | 0d45c63feb9cd4b5ae2c312ccc12921eccbfef79 | hisoka666/fasttracksanglahver2 | /ft/view.go | Go | go | 1,141 | no_license | package ft
import (
"net/http"
"html/template"
"strings"
"fmt"
)
func RenderPasien(w http.ResponseWriter, data interface{}, tmp string ){
tmpl, err := template.New("tempPasien").Parse(tmp)
if err != nil {
fmt.Fprint(w, "Error Parsing: %v", err)
}
tmpl.Execute(w, data)
}
func RenderTempla... |
ac606d828bc89e4a3089ea8f5de3057db0b4115c | 96b3f8dd0b96065309289265344dd3046e59c211 | imdone/kubernetes | /pkg/kubelet/dockershim/helpers_linux.go | Go | go | 4,537 | permissive | // +build linux
/*
Copyright 2015 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 agree... |
1b16c5a12ccc08ba81493748a5721c4b751ce8c7 | c2e642f4716e9956949a591adb8db6e5dd4fbcc2 | mechmind/ttti | /client/game.go | Go | go | 3,136 | no_license | package main
import (
"log"
"os"
"time"
"math/rand"
"github.com/mechmind/ttti-server/message"
"github.com/mechmind/ttti-server/game"
)
type Gamer struct {
game *game.Game
glyph game.Glyph
}
func runGame(c *Client) error {
// init rand
rand.Seed(time.Now().UnixNano())
c.S... |
19137f90d0ac56f31062a17ca301f2bcbeb37d3d | 26a6ae9a8be177cfdf2532e782e904d1c835260b | honeycombio/opentelemetry-collector-contrib | /processor/filterprocessor/config.go | Go | go | 12,782 | permissive | // Copyright The OpenTelemetry 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 ag... |
cc1ca0e30f92f95c19c992d54f9f0c7cb8d92c47 | 92b7650ac396af735bb6088c581ccbb0c2aefe72 | pschulten/components-contrib | /pubsub/kafka/kafka_test.go | Go | go | 2,780 | permissive | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation and Dapr Contributors.
// Licensed under the MIT License.
// ------------------------------------------------------------
package kafka
import (
"testing"
"github.com/dapr/components-contrib/pubsub"
"github.com/... |
255e8022af0ce89cfefee9f94a2953a812b8cc6c | ee17af0d89d0ffc9e6dbb243e16648de2e9afda4 | gotokatsuya/break | /model/tour/repository.go | Go | go | 1,577 | no_license | package tour
import (
"fmt"
"github.com/jinzhu/gorm"
"github.com/labstack/echo"
"github.com/gotokatsuya/break/model"
)
// Repository ...
type Repository struct {
*model.RootRepository
}
// NewRepository ...
func NewRepository(ctx echo.Context) *Repository {
return &Repository{
RootRepository: model.NewRoot... |
d01d24be97095926e2f6e5a73048703d75ec2c32 | 4d8a5ac2231066db571786a76f204f5dac6b901b | simhaonline/gvisor | /pkg/sentry/socket/epsocket/epsocket.go | Go | go | 79,348 | permissive | // Copyright 2018 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... |
90f3ba8790d9f692c59c7d114f5142c7ccc02f1f | 6f490f4f9ebb98fb06ce1504c270bc58c51c6650 | chendx79/gafka | /cmd/kateway/gateway/handler_pub_ws.go | Go | go | 431 | no_license | // +build !fasthttp
package gateway
import (
"net/http"
log "github.com/funkygao/log4go"
"github.com/julienschmidt/httprouter"
)
// POST /v1/ws/msgs/:topic/:ver
// TODO not implemented yet
func (this *pubServer) pubWsHandler(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
ws, err := upgrader... |
64983eb65bd31f6402555514703dd4b028b44499 | 60ef769074f989e50fd13e7256a8b0373f257728 | playniuniu/fortiscan | /scan/scan.go | Go | go | 10,804 | no_license | package scan
import (
"bufio"
"bytes"
"encoding/json"
"io"
//"errors"
"crypto/tls"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"regexp"
"strings"
"sync"
"time"
"unicode"
"unicode/utf8"
"github.com/cockroachdb/errors"
"github.com/common-nighthawk/go-figure"
)
const userAgent = "Mozilla/5.0 (X11... |
7192f17cf7529ea6d30a8a2fd04491b1c6eddeae | 2767862066bdd0aabef1b85047f2dce9018967b8 | rx007/automate | /components/event-service/integration_test/publish_test.go | Go | go | 7,752 | permissive | package integration_test
import (
"context"
"fmt"
"strconv"
"testing"
"time"
"github.com/gofrs/uuid"
"github.com/golang/protobuf/ptypes"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
api "github.com/chef/automate/api/i... |
b159871064f82ead45e30940e9571598a7bc889a | 4720dd1957e10108706cbddf852be132fb94d309 | jglouis/4eail40_2020 | /samples/pattern/functional/memoize/fib.go | Go | go | 369 | permissive | package memoize
func fibonacci(n int) int {
if n <= 1 {
return 1
}
return memoizedIntInt(fibonacci)(n-1) + memoizedIntInt(fibonacci)(n-2)
}
var cache = make(map[int]int)
func memoizedIntInt(f func(int) int) func(int) int {
return func(i int) int {
if cached, exist := cache[i]; exist {
return cached
}
... |
52cc853b49165484aa225de03a34f0aa6ddca52c | 3513b8f3b6c823c2c74a156eea968ade92730daa | sancus-project/sancus-golang | /web/uritemplate/uritemplate.go | Go | go | 331 | permissive | package uritemplate
// expressions
//
type exprType int
const (
exprLITERAL exprType = iota + 1
exprEOL
exprCAPTURE
exprOPTIONAL
)
type expression interface {
Type() exprType
String() string
}
type container interface {
addToken(t *token, p *parser) (bool, error)
addExpression(e expression, p *parser) (bool... |
8711a78e641cba3807fe9335ab7ff81b48ca68ba | 860d5d8aefc0b9d73baeb3612e8ad2ed24f09ab3 | sebeec/tzgo | /rpc/utils.go | Go | go | 2,210 | permissive | // Copyright (c) 2018 ECAD Labs Inc. MIT License
// Copyright (c) 2020-2021 Blockwatch Data Inc.
// Author: alex@blockwatch.cc
package rpc
import (
"encoding/hex"
"encoding/json"
"fmt"
)
// HexBytes represents bytes as a JSON string of hexadecimal digits
type HexBytes []byte
// UnmarshalText umarshalls a hex str... |
d3cfcfefbf055faa7c1cd88a7c4ecd6c0ea0a763 | 14582c4da47a56e8399b230013ee1edc1dfae7d2 | wget1988/Gol- | /chapter02/map.go | Go | go | 1,386 | no_license | package main
import "fmt"
func main() {
//[]中为key类型
var scores map[string]int //nil映射
//定义完映射后必须初始化后再进行操作
// fmt.Printf("%T %#v\n", scores, scores)
// fmt.Println(scores == nil)
scores = map[string]int{"sql": 8, "hyy": 10}
fmt.Println(scores)
// scores = make(map[string]int)
// //scores = map[string]in... |
a54fc81a8457728e07ec839817a41408436019a6 | cba9de27903abc8108e4343a766331cfee8747f4 | Febby315/wm_spider | /etl_do/etl_mongo_src/server/price/priceModel.go | Go | go | 1,087 | no_license | package price
import (
"../../utils"
"gopkg.in/mgo.v2/bson"
)
type (
// 价格结构体
Price struct {
ID bson.ObjectId `json:"_id" bson:"_id"`
PublishDate string `json:"publishDate" bson:"publishDate,omitempty"`
Marketname string `json:"marketname" bson:"marketname,omitempty"`
Name s... |
99763e3581f544ad5611ac883211d407e11484e0 | a3d41066ce0e36b85eb1e4faddd0c2390cfda984 | guanjie/erictools | /basic_tools/basic_hello/sleep.go | Go | go | 366 | no_license | package main
import (
"fmt"
"time"
)
func main() {
for i := 0; i < 10; i++ {
// select {
// case <-time.After(time.Second):
// fmt.Println("this is after one second number: ", i)
// }
time.Sleep(time.Second)
fmt.Println("This is af... |
319e96981d16bd6c7c49c5ace3eac3e77a9bdaef | dd07230c4bb87df18d1dc407a7490c5c70b1f443 | FabienGadet0/dota-predictor-API | /app/handlers/predictions.go | Go | go | 9,048 | no_license | package handlers
import (
"dota-predictor/app/config"
"dota-predictor/app/helpers"
"dota-predictor/app/models"
"encoding/json"
"log"
"net/http"
"strconv"
"time"
"github.com/gorilla/mux"
)
// @Summary Get prediction for specific match
// @Produce json
// @Success 200 {object} models.Response
// @Failure 500 ... |
ce07b986cbc4e942ec55dc102067a6eeb2fc8c91 | a696869513a37a4aa1341a9a360ca24c58f09fdb | CodingSoldier/java-learn | /project/docker+k8s/慕课网docker/docker教程课件/chapter10/labs/heapster-master/metrics/util/metrics/http.go | Go | go | 4,948 | permissive | // Copyright 2015 Google 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... |
86ab0af26b6f803d4cb88e0ca326d7ea4291546d | f63ae926308045c2a795ee301fa77d989a914e8e | amit2014/terraform-colonist | /colonist/utils_test.go | Go | go | 1,476 | permissive | /*
* 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 applicabl... |
752883fb57b937c918371c64708f18b7b747edbc | 6bdd51da7811846a5083259a4590b8a107558892 | naaytesting2/gitlab-pages-mirror | /internal/serving/serverless/cluster.go | Go | go | 780 | permissive | package serverless
import (
"crypto/tls"
"strings"
)
// Cluster represent a Knative cluster that we want to proxy requests to
type Cluster struct {
Address string // Address is a real IP address of a cluster ingress
Port string // Port is a real port of HTTP TLS service
Name string // Name is a cluster nam... |
d161bcff42004d8004358795387709bd19447c7d | 58e3ef770a3b9453770250c89d76f3183fe169d5 | SteveBirtles/gowalkthrough | /server/controllers/game.go | Go | go | 2,837 | no_license | package controllers
import (
"../../server/models"
"../../server/utils"
"encoding/json"
"fmt"
"net/http"
"strconv"
)
func ListGames(w http.ResponseWriter, r *http.Request) {
if r.Method != "GET" {
w.WriteHeader(http.StatusMethodNotAllowed)
return
}
type GamesWithConsole struct {
ConsoleName string ... |
e090c5b5a8f42add91b8c3e7a85c7d4fb13ee47d | babb3c37c7844a0bf369063a8132b251dcddb8f2 | WheeskyJack/algorithms | /189/1.6/main.go | Go | go | 651 | no_license | package main
import (
"fmt"
"algorithms/189/1.6/try1"
)
//String Compression: Implement a method to perform basic string compression using the counts
//of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the
//"compressed" string would not become smaller than the original string, ... |
5641ac26ad3662e9863f83562ec1be482e90655f | 57fa29e96eb4d898873915d38e9fbe4215fe4fab | LIP-Computing/gophercloud | /openstack/db/v1/configurations/testing/requests_test.go | Go | go | 6,902 | permissive | package testing
import (
"testing"
"github.com/samuelbernardolip/gophercloud/openstack/db/v1/configurations"
"github.com/samuelbernardolip/gophercloud/openstack/db/v1/instances"
"github.com/samuelbernardolip/gophercloud/pagination"
th "github.com/samuelbernardolip/gophercloud/testhelper"
fake "github.com/samuel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.