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 |
|---|---|---|---|---|---|---|---|---|
b093d75c157ae81fda99c906954479824536708c | 173eb34c68c2507d3d5a3ea6da1eb4c12287cbc8 | captdeaf/rollpoker | /gofuncs/gamedefs.go | Go | go | 3,719 | no_license | // Game DSLs for Poker-style games.
package rollpoker
import (
"fmt"
"time"
"context"
"cloud.google.com/go/firestore"
"reflect"
)
type GameCmd struct {
Name string // Name of function and call
Arg int // Argument for this event (e.g: "2" to deal 2 to each player)
Sleepfor time.Duration // How long to sleep a... |
814a2be3e6d5b9bbf89a79e2617c43dc2fb71c92 | bda4457ae992f2d3a4f5e9610095986f770659a2 | fastly/secretd | /model/message/client/client.go | Go | go | 1,789 | no_license | package client
import (
"encoding/json"
"github.com/davecgh/go-spew/spew"
message "github.com/fastly/secretd/model/message"
"io"
)
func SendMessage(w io.Writer, m message.GenericMessage) (err error) {
enc := json.NewEncoder(w)
err = enc.Encode(m)
if err != nil {
return err
}
return nil
}
func GetMessage(r... |
f164d78b0320a829107a37a4950dabb087d520e1 | 246c447b8744ed6e0f4ebb49d8defd499198b5a3 | nota-ja/cli | /src/cf/commands/service/rename_service_test.go | Go | go | 3,555 | permissive | /*
WARNING WARNING WARNING
Attention all potential contributors
This testfile is not in the best state. We've been slowly transitioning
from the built in "testing" package to using Ginkgo. As you can see, we've
changed the format, but a lot of the setup, test body, desc... |
94cb24e924ec6dc50324d2400dd1fae7783787d6 | 06474ad800c3d58818cf41a6a49abc36822e5472 | tlsrc/learn-go-with-test-exercises | /arrays/sum_test.go | Go | go | 1,203 | permissive | package arrays
import (
"fmt"
"reflect"
"testing"
)
func TestSum(t *testing.T) {
input := []int{1, 2, 3}
got := Sum(input)
expected := 6
if got != expected {
t.Errorf("Expected %d but got %d given %v", expected, got, input)
}
}
func TestSumAll(t *testing.T) {
t.Run("Sum tails of regular slices", func(t ... |
d3049271d659d133cd885a8ced9031d85594d1f1 | b528d986eff2b535afc6b8860d89bfdd565b2758 | builderscon/octav | /octav/service/blog_entry_gen.go | Go | go | 4,768 | permissive | package service
// Automatically generated by genmodel utility. DO NOT EDIT!
import (
"context"
"database/sql"
"sync"
"time"
"github.com/builderscon/octav/octav/cache"
"github.com/builderscon/octav/octav/db"
"github.com/builderscon/octav/octav/internal/errors"
"github.com/builderscon/octav/octav/model"
"gi... |
2d29d64b4f7148190f275266533071ceb06824da | e57fb3bd51493e9164f9babb1daf05116fc36c61 | ESPOIR-DITE/OKVS2 | /io/order_io/status/status_io.go | Go | go | 1,872 | no_license | package status
import (
"OKVS2/api"
"OKVS2/domain/orders"
"errors"
)
const statusURL = api.BASE_URL + "status/"
func CreateStatus(obj orders.Status) (orders.Status, error) {
entities := orders.Status{}
resp, _ := api.Rest().SetBody(obj).Post(statusURL + "create")
if resp.IsError() {
return entities, errors.N... |
992ac8e7f527c29b5b6a03cba92db08d6ce1e12c | bdacc175900f5efacf7642acb57939c3c3320e5b | goplume/core | /rest_api/AuthFilter.go | Go | go | 3,767 | permissive | package rest_api
import (
"fmt"
"github.com/goplume/core/rest_api/context"
"github.com/goplume/core/fault"
"github.com/goplume/core/oaut_client"
"github.com/goplume/core/utils/logger"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
type AuthFilter struct {
OAuthClient *oaut_c... |
2dc7a685861bf06dcaa3e8aa107acb329c6ba9a1 | fb8109d422811d91a023da746c908d950f6470f3 | get-ion/ion | /_examples/subdomains/wildcard/main.go | Go | go | 2,866 | no_license | // Package main an example on how to catch dynamic subdomains - wildcard.
// On the first example (subdomains_1) we saw how to create routes for static subdomains, subdomains you know that you will have.
// Here we will see an example how to catch unknown subdomains, dynamic subdomains, like username.mydomain.com:8080.... |
f686d96be336f8e18e7e4c1edfb7c5bcfa25e0a2 | f5862e656673b2f2158d5e4661d324cf93181912 | kyf/ktp | /session/session.go | Go | go | 4,759 | no_license | package session
import (
"encoding/json"
"fmt"
"log"
"net"
"net/http"
"strings"
"sync"
"time"
"github.com/kyf/ktp/message"
)
const (
BUF_SIZE = 2 << 17 //1024 * 256
)
var (
PongWait time.Duration = time.Second * 10
PingPeriod time.Duration = (PongWait * 8) / 10
)
type Server struct {
addr string
... |
cf9e8d251005f075183c28209be2f38b248bd522 | b16405fc5ea9811cf97de33feb96454a2d616dda | Place1/pulumi | /tests/integration/read/read_dbr/read_dbr_test.go | Go | go | 581 | permissive | // Copyright 2016-2018, Pulumi Corporation. All rights reserved.
package ints
import (
"testing"
"github.com/pulumi/pulumi/pkg/v2/testing/integration"
)
// Test that the engine tolerates two deletions of the same URN in the same plan.
func TestReadDBR(t *testing.T) {
integration.ProgramTest(t, &integration.Prog... |
302bf5c73f5a9b6fa0289ef33836e569d91028c1 | 2e0b67dca464a8310006101147e911eadb85a2c1 | AP-Hunt/paas-cf | /tools/metrics/pkg/cloudfront/cloudfront_suite_test.go | Go | go | 203 | permissive | package cloudfront_test
import (
"testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
func TestCloudfront(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Cloudfront Suite")
}
|
484005782fba8a3fafdbeacd381ae6a78d85056b | 6e61b98b7c39b5bad9ae8ce58493f975b8ab607c | eDyablo/handicraft | /go/mediator/src/mediator/bulb.go | Go | go | 319 | permissive | package mediator
type Bulb struct {
dashboard *Dashboard
lit bool
}
func NewBulb(dashboard *Dashboard) *Bulb {
return &Bulb{dashboard: dashboard}
}
func (bulb *Bulb) IsLit() bool {
return bulb.lit
}
func (bulb *Bulb) LightOn() {
bulb.lit = true
}
func (bulb *Bulb) TurnOff() {
bulb.lit = false
}
|
b2fa547e7b378621877650327178e211c9bd4337 | 742c20826317814ba4dc395b72b1cd0bd9429a48 | praveenkumar/cluster-etcd-operator | /pkg/operator/etcd_assets/bindata.go | Go | go | 34,491 | permissive | // Code generated for package etcd_assets by go-bindata DO NOT EDIT. (@generated)
// sources:
// bindata/etcd/cluster-backup.sh
// bindata/etcd/cluster-restore.sh
// bindata/etcd/cm.yaml
// bindata/etcd/defaultconfig.yaml
// bindata/etcd/etcd-common-tools
// bindata/etcd/ns.yaml
// bindata/etcd/pod-cm.yaml
// bindata/e... |
becf3970c25098a7fd17f1ccfa49801a9b0374b1 | 672e67a1ebc8b05755bf787d28f69b4b409823fb | yunify/qingcloud-csi | /pkg/common/calculator_test.go | Go | go | 4,319 | permissive | /*
Copyright (C) 2018 Yunify, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this work except in compliance with the License.
You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... |
c7364348db3310730a1e186f2bac4f7bafc76f26 | ca10e22f83e1dc0edb34efaff461b9544167d119 | cujo/grpc-gateway | /runtime/marshaler_registry.go | Go | go | 2,764 | permissive | package runtime
import (
"errors"
"net/http"
)
// MIMEWildcard is the fallback MIME type used for requests which do not match
// a registered MIME type.
const MIMEWildcard = "*"
var (
acceptHeader = http.CanonicalHeaderKey("Accept")
contentTypeHeader = http.CanonicalHeaderKey("Content-Type")
defaultMarsha... |
50f71fa329f203f21207bc9e09daa9e6067c55fd | 95bd866b8b537e30ffab8461f24c4badc8593082 | cht9862/mango | /file/copyfile.go | Go | go | 1,920 | no_license | package file
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"os"
)
// 方法1 使用ioutil 编写CopyFile函数
func CopyFileIOutil(src string, dst string) {
data, err := ioutil.ReadFile(src)
if err != nil {
fmt.Println("读取文件失败", err)
}
err = ioutil.WriteFile(dst, data, 0777)
if err != nil {
fmt.Println("写入文件失败", err)
}
fm... |
cd6aa194ac5f7376216dbd3d0cb590e3b4cc1cb2 | 1bfb75007007156195231349591263ddfeb519df | MyPureCloud/platform-client-sdk-cli | /build/gc/models/storysetting.go | Go | go | 1,209 | permissive | package models
import (
"encoding/json"
"strconv"
"strings"
)
var (
StorysettingMarshalled = false
)
// This struct is here to use the useless readonly properties so that their required imports don't throw an unused error (time, etc.)
type StorysettingDud struct {
}
// Storysetting
type... |
4592e3127377c8167fca64145c964031fa725660 | b1d14b9720c82f42013d00d793bf27d26d9a3523 | Ladicle/todoist | /filter_parser_test.go | Go | go | 5,511 | permissive | package main
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
// Test ...
func TestFilter(t *testing.T) {
assert.Equal(t, nil, Filter(""), "they should be equal")
}
func TestPriorityFilter(t *testing.T) {
assert.Equal(t, StringExpr{literal: "p1"}, Filter("p1"), "they should be equal")
}
func ... |
84898255d704347f1f686d52d602fe317ff84b8d | 7b74ad94b7a2619148a593f336f6b2f0b56274f8 | khalilliu/beau-blog | /server/initialize/router.go | Go | go | 735 | no_license | package initialize
import (
"beau-blog/global"
"beau-blog/middleware"
"beau-blog/router"
"github.com/gin-gonic/gin"
"net/http"
)
func Routers() *gin.Engine {
var Router = gin.Default()
Router.StaticFS(global.BB_CONFIG.Local.Path, http.Dir(global.BB_CONFIG.Local.Path)) // 静态文件
global.BB_LOG.Info("use middlewar... |
451417d61c7cc1d754a7264df2e7ec144045347d | f8054f9e074e59c1a29ae547af179576069905c5 | rymanalu/udemy-go | /114/main.go | Go | go | 273 | no_license | package main
import "fmt"
func main() {
fmt.Println("foo", foo(1, 2, 3, 4, 5))
fmt.Println("bar", bar([]int{6, 7, 8, 9, 10}))
}
func foo(n ...int) int {
total := 0
for _, v := range n {
total += v
}
return total
}
func bar(n []int) int {
return foo(n...)
}
|
f899389eaadb5da8d5ddc79bb199e990fbc87d0e | 98168dbf7202ea7000da4e88b9e3f90a33ab3247 | williammartin/runa | /integration/integration_suite_test.go | Go | go | 860 | no_license | package integration_test
import (
"os/exec"
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var runaBinPath string
var _ = SynchronizedBeforeSuite(func() []byte {
preloadAssetImageCmd := exec.Command("docker", "pull", "cfgarden/hello")
Eventually(execB... |
8d75eec3e39954bfbfc8baf8604875e8cfa5c858 | 6a479674ba6a25ccffb4026499ba18879b2ee5b9 | RWTH-OS/unik | /pkg/compilers/hermit/hermit_uhyve.go | Go | go | 1,763 | permissive | package hermit
import (
goerrors "errors"
"os"
"path"
"path/filepath"
"github.com/Sirupsen/logrus"
"github.com/cf-unik/unik/pkg/compilers"
"github.com/cf-unik/unik/pkg/types"
unikutil "github.com/cf-unik/unik/pkg/util"
"github.com/emc-advanced-dev/pkg/errors"
)
type HermitUhyveCompiler struct {
CompilerTyp... |
61941fd39a4ab8c340b6710d82dd22f48bd7c838 | 4616c7037002b426aa92e38c2f192d665f6fe1fe | zhangsongdmk/matrixone | /pkg/sort/desc/int8s/sort.go | Go | go | 5,583 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package sort provides primitives for sorting slices and user-defined
// collections.
package int8s
// Sort sorts data.
// It makes one call to data.Len to d... |
dc28cdfadce0bfb8649db74b604eba730fbcc9c1 | 5aef06b624dfddf9f7bcfaf67955013f44660565 | tilt-dev/tilt | /internal/tiltfile/starkit/set_state.go | Go | go | 2,217 | permissive | package starkit
import (
"fmt"
"reflect"
"go.starlark.net/starlark"
)
// SetState works like SetState in React. It can take a value or a function.
//
// That function should transform old state into new state. It can have the signature `func(T) T` or `func(T) (T, error)`.
//
// For example, an plugin that accumul... |
c41c2503b4ece26251fd7cba0697f162c568efec | b43d61983c0aac7e141778d5a0163d4121f96589 | mtrovo/skipper | /routing/matcher.go | Go | go | 11,262 | permissive | package routing
import (
"fmt"
"net/http"
"regexp"
"sort"
"github.com/dimfeld/httppath"
"github.com/zalando/skipper/pathmux"
)
type leafRequestMatcher struct {
r *http.Request
path string
}
func (m *leafRequestMatcher) Match(value interface{}) (bool, interface{}) {
v, ok := value.(*pathMatcher)
if !ok ... |
ac0d29cf70dec68d6f0ca888244c1a393543c7ea | 60979186a08cca568ac895fc32c7353855e236dd | mvinicius563/golang-learning | /ps-go-gettingstarted/main.go | Go | go | 402 | no_license | package main
import (
"net/http"
"github.com/mvinicius563/golang-learning/ps-go-gettingstarted/controllers"
)
func main() {
// type Message struct {
// Name string
// Body string
// Time int64
// }
// m := Message{"Alice", "Hello", 1294706395881547000}
// b, _ := json.Marshal(m)
// fmt.Printf("%v\n", s... |
52736b8c299928014920bb17713624d5e29c51a3 | 70c822fcb9234b9f092b363d49586196f32817f5 | blacknut/azure-sdk-for-go | /profiles/preview/preview/analysisservices/preview/mgmt/analysisservices/models.go | Go | go | 5,924 | permissive | // +build go1.9
// Copyright 2018 Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by appl... |
63609db44c770d0bae2a88e3dc3e713a2f46bb8e | d98a5874d066a412f35776211564207be9bd215d | darunshen/kubeedge | /keadm/cmd/keadm/app/cmd/edge/join.go | Go | go | 5,792 | permissive | /*
Copyright 2019 The KubeEdge 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, so... |
dbc0e13eb7c237a714ee69a0ed9ea3f6f373e630 | af05b1101c47a45a8f3aa830bb83655dc5eaf1f7 | czc006/block-rewrite-header-body | /block_rewrite.go | Go | go | 1,570 | no_license | // Package plugin_blockpath a plugin to block a path.
package block_rewrite_header_body
import (
"context"
"log"
"net/http"
"strconv"
)
// Config holds the plugin configuration.
type Config struct {
Headers map[string]string `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
}
// Crea... |
46a8b5b46e4c00018ac9b66fa6b97d300b80ec18 | 11348b5f4fee700110faff87c90229d557f2a876 | Duncaen/go-xbps-src | /runtime/shfuncs.go | Go | go | 882 | no_license | package runtime
import (
"context"
"errors"
"fmt"
"io"
"mvdan.cc/sh/interp"
)
// write writes a string to a module context's stdout (linked in ctx).
func write(ctx context.Context, s string) error {
mod, ok := interp.FromModuleContext(ctx)
if !ok {
return errors.New("unable to acquire module context")
}
_... |
afb9260c1bdd6ba82e97042a64eeb26490e45d68 | 1f9649d16b832a2785b93760800dca731a508c1d | khanchan/porter | /api/server/handlers/namespace/stream_pod_logs.go | Go | go | 2,140 | permissive | package namespace
import (
"errors"
"fmt"
"net/http"
"github.com/porter-dev/porter/api/server/authz"
"github.com/porter-dev/porter/api/server/handlers"
"github.com/porter-dev/porter/api/server/shared"
"github.com/porter-dev/porter/api/server/shared/apierrors"
"github.com/porter-dev/porter/api/server/shared/co... |
2cc335ce44f09a8a645cf51848cf2056b6822e9e | b1d230d5c0a0cd3a3e442f17010202c2c1bb83cb | xiangrumei/nbp | /vendor/github.com/kubernetes-incubator/service-catalog/pkg/controller/controller_test.go | Go | go | 103,312 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
fbaaf792f07959eac5cc9eba58faf0f35461b683 | fa660bb808297e7c4b12d2c437015415c5d21712 | Malyaka-Imran/askgit | /tables/internal/funcs/enry_is_test_file_test.go | Go | go | 471 | permissive | package funcs
import (
"testing"
"github.com/askgitdev/askgit/tables/internal/tools"
)
func TestEnryIsTest(t *testing.T) {
path := "./scripts_test.go"
rows, err := FixtureDatabase.Query("SELECT enry_is_test(?)", path)
if err != nil {
t.Fatal(err)
}
rowNum, contents, err := tools.RowContent(rows)
if err !=... |
376e0d1b4179c3381918890831c4264f9730ffa1 | 648350979d8537c0937625981a6175b2d493988e | StupidTAO/wallet | /accounts/keystore/account_cache_test.go | Go | go | 3,822 | permissive | package keystore
import (
"fmt"
"github.com/DSiSc/wallet/accounts"
"github.com/DSiSc/wallet/common"
"math/rand"
"os"
"path/filepath"
"reflect"
"testing"
"time"
"github.com/cespare/cp"
"github.com/davecgh/go-spew/spew"
)
var (
cachetestDir, _ = filepath.Abs(filepath.Join("testdata", "keystore"))
cachete... |
ea78e5e239383c099e804b3f8ae4eeab1b281ad2 | 73f873fa503eb4b08243aa88430032ea64ec15e7 | cpwang96/GO-RAFT | /src/service/monkeyservice.go | Go | go | 2,815 | no_license | package service
import (
pb_monkey "chaosmonkey"
"context"
"fmt"
)
type MonkeyService struct {
matrix [][]float32
selfID int32
}
func NewMonkeyService(n int, id int32) *MonkeyService {
var matrix [][]float32
for i:= 0; i < n; i++ {
tmp := make([]float32, n)
matrix = append(matrix, tmp)
}
monkey := &Mon... |
3b1d1eb94bb611fa87bc3b8ee44c8afa2cd49282 | 8058ee694c5744ab314544b94faf842ce42b016b | AndriiDidkivsky/go-algorithms | /bsearch/bsearch_test.go | Go | go | 984 | no_license | package bsearch
import (
"testing"
)
func TestMultipeValues(t *testing.T) {
t.Log("Testing miltiple values")
array := []int{0, 0, 0, 0, 0, 0, 0}
result := BSearch(array, 0)
if result != 3 {
t.Error("Incorrect result")
}
}
func TestSingleValue(t *testing.T) {
t.Log("Testing single value")
array := []int{1, ... |
2af64dda0625fc5fd87044e63a9dbf257e2a7f10 | 70988ef3ebe47f317da03d7fb8f53857cb9dd261 | divjotarora/evergreen | /rest/client/interface.go | Go | go | 9,224 | permissive | package client
import (
"context"
"encoding/json"
"time"
"github.com/evergreen-ci/evergreen"
"github.com/evergreen-ci/evergreen/apimodels"
"github.com/evergreen-ci/evergreen/cloud"
"github.com/evergreen-ci/evergreen/model"
"github.com/evergreen-ci/evergreen/model/artifact"
"github.com/evergreen-ci/evergreen/... |
7ac13efaa2f95e3bb4bf3e8ba4f9dfd6050aabe3 | 5c3a4faebf828fb8200c228394d60e673fc69f78 | goa-golang/goa-log | /log_test.go | Go | go | 1,639 | no_license | package goalog
import (
"log"
"testing"
)
func TestColor(t *testing.T) {
log.Printf("\x1b[%dm[E] hello world 31: 红 \x1b[0m\n", 31)
log.Printf("\x1b[%dm[I]hello world 30: 黑 \x1b[0m\n", 30)
log.Printf("\x1b[%dm[D]hello world 31: 红 \x1b[0m\n", 31)
log.Printf("\x1b[%dm[W]hello world 32: 绿 \x1b[0m\n", 32)
log.Prin... |
1203b789e3c260832080a33a1ba215e97a6c9ae3 | eca915555db0116d4ff920550bf090fda138f9a1 | HiThisIsNotCodeRepo/HelloGoSevenDays | /GeeORM/day4-update-delete-count/schema/schema.go | Go | go | 1,382 | no_license | package schema
import (
"go/ast"
"reflect"
"github.com/qinchenfeng/HelloGoSevenDays/GeeORM/day4-update-delete-count/dialect"
)
type Field struct {
Name string
Type string
Tag string
}
type Schema struct {
Model interface{}
Name string
Fields []*Field
FieldNames []string
fieldMap map[str... |
aeda22c622c33c87b0bbb1ef2e61293c4b215886 | 2e272a00200aad8a9cc0de056e1b91e0b821403c | VicVillegas/bcda-app | /bcda/auth/middleware.go | Go | go | 4,576 | permissive | package auth
import (
"context"
"net/http"
"regexp"
"strconv"
"github.com/dgrijalva/jwt-go"
"github.com/go-chi/chi"
log "github.com/sirupsen/logrus"
"github.com/CMSgov/bcda-app/bcda/database"
"github.com/CMSgov/bcda-app/bcda/models"
"github.com/CMSgov/bcda-app/bcda/responseutils"
)
// Use context keys for... |
0f22f5ec398cab68f6dcb15524c933deb334cb77 | fe74ffab964081b4c5d90f52ce118e5ee3f1db67 | weaveworks/weave | /vendor/github.com/vishvananda/netlink/link.go | Go | go | 17,896 | permissive | package netlink
import (
"fmt"
"net"
"os"
)
// Link represents a link device from netlink. Shared link attributes
// like name may be retrieved using the Attrs() method. Unique data
// can be retrieved by casting the object to the proper type.
type Link interface {
Attrs() *LinkAttrs
Type() string
}
type (
NsP... |
2c1c220312870bae22a41bd3e378f59a2c10b5d3 | 0f3070eda148ad39f6f79e38657f1b121257a08d | 899/healthcheck | /checks_test.go | Go | go | 1,798 | permissive | // Copyright 2017 by the contributors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
c2730430f174d92e4a67ca440bd1303fb3fef7d1 | acbb8f69e1f141451e85cba72604c318960bae17 | gekuu/XTimer | /TimeUtility/TimeUtility.go | Go | go | 745 | no_license | package TimeUtility
import (
"time"
"log"
)
var _delegate func(chan TimerData)
var _data chan TimerData;
var _isDone bool;
type TimerPlus struct {
Second int
Data chan string
}
type TimerData struct {
Time time.Time
}
func NewTimerPlus(second int) *TimerPlus {
return &TimerPlus{Second:second};
}
func (t ... |
542f99fc3ebee8c5c257d9dfd7e378c0b1e08203 | 6b211f08eb05b8c2def1ad44148d19c9e979fa30 | afajl/am | /pic.go | Go | go | 1,829 | no_license | package main
import (
"fmt"
"github.com/afajl/log"
"hash/adler32"
"image"
_ "image/png"
"io"
"os"
"path/filepath"
)
type Pic struct {
originalPath string
id string
isWide bool
height, width int
}
func NewPic(path string) (*Pic, error) {
pic := new(Pic)
pic.originalPath = path
f, er... |
1537a192633fc27ec3174535742771aef2804148 | b8a11ece5ec3f38ef440b217eae109a55ad1c69f | LuYanFCP/gpu-monitoring-tools | /pkg/types.go | Go | go | 2,557 | permissive | /*
* Copyright (c) 2020, NVIDIA CORPORATION. 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 requi... |
0916061872d93dcea654f07cfdde152c2c3898fb | 4c9ff4b0b8bec14d1c4a2a8383a9dd5ff283553a | linfan/kt-connect | /cmd/router/main.go | Go | go | 3,177 | permissive | package main
import (
"fmt"
"github.com/alibaba/kt-connect/pkg/router"
"github.com/gofrs/flock"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"os"
"strings"
)
func init() {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
}
const pathKtLock = "/v... |
d773171357cfe3e3db2acf73289be52fbe2997a2 | 7623ef96befc636d52e21aa3ed973a9ac89e688c | alika/cma-ssh | /vendor/github.com/juju/gomaasapi/interfaces.go | Go | go | 12,448 | permissive | // Copyright 2016 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package gomaasapi
import "github.com/juju/collections/set"
const (
// Capability constants.
NetworksManagement = "networks-management"
StaticIPAddresses = "static-ipaddresses"
IPv6DeploymentUbuntu = "ipv6-d... |
5fae63bfe4420ff157a0fdf64bbed2d325ac0e63 | 0140cb7850efe041138bc0e23bf8bcb5bc7bd9a1 | cryptophonic/cosmos-sdk | /x/ibc/core/02-client/client/cli/query.go | Go | go | 8,451 | permissive | package cli
import (
"context"
"errors"
"fmt"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/client/utils"
"github.com/cosmos/cosmos-sdk/x/ibc/core/02-client/... |
afbca589d6e07018a76c1ad1f8651fe4439cf1c0 | 8d7c028028b496bb905a486178e18dc672e70d70 | thanhnguyennguyen/incognito-analytic | /incognito-data-collector/databases/postgresql/pdestate.go | Go | go | 1,397 | no_license | package postgresql
import (
"github.com/incognitochain/incognito-analytic/incognito-data-collector/models"
_ "github.com/lib/pq"
)
// PDEStatePGStore is PDE State postgresql store
type PDEStatePGStore struct {
PGStoreAbs
}
// NewPDEStatePGStore initialises PDEStatePGStore with pg connection
func NewPDEStatePGSto... |
e6e44800eafe6659f55766a22e27ade20c49cf07 | 8473d1e46ee3b2775678bb2b18c4730bff3c1555 | jasondscott/codeowners-validator | /tests/integration/integration_test.go | Go | go | 4,226 | permissive | // +build integration
package integration
import (
"os"
"runtime"
"testing"
"time"
"github.com/sebdah/goldie/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const (
binaryPathEnvName = "BINARY_PATH"
codeownersSamplesRepo = "https://github.com/gh-codeowners/codeowners-sa... |
c63cbdfa172635fe7356f8abe87ad6a659a96258 | 3fd5d36088dc4857ca20e398f0244bb8c8cff9b6 | xuzhuoxi/infra-go | /netx/wsx/sockws_c.go | Go | go | 1,636 | permissive | package wsx
import (
"github.com/xuzhuoxi/infra-go/errorsx"
"github.com/xuzhuoxi/infra-go/logx"
"github.com/xuzhuoxi/infra-go/netx"
"golang.org/x/net/websocket"
)
func NewWebSocketClient() IWebSocketClient {
return newWebSocketClient().(IWebSocketClient)
}
func newWebSocketClient() netx.ISockClient {
client :=... |
f64397e156829b906705f3b5b6a4d54c28a6c755 | 1be24486a867f9d39c114a6ee9e64154de00a9eb | wanxingroup/fanli-card | /pkg/rpc/card/create_card.go | Go | go | 2,289 | no_license | package card
import (
"fmt"
rpclog "dev-gitlab.wanxingrowth.com/wanxin-go-micro/base/api/rpc/utils/log"
"dev-gitlab.wanxingrowth.com/wanxin-go-micro/base/data/database"
idcreator "dev-gitlab.wanxingrowth.com/wanxin-go-micro/base/utils/idcreator/snowflake"
validation "github.com/go-ozzo/ozzo-validation/v4"
"gola... |
a97755a8d8965bf9ada085eb445bfe2eb008428a | 3a27a5cb2d411abf274fcf7d5114737d8e98c21f | panenming/go-leetcode | /partition-list/partition-list.go | Go | go | 600 | no_license | package leetcode
type ListNode struct {
Val int
Next *ListNode
}
func partition(head *ListNode, x int) *ListNode {
if head == nil || head.Next == nil {
return head
}
// 存放< x的节点
lessHead := &ListNode{}
// 存放 > x的节点
noLessHead := &ListNode{}
lessEnd := lessHead
noLesssEnd := noLessHead
for head != nil... |
5b8989a9311b92f1ec50b1d1ca84cfbb211bc13a | b9c1d2c903d44f729ee893f2cbaf575c07cf25e4 | dajohi/dcrpool | /pool/hub.go | Go | go | 23,946 | permissive | // Copyright (c) 2019-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package pool
import (
"context"
"crypto/rand"
"crypto/tls"
"crypto/x509"
"encoding/binary"
"encoding/hex"
"errors"
"fmt"
"math/big"
"net/http"
"os"
"strings"
... |
07f9dcaff357909c95879d8d7bb2cc05d22c205a | 257b9be78b59fe83d4fe4cfbf677b6936957fe48 | gunosy/aws-sdk-go | /internal/protocol/json/jsonutil/build_test.go | Go | go | 1,461 | permissive | package jsonutil_test
import (
"encoding/json"
"testing"
"time"
"github.com/gunosy/aws-sdk-go/internal/protocol/json/jsonutil"
"github.com/stretchr/testify/assert"
)
func S(s string) *string {
return &s
}
func D(s int64) *int64 {
return &s
}
func F(s float64) *float64 {
return &s
}
func T(s time.Time) *ti... |
443d8de27bc0aff1ddad1c2d6c1be605e03fa5f5 | ef9c205104e957a300f40c679785d407fe98983e | mvarlese/rancher | /pkg/controllers/managementuserlegacy/alert/configsyncer/configsyncer.go | Go | go | 27,149 | permissive | package configsyncer
import (
"bytes"
"context"
"fmt"
"net/url"
"sort"
"strconv"
"time"
v32 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
"github.com/rancher/norman/controller"
"github.com/rancher/rancher/pkg/controllers/managem... |
09d752e4f6b82f0e99aedcfb0190ccfbdeb5b5c6 | 727a850d3315c81c5b9cd14f6ae63dad7ca9737b | zqqq/videortc | /ws/ws.go | Go | go | 3,500 | no_license | package ws
import (
"time"
"videortc/util"
"github.com/gorilla/websocket"
"github.com/tidwall/gjson"
)
// InitEvent mean myself online , give me who is online
type InitEvent struct {
IDS []string
}
// OnlineEvent mean someone online
type OnlineEvent struct {
ID string
}
// MsgEvent mean candidate/offer/answ... |
2e5dab9ab07bb2c7e28cbf68007c729329826ba4 | bd1cb6958798a8c893cd30a93a9ed35e63eaa772 | kaywu11/cellnet | /peer/http/respond_msg.go | Go | go | 1,220 | permissive | package http
import (
"errors"
"fmt"
"github.com/davyxu/cellnet"
"github.com/davyxu/cellnet/codec"
"io"
"io/ioutil"
"net/http"
)
type MessageRespond struct {
StatusCode int
Msg interface{}
CodecName string
}
func (self *MessageRespond) String() string {
return fmt.Sprintf("Code: %d Msg: %+v CodeNa... |
bd6ab657b5ee545db61d4601cf7b2051015b7e19 | 74dc427012710e580d67e2112e597f8f6c9df998 | expipiplus1/uv3dp | /cmd/uv3dp/resin.go | Go | go | 1,654 | permissive | //
// Copyright (c) 2020 Jason S. McMullan <jason.mcmullan@gmail.com>
//
package main
import (
"fmt"
"github.com/spf13/pflag"
"github.com/ezrec/uv3dp"
)
type ResinCommand struct {
*pflag.FlagSet
ResinName string
}
func NewResinCommand() (cmd *ResinCommand) {
cmd = &ResinCommand{
FlagSet: pflag.NewFlagSet... |
abb8f30e8d23e141a254852a3efbc382b18f8391 | dd66b79ac221e33296c935bbb3a030379acf25c6 | NameHaibinZhang/mosn | /test/cases/simple/boltv1_test.go | Go | go | 7,324 | permissive | package simple
import (
"errors"
"fmt"
"testing"
"time"
"mosn.io/mosn/pkg/protocol/xprotocol/bolt"
"mosn.io/mosn/test/lib"
"mosn.io/mosn/test/lib/sofarpc"
)
func runSimpleClient(addr string) error {
cfg := sofarpc.CreateSimpleConfig(addr)
// the simple server's response is:
// Header mosn-test-default: bol... |
2f6508cec36172447aa120fb94f42939b8636fbc | 53078b4ab162061c7a208d78e4fd3f350f6e867a | cokeboL/GoDesignMode | /Strategy/src/main.go | Go | go | 326 | no_license | package main
import (
"Duck"
"fmt"
)
func DuckAction(duck Duck.Duck) {
fmt.Println("\n----------------------------")
duck.Description()
duck.Fly()
duck.Sing()
fmt.Println("----------------------------")
}
func main() {
gDuck := &Duck.GreenDuck{}
wDuck := &Duck.WildDuck{}
DuckAction(gDuck)
DuckAction(wDu... |
14503cef76a76ae00ce0e0ddab781a84129a8dbc | 2d60ff24c28d0a79c00379921ae59d5c6b26497c | spatocode/drone | /scene/fog.go | Go | go | 282 | no_license | package scene
import (
"github.com/spatocode/karid"
)
type Fog struct {
color karid.Color
}
func (fg *Fog) Color() karid.Color {
return fg.color
}
func (fg *Fog) SetColor(color karid.Color) {
fg.color = color
}
func CreateFog(color karid.Color) *Fog {
return &Fog{color}
} |
4d1b378354c8295b9568271c80e80afb003ce2f5 | dd7e910c1ede20711071f8e4000ca0b9a15f03ac | clareliguori/goformation | /cloudformation/aws-ecs-service.go | Go | go | 7,959 | permissive | package cloudformation
import (
"encoding/json"
"errors"
"fmt"
)
// AWSECSService AWS CloudFormation Resource (AWS::ECS::Service)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
type AWSECSService struct {
// Cluster AWS CloudFormation Property
// Required: fa... |
f9b24a3e7c09ead74440b63d9c71635ea9012059 | 7776a33a2b601f15c55d0d2251d74516bd731aa7 | viacoin/lnd | /channeldb/invoices.go | Go | go | 13,160 | permissive | package channeldb
import (
"bytes"
"crypto/sha256"
"encoding/binary"
"fmt"
"io"
"time"
"github.com/boltdb/bolt"
"github.com/viacoin/lnd/lnwire"
"github.com/roasbeef/btcd/wire"
)
var (
// invoiceBucket is the name of the bucket within the database that
// stores all data related to invoices no matter their... |
3a1320d21913989cb0b92aa8a0bb309d079c23d9 | 8086b5bd8171c8c377808e499f93c99e368a1746 | mpetrun5/vedran | /internal/models/payout.go | Go | go | 314 | permissive | package models
import "time"
type Payout struct {
ID int `storm:"id,increment"`
Timestamp time.Time `json:"timestamp"`
PaymentDetails map[string]NodeStatsDetails
}
type NodeStatsDetails struct {
TotalPings float64 `json:"total_pings"`
TotalRequests float64 `json:"total_requests"`
}
|
72273459729d57acc5d3c9259a08b8c30cfc31f3 | baab1388a5ffb4ab1db16faa4e493e523a1365d6 | sinmetal/srunner | /item/user_store_test.go | Go | go | 803 | permissive | package item
import (
"context"
"fmt"
"testing"
"cloud.google.com/go/spanner"
"github.com/google/uuid"
)
func TestUserStore_Insert(t *testing.T) {
t.SkipNow()
ctx := context.Background()
us := newTestCreateUserStore(t)
const lot = 1000
var count int
var users = make([]*User, 0, lot)
for i := 0; i < 10... |
2554f516aa82bf42ea1ca24230369bf451e5a1a9 | 567431984326d65f66157040b28c5eb0763ed0e2 | DrWrong/tantan_demo | /src/github.com/DrWrong/monica/thriftext/text_protocol.go | Go | go | 4,233 | no_license | /**
* TTextProtocol
* archive使用该格式可以将对象输出为文本格式,便于直接放入hive
* @WARNNING:
* 只实现了Writer,没有实现Read,有需要的同学自己动手吧。
*/
package thriftext
import (
"github.com/DrWrong/monica/thrift"
"strconv"
)
type TTextProtocol struct {
trans thrift.TTransport
}
func NewTTextProtocolTransport(trans thrift.TTransport) *TTextProtocol... |
db65a534391e18863f37edf4da434740efb01711 | 612612f933af35182723cba54038b216ea00d7d2 | transcom/mymove | /pkg/services/admin_user.go | Go | go | 1,546 | permissive | package services
import (
"github.com/gobuffalo/validate/v3"
"github.com/gofrs/uuid"
"github.com/transcom/mymove/pkg/appcontext"
"github.com/transcom/mymove/pkg/gen/adminmessages"
"github.com/transcom/mymove/pkg/models"
)
// AdminUserListFetcher is the exported interface for fetching multiple admin users
//
//g... |
82af030193bb748b710c0e61bdb50fcff186b5a8 | 0ad3f524a39b8e49c649ac05faac172e7627722f | otiai10/hisyotan.backup | /actions/add.go | Go | go | 994 | no_license | package actions
import (
"fmt"
"hisyotan/conf"
"hisyotan/models"
"log"
"github.com/otiai10/botw"
)
// Add ...
type Add struct {
*botw.Action
}
// Match ...
func (act *Add) Match(status botw.Status) bool {
if filtered(status) {
return false
}
// TODO: check user
return models.ParseText(status.Text).Has(c... |
9ae8867f5d6cde207999cdcf22591d1e92df69f3 | 3ddf8cd2ee9f011e7666fcc148d5c2732acfc917 | judaro13/ebay-challenge | /challenge.go | Go | go | 727 | no_license | package main
import (
"log"
"time"
_ "github.com/mattn/go-sqlite3" // go get github.com/mattn/go-sqlite3
flag "github.com/spf13/pflag" //go get github.com/spf13/pflag
)
var (
xmlContent = ``
)
func checkErr(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
rebuildOpt := flag.Bool("rebuild",... |
926f061557e82135f3a8ceab830352cf47ec82d7 | 03887efd17a562220abe2a6861f375fbddec0d6d | bby-bishopclark/capsulecd | /pkg/scm/scm_github_test.go | Go | go | 17,764 | permissive | package scm_test
import (
"capsulecd/pkg/scm"
"github.com/stretchr/testify/require"
"testing"
"capsulecd/pkg/config/mock"
"capsulecd/pkg/pipeline"
"capsulecd/pkg/utils"
"context"
"crypto/tls"
"github.com/golang/mock/gomock"
"github.com/seborama/govcr"
"golang.org/x/oauth2"
"io/ioutil"
"net/http"
"os"
"... |
e332bfb3b8ef9f35a27ec98a86ab17dc9c301310 | 406591b8f043dcb88b27142dc78c712ff2aefedb | hlts2/gohot | /vendor/github.com/ikawaha/kagome/cmd/kagome/server/cmd.go | Go | go | 15,431 | permissive | // Copyright 2015 ikawaha
//
// 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... |
035c909b4f72f12e318b938790bbed32a349177e | d79863a30961d8254b7d5a78854b91c76fb10ad0 | cloudfoundry-attic/cli-acceptance-tests | /vendor/github.com/cloudfoundry/cli/cf/api/route_service_binding_repository.go | Go | go | 1,952 | permissive | package api
import (
"bytes"
"encoding/json"
"fmt"
"io"
"strings"
"github.com/cloudfoundry/cli/cf/configuration/coreconfig"
"github.com/cloudfoundry/cli/cf/net"
)
//go:generate counterfeiter . RouteServiceBindingRepository
type RouteServiceBindingRepository interface {
Bind(instanceGUID, routeGUID string, u... |
f0a817e3532948f146bba41a6a147169d0b15c3c | b166fca14237f5db77db8d8ecb02a6cb21794a76 | moul/docker | /daemon/graphdriver/zfs/zfs.go | Go | go | 11,919 | permissive | //go:build linux || freebsd
package zfs // import "github.com/docker/docker/daemon/graphdriver/zfs"
import (
"fmt"
"os"
"os/exec"
"path"
"strconv"
"strings"
"sync"
"time"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/parsers"
zfs "githu... |
1044eeebc726ce70e0ea84c69f2b3175977763bf | bcd12742cdcf8cd2786eaea21ede3c2787ac985a | nikhilsbhat/unpackker | /pkg/exec/exec.go | Go | go | 731 | permissive | // Package unexec is a thin wrapper around os/exec to support Unpackker.
package unexec
import (
"io"
"os/exec"
)
// ExecCmd implements methods required to invoke shell.
type ExecCmd struct {
Command string
Args []string
Writer io.Writer
}
// GetCmdExec gets the constructed shell command ready to be execute... |
c9817facd1166db58c122fe835725403e2f5bd6b | f99f34f7d2665a6175f9418c0d5098fcf09d8132 | ngadhith/go-by-example | /variables.go | Go | go | 750 | no_license | // In Go, _variables_ are explicitly declared and used by
// the compiler to e.g. check type-correctness of function
// calls.
package main
import "fmt"
func main() {
// `var` declares 1 or more variables.
var a = "initial"
fmt.Println(a)
// You can declare multiple variables at once.
var b, c int = 1, 2
fmt... |
ad7a754e55d111b663779bb4e93d9a5b292c7175 | 810bbc7da86114c816809109d92c9e485d72ccf8 | r2d2-ai/cv | /trigger/ipcam/medatata.go | Go | go | 975 | no_license | package ipcam
import "github.com/r2d2-ai/core/data/coerce"
type Settings struct {
}
type HandlerSettings struct {
Protocol string `md:"protocol,required,allowed(RSTP,ONVIF)"`
Host string `md:"host,required"`
User string `md:"user"`
Password string `md:"password"`
VideoURI string `md:"videoUri"`
GroupId... |
76d78f64787d45461f3d2ce2d648b2ba23b499b7 | 1982ec4cf2708a124b77030607fea7e10c7fa9bb | jjjachyty/apcc_wallet_api | /services/dappSrv/dapp.go | Go | go | 775 | no_license | package dappSrv
import (
"apcc_wallet_api/models"
"apcc_wallet_api/models/dappMod"
"apcc_wallet_api/utils"
"net/url"
)
type DappService struct{}
func (DappService) Page(page *utils.PageData, pars url.Values) error {
sql, args := models.GetSQL(pars, dappMod.DappSearchSQL)
return models.GetSQLPage(p... |
d770074562fad534a326a07d02db0fc6ff3842bd | 58da2ac85360acea9d4a0f5a4f0b52d0ead123fa | OpusDude/bosh-bootloader | /commands/rotate_test.go | Go | go | 4,214 | permissive | package commands_test
import (
"errors"
"github.com/cloudfoundry/bosh-bootloader/commands"
"github.com/cloudfoundry/bosh-bootloader/fakes"
"github.com/cloudfoundry/bosh-bootloader/storage"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Rotate", func() {
var (
stateStore *fake... |
d8c18a5624f08dae4734c73cfae2746f988830ae | 9f0c9943563778bb93080127987039efb5966a70 | vegaprotocol/tendermint | /internal/evidence/pool_test.go | Go | go | 16,759 | permissive | package evidence_test
import (
"context"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tendermint/internal/evidence"
"github.com/tendermint/tendermint/internal/evidence/... |
6b56090a0df27701ff4774c08c045313eff775f3 | 09ac816853bcc8d8be26b6fb1f8290e282bb6279 | johntdyer/golang-devops-stuff | /src/github.com/influxdb/influxdb/src/datastore/boolean_operators.go | Go | go | 3,797 | permissive | package datastore
import (
"common"
"fmt"
"protocol"
"regexp"
)
type oldBooleanOperation func(leftValue, rightValues *protocol.FieldValue) (bool, error)
type BooleanOperation func(leftValue *protocol.FieldValue, rightValues []*protocol.FieldValue) (bool, error)
func wrapOldBooleanOperation(operation oldBooleanOp... |
389907fd1a4c3cd4e818b23897dd2f601ed89cfc | 883ba60061070c5211b3ea3f93d61f5b149ae129 | oracle/cluster-manager | /vendor/github.com/vmware/govmomi/govc/vm/disk/attach.go | Go | go | 2,701 | permissive | /*
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
0d710c9c9ef3366f0340691fa529080c7ada876a | 446094754952d314e3417f862b9205d6bb20ebe2 | zhangchunsheng/grpc-test | /go-grpc-example/pkg/gtls/client.go | Go | go | 930 | permissive | package gtls
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"google.golang.org/grpc/credentials"
)
type Client struct {
ServerName string
CaFile string
CertFile string
KeyFile string
}
func (t *Client) GetCredentialsByCA() (credentials.TransportCredentials, error) {
cert, err := tls.LoadX509KeyPa... |
5257cf387878988e73cb8cc2699f9e3d118e6596 | e8c65745bc68430d180f6926381ffd1d646c29f3 | lodexinc/cli-1 | /command/v2/shared/new_clients.go | Go | go | 2,382 | permissive | package shared
import (
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2"
ccWrapper "code.cloudfoundry.org/cli/api/cloudcontroller/wrapper"
"code.cloudfoundry.org/cli/api/uaa"
uaaWrapper "code.cloudfoundry.org/cli/api/uaa/wrapper"
"code.cloudfoundry.org/cli/command"
)
// NewClients creates a new V2 Cloud Cont... |
4ed30437381c42c9420f7b640c4fbaa1de8d1211 | 29744fd9064cb2e8e1c7ac07b549972d98696350 | vincent-pli/tekton-listener | /vendor/github.com/knative/serving/pkg/reconciler/autoscaling/hpa/resources/hpa.go | Go | go | 3,093 | permissive | /*
Copyright 2018 The Knative 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... |
431e9f8da47f43deb80f24219000c95422e272d8 | 2721c25d2f12b5551a83dd8c637bd35f6dbbbd95 | ryo33/ghq | /main.go | Go | go | 363 | permissive | package main
import (
"os"
"github.com/codegangsta/cli"
)
var Version string = "0.7.2"
func main() {
newApp().Run(os.Args)
}
func newApp() *cli.App {
app := cli.NewApp()
app.Name = "ghq"
app.Usage = "Manage GitHub repository clones"
app.Version = Version
app.Author = "motemen"
app.Email = "motemen@gmail.c... |
f344106961c23d1bcee69e551708fd2c62522ebb | 07a70be44a44f67294f2331b0fe5f8b3627381ed | lucadonnoh/optimism | /l2geth/core/genesis_test.go | Go | go | 5,943 | permissive | // Copyright 2017 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... |
31807e39d72908d206ad1e7dd86ec856733970dc | e483c234f4ffd73805966789e67e41c4f0f983ad | cctvbtx/rainbow | /model/net.go | Go | go | 3,271 | no_license | package model
import (
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/orm"
"fmt"
)
type NetIpInfoModel struct {
}
type NetWorkModel struct {
}
func init() {
orm.RegisterModel(new(Ip))
orm.RegisterModel(new(Network))
}
func NewNetWorkModel() *NetWorkModel {
netWorkModel := &NetWorkModel {
}
retu... |
23cee8948c48d0899976c09accd32087d1865af4 | c2a438177d6def6bd8894c721d3487581de896f9 | ldkingvivi/cilium | /pkg/k8s/watchers/cilium_node.go | Go | go | 7,197 | permissive | // SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package watchers
import (
"context"
"sync"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/tools/cache"
"github.com/cilium/cilium/pkg/compa... |
4ab602b66e8b301b91474449bf4f14eef81b4cfa | fdb9fbc7c06ea032735b40343e1e294af02a9abd | fpawel/bio3 | /internal/products/products.go | Go | go | 1,987 | no_license | package products
import (
"github.com/boltdb/bolt"
"github.com/fpawel/bio3/internal/utils"
"time"
)
type DB struct {
DB *bolt.DB
}
type Tx struct {
tx *bolt.Tx
db DB
}
type PartyTime time.Time
type ProductTime time.Time
type Party struct {
PartyTime PartyTime
Tx Tx
}
type Product struct {
ProductT... |
779420e83616a344a3111b696c7e4c61d75de3c4 | b5b1cc7fbb9b440c0473036a58ece9d1a1ca5fc4 | zhujian7/build-pipeline | /test/helm_task_test.go | Go | go | 16,913 | permissive | // +build e2e
/*
Copyright 2018 Knative Authors LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
436822f7e5a2d4bf1007d85f71a22567e449054c | 4d33aa33e115501f5a70ab0f5874a34535f1cfdb | xiachengfan/gopractise | /xhttp/framework/router.go | Go | go | 529 | no_license | package framework
import (
"net/http"
)
type router struct {
handlers map[string]HandlerFunc
}
func newRouter() *router {
return &router{handlers: make(map[string]HandlerFunc)}
}
func (r *router) addRoute(method string, pattern string, handler HandlerFunc) {
key := method + "-" + pattern
r.handlers[key] = hand... |
d5d5663946a60b3df3c3373d8bd1db13a27f9653 | f6cd03d5402e06e07fefd6cef23a0d8084b49c10 | MegiDervishi/petitgo | /tests/exec/integer.go | Go | go | 210 | no_license | package main
import "fmt"
func main() {
fmt.Print(42)
fmt.Print("\n")
fmt.Print(0x2a)
fmt.Print("\n")
fmt.Print(0x2A)
fmt.Print("\n")
fmt.Print(0X2a)
fmt.Print("\n")
fmt.Print(0X2A)
fmt.Print("\n")
}
|
9223944626d94b0d4a1a93600070ee40e5a72ed4 | 787505ba93360ea09e369ddaff6e0996b39bb2d6 | ijsnellf/amalgam8 | /vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1/defaults.go | Go | go | 1,596 | permissive | /*
Copyright 2016 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, ... |
e4bfec30475393e6d8775ac974bf956a6f9368af | 456ee1ac46bbf7adcc975513463594cf009ccd93 | spotinst/spotctl | /internal/spot/spotinst.go | Go | go | 2,429 | permissive | package spot
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"github.com/spotinst/spotctl/internal/log"
"github.com/spotinst/spotctl/internal/version"
"github.com/spotinst/spotinst-sdk-go/spotinst"
"github.com/spotinst/spotinst-sdk-go/spotinst/client"
"github.com/spotinst/spotinst-sdk-go/spotinst/credentials"
... |
859bc571dadce1fac9732c338bb7e1dc0cb66900 | ebe1e5d97ac3fe1bedb2734fab5c10564d1985ba | stormgbs/protoc-go-inject-tag | /parse.go | Go | go | 1,251 | permissive | package main
import "fmt"
func tagFromComment(comment string) (tag string) {
match := rComment.FindStringSubmatch(comment)
if len(match) == 2 {
tag = match[1]
}
return
}
func beegoOrmTblNameFromComment(comment string) (tblName string) {
match := rBeegoOrmTable.FindStringSubmatch(comment)
if len(match) == 2 {... |
0910f0b53e52538820aaa2d021eca904d84f4496 | 4c93aaaf5a60439879ec0d5c1a330a607b7ce8e7 | msingle/kubernetes | /cmd/cloud-controller-manager/app/options/options.go | Go | go | 5,027 | permissive | /*
Copyright 2016 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, ... |
af515325999790f69b7ba0b45b6d142d5cb98420 | 1433fea59dee3c824c739a5e100044a50d33b556 | erda-project/erda | /internal/apps/msp/apm/trace/storage/cassandra_v1/consumer.go | Go | go | 7,222 | permissive | // Copyright (c) 2021 Terminus, 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 agree... |
c6d647ac26d7e27bcad63cfb56fb07177905b6d1 | 37ae5f00f9546fe68b7b69ccaeb2ef48c7b07408 | ediboko1980/maddy | /signal.go | Go | go | 950 | permissive | //+build darwin dragonfly freebsd linux netbsd openbsd solaris
package maddy
import (
"os"
"os/signal"
"syscall"
"github.com/foxcpp/maddy/log"
)
// handleSignals function creates and listens on OS signals channel.
//
// OS-specific signals that correspond to the program termination
// (SIGTERM, SIGHUP, SIGINT) ... |
5f33a4b5783aa51705970844b5ffcd3e8d8d8b1f | e2d431e348268d1af35062791ecdb94b603f0e15 | caochun0701/gowork | /src/libbeat/outputs/elasticsearch/json_read.go | Go | go | 11,474 | no_license | package elasticsearch
import (
"errors"
"libbeat/common/streambuf"
)
// SAX like json parser. But instead of relying on callbacks, state machine
// returns raw item plus entity. On top of state machine additional helper methods
// like expectDict, expectArray, nextFieldName and nextInt are available for
// low-lev... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.