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 |
|---|---|---|---|---|---|---|---|---|
6afe4af9c46ec55dad1c6da8a7750b20a877c5b1 | bf6a03c3e589cdadc9055456874f46fe394426a7 | davidtran641/gobeginner | /gowithtest/http_server/poker/server.go | Go | go | 3,525 | no_license | package poker
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strconv"
"strings"
"text/template"
"github.com/gorilla/websocket"
)
const (
jsonContentType = "application/json"
)
// Player is datastruct of a player
type Player struct {
Name string
Wins int
}
// PlayerStore saves user's scores
type Player... |
c41867c1cafa9db331d72974a284ef351dd4c8ed | fba096c56991efc9ef8aae6ab94bd94a2a5244ff | renobutar/Netprog1 | /No3/No3a.go | Go | go | 358 | no_license | package main
import "fmt"
func main() {
var a [5]int
fmt.Println("emp;", a)
a[4] = 100
fmt.Println("set:", a)
fmt.Println("get:", a[4])
fmt.Println("len:", len(a))
b := [5]int{1, 2, 3, 4, 5}
fmt.Println("dcl:", b)
var twoD [2][3]int
for i := 0; i < 2; i++ {
for j := 0; j < 3; j++ {
twoD[i][j] = i +... |
6775f074063308165004c9cce8e23162ffb0c808 | 6a8ded31587430657a87fcb7a43654a69e2d5943 | StrongMonkey/norman | /generator/lifecycle_template.go | Go | go | 1,384 | permissive | package generator
var lifecycleTemplate = `package {{.schema.Version.Version}}
import (
{{.importPackage}}
"k8s.io/apimachinery/pkg/runtime"
"github.com/rancher/norman/lifecycle"
)
type {{.schema.CodeName}}Lifecycle interface {
Create(obj *{{.prefix}}{{.schema.CodeName}}) error
Remove(obj *{{.prefix}}{{.schema.... |
dcebc7f972489f1789b3879554266298b171d2db | 881318793f0caa505f29198310464ad20fad0809 | andre-karrlein/hambach-admin | /app/articleList.go | Go | go | 2,666 | permissive | package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"sort"
"strconv"
"strings"
"github.com/maxence-charriere/go-app/v9/pkg/app"
)
type articleList struct {
app.Compo
content []Content
nextID string
}
func (a *articleList) edit(ctx app.Context, e app.Event) {
articleId := ctx.JSSrc().Get("id").... |
210124ed28cbac221cbb154f8e7216c56797bd6f | 7abff1dbbf66ab8156cdb31a1b12c52cb8e69601 | remodoy/minio | /cmd/admin-handlers_test.go | Go | go | 37,403 | permissive | /*
* Minio Cloud Storage, (C) 2016, 2017 Minio, 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 applica... |
eef249bfe24e720f94f6a5c043f87a7472df91e4 | 1fac33911293359e58484e644aed59c1b9834f8a | lawrencegripper/azbrowse | /internal/pkg/keybindings/item_copy_id.go | Go | go | 1,238 | permissive | package keybindings
import (
"fmt"
"github.com/awesome-gocui/gocui"
"github.com/lawrencegripper/azbrowse/internal/pkg/views"
)
type ItemCopyItemIDHandler struct {
ListHandler
Item *views.ItemWidget
StatusBar *views.StatusbarWidget
}
var _ Command = &ItemCopyItemIDHandler{}
func NewItemCopyItemIDHandler(... |
1aeca73b98df82a8ec021b11e3ac43c45e932518 | 0493f87ccfb4f475733de302b0f8f157f319d899 | vend/vend-cli | /vendor/github.com/wallclockbuilder/stringutil/swapcase.go | Go | go | 462 | permissive | package stringutil
import (
"unicode"
"strings"
)
// Swapcase returns a copy of str
// with uppercase alphabetic characters converted to lowercase and
// lowercase characters converted to uppercase.
// Note: case conversion is effective only in ASCII region.
func Swapcase(s string) string {
return strings.Map(s... |
6cfe503ddb4605d877fe8249440d1e2d2237f161 | d8b68db2458e86fe6b15334a40d428a9d16e8505 | drkiet/stix21 | /marking_definition.go | Go | go | 1,238 | no_license | package stix21
import (
"encoding/json"
"fmt"
"time"
)
type MarkingDefinition struct {
Type string `json:"type" binding:"required"`
SpecVersion string `json:"spec_version" binding:"required"`
ID string `json:"id" binding:"required"`
CreatedByRef string `json:"created-by-ref,omitempty"`
Created time.Time `json... |
c737a2707e660b2f91c7b99c021221fceed4d173 | 12b553b95a8aa6b1cfc6f8a792fc12016e5507fb | rsc/client | /go/spotty/spotty_nix.go | Go | go | 1,409 | permissive | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
package spotty
import (
"io/ioutil"
"os"
"path/filepath"
"regexp"
"syscall"
)
func sameFile(ss1 *syscall.Stat_t, fi os.Fi... |
b9f445247de456324e033b20a4a7528bd599a84e | 6fe7a79c442cd3f799b8f5e00a171edf0cf9220c | cfergeau/crc | /pkg/os/windows/win32/shell32_windows.go | Go | go | 1,049 | permissive | package win32
import (
"syscall"
"github.com/crc-org/crc/pkg/crc/logging"
"golang.org/x/sys/windows"
)
const (
HwndDesktop = windows.Handle(0)
)
// Uses "runas" as verb to execute as Elevated privileges
func ShellExecuteAsAdmin(reason string, hwnd windows.Handle, file, parameters, directory string, showCmd int)... |
e850a16ff877c73f38e86fa292f75b5dc7fa8f77 | 76f1ffd8f66bf3164d675ea18e0b45b3e633ebfc | BillZong/fdn-cloud-resource-deleter | /utils.go | Go | go | 275 | no_license | package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
func ReadYamlFile(filePath string, out interface{}) (err error) {
yamlFile, err := ioutil.ReadFile(filePath)
if err != nil {
return
}
if err = yaml.Unmarshal(yamlFile, out); err != nil {
return
}
return
}
|
d03c37ec4dfffe8abd96d87d07f71e794990fcbb | 0bd4381d834c6120060459a3ee53435b0908b88d | Wazzymandias/blockstack-crawler | /storage/interface.go | Go | go | 685 | permissive | package storage
import "time"
// Storage defines basic operations that need to be implemented by storage drivers
type Storage interface {
Exists(path string) bool
Find(path string) ([]byte, error)
Write(path string, value []byte) error
Read(path string) ([]byte, error)
}
// BlockstackStorage defines Blockstack r... |
9754b8f2a2e6047db52add66faf8258b848ae3b4 | a6d41bc54b40361d9ffb3ba51050461a087be84c | chapin666/GO-BBS | /controllers/response.go | Go | go | 1,048 | permissive | package controllers
import (
m "git.oschina.net/scitc/bbs/models"
"github.com/astaxie/beego"
"github.com/astaxie/beego/validation"
"strconv"
)
type ResController struct {
SimpleController
}
func (this *ResController) PostAdd() {
response := m.Response{}
id, err := this.GetInt("id")
u, ok := this.Data["user... |
b2756b4bf7d06ac75ae372e25f4f7153da999cd7 | 9fb341f025589e21a47bdead88d5ee2e97fd3f9d | threefoldfoundation/tfchain | /vendor/github.com/ethereum/go-ethereum/core/rawdb/freezer_table.go | Go | go | 20,558 | permissive | // Copyright 2019 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
019c41e31fd9e93168d943e4d9ffe723f495cc79 | 63ae3dce6499435b8c5e36ef182767e1bca55584 | GoogleContainerTools/skaffold | /pkg/skaffold/schema/v2beta2/upgrade_test.go | Go | go | 4,120 | 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... |
aced93756322a6f66745850857d0ad6c08a74436 | 167a16d09231f68ccd75a6b657c1150fd43205c7 | whipstein/golinalg | /golapack/dorgbr.go | Go | go | 4,525 | no_license | package golapack
import (
"fmt"
"github.com/whipstein/golinalg/golapack/gltest"
"github.com/whipstein/golinalg/mat"
)
// Dorgbr generates one of the real orthogonal matrices Q or P**T
// determined by DGEBRD when reducing a real matrix A to bidiagonal
// form: A = Q * B * P**T. Q and P**T are defined as products... |
8c0d600b078044f7a24131fbef777eefaa93424b | 66c1a0b8144143a789c68c74a2d35dca1ef90168 | bpkgoud/pulumi-azure-native | /sdk/go/azure/network/v20200701/getVirtualHubRouteTableV2.go | Go | go | 1,129 | permissive |
package v20200701
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func LookupVirtualHubRouteTableV2(ctx *pulumi.Context, args *LookupVirtualHubRouteTableV2Args, opts ...pulumi.InvokeOption) (*LookupVirtualHubRouteTableV2Result, error) {
var rv LookupVirtualHubRouteTableV2Result
err := ctx.Invoke("azure-n... |
012eefafb44a5e7f9c5d813d093dae64340b6b92 | a1644895d0e2e8d0f3650707d178b49ce484421d | microsoftgraph/msgraph-beta-sdk-go | /devices/item_transitive_member_of_directory_object_item_request_builder.go | Go | go | 6,375 | permissive | package devices
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
i20a3050780ee0b0cde0a884a4f35429a20d... |
06e35adbcbdd002e072f193625fd131957a59f2f | 778f0baf168f1c41e1885a24d58ef08f846f9daa | bnfinet/go-httpheader | /decode.go | Go | go | 2,334 | permissive | package httpheader
import (
"fmt"
"net/http"
"reflect"
"strconv"
"time"
)
var decoderType = reflect.TypeOf(new(Decoder)).Elem()
// Decoder is an interface implemented by any type that wishes to decode
// itself from Header fields in a non-standard way.
type Decoder interface {
DecodeHeader(header http.Header, ... |
0614d3ba6723bfc06743d9202b8951fcd27587c2 | 17309e45fdbcd054b59247cca76925bc9a96c565 | maxcleme/adventofcode | /2019/11/part_one/modes/modes.go | Go | go | 262 | no_license | package modes
import "github.com/maxcleme/adventofcode/2019/11/part_one/model"
var Modes = map[int]Mode{
0: Position{},
1: Immediate{},
2: Relative{},
}
type Mode interface {
AtRead(p *model.Program, src int) int
AtWrite(p *model.Program, src int) int
}
|
14a56cf5f7bfa848815b0004c2202675b64a0937 | 564d0ca64fadfeab40909d2c2eae1f27f1196950 | aqan213/app-autoscaler | /src/autoscaler/eventgenerator/generator/evaluator.go | Go | go | 7,169 | permissive | package generator
import (
"autoscaler/db"
"autoscaler/eventgenerator/aggregator"
"autoscaler/models"
"autoscaler/routes"
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
"time"
"code.cloudfoundry.org/lager"
"github.com/rubyist/circuitbreaker"
)
var validOperators = []string{">", ">=", "<"... |
35dd278083ea92db2011a18cd2b62530a58ddbcf | 51262dd071e13649c7647e8f3a24e867119fff70 | shurcooL/play | /103/given_implementation.go | Go | go | 1,654 | permissive | package task
// Implementation details of given interfaces (needed for test code to run).
// e implements Dataᐸintᐳ interface for a single element.
type e int
func (_ e) IsCollection() bool { return false }
func (_ e) Collection() CollectionᐸDataᐸintᐳᐳ { panic("not collection") }
func (e e) Element() ... |
cc21fb81d1eda25653f12987e7baebe35ca23c3d | 346192343e1b92df1171c08c1c765e6078d40393 | SoulDefender/xelogstash | /vendor/github.com/elastic/go-elasticsearch/esapi/api.indices.put_alias.go | Go | go | 4,231 | permissive | // Code generated from specification version 8.0.0: DO NOT EDIT
package esapi
import (
"context"
"io"
"strings"
"time"
)
func newIndicesPutAliasFunc(t Transport) IndicesPutAlias {
return func(index []string, name string, o ...func(*IndicesPutAliasRequest)) (*Response, error) {
var r = IndicesPutAliasRequest{I... |
425779979560f8da4e8e4149659411a6626c43af | ddeaf6642638803d84bc6f4f62c2f61181f8816e | canonical/kubernetes-dqlite | /vendor/github.com/opencontainers/runc/libcontainer/cgroups/systemd/user.go | Go | go | 3,438 | permissive | // +build linux
package systemd
import (
"bufio"
"bytes"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
systemdDbus "github.com/coreos/go-systemd/v22/dbus"
dbus "github.com/godbus/dbus/v5"
"github.com/opencontainers/runc/libcontainer/userns"
"github.com/pkg/errors"
)
// newUserSystemdDbus creates a c... |
7662a5eedc88bc99f94911aea7cad30a49839d2b | 416eda049569a35979c3bb4a508780e096355590 | cebrains/jupiter | /pkg/xlog/rotate/example_test.go | Go | go | 1,017 | permissive | // Copyright 2020 Douyu
//
// 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 writin... |
17d4a7f0d5a7baba1fdf664495c2c0a8682f065d | f8ec5933d18289037efa9e8f00d41b912658721f | randomvariable/cluster-api | /bootstrap/kubeadm/types/utils_test.go | Go | go | 10,586 | permissive | /*
Copyright 2021 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, ... |
317882e0494ccee9a830787204c302c4e9178564 | 257d59f265e6c064592094369faba97a7e86f735 | FiloSottile/tailscale | /wgengine/wgengine.go | Go | go | 4,874 | permissive | // Copyright (c) 2020 Tailscale Inc & 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 wgengine
import (
"errors"
"inet.af/netaddr"
"tailscale.com/ipn/ipnstate"
"tailscale.com/net/interfaces"
"tailscale.com/tailcfg"
"ta... |
0b67799688e843b55d3deff71cde828801232a2f | 04a749b02af54fe7bfbc34fc596ecb77e5b7d3ce | RongAtRabbit/lora-app-server | /internal/storage/device_queue_mapping_test.go | Go | go | 4,349 | permissive | package storage
import (
"fmt"
"testing"
"time"
"github.com/brocaar/lorawan"
. "github.com/smartystreets/goconvey/convey"
"github.com/brocaar/lora-app-server/internal/common"
"github.com/brocaar/lora-app-server/internal/test"
)
func TestDeviceQueueMapping(t *testing.T) {
conf := test.GetConfig()
db, err :... |
9b408a55cd7e8696259c2ffacc8e2bdad2334325 | 690e91a6a724d95257bb7795705f1ee87f9cc9cf | sourya/go-sdk | /r2/opt_tls_root_cas_test.go | Go | go | 343 | permissive | package r2
import (
"crypto/x509"
"net/http"
"testing"
"github.com/blend/go-sdk/assert"
)
func TestOptTLSRootCAs(t *testing.T) {
assert := assert.New(t)
pool, err := x509.SystemCertPool()
assert.Nil(err)
r := New("http://foo.com", OptTLSRootCAs(pool))
assert.NotNil(r.Client.Transport.(*http.Transport).TLSC... |
3685ebf8223c47e78f55ccbb03a4ecfcbe3f76c8 | c3dd6c85d4abb3810e8cb88567b8ff1219779e00 | mihaimelonari/cluster-api-provider-azure | /cloud/services/agentpools/agentpools.go | Go | go | 5,133 | permissive | /*
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, ... |
f880643449c00e626aa1421b1700783dadaf3858 | 4b0ab54de8f0c4345a9b3cb7930c61e4fab2b8e2 | peterj/cli | /langs/node.go | Go | go | 2,558 | permissive | package langs
import (
"io/ioutil"
"os"
"path/filepath"
)
type NodeLangHelper struct {
BaseHelper
}
func (h *NodeLangHelper) Handles(lang string) bool {
return defaultHandles(h, lang)
}
func (h *NodeLangHelper) Runtime() string {
return h.LangStrings()[0]
}
func (lh *NodeLangHelper) LangStrings() []string {
... |
1b68e6cfd9bae8fafd9408a817c6c40dbaba41b1 | c35054b17c0ee2cc944bf7171cdf3d97d8d7e967 | aiescola/go_shop_api | /server/api/products/dataSource.go | Go | go | 357 | no_license | package products
import "go.mongodb.org/mongo-driver/mongo"
type ProductDataSource interface {
GetProducts() ([]Product, error)
GetProduct(code string) (*Product, error)
AddProduct(product Product) error
}
func NewMongoDataSource(database *mongo.Database) mongoDataSource {
return mongoDataSource{
collection: d... |
6ba6e7b80d856e694427aca6e2dd875e0016ef58 | dcd5875f938226357b1a4f9834ebc994b5b214d2 | IliaSuslov/wasty | /internal/hands/users.go | Go | go | 441 | no_license | package hands
//func Users(DB *mongo.Database, t *template.Template) func(w http.ResponseWriter, r *http.Request) {
// return func(w http.ResponseWriter, r *http.Request) {
// roles := gcontext.Get(r, "user_roles")
// if model.IsRole(roles, "admin") == -1 {
// w.WriteHeader(401)
// return
// }
//
// err := t.E... |
d91bafbf080778f8deb0a38f5b3d4d16b015594a | d5ed5099022f656f09a1994313939c099863ee7c | asstarra/accounting | /data/qwery/entity_rec.go | Go | go | 2,190 | no_license | package qwery
import (
s "accounting/data/db"
"fmt"
)
// Выборка из таблицы "EntityRec" с возможным известным Id родителя,
// где для дочерней детали помимо Id указывается название и тип.
// Порядок: IdParent, IdChild, TypeTitleChild, TitleChild, count.
func SelectEntityRecChild(idP *int64) string {
rTable := s.Ta... |
c79d4bb786c45d617d3cabf5968274f535433bab | 5a8fe8bdcd59622763458eda1792f1e44e8590b0 | joshprzybyszewski/shingokisolver | /state/coordSeen.go | Go | go | 613 | no_license | package state
import "github.com/joshprzybyszewski/shingokisolver/model"
type CoordSeener interface {
Mark(model.NodeCoord)
UnmarkAll()
IsCoordSeen(model.NodeCoord) bool
}
type coordSeen struct {
rows []bitData
}
func NewCoordSeen(numEdges int) CoordSeener {
return coordSeen{
rows: make([]bitData, numEdges+1... |
4061394516c0008b662ce8a15b91ac3ca19e8df4 | 6581c63909d279549862733f2a503e5cb2163f75 | lukedirtwalker/tail | /tail.go | Go | go | 10,156 | permissive | // Copyright (c) 2015 HPE Software Inc. All rights reserved.
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
package tail
import (
"bufio"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"
"sync"
"time"
"github.com/nxadm/tail/ratelimiter"
"github.com/nxadm/tail/util"
"github.com/... |
eef9d81e1f5ba88875e0e13f4d5b2cc933d7a72a | 9d9ae28986bd2f371e4f9d6b447bde41b43f32f1 | SuburbanDad/ethereal | /util/txdata/signature.go | Go | go | 9,361 | permissive | // Copyright © 2018 Weald Technology Trading
// 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 a... |
1c7a41add9abf54dbab600319d6f3e3b213b21e8 | a2724d913c08fabe63e3fe01b4ba66715568d3a7 | ordovician/bensin | /graphics/graphics.go | Go | go | 780 | no_license | // Copyright 2012 Erik Engheim. All rights reserved.
// Use of this source code is governed by a GPL-style
// license that can be found in the LICENSE file.
// OpenGL related code. Does not contain code related to the windowing system, so
// there is a free choice in using glfw, glu or SDL.
package graphics
import ... |
6e0b9ef6a16f99679d57bd7a6c32abff5183b7b2 | 43b7d82aafcc01e02d3592ba8b1851479908342c | YafimK/wx-succ-tree | /wx_test.go | Go | go | 8,998 | permissive | package tree
import (
"math/rand"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestEmptyWX(t *testing.T) {
Convey("When an empty key/val is given", t, func() {
wxb := NewBuilder()
wx := wxb.Build()
Convey("Num should be 0", func() {
So(wxb.TotalByteNum(), ShouldEqual, 0)
So(wx.Num(),... |
b571a1ac2df4c2f6b6b342b3cc4d055d647200ba | fb5c254dc88d35207ba29a12ec2aaa5f41633845 | cosmos/cosmos-sdk | /orm/internal/listinternal/options.go | Go | go | 725 | permissive | package listinternal
import (
"fmt"
"google.golang.org/protobuf/proto"
)
// Options is the internal list options struct.
type Options struct {
Reverse, CountTotal bool
Offset, Limit, DefaultLimit uint64
Cursor []byte
Filter func(proto.Message) bool
}
func (o O... |
32cff4e97ebb80bc6101d5fbb24237d4cf5e72c0 | 5ca6670e3b0ae48e5a62d45d23355b4338716bef | cloudmelon/kops | /util/pkg/vfs/fs_test.go | Go | go | 1,592 | permissive | /*
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, ... |
966568f1da3d9acb2bc2877580a7d9ba3faadbac | 04930dce866a7c440511121fbab8efc10aab9f5d | richenlin/zgo | /app/swagger/docs.go | Go | go | 12,228 | permissive | // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package swagger
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"descri... |
38ac282a4bf1cadba7b8274bc98421ab99050c75 | d77cc1da535159b79d991295bf0304f27912f421 | ondrej-fabry/vpp-agent | /plugins/vpp/l3plugin/vppcalls/vpp1908/route_vppcalls_test.go | Go | go | 3,320 | permissive | // Copyright (c) 2019 Cisco 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 app... |
dc7756070c86d1eb29b5a7344f497d0d99ecab69 | a27b7f3b0c839fc87a9a5b8a00248029abf3a12b | sallyom/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-plugin-log/tfsdklog/sdk.go | Go | go | 7,245 | permissive | package tfsdklog
import (
"context"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/terraform-plugin-log/internal/hclogutils"
"github.com/hashicorp/terraform-plugin-log/internal/logging"
)
// NewRootSDKLogger returns a new context.Context that contains an SDK logger
// configured with the passed options.
f... |
1ab68788ac089af977fa9c7f66fbf969d4e66d07 | 955ce1e0f0eb630e3c8a951a1f136e1623f5db37 | vmlemon/eve | /pkg/pillar/attest/attest_test.go | Go | go | 10,446 | permissive | // Copyright (c) 2020 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
package attest
import (
"fmt"
"testing"
"time"
"github.com/lf-edge/eve/pkg/pillar/base"
"github.com/lf-edge/eve/pkg/pillar/pubsub"
"github.com/sirupsen/logrus"
)
type VerifierMock struct{}
var (
simulateControllerReqFailure = false
s... |
c1756b0df47e025284a7709963556c9fd48a26d8 | 54ee3f050d7daa70972475393b82fec281a3ff8b | lvshuang/binlog-sync | /vendor/github.com/siddontang/go-mysql/client/conn.go | Go | go | 4,658 | permissive | package client
import (
"crypto/tls"
"fmt"
"net"
"strings"
"time"
"github.com/juju/errors"
. "github.com/siddontang/go-mysql/mysql"
"github.com/siddontang/go-mysql/packet"
)
type Conn struct {
*packet.Conn
user string
password string
db string
TLSConfig *tls.Config
capability uint32
st... |
4900488f400b25f20a925e6997a1199666dd16c7 | fe2955c46a2ed866feaa8c3073ad5c7fadcc69ae | stellar-deprecated/bridge-compliance | /bridge/internal/listener/payment_listener_test.go | Go | go | 20,703 | no_license | package listener
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"time"
hc "github.com/stellar/go/clients/horizonclient"
"github.com/stellar/go/protocols/compliance"
hProtocol "github.com/stellar/go/protocols/horizon"... |
bca5f0cfaf3aa45a683af80512dc86380e32922b | d30aa96b6963e69036182a8aca77bb8fe9467738 | duydb2/tendermint | /vm/secp256k1/secp256.go | Go | go | 5,876 | no_license | package secp256k1
// TODO: set USE_SCALAR_4X64 depending on platform?
/*
#cgo CFLAGS: -I./secp256k1
#cgo darwin CFLAGS: -I/usr/local/include
#cgo linux,arm CFLAGS: -I/usr/local/arm/include
#cgo LDFLAGS: -lgmp
#cgo darwin LDFLAGS: -L/usr/local/lib
#cgo linux,arm LDFLAGS: -L/usr/local/arm/lib
#define USE_NUM_GMP
#defin... |
7e6faa0dc35469eb5e0cc4511629bbc4b0d08dc7 | 97e834d44dbaa418d5a71464b309ff5aa0930c80 | infradash/dash | /pkg/agent/discover.go | Go | go | 8,716 | permissive | package agent
import (
"fmt"
"github.com/golang/glog"
. "github.com/infradash/dash/pkg/dash"
"github.com/qorio/maestro/pkg/docker"
"strings"
)
func (this *Agent) DiscoverSelfInDocker() error {
docker_name := this.Name
if docker_name == "" {
return ErrNoDockerName
}
glog.Infoln("Discovering container in ... |
3b596d8f1d8af43246c31781654bfcc084828433 | a0f8bc66651e403d4a221cc3d4755f0cf97236fe | tangtj/leetcode-go | /20.go | Go | go | 648 | no_license | package leetcode
func isValid(s string) bool {
stack := make([]int32, 0)
top := 0
for _, c := range s {
if top <= 0 {
if c == '(' || c == '[' || c == '{' {
stack = append(stack, c)
top++
} else {
return false
}
} else if c == '(' || c == '[' || c == '{' {
stack = append(stack, c)
t... |
f7f9fa13a7e7b93f3f1ca7aa06c47de6c27ae1b4 | b962c83a06db6825b74b8c71ec4d3d970c7118b2 | ays-network/go-ays | /signer/rules/deps/deps.go | Go | go | 967 | no_license | // Copyright 2018 The go-ays Authors
// This file is part of the go-ays library.
//
// The go-ays library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at you... |
9f103224dd501c4cf7573a0a5d68ae0e9a20f7af | 3c96a86a4cca32ac296845db7626b7120f265bde | l30thelion/gloo | /projects/gloo/pkg/translator/translator_test.go | Go | go | 54,643 | permissive | package translator_test
import (
"context"
"fmt"
envoycore "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
envoyrouteapi "github.com/envoyproxy/go-control-plane/envoy/api/v2/route"
envoytcp "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/tcp_proxy/v2"
envoy_type "github.com/envoyp... |
47e8b10e46da72f1e11adb4d5a7b705246526cb2 | a443cb769e55a6d30d4cf16b886585d7a914264d | joshdk/iamfmt | /iam/new.go | Go | go | 823 | permissive | // Copyright 2017 Josh Komoroske. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE.txt file.
package iam
import (
"encoding/json"
"io"
"io/ioutil"
"os"
"strings"
)
func NewFromFile(name string) (*Policy, error) {
file, err := os.Open(name)
... |
b6e8d038984c97d27e7ba015f83c4cb4ea280fd8 | 1634b9cda76862b93cfc33e849fa5aa20f2c61d3 | openshift/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors/model_routeconfiguration.go | Go | go | 1,464 | permissive | package frontdoors
import (
"encoding/json"
"fmt"
"strings"
)
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type RouteConfiguration interface {
}
func unmarshalRouteConfigurationImplementation(input []by... |
4b79b08ad862e17c64252db17a09d9e792b26d1f | bda3778a5bea43b006b7efb1278e8905ca25588c | fanple/gohello | /algorithms/bubblesort/bubblesort_test.go | Go | go | 697 | no_license | package bubblesort
import "testing"
func TestBubbleSort1(t *testing.T) {
values := []int{5,4,3,2,1}
BubbleSort(values)
if values[0] !=1 || values[1] !=2 || values[2] !=3 || values[3] !=4 || values[4] != 5 {
t.Error("BubbleSort() failed. Got", values, "Expected 1 2 3 4 5")
}
}
func TestBubbleSort2(t *testing.T)... |
dc94ce7f00e7c72ee85a581f9e54b579d1bbf239 | 46492ba8bec6260992eed18ec58bec32727adfe3 | someonemaybe/readcode-etcd-v3.4.10 | /src/go.etcd.io/etcd/raft/read_only.go | Go | go | 4,068 | permissive | // Copyright 2016 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
3af803fcdb1e95256d2b070584add9459b0490f2 | 1f5e574d81f7814503b523566be762d3266deeff | markmoloney/machine-config-operator | /cmd/gcp-routes-controller/main.go | Go | go | 563 | permissive | package main
import (
"flag"
"github.com/golang/glog"
"github.com/spf13/cobra"
)
const (
componentName = "gcp-routes-controller"
)
var (
rootCmd = &cobra.Command{
Use: componentName,
Short: "Controls the gcp-routes.service on RHCOS hosts based on health checks",
Long: "",
Sil... |
491651dd976814c237b0cafc4a2bcd191bdbb621 | a21f1baf7e6fee695a4d0a899e5dbf16fd03231c | ktaf/go-learn | /14_maps/maps_2.go | Go | go | 1,677 | permissive | package main
import (
"fmt"
)
func main() {
fmt.Println("_main()")
fmt.Println("----------------------------")
fmt.Println("INICIO")
_maps_2()
fmt.Println("FIM")
fmt.Println("----------------------------")
}
// functions
func _maps_2() {
fmt.Println("_maps_2()")
// To create an empty map, use the builtin... |
e9eefded32147d1e8500748145a01ef2c71de47d | eed7e9382776779922f8cef2d51d7a04b8f04d1c | ioito/onecloud | /vendor/yunion.io/x/cloudmux/pkg/multicloud/ucloud/doc.go | Go | go | 654 | permissive | // Copyright 2019 Yunion
//
// 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... |
d9436676b9be2891c66866fbfbd694a7d039d099 | 19a7fefbb502cde01501c168e308b64127469bf2 | kubemove/kubemove | /pkg/engine/utils.go | Go | go | 2,579 | permissive | package engine
import (
"strings"
"github.com/kubemove/kubemove/pkg/apis/kubemove/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func (m *MoveEngineAction) addToResourceList(obj unstructured.Unstructured) {
... |
da304a2bfc4334dd6c62d7c75771a3783599c393 | 847c60c25f820001fcc564cbaac66bbd6e317ac6 | sauercrowd/http-perf | /pkg/flags/flags.go | Go | go | 1,341 | no_license | package flags
import (
"flag"
"log"
"net/url"
)
// Flags is used for command line flags
type Flags struct {
TimeS, Amount, GoroutineN int
URL, ChartPath, JSONPath string
NoChart, ResultJSON bool
}
// Parse parses the command line flags and returns a Flags struct
func Parse() Flags {
var f Flags
flag.S... |
2775992562d83f7f76e4c129a4efd28fb6161d19 | 455db4f2402ff64aad27e95ebeac63e3a8cf18cf | liborio7/npong | /game/camera/entity.go | Go | go | 633 | no_license | package camera
import (
"github.com/faiface/pixel/pixelgl"
"github.com/liborio7/npong/core"
)
type entityManager struct {
}
func newEntityManager() *entityManager {
return &entityManager{}
}
func (em *entityManager) newEntity(m *Manager, win *pixelgl.Window, jointEntity *core.Entity) *core.Entity {
... |
ec03063c751d278c84ae0500917eb919efb9751b | aacd74e525ab69a53a111fbf62c7aba8bd886a44 | scaleway/scaleway-cli | /internal/namespaces/instance/v1/custom_user_data_test.go | Go | go | 3,091 | permissive | package instance
import (
"os"
"testing"
"github.com/scaleway/scaleway-cli/v2/internal/core"
)
func Test_UserDataGet(t *testing.T) {
t.Run("Get an existing key", core.Test(&core.TestConfig{
BeforeFunc: core.BeforeFuncCombine(
createServer("Server"),
core.ExecBeforeCmd("scw instance user-data set server-i... |
cfae612cb60923cdf3717474076ab20bbd79c099 | 933ada895d6713327812b8385def9f1c40d116b2 | manuelpuyol/gotc | /hash/hash.go | Go | go | 688 | no_license | package hash
import (
"crypto/sha256"
"fmt"
"strings"
)
type Hash struct {
difficulty int
challenge string
}
func NewHash(difficulty int) *Hash {
challenge := strings.Repeat("0", difficulty)
return &Hash{difficulty, challenge}
}
func (h *Hash) IsValid(test string) bool {
val := BTCHash(test)
cmp := val[0... |
5b1e11658fdd46a794db0482719a89c2942c60c7 | 193c7fe1e38c70b8b3bc9811ec2508a3fcbab2df | treeder/bump | /bump.go | Go | go | 2,120 | permissive | package bump
import (
"fmt"
"regexp"
"github.com/coreos/go-semver/semver"
)
const (
semverMatcher = `(\d+\.){1}(\d+\.){1}(\*|\d+)`
)
// BumpInContent takes finds the first semver string in the content, bumps it, then returns the same content with the new version
func BumpInContent(vbytes []byte, part string, in... |
eab4f265d5ee3a8c178d0e5fc42d7d3b3577da0e | f625a9adcbbae69ffb71ba7ae61b55280bb3c0a1 | huanglaoxie0503/go_rpc | /example1/rpc/client.go | Go | go | 745 | no_license | package main
import (
"fmt"
"go_rpc/example1/rpc/utils"
"log"
"net/rpc"
)
func main() {
var serverAddress = "localhost"
client, err := rpc.DialHTTP("tcp", serverAddress + ":8080")
if err != nil {
log.Fatal("建立与服务端连接失败:", err)
}
// 同步调用 RPC
args := &utils.Args{10, 10}
var reply int
err = client.Call("Ma... |
7bc5b16aaa13abc6457a3967af9b3175a409a45b | 8e20c82cd2e91745a7cdd4d85b263a3992ecdaaa | lf-edge/eve | /pkg/newlog/vendor/github.com/lf-edge/eve/pkg/pillar/pidfile/pidfile.go | Go | go | 1,830 | permissive | // Copyright (c) 2018 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
// Manage pidfile in /run/
package pidfile
import (
"fmt"
"os"
"strconv"
"syscall"
"github.com/lf-edge/eve/pkg/pillar/base"
)
const (
rundir = "/run"
)
func writeMyPid(filename string) error {
pid := os.Getpid()
pidStr := fmt.Sprint... |
e0d309575e8cbaad411da124c62056f31f3fdcc6 | c86bd294c8d867574cd1ec8f646056b274f12106 | cwww3/go-demo | /算法/多重背包/main.go | Go | go | 549 | no_license | package main
import "fmt"
func main() {
var w = 10
weight := []int{1, 3, 4}
value := []int{15, 20, 30}
nums := []int{2, 3, 2}
dp := make([]int, w+1)
//初始化 dp[0]=0
for i := 0; i < len(weight); i++ {
for j := w; j >= weight[i]; j-- {
// 以上为01背包,然后加⼀个遍历个数
for k := 1; k <= nums[i] && (j-k*weight[i]) >= ... |
c7f6085684fb06f26c76dbe6a3241e74668b9cc5 | cc1b8632c1aeaccc054e79140f8a348eec7ae2b3 | control-center/serviced | /zzk/service/assignment.go | Go | go | 6,623 | permissive | // Copyright 2017 The Serviced 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... |
d4b240b0f1970c8758f5a52b09fdb20f2c164ee7 | 995a5eb91b2b58208af0928c3aeedebed467a10a | zkangHUST/GO_practise | /tour/51.go | Go | go | 289 | no_license |
// 映射的文法(续)
// 若顶级类型只是一个类型名,你可以在文法的元素中省略它。
package main
import (
"fmt"
)
type Vertex struct {
x, y int
}
var m = map[string]Vertex {
"vincent": {750, 750},
"erli": {750, 750},
}
func main() {
fmt.Println(m)
} |
657304d2b2937a2a45f7b395f31fa87ca356065a | 9ae6715f1b59bbcf450ce1d811d7a37c0556de87 | FelipeRando/go-workspace | /src/web-basics/state/session/main.go | Go | go | 458 | no_license | package main
import (
"fmt"
"net/http"
)
import (
"github.com/satori/go.uuid"
)
func main() {
http.HandleFunc("/", foo)
http.ListenAndServe(":8080", nil)
}
func foo(w http.ResponseWriter, r *http.Request) {
cookie, err := r.Cookie("session")
if err != nil {
id, _ := uuid.NewV4()
cookie = &http.Cookie{
... |
5198a23cf50d15a7308956db614703bdf52d8285 | 3c7491f4a203db20677fe9bb685ad448495b1fc5 | hyangah/tracer | /trace/parser.go | Go | go | 30,207 | permissive | // Copyright 2014 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 trace
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"math/rand"
"os"
"os/exec"
"strconv"
"strings"
_ "unsafe"
)
// Event describes one event in... |
367d450399c6ceca3352e5dcf09ea539a028abb0 | 11143a257a66cec0a9664a09db36b00c496e8c05 | bamaao/coconut | /coconutGo/rust_compatibility_test.go | Go | go | 3,933 | no_license | // Copyright 2021 Nym Technologies SA
//
// 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... |
6fe8c5d0af2f5a52924ea1b1eb8e9b87cbe57496 | 1e1b2f9a9eac873a5196d2500f00cef4dd9aee81 | madefortv/electronics-store | /config.go | Go | go | 225 | no_license | package store
type Config struct {
Enabled bool
DatabasePath string
Port string
}
func NewConfig() *Config {
return &Config{
Enabled: true,
DatabasePath: "./store.db",
Port: "8000",
}
}
|
56291c4f5f9edc17e33f20de80b02d1138e178b9 | e3e0905dd2028d9d6f3ab0ad5aee5bb4f02e6af9 | TiNiuB/tidb | /statistics/update.go | Go | go | 23,382 | permissive | // Copyright 2017 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... |
bfc1771e4fa61ea5b216aec8423f64631d223303 | 683249102f93fd8695a4c093f6baec024c1d35c5 | andrepatete/amazon-ecs-agent | /agent/stats/engine_integ_test.go | Go | go | 29,559 | permissive | //+build integration
// Copyright 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 t... |
653801c2d604be8c0850737548cddbc262ece0dc | 30e514dc5371c3b0694462f62d6997e7a4ae865a | thedemodrive/istio | /security/pkg/nodeagent/caclient/providers/google/client.go | Go | go | 4,431 | permissive | // Copyright 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 in wri... |
2aebd2bd951b8cddfbf6e3df98e0a4d13a0da0d1 | 8007d37ff65441370fb65f8952f084260233f6a5 | futureCreator/nuclio | /pkg/platform/types.go | Go | go | 5,497 | permissive | /*
Copyright 2017 The Nuclio 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, soft... |
f01e6ba148b001c950debc7db161730c56279fa4 | 88a7d2ee92057fe26390934693c382664b25bc11 | jakecraige/adss | /s1.go | Go | go | 1,672 | permissive | package adss
import (
"crypto/sha256"
"fmt"
"golang.org/x/crypto/hkdf"
)
type s1SecretShare struct {
i, t, n uint8
secret []byte
}
func s1Share(A AccessStructure, M, R, T []byte) ([]*s1SecretShare, error) {
// Use HKDF-SHA256 as our PRF, keying it with the provided randomness
prf := hkdf.New(sha256.New, R, ... |
f4ad2a63a332423ee551a3233228d4e1e12379f1 | 5facce1c9aca19ff7e8901228d0972b9c3a48a2d | binbincai/golabs | /src/shardkv/call.go | Go | go | 290 | no_license | package shardkv
import "time"
func call(timeout time.Duration, callback func()) bool {
done := make(chan bool, 1)
go func() {
callback()
done <- true
close(done)
}()
t := time.NewTimer(timeout)
select {
case <- t.C:
return false
case <- done:
t.Stop()
}
return true
}
|
1e70fc51e64a14cd3365fe759c8b5433d792f55b | da40edf3c9789b62ce3eff07565823346edb3788 | alan-agius4/buildtools | /warn/warn_naming.go | Go | go | 3,074 | permissive | package warn
import (
"fmt"
"github.com/bazelbuild/buildtools/build"
"github.com/bazelbuild/buildtools/bzlenv"
"strings"
)
var ambiguousNames = map[string]bool{
"I": true,
"l": true,
"O": true,
}
// ambiguousNameCheck checks for the names of idents and functions
func ambiguousNameCheck(f *build.File, expr bui... |
de104c17e7b69153c70d3bd449b8286920801dd8 | a30746881fbc3152cfb5fbee3e749d6ab1a83ef7 | littlejiancc/libstix2 | /objects/campaign/json.go | Go | go | 2,862 | permissive | // Copyright 2015-2020 Bret Jordan, All rights reserved.
//
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file in the root of the source tree.
package campaign
import (
"encoding/json"
"github.com/wxj95/libstix2/defs"
)
// -------------------------------------... |
d4d868e9e4da4e0a1b43773fb4d913f5e067dda8 | 4e8f95485c0dfc9d746392f84162554d8bbcb3eb | run-dream/leetcode-go | /data-structure/tree/0530.mininum-absolute-difference-in-bst/solve.go | Go | go | 727 | no_license | package problem0530
//TreeNode 树节点
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func getMinimumDifference(root *TreeNode) int {
minDif := 0xFFFF
var prev *TreeNode
cur := root
stack := []*TreeNode{}
for cur != nil || len(stack) > 0 {
for cur != nil {
stack = append(stack, cur)
cu... |
81249b235684ca3bfc14f98e636f02aa2317db49 | d2b06c06e8d7718aa5ef34e312362fd5dcbe22db | Azure/ARO-RP | /vendor/github.com/microsoftgraph/msgraph-sdk-go/models/print_task_trigger_collection_response.go | Go | go | 3,605 | permissive | package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// PrintTaskTriggerCollectionResponse
type PrintTaskTriggerCollectionResponse struct {
BaseCollectionPaginationCountResponse
}
// NewPrintTaskTriggerCollectio... |
493cf176f5e7a24a11b4c1664ad47bf9b8cc41d0 | ee1f401dd079f3ca302d0446ba97f3da5f238f5f | fandithung/wormhole | /config/config.go | Go | go | 1,332 | permissive | package config
import (
"log"
"path/filepath"
"time"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
type Config struct {
Playbook string
PlaybookFolder string
Inventory string
ConnectTimeout time.Duration
ExecTimeout time.Duration
MaxConcurrentCon... |
b58af0a95f29b9877fabcde53226dbb7fe4a72a0 | d38c6cefda0a0ae1eef5575418f31c6ad2013dd4 | shangsony/fabric_sdk_golang | /core/ledger/statemgmt/state/state.go | Go | go | 12,579 | permissive | /*
Copyright IBM Corp. 2016 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 wri... |
aceb9afc27ecf851145daa64d7f99d3c6007b1c8 | 137de83f7d3469ef78daa32294e2c0a8edcfe75c | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/network/v20200601/getVirtualApplianceSite.go | Go | go | 1,482 | 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 v20200601
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func LookupVirtualApplianceSite(ctx *pulumi.Context, args *LookupVirtualApplianceSiteArg... |
c30ec6233131abc4ec38d0ae40ab7c3d4d42c5d0 | ed32b1cbb83530c9fc0a34dc4a6e707694e31c89 | saisai/tutorial | /golang/golangprograms_com/string-functions/replace.go | Go | go | 552 | no_license | package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Replace("Australia Japan Canada Indiana", "an", "anese", 0))
fmt.Println(strings.Replace("Australia Japan Canada Indiana", "an", "anese", 1))
fmt.Println(strings.Replace("Australia Japan Canada Indiana", "an", "anese", 2))
fmt.Println(str... |
143278aec8e73ca07448186edda17de80291adb2 | 6886289498c8f7dab3191ffccb8d9f281189dbdb | metacoin/flojson | /cmdhelp.go | Go | go | 32,064 | permissive | // Copyright (c) 2014 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package flojson
import (
"errors"
)
// defaultHelpStrings contains the help text for all commands that are supported
// by btcjson by default.
var defaultHelpStrings = map[... |
3cccacdeb0d4f5714d5321051b2b53049938d85a | a0abe56df0c5e0c73791b1ae7c0d969de1d8bd7f | isgasho/sqlx-1 | /datatypes/mysql_timestamp_test.go | Go | go | 1,800 | permissive | package datatypes
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
const (
DATE_LAYOUT_S1 = "2006-01-02"
TIME_LAYOUT_S1 = "2006-01-02 15:04:05"
)
func TestTimestamp(t *testing.T) {
tt := require.New(t)
t0, _ := time.Parse(time.RFC3339, "2017-03-27T23:58:59+08:00")
dt := MySQLTimestamp(t0)
... |
aa990b936f405948e0a41cb058395553961643aa | ee1845921659ec9e72b7223b1157d9dbfdee4470 | Plusid/kelp | /api/exchange.go | Go | go | 7,290 | permissive | package api
import (
"fmt"
"github.com/stellar/go/build"
"github.com/stellar/go/clients/horizon"
"github.com/stellar/kelp/model"
)
// ExchangeAPIKey specifies API credentials for an exchange
type ExchangeAPIKey struct {
Key string
Secret string
}
// Account allows you to access key account functions
type A... |
705619336a98e0255e9f998dd0386bca9b662e9d | 3bec997186075e94609a2c2400663dcb62efd634 | Caratpine/sec-dev-in-action-src | /scanner/tcp-connect-scanner1/scanner/tcp_scanner.go | Go | go | 280 | no_license | package scanner
import (
"fmt"
"net"
"time"
)
func Connect(ip string, port int) (string, int, error) {
conn, err := net.DialTimeout("tcp", fmt.Sprintf("%v:%v", ip, port), 2*time.Second)
defer func() {
if conn != nil {
_ = conn.Close()
}
}()
return ip, port, err
} |
2feed2ba840f81915aa309eae995591ca81aeda3 | e9429c8e9e8bd8162589a98b42c21ff5ff12e1bf | herojan/skipper | /dataclients/kubernetes/update_test.go | Go | go | 815 | permissive | package kubernetes
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/zalando/skipper/dataclients/kubernetes/definitions"
)
func TestUpdateOnlyChangedRoutes(t *testing.T) {
api := newTestAPIWithEndpoints(t, &serviceList{}, &definitions.IngressList{}, &endpointList{}, &secretList{})
defer api.C... |
5ace2b0b9ec705abb040d4d2724236e1b8db601a | a1d69f53e54a77037cd1cc57497733a57f9407f8 | cfromknecht/lnd | /lntest/itest/lnd_network_test.go | Go | go | 3,578 | permissive | package itest
import (
"context"
"fmt"
"strings"
"time"
"github.com/lightningnetwork/lnd"
"github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lntest"
"github.com/stretchr/testify/require"
)
// testNetworkConnectionTimeout checks that the connectiontimeout is taking
// effect. It creates ... |
b45a237a4fb7e38fe51a91b8f44395e23127a375 | da6a7cd261717e3f365d210609cd9d2a04a0e895 | alexeykazakov/fabric8-cluster | /test/suite/unit_test_suite.go | Go | go | 994 | permissive | package suite
import (
"github.com/fabric8-services/fabric8-cluster/configuration"
"github.com/fabric8-services/fabric8-cluster/log"
"github.com/fabric8-services/fabric8-cluster/resource"
"github.com/stretchr/testify/suite"
)
// NewRemoteTestSuite instantiates a new UnitTestSuite
func NewUnitTestSuite() UnitTest... |
61749c3628c4c60822377cef4dcd3ff7e4f32a60 | 8b34c26fd1d156c059d7b085256302b5680dd0b0 | mangchiandjjoe/istio | /pilot/pkg/model/config.go | Go | go | 28,753 | permissive | // Copyright 2017 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... |
37f3c78d62d228937339b01940bb409a612af5eb | 41500459d041c8d79fce02ec1bb500f46f235a30 | MrNieQianliang/goLearn | /json/json.go | Go | go | 610 | no_license | package main
import (
"encoding/json"
"fmt"
)
//go语言处理json,json的Key必须是首字母大写,作为一个可导出的字段
type Server struct {
Servername string
Serverip string
}
type serverlice struct {
Servers []Server
}
func main() {
var s serverlice
//json的字符串必须使用刀秋字符括起来才可以正常使用
str := `{"servers":[{"servername":"zhengzhou_VPN","serverip... |
4b8f2e4c809ef10c2bf8c2c8b9b46845a9099c3c | f0a7f5ec963f544544480db5335b8f2f95f16a74 | divinerapier/learn-kubernetes | /pkg/volume/azure_dd/azure_common_test.go | Go | go | 5,049 | permissive | // +build !providerless
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... |
8f6826e59aea4c3690d727c5912dcea0b8b6b6e7 | d208294985d53f259b12ca0394f1da7788f0e6ca | itsabot/plugin_weather | /weather_test.go | Go | go | 1,465 | no_license | package weather
import (
"bytes"
"flag"
"fmt"
"log"
"net/http"
"net/http/httptest"
"net/url"
"os"
"strings"
"testing"
"github.com/itsabot/abot/core"
"github.com/julienschmidt/httprouter"
)
var r *httprouter.Router
var phone string
func TestMain(m *testing.M) {
if err := os.Setenv("ABOT_ENV", "test"); e... |
cee2edc67b24cd29bc9808bab04b40bda9922748 | d036de7364ba11afcd692e467ff8e9b6218a9003 | ChimeraCoder/golang-stuff | /github.com/dotcloud/docker/auth/auth_test.go | Go | go | 2,144 | permissive | package auth
import (
"crypto/rand"
"encoding/hex"
"os"
"strings"
"testing"
)
func TestEncodeAuth(t *testing.T) {
newAuthConfig := &AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
authStr := encodeAuth(newAuthConfig)
decAuthConfig, err := decodeAuth(authStr)
if err != nil {
t.Fatal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.