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 |
|---|---|---|---|---|---|---|---|---|
bf145b2d926df2412546ef0ef301d3f07925553a | 2028a2ffd3b60eac1669679c822e2044db744c6a | cw2030/go101 | /go101.go | Go | go | 12,793 | no_license | package main
import (
"bytes"
"context"
"errors"
"go/build"
"html/template"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync"
"time"
)
type Go101 struct {
staticHandler http.Handler
articleResHandler http.Handler
isLocalServer bool
articlePages map[... |
d4e6c5d904fe500d986a439f8d9efe2ef7c916e5 | cc1d042ae4ee302ca2862afb1cc43407ab0bfa91 | overtalk/gp-server | /module/analysis.go | Go | go | 231 | no_license | package module
import (
"net/http"
"github.com/golang/protobuf/proto"
)
// Analysis : analysis module
type Analysis interface {
DifficultyAnalysis(r *http.Request) proto.Message
TagsAnalysis(r *http.Request) proto.Message
}
|
8d2e30c701bd11c2fd0d90219059f785f331218f | 5bc0fd96388f489b86be16df8db55dc568088c0e | knodos/kmodel | /graphics/dots.go | Go | go | 1,728 | permissive | package graphics
import (
"code.google.com/p/plotinum/plot"
"code.google.com/p/plotinum/vg"
"image/color"
"math"
)
// DotPlot plots a XY plot with dots in it
type Dots struct {
X []float64
Y []float64
color.Color
}
func NewDots(x, y []float64) (*Dots, error) {
return &Dots{x, y, color.RGBA{G: 100, B: 200, A:... |
7fe1b6eb48e7d0163e622eea49aa4a9f6820c516 | 752a4de3a573e1f4c1b5c9546baf8880947b43d8 | gammons/advent-of-code-2020 | /day-9/part-1/main.go | Go | go | 854 | no_license | package main
import (
"bufio"
"fmt"
"log"
"os"
"sort"
"strconv"
)
const Preamble = 25
func main() {
allnums := readInput()
for i := Preamble + 1; i < len(allnums); i++ {
consider := make([]int, Preamble)
copy(consider, allnums[i-Preamble:i])
sort.Ints(consider)
if !isValid(allnums[i], consider) {
... |
45f2feae98fe9bdf173a2e9b12ce3d7e1ba2018e | d9e5b2d4006e0685386a54a9767b9bdf1c44dbf1 | yesmola/AdvancedComputerNetwork | /DV_algorithm/router.go | Go | go | 14,062 | permissive | package main
import (
"bufio"
"bytes"
"encoding/gob"
"fmt"
"log"
"net"
"os"
"strconv"
"strings"
"time"
)
const Unreachable = 16
const DefaultTTL = 5
const BroadcastCycle = 5
/*
* @Destination: the destination of this data packet
* @TTL: time-to-live of this data packet
*/
type DataPacket struct {
Desti... |
6a1200b30ae13a6d7457335d4b79f4925fdba1d5 | bfa00a0bcebe70961ebc2195761435a4aa831632 | codexc/gin-demo | /src/App/services/TopicService.go | Go | go | 720 | no_license | //这里放的是框架无关的纯业务处理代码
//为了统一约定涉及到的对象一律使用指针
package services
import (
"fmt"
"learn/topic/src/AppInit"
"learn/topic/src/Models"
)
type TopicService struct {
}
func (t *TopicService) GetList(req *TopicListRequest) (*Models.TopicList, error) {
topicList := &Models.TopicList{}
err := AppInit.GetDB().Limit(req.Size).Fi... |
1b00e208c560eee06ddab43d58c93c02541f9e11 | 8cc3fa7490c2ba9ecee1439515c65950b941f8e7 | xiaowei-leo/istio | /galley/pkg/config/analysis/local/source_test.go | Go | go | 2,361 | permissive | // Copyright 2019 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... |
464bd272ba5358ed8f8e53a7d2969f6cf2c4926b | 4624ae86a21a1abffb4de7582371e0b89cb052a7 | arangodb/kube-arangodb | /pkg/util/arangod/error.go | Go | go | 1,501 | permissive | //
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
//
// 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 re... |
fb002a9f11d6ce24da496552b752347179918d71 | 8a9a1f579c9784982e522bd1b42b39b93b70976b | jessfraz/docker | /quota/projectquota.go | Go | go | 11,319 | permissive | //go:build linux && !exclude_disk_quota && cgo
//
// projectquota.go - implements XFS project quota controls
// for setting quota limits on a newly created directory.
// It currently supports the legacy XFS specific ioctls.
//
// TODO: use generic quota control ioctl FS_IOC_FS{GET,SET}XATTR
// for both xfs/ext4 ... |
7bd15d61ee1caba925c71de4b9119b98359dcfb6 | 4ab3a18924a88980de4813b035ff065bea99a1a0 | renevall/gorilla-websocket-reconn-error | /remote/remote.go | Go | go | 2,286 | no_license | package main
import (
"flag"
"fmt"
"log"
"net/url"
"time"
"github.com/gorilla/websocket"
)
var addr = flag.String("addr", "192.168.33.1:3500", "http service address")
const (
// Time allowed to write a message to the peer.
writeWait = 10 * time.Second
// Time allowed to read the next pong message from the... |
6e607f084eac33b9243eac5981182822bf227686 | 0110b81ac6a03428e94b450dbf833e4e0d0a93f9 | yanbinzong/gva | /server/api/v1/message.go | Go | go | 1,831 | permissive | package v1
import (
"fmt"
"gin-vue-admin/global"
"gin-vue-admin/model"
"gin-vue-admin/model/response"
"gin-vue-admin/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
func CreateMessage(c *gin.Context) {
var message model.Message
_ = c.ShouldBindJSON(&message)
fmt.Println(message)
if err := service.... |
f8a81e6eaad1f2b216c6d46fc487bf7c9cf34c7f | bf5238f90ad566c867052751e63e4282524bcf57 | HunDunDM/tidb-dashboard | /pkg/apiserver/logsearch/models.go | Go | go | 5,175 | permissive | // Copyright 2020 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
7dc9235ff0ebe420fb1ee448fbc1ef7b88264693 | 6e98a05baece886354820c4c36543ef4c61288c4 | therealdannzor/cs | /leetcode/160.intersection-of-two-linked-lists.go | Go | go | 3,531 | permissive | /*
* @lc app=leetcode id=160 lang=golang
*
* [160] Intersection of Two Linked Lists
*
* https://leetcode.com/problems/intersection-of-two-linked-lists/description/
*
* algorithms
* Easy (37.81%)
* Likes: 3176
* Dislikes: 356
* Total Accepted: 427.8K
* Total Submissions: 1.1M
* Testcase Example: '8\n... |
eb3589000bdf8ef6674c9d914ff5931db9a34474 | eb51dcc9e14652335bd10e5ee11703ba46884832 | aliyun/aliyun_assist_client | /agent/pluginmanager/installeds.go | Go | go | 8,935 | permissive | package pluginmanager
import (
"encoding/binary"
"encoding/json"
"errors"
"io"
"os"
"github.com/aliyun/aliyun_assist_client/thirdparty/sirupsen/logrus"
bolt "go.etcd.io/bbolt"
"github.com/aliyun/aliyun_assist_client/agent/log"
"github.com/aliyun/aliyun_assist_client/common/fuzzyjson"
)
const (
_PluginList... |
d46748686b23ef718f9c7a79b42fc377bd391231 | b2edec0c960331ad357e15f9407b907d09602eac | doodles526/optimus | /sources/slice/slice.go | Go | go | 678 | permissive | package slice
import (
"gopkg.in/Clever/optimus.v3"
)
type sliceTable struct {
rows chan optimus.Row
stopped bool
}
func (s sliceTable) Rows() <-chan optimus.Row {
return s.rows
}
func (s sliceTable) Err() error {
return nil
}
func (s *sliceTable) Stop() {
s.stopped = true
}
func (s *sliceTable) start(sl... |
873e968d1d43f8484ef6b34fd64cf2d45c782b69 | ca5d90358bbd9d3daab3a388a2ac573fd95983ff | MisinformedDNA/pulumi-azure-nextgen | /sdk/go/azure/web/v20180201/listWebAppConnectionStrings.go | Go | go | 1,043 | permissive | // *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20180201
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func ListWebAppConnectionStrings(ctx *pulumi.Context, args *ListWebAppConnectionStringsA... |
a05155d516d9c8de26537516cd43a07c4c5413ee | 787fe917f126dec5b5dd668f9df7467e3caf1e5f | wxdao/wengine | /scene.go | Go | go | 984 | no_license | package wengine
import "github.com/go-gl/mathgl/mgl32"
type ObjectMap map[string]*Object
type Scene struct {
objects ObjectMap
}
func NewScene() *Scene {
return &Scene{objects: make(ObjectMap)}
}
func (s *Scene) Objects() ObjectMap {
return s.objects
}
func (s *Scene) RegisterObject(name string, object *Object... |
b5d6e889222cfdabdb8afeb51c250e2953ae4e55 | 217a5564297c7fdb671682e2dafff5fad11c0771 | lucapette/fakedata | /pkg/data/first_names.go | Go | go | 7,803 | permissive | package data
// Firstnames is an array of first names
var Firstnames = []string{
"Abram",
"Adalberto",
"Adaline",
"Adriene",
"Ahmed",
"Alease",
"Alec",
"Aleshia",
"Alfonzo",
"Alishia",
"Alisia",
"Alix",
"Aliza",
"Allen",
"Alline",
"Almeta",
"Alonso",
"Amado",
"Amberly",
"Ambrose",
"Andreas",
"Ang... |
0fb3e53e74bd7c7515fccfed670a279ca1dd8a57 | 4c1a108e694237a336fc02ee3739e07697d14014 | nathanKith/MIAMI-backend | /api/photos/delivery/http/delivery_test.go | Go | go | 8,966 | no_license | package http_test
import (
"bytes"
"context"
"mime/multipart"
"net/http"
"net/http/httptest"
"park_2020/2020_2_tmp_name/api/photos/mock"
"park_2020/2020_2_tmp_name/models"
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/gorilla/mux"
"github.com/stretchr/testify/require"
photoHttp "park_2020... |
68bad98c8e1ef31826944171210c8a978c310b6d | 60f31b543b43cc1386ff10601b9a3bd7242062ce | chrsan/c2goasm | /test/MultiplyAndAdd_test.go | Go | go | 460 | permissive | package c2goasmtest
import (
"testing"
)
func TestMultiplyAndAdd(t *testing.T) {
f1 := [8]float32{}
f2 := [8]float32{}
f3 := [8]float32{}
for i := 0; i < 8; i++ {
f1[i] = float32(i)
f2[i] = float32(i * 2)
f3[i] = float32(i * 3)
}
f4 := MultiplyAndAdd(&f1, &f2, &f3)
for i := 0; i < 8; i++ {
expecte... |
58be69d7a3fa4160bbac46ef8007dfd4b45d2c0b | 45c4c270aeb939dd7b9efd1f72b75e0626028284 | cbsinteractive/bitmovin-api-sdk-go | /encoding/encoding_encodings_muxings_fmp4_drm_widevine_api.go | Go | go | 3,386 | permissive | package encoding
import (
"github.com/cbsinteractive/bitmovin-api-sdk-go/common"
"github.com/cbsinteractive/bitmovin-api-sdk-go/query"
"github.com/cbsinteractive/bitmovin-api-sdk-go/model"
"github.com/cbsinteractive/bitmovin-api-sdk-go/pagination"
)
type EncodingEncodingsMuxingsFmp4DrmWidevineApi struc... |
4299d211aa0e944ed24c1e197ef31af50c53e6d7 | 794b1592c3729e81340c847a528ec8a14b8bbc40 | fhs/mux9p | /internal/p9p/fcall.go | Go | go | 6,460 | permissive | // This file is based on 9fans.net/go, which has this license:
//
// Copyright (c) 2009 Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code mu... |
a9512e66f0598e8cf9a14b48dd6011fa793b20ee | d30419af5dc6b1b2e37b2c7a0bba94d5dfb7def8 | trongbq/snowflake-server | /snowflake/idworker.go | Go | go | 2,118 | permissive | package snowflake
import (
"encoding/json"
"errors"
"sync"
"time"
)
const (
SequenceBits = 12
MachineBits = 10
MachineIDMax = -1 ^ (-1 << MachineBits)
MachineIDShift int64 = SequenceBits
TimestampShift int64 = MachineBits + SequenceBits
SequenceMask = -1 ^ (-1 << SequenceBits)
// Our sch... |
b2e97f85ed27fe7b6726d84d74e7cdf4c83be916 | 9d02e33f852a712f4f2d820d67c9eac247d38bea | lyhiving/temporal | /service/history/visibilityQueueTaskExecutor_test.go | Go | go | 16,156 | permissive | // The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Soft... |
62658f02932b325f36936a25cadaa508b077076a | d98ebc2615bccf5037ef1f4da9f78d57e517eca6 | tokopedia/teleport | /vendor/github.com/tstranex/u2f/messages.go | Go | go | 1,994 | permissive | // Go FIDO U2F Library
// Copyright 2015 The Go FIDO U2F Library Authors. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package u2f
import (
"encoding/json"
)
// JwkKey represents a public key used by a browser for the Channel ID TLS
// exte... |
ac458a540a31b32c7ce6c215360d6c77f29283a5 | 04f228d794ba8e5266b07935d62a676d022590c6 | BruceChan2000/v2ray-core | /proxy/shadowsocks/protocol.go | Go | go | 4,080 | permissive | package shadowsocks
import (
"io"
"github.com/v2ray/v2ray-core/common/alloc"
"github.com/v2ray/v2ray-core/common/log"
v2net "github.com/v2ray/v2ray-core/common/net"
"github.com/v2ray/v2ray-core/common/serial"
"github.com/v2ray/v2ray-core/proxy"
"github.com/v2ray/v2ray-core/transport"
)
const (
AddrTypeIPv4 ... |
a560dda61d8374012a976b71a0480e2a2c0ecb54 | 80933591c82aaefda51524c59102bf92ebebdfed | lifa1225/aspose-words-cloud-go | /v2107/tests/field_test.go | Go | go | 23,943 | permissive | /*
* --------------------------------------------------------------------------------
* <copyright company="Aspose" file="field_test.go">
* Copyright (c) 2021 Aspose.Words for Cloud
* </copyright>
* <summary>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software a... |
5229592e78c0bfa2cb2454eaed0765b367c29110 | 695706a56c0945fd0b972dbdaefc511698d2527a | mantnicot/promedio_crud | /models/usuario.go | Go | go | 3,871 | no_license | package models
import (
"errors"
"fmt"
"reflect"
"strings"
"github.com/astaxie/beego/orm"
)
type Usuario struct {
Id int `orm:"column(id);pk"`
Nombre string `orm:"column(nombre)"`
Apellido string `orm:"column(apellido);null"`
}
func (t *Usuario) TableName() string {
return "usuario"
}
func init... |
b21a0b44dcddb1cf04fdc306b81c822a748ad9f1 | 06129005db43cc40d2ec961fd422203bc990f3cb | voor/cluster-api-provider-azure | /exp/controllers/azuremanagedcluster_controller.go | Go | go | 3,771 | 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, ... |
decab27bd42bdc8caf5a6fde1c1f0e00ba959668 | 1a2cb15ef1003f04bc979c26ce9392d02c826c88 | cocobao/howfw | /howservice/service/rpc_cli.go | Go | go | 1,244 | no_license | package service
import (
"context"
"encoding/json"
"github.com/cocobao/howfw/howservice/conf"
"github.com/cocobao/howfw/mode"
"github.com/cocobao/howfw/rpcser"
"github.com/cocobao/log"
)
var (
rpcCli *rpcser.RpcxMultiCli
callClimgr mode.CallClimgr
)
func RunRpc(c mode.CallClimgr) {
rpcCli = &rpcser.Rpc... |
70e1e0a7689068c6a8502ad2592a9d7463c8af3f | 2e5b1d5319e0ad410f8b1c5e8cf2f0791fa39dea | pombreda/gomapgen | /gmgmap/interior.go | Go | go | 2,347 | permissive | package gmgmap
import "math/rand"
const (
LOBBY_EDGE = iota
LOBBY_INTERIOR
LOBBY_ANY
)
// NewInterior - create a building interior layout map.
// The layout has a "lobby", multiple rooms and corridors.
// The lobby must be at most 2 steps from any room.
func NewInterior(width, height, minRoomSize, maxRoomSize,... |
502c955bc25b221db6dd03a4ac7a1094f11920d5 | 494652f5ea4d07212c8dc3c8227ee7294592198d | codeblooded/kubebuilder | /pkg/model/resource/options_test.go | Go | go | 4,751 | permissive | package resource_test
import (
"strings"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
. "sigs.k8s.io/kubebuilder/pkg/model/resource"
)
var _ = Describe("Resource Options", func() {
Describe("scaffolding an API", func() {
It("should succeed if the Options ... |
26f4ce970cc70623a91470a30afe54a5fada8476 | 7f786f1f0235c77aa3c365d659518fc9cff406ce | cesrjimenez/keltur-backend | /models/item.go | Go | go | 717 | permissive | package models
// Item is each of the item.
type Item struct {
Id string
Title string
Vendor string
ImageURL string
Category string
Price float32
}
func (db *DB) AllItems() ([]*Item, error) {
rows, err := db.Query("SELECT * FROM items")
if err != nil {
return nil, err
}
def... |
01b5603864225eaeb7bdfb9801b076bafcd33a88 | 0d258192cb2a933efa5837c85353310535aa914a | puresoul/dashboard | /lib/funcs/str/str.go | Go | go | 882 | no_license | package str
import (
"crypto/sha256"
"fmt"
"github.com/sethvargo/go-password/password"
"unicode"
)
func LcFirst(str string) string {
for i, v := range str {
return string(unicode.ToLower(v)) + str[i+1:]
}
return ""
}
func GeneratePassword() (string, error) {
pass, err := password.Generate(8, 10, 0, false, ... |
f46a7ca4f94dc0ab38425a6bc38c37ca9129c0ad | a906a89607346a569eac5e7f1ab3ae01b6bfcd85 | psh-rocks/go-prompt | /_tools/vt100_debug/main.go | Go | go | 800 | permissive | // +build !windows
package main
import (
"fmt"
"syscall"
prompt "github.com/psh-rocks/go-prompt"
"github.com/psh-rocks/go-prompt/internal/term"
)
func main() {
if err := term.SetRaw(syscall.Stdin); err != nil {
fmt.Println(err)
return
}
defer term.Restore()
bufCh := make(chan []byte, 128)
go readBuffe... |
ac770060cbe9cd1db93dcce6074bda36c7dade69 | 8d9592e1e2466f532075e2f39f6e9cc699656c9a | vasu81in/Algorithms | /graph.go | Go | go | 976 | no_license | package main
import (
"fmt"
)
type elem struct {
v int
next *elem
}
type graph struct {
size int
list []*elem
}
func (g *graph) new_elem(v int) *elem {
return &elem{v: v, next: nil}
}
func (g *graph) new_graph(size int) *graph {
return &graph{size: size,
list: make([]*elem, size)}
}
func (g *graph) ini... |
2a5ee1eb6f2fcbefc53f383d6a87c7f91c39975b | 6186f913b1a2705c651b37005532cf110e40c4a3 | sasg/operatorkit | /controller/integration/test/parallel/parallel_test.go | Go | go | 10,472 | permissive | // +build k8srequired
package parallel
import (
"context"
"reflect"
"sort"
"sync"
"testing"
"time"
"github.com/giantswarm/apiextensions/pkg/apis/core/v1alpha1"
"github.com/giantswarm/backoff"
"github.com/giantswarm/microerror"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1... |
c6be0862fa3abf9c4dced36c6f66814523afc874 | 03602ac8b669841ae03b2543596fd793eb454614 | kblomster/go-structured-query | /postgres/literal.go | Go | go | 323 | permissive | package sq
import (
"strings"
)
// Literal allows for the underlying string to be literally plugged into the SQL query
type Literal string
var _ SQLExcludeAppender = (*Literal)(nil)
func (l Literal) AppendSQLExclude(buf *strings.Builder, _ *[]interface{}, _ map[string]int, _ []string) {
buf.WriteString(string(l))... |
230738f66b82b669b41a3b8bd4772d69f604609a | ed03f0108e85a0cf7aabd17867c50d9dca103da8 | ar90n/lab | /sandbox/go_todo_app/config/config_test.go | Go | go | 394 | no_license | package config
import (
"fmt"
"testing"
)
func TestNew(t *testing.T) {
wantPort := 3333
t.Setenv("PORT", fmt.Sprint(wantPort))
got, err := New()
if err != nil {
t.Fatalf("cannot create config: %v", err)
}
if got.Port != wantPort {
t.Errorf("want %d, but %d", wantPort, got.Port)
}
wantEnv := "dev"
if ... |
d3e190e94c1c9bbd3c1c96598d80da90547a7562 | 3a199e76fbcd351bcfeed48e66b607a16a989239 | pointlander/grpc | /proto/grpc2grpc/petstore.PetStoreService.server.grpcservice.go | Go | go | 5,538 | no_license | // This file registers with grpc service. This file was auto-generated by mashling at
// 2018-12-05 14:00:51.859472535 -0700 MST m=+0.048388335
package grpc2grpc
import (
"encoding/json"
"fmt"
"strings"
"golang.org/x/net/context"
"log"
"errors"
servInfo "github.com/project-flogo/grpc/trigger"
"google.golan... |
a607230afc9328f567c07949aeea6c66618547a0 | 5a39fc8dae446b5b169a30592812e219ddc14bf8 | johnkeates/terraform-provider-databricks | /client/service/instance_profiles.go | Go | go | 2,654 | permissive | package service
import (
"encoding/json"
"fmt"
"net/http"
"github.com/databrickslabs/databricks-terraform/client/model"
)
// InstanceProfilesAPI exposes the instance profiles api on the AWS deployment of Databricks
type InstanceProfilesAPI struct {
Client *DBApiClient
}
// Create creates an instance profile re... |
05153633cf41e3216fe2acccd90c853f6876a1c8 | 64863efb6ef58de01f84dcafab7b64257c30ca79 | whereswaldon/cryptage | /protocol/protocol_test.go | Go | go | 6,550 | permissive | package deck_test
import (
mconn "github.com/jordwest/mock-conn"
"github.com/sorribas/shamir3pass"
. "github.com/whereswaldon/cryptage/protocol"
"io"
"math/big"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
type mockHandler struct {
messages chan Message
}
func NewMockHandler() *mockHandle... |
8444473428701e999fae5e2ceb60a480f58f25c8 | 59c6a6d9f8eaad7d488bfc96d83c19cc4ccd20e5 | caicloud/heapster | /vendor/k8s.io/kubernetes/pkg/client/unversioned/ingress.go | Go | go | 3,705 | permissive | /*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
6294ca3fd5f1a1507c5109cd8fee941676639ff0 | 7acd6e97ea42fea5a606230d3e5fcc482b16047d | x-Ichiraku/go-zero | /core/threading/taskrunner.go | Go | go | 488 | permissive | package threading
import (
"github.com/yilefreedom/go-zero/core/lang"
"github.com/yilefreedom/go-zero/core/rescue"
)
type TaskRunner struct {
limitChan chan lang.PlaceholderType
}
func NewTaskRunner(concurrency int) *TaskRunner {
return &TaskRunner{
limitChan: make(chan lang.PlaceholderType, concurrency),
}
}... |
5eed2a6889da001e92fa65af46dcdccfbd6edf00 | 51a06ff69a6d43e4ebf07e1559633deee942a84b | zaschiff/GolangTheCompleteBootcamp | /MyWork/Sec6 - Arrays and Memory Layout/Exercise2Section6/averages/main.go | Go | go | 802 | no_license | /*
* Title: Exercise2Section6/averages/main.go
* Course (optional): GO (Golang): The Complete Bootcamp By Jose Portilla and Inanc Gumus - Udemy Online
* Program Author: Zach Schiff
* Date: 2020-06-04
* Version: 1.0
* Description: an average calculator based on a max of 5 numbers entered at the command line
*... |
f5a0373f9fecf462a0f2abeb4ae813861cf7daa2 | f71b8fe728165c07d90302864449dc204df8e5ce | newlysoft/backup-db | /client/backup.go | Go | go | 3,243 | permissive | package client
import (
"backup-db/entity"
"backup-db/util"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"strconv"
"strings"
"time"
)
var unSendFiles = []string{}
// StartBackup start backup db
func StartBackup() {
for {
RunOnce()
// sleep to tomorrow night
sleep()
}
}
// RunOnce 运行一次
func Run... |
2366326df9e1aff8383902977594a7942f1c817c | 0441a367e0a022c85c8434959c7b65f079484cd3 | leftmike/maho | /sql/columntype_test.go | Go | go | 1,237 | permissive | package sql_test
import (
"testing"
"github.com/leftmike/maho/sql"
)
func TestDataType(t *testing.T) {
cases := []struct {
ct sql.ColumnType
dt string
}{
{
sql.ColumnType{Type: sql.BooleanType},
"BOOL",
},
{
sql.ColumnType{Type: sql.StringType, Fixed: false, Size: 123},
"VARCHAR(123)",
},... |
89eed3f91e8175d411807678ee8ab978813c0bd0 | c13298dd8dbe9df1d2e2816063fcd346186d854c | sclasen/aws-go | /gen/ses/ses.go | Go | go | 29,894 | permissive | // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package ses provides a client for Amazon Simple Email Service.
package ses
import (
"net/http"
"time"
"github.com/awslabs/aws-sdk-go/aws"
"github.com/awslabs/aws-sdk-go/gen/endpoints"
)
import (
"encoding/xml"
"io"
)
// SES is a client for Amazon Simpl... |
3cd8e454e52ca63c24b8c38541c0341c8184c210 | 8ee498b374d1a0f749be24a4f3216b3a83080d29 | slavrd/terraform-terratest-example | /test/random_pet_test.go | Go | go | 979 | permissive | package test
import (
"strings"
"testing"
"github.com/gruntwork-io/terratest/modules/terraform"
)
func TestTerraformBasicExample(t *testing.T) {
expPetNameLength := 3
terraformOptions := &terraform.Options{
// The path to where our Terraform code is located
TerraformDir: "../",
// Variables to pass to ... |
01336c0b11a8140b981463256a8c30b3c2d927ea | 6b7c8651b6ca7a5d10365c4fe3fe4fefd19926c7 | idyllicvision/iden3-claim-processor | /pkg/json-ld/validator.go | Go | go | 449 | no_license | package json_ld
import (
"github.com/pkg/errors"
)
// Validator is responsible for document verification
type Validator struct {
}
//ValidateData validate JSON data by JSON-LD Schema
func (v Validator) ValidateData(data, schema []byte) error {
return errors.New("not implemented")
}
//ValidateDocument validate JSO... |
223e267cfac6af9334a843ce5582ad8160c9d783 | 049e1f8e5ff28e61c26b447e35d2a3d2dcce517a | cha63506/emgo | /egpath/src/stm32/hal/raw/i2c/l1xx_md--xgen_i2c.go | Go | go | 14,533 | permissive | // +build l1xx_md
package i2c
// DO NOT EDIT THIS FILE. GENERATED BY xgen.
import (
"mmio"
"unsafe"
"stm32/o/l1xx_md/mmap"
)
type I2C_Periph struct {
CR1 CR1
_ uint16
CR2 CR2
_ uint16
OAR1 OAR1
_ uint16
OAR2 OAR2
_ uint16
DR DR
_ uint16
SR1 SR1
_ uint16
SR2 SR2
... |
1e5cd7cd3f4b2110ec92b8ae9f07998bec4bdd1b | 8f269d98892668a34cdddaa17797374e86f594f3 | jyzgo/annie | /extractors/mgtv/mgtv_test.go | Go | go | 1,147 | permissive | package mgtv
import (
"testing"
"../../config"
"../../test"
)
func TestDownload(t *testing.T) {
config.InfoOnly = true
config.RetryTimes = 20
tests := []struct {
name string
args test.Args
}{
{
name: "normal test 1",
args: test.Args{
URL: "https://www.mgtv.com/b/322712/4317248.html",
T... |
4814e98105ea13b22197ce9c19dd5b33ee6d2226 | fc852ea78726dc23c6b94e29c288acc9913cb327 | Aouainia-Mohamed/router_checkpoint | /router_checkpoint/main.go | Go | go | 375 | no_license | package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
)
func sarra(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(200)
w.Write([]byte("ahla ya a9wa instructrice fik ya GOMYCODE"))
}
func main() {
router := mux.NewRouter()
router.HandleFunc("/sarra", sarra).Methods("GET")
... |
6ec865e23c6b9a09d851b729935da0d01d1bbb42 | 77d081f9bc8059ed05083fad5d56f1f65545f574 | hbbio/bleve | /analysis/token/unique/unique_test.go | Go | go | 2,405 | permissive | // Copyright (c) 2018 Couchbase, 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... |
eced1e4e7d2c0cdc9f8c2f55c5473bf9799b616f | 660af9db67bb86f2d9d833163affc4a6de58af00 | virtual-kubelet/virtual-kubelet | /internal/kubernetes/remotecommand/attach.go | Go | go | 2,904 | 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, ... |
3ebf12962abe4ed999a7a0f2bf503f0d4612ab69 | 327ef05835982dabc085b184eaa7b543ec7ec6bd | lworkltd/kits | /service/invoke/util.go | Go | go | 1,102 | no_license | package invoke
import (
"bytes"
"net/url"
"strings"
)
func parsePath(path string, r map[string]string) (string, error) {
ret := path
// FIXME:bad perpormance
for key, value := range r {
old := "{" + key + "}"
ret = strings.Replace(ret, old, value, 1)
}
return ret, nil
}
func makeUrl(sche, host, path str... |
9826599181f3dd1118a04de0f1242236e9918036 | d3c055ee860d7d1e12c39b1fcd4ca2c7b3ae0195 | yunionio/structarg | /structarg_test.go | Go | go | 13,560 | 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... |
602e067d3a921efc793b03d2712e8328e59f3fc4 | 9dedca659598c94237090569f723449705cd08de | grossjo/aerospike-client-go | /connection_heap_test.go | Go | go | 2,596 | permissive | // Copyright 2014-2021 Aerospike, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed t... |
43ddc556b0eecfc149de7a1efde8f09e60185136 | 4915d981919948e3bd23575db01d004afe3121bc | Udit107710/argo-dataflow | /test/matchers.go | Go | go | 650 | permissive | //go:build test
// +build test
package test
import "fmt"
type matcher struct {
string
stall *stall
test func(w int) bool
}
func (m *matcher) String() string { return m.string }
func (m *matcher) match(v int) bool {
m.stall.accept(v)
return m.test(v)
}
func Eq(v int) *matcher {
return &matcher{
fmt.Sprint... |
83e0790e8519436cd15d0bfe276dc53afd4f953d | c2d0e1d813af05fa33c10a168ed9e4afed423b05 | dwarvesf/smithy | /backend/view/view.go | Go | go | 1,077 | permissive | package view
import (
"errors"
"strings"
"time"
"github.com/dwarvesf/smithy/backend/sqlmapper"
)
// View .
type View struct {
ID int `json:"id"`
SQL string `json:"sql"`
DatabaseName string `json:"database_name"`
CreatedAt time.Time `json:"created_at"`
}
// Validate validate... |
8b18c198ab6f6125d50e8f8f23af536470f6ec78 | 7636e05a6ef9d1b5079ac37fc43b0cdaddea9b2f | SmartHubSolutions/prebid-server | /adapters/gamma/usersync_test.go | Go | go | 975 | permissive | package gamma
import (
"testing"
"text/template"
"github.com/prebid/prebid-server/privacy"
"github.com/prebid/prebid-server/privacy/gdpr"
"github.com/stretchr/testify/assert"
)
func TestGammaSyncer(t *testing.T) {
syncURL := "//hb.gammaplatform.com/sync?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&redirectUri=... |
863d5a148571af9e4d3066cbd995fc5f95033063 | e096af33166d734f03578f1a0136cfff0fa5cab7 | JamazRuan/mesh | /vendor/github.com/ugorji/go/codec/gen.go | Go | go | 67,353 | permissive | // +build codecgen.exec
// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
package codec
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"go/format"
"io"
"io/ioutil"
"math/rand"
"reflect"
"regex... |
23d40ada07ed7a6cdea596904d142068afaa60a1 | a0c7b0e87c6449667e36ae245ad48f5a0c11877d | mitch000001/timetables | /Godeps/_workspace/src/github.com/mitch000001/go-harvest/harvest/invoice.go | Go | go | 2,957 | no_license | package harvest
import "time"
//go:generate go run ../cmd/api_gen/api_gen.go -type=Invoice -c -fields CrudEndpointProvider
type Invoice struct {
ID int `json:"id"`
Amount float64 `json:"amount"`
DueAmount float64 `json:"due-amount"`
DueAt ShortDate `json:"due-at"`
// human representation... |
e5215d498c85abc9b6468a1b2f56d5e29532f0e8 | 1cc1eda28e9018b17cf4a340a9b01de6484745d6 | kukinsula/boxy | /framework/redis/client/monitoring.go | Go | go | 449 | no_license | package client
import (
monitoringEntity "github.com/kukinsula/boxy/entity/monitoring"
redisFramework "github.com/kukinsula/boxy/framework/redis"
)
type Monitoring struct {
*redisFramework.Client
}
func NewMonitoring(client *redisFramework.Client) *Monitoring {
return &Monitoring{Client: client}
}
func (monitor... |
25e1039287e444d4280fc899e2823b6f79bb1ec4 | 51afd0eae735f8ccde0d976195bf593496bc4026 | moul/numberinfo | /float64_test.go | Go | go | 1,286 | no_license | package numberinfo
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestFloat64Number(t *testing.T) {
Convey("Testing Float64Number", t, func() {
_, ok := interface{}(Float64(4242)).(Number)
So(ok, ShouldBeTrue)
})
}
func TestFloat64(t *testing.T) {
Convey("Testing Float64()", t, func... |
7fa53c48072b92520c3afde1a0a60a6068bc85c8 | 74d22397b5ea41944b6a166acf068d8361431753 | ALTA-BE-Capstone-Project/berbagi | /controllers/gift_Controller_test.go | Go | go | 8,932 | no_license | package controllers
import (
"berbagi/config"
"berbagi/models"
"strings"
"net/url"
"fmt"
"testing"
"net/http"
"net/http/httptest"
"encoding/json"
"github.com/stretchr/testify/assert"
"github.com/labstack/echo/v4"
)
func InitGiftTest() *echo.Echo{
config.InitDBTest("provinces", "cities","addresses","use... |
a76889593e4f3153f42acfed8dc3a224ab9d9c74 | f6e75fc0f3c80ae18a6d7477ef8e1f2cbb30f1dd | thu-vu-33/ultimate-go | /awesome-go/rpcx/101basic/client/client.go | Go | go | 486 | permissive | package main
import (
"context"
"fmt"
"github.com/smallnest/rpcx/client"
"gobyexample/awesome-go/rpcx/arith"
)
func main() {
d, _ := client.NewPeer2PeerDiscovery("tcp@localhost:8972", "")
arithClient := client.NewXClient("Arith", client.Failtry, client.RandomSelect, d, client.DefaultOption)
reply := &arith.R... |
878dc77153f98397ca6f062da39e0d079fe3ac51 | a6d70019deaacd84cd68e5d338249c6baf2fa74c | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/compute/v20150615/virtualMachineExtension.go | Go | go | 13,618 | 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 v20150615
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Describes a Virtual Machine Extension... |
110d6b89ddc1bb0e53510b649d523573610c3444 | 8642fd3ec8458d4eb0e2f5fad40908d9e6928e41 | abcum/cirrius | /cpm/text/patch/main.go | Go | go | 1,044 | permissive | // Copyright © 2016 Abcum Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this info 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 ... |
2f9f66597400eaa6f12da03a9795e028b388d96d | 98dfe1f52d5e3decd8737e0bc98a49cb1aae1170 | DinoInc/fhir | /models/medication.go | Go | go | 86,267 | permissive | // Copyright (c) 2011-2017, HL7, Inc & The MITRE Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, ... |
02ab32baac4aef82a474c81831245204981a42fd | 8912b23442b97949e180034d21afe03d78f5e732 | gophergala2016/gophersiesta | /cmd/gophersiesta-cli/main.go | Go | go | 697 | permissive | // Copyright © 2016 GOPHERSIESTA
//
// 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 ... |
8cc151bf543201c5ecd3f66617df1b2b48c3d318 | 4b8e44d56d334fbfc5ba42f1f37c7c76bd289697 | wuchen-huawei/huaweicloud-sdk-go | /openstack/bssintl/v1/realnameauth/requests.go | Go | go | 7,234 | permissive | package realnameauth
import (
"github.com/gophercloud/gophercloud"
)
type IndividualRealNameAuthOpts struct {
//Customer ID.
CustomerId string `json:"customerId" required:"true"`
//Authentication method.
IdentifyType *int `json:"identifyType" required:"true"`
//Certificate type.
VerifiedType int `json:"verif... |
59e3bb971a5b681528bab418cd20162fbb4e01ae | 9e53edcf87835598d1be8f6248aac83c98eb9b0c | egeneralov/terraform-provider-libvirt | /vendor/github.com/mitchellh/packer/builder/ncloud/builder.go | Go | go | 3,378 | permissive | package ncloud
import (
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
// Builder assume this implements packer.Builder
type Build... |
17d3c48b595af4775211de2fa6476a24c0bc9f02 | 4680a7804e155833b3f28391256c606c3681789e | youxidev/GoGameServer | /src/module/cache/cache.go | Go | go | 2,864 | no_license | package caches
import (
"github.com/funny/link"
. "model"
"module"
"sync"
// . "tools"
)
type CacheModule struct {
onlineUsers map[string]*OnlineUserModel
onlineUsersID map[uint64]string
onlineUsersSession map[uint64]string
onlineUsersNum int32
onlineUsersMutex sync.RWMutex
}
// 在初始化的时候将模... |
b937cf78bc90435a708fbf2824e0ac6444dc6915 | 1e8dac3e2014dc2cdbce55b49bcfa102c888c4ac | harisanker1780/dashboard | /src/app/backend/resource/replicationcontroller/list.go | Go | go | 4,926 | permissive | // Copyright 2017 The Kubernetes Dashboard 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 applicabl... |
505297f0d9aeb06f1db67d03b433d5fcc6de5fce | 38a1f9eb4f6c3962bcd94743d024b328bae74d72 | jmanzanog/golab | /concurrent/Main.go | Go | go | 1,959 | permissive | package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"strconv"
"time"
)
type DNS []struct {
URL string `json:"url"`
}
var nextInt = intSeq()
var channel = make(chan map[string]string)
var methodGET = "GET"
func main() {
content, err := ioutil.ReadFile("./concurrent/dns.js")
... |
ed4ad088e22829df0dc941119f1d3e61ba57aa02 | a2936f40d9ef4635312013ea948094642b13c871 | wallarm/gotestwaf | /vendor/github.com/go-echarts/go-echarts/v2/charts/themeriver.go | Go | go | 1,534 | permissive | package charts
import (
"github.com/go-echarts/go-echarts/v2/opts"
"github.com/go-echarts/go-echarts/v2/render"
"github.com/go-echarts/go-echarts/v2/types"
)
// ThemeRiver represents a theme river chart.
type ThemeRiver struct {
BaseConfiguration
BaseActions
}
// Type returns the chart type.
func (ThemeRiver) T... |
e48af1a507fcd524f5ff0f0da295216eb7f1fd33 | fc092b521e45dc5b451ace06d2777b0eb34d21ab | Prashanth684/coreos-assembler | /tools/vendor/github.com/elastic/go-elasticsearch/v7/esapi/api.xpack.license.get.go | Go | go | 4,588 | permissive | // Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V. licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// Code generated from specification version 7.12.0: DO NOT EDIT
package esapi
import (
"context"
"net/htt... |
b05fab5aba766b78488ff9bc9770442b52453621 | 66e44780909aed09d4d09da3b966b22d16f1c921 | maojxsir/pando-cloud | /pkg/rpcs/registry.go | Go | go | 273 | permissive | package rpcs
// device register args
type DeviceRegisterArgs struct {
ProductKey string
DeviceCode string
DeviceVersion string
}
// device update args
type DeviceUpdateArgs struct {
DeviceIdentifier string
DeviceName string
DeviceDescription string
}
|
e8d5fe72f83907961ee03e283caffed61ed6a351 | 5d72c337eb8a3ed400306e99d1228d8c16b7acb5 | WuLiFang/csheet | /server/internal/worker/manager.go | Go | go | 1,269 | no_license | package worker
import (
"context"
"sync"
"github.com/WuLiFang/csheet/server/v6/internal/util"
)
type Manager interface {
SetWorkerCount(ctx context.Context, n int) (err error)
WorkerCount(ctx context.Context) (n int, err error)
}
type manager struct {
b Builder
mu sync.Mutex
w... |
a4d046a50e68f3c4eab4aca2907059221880afbd | b2da6991f4b34963903988088bdb9779428b90ce | tobiaskohlbau/client | /cmd/config.go | Go | go | 2,344 | permissive | package cmd
import (
"fmt"
"os"
"github.com/magiconair/properties"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func init() {
rootCmd.AddCommand(configCmd)
configCmd.AddCommand(listCmd)
configCmd.AddCommand(getCmd)
configCmd.AddCommand(setCmd)
}
// configCmd re... |
b36229f884bb1d6534a031c7db2994844f007e45 | 0aa1d16850605f8db801ad532fe6fc3c03a3cbcb | spxtr/test-infra | /kubetest/extract_k8s.go | Go | go | 14,878 | 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 writing, ... |
a077fb6d93ae3862db8dad7324da717d978e71a3 | 53f87bae055b94c35844ae2526270ec278abd3bf | ZacharyGg/sealer | /build/utils.go | Go | go | 7,588 | permissive | // Copyright © 2021 Alibaba Group Holding Ltd.
//
// 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... |
3a702f427860f7143def2344d14e6cba9878fec8 | 039fb30760a1396405bb9c34a7b78e87f777a71c | SpoortiPalakshaiah/operator | /api/v1beta1/vmcluster_types.go | Go | go | 34,838 | permissive | package v1beta1
import (
"fmt"
"path"
"strings"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
)
const (
ClusterStatusExpanding = "expanding"
ClusterStatusOperational = "operational"
ClusterStatusFailed = "failed"
InternalOp... |
ad73202b7105237ae9e7e815bc8d2b7d711d7a1e | d127bae4cb977e856ac786e3dec2bcd0c7ec6149 | JonParton/http-add-on | /interceptor/proxy_handlers_test.go | Go | go | 8,902 | permissive | package main
import (
"context"
"fmt"
"net/http"
"strconv"
"strings"
"testing"
"time"
"github.com/go-logr/logr"
kedanet "github.com/kedacore/http-add-on/pkg/net"
"github.com/kedacore/http-add-on/pkg/routing"
"github.com/stretchr/testify/require"
)
// the proxy should successfully forward a request to a ru... |
4839832b138ff1fe7103e13d74680f0b9521c7f0 | 2ee1a233bf9365093fbbfc8332f1d9e99d6e8064 | hypebid/twitch-views-service | /internal/rpc/models.go | Go | go | 735 | permissive | package rpc
import "time"
type StreamInfo struct {
Data []struct {
ID string `json:"id"`
UserID string `json:"user_id"`
UserLogin string `json:"user_login"`
UserName string `json:"user_name"`
GameID string `json:"game_id"`
GameName string `json:"game_nam... |
c085424780c959e7a70878f4896c5de68e75d75f | 2f6c85c1ff20c83419c1e71c6ee960123fac0ebc | Ganben/code-prac | /go/LeetCode1/0Medium/BestSightseeingPair/solution.go | Go | go | 263 | no_license | package BestSightseeingPair
func maxScoreSightseeingPair(A []int) int {
ans, mx := 0, A[0]+0
for j := 1; j < len(A); j++ {
ans = max(ans, mx+A[j]-j)
//
mx = max(mx, A[j]-j)
}
return ans
}
func max(x, y int) int {
if x > y {
return x
}
return y
}
|
2f3ac6c81e24942acd415af30072e196979f7ae4 | 01c17e0fc64983f2cdc6521e8f2cf7e39e5bc2f4 | HeHuiqi/HqGoAction | /goroutine/hqchannel/hqchannel1.go | Go | go | 802 | no_license | package hqchannel
import (
"sync"
"fmt"
)
type Worker1 struct {
in chan int
wg *sync.WaitGroup
}
func doWork1(id int, c chan int,wg *sync.WaitGroup) {
for n := range c {
fmt.Printf("Worker1 %d received %d\n",id,n)
//结束goroutine
wg.Done()
}
}
func createDoWorker1(id int,wg *sync.WaitGroup) Worker1 {
w ... |
f1a0e896486bb65bf6afe7bdf17592c84216f3f2 | ab3393cb260a6df9c406565c3e30024d979c9891 | yutiansut/QA_Auto | /test_go/test_go_redis_2.go | Go | go | 745 | permissive | package main
import (
"fmt"
"github.com/go-redis/redis"
)
func main() {
client := redis.NewClient(&redis.Options{
Addr: "127.0.0.1:6379",
Password: "", // no password set
DB: 0, // use default DB
})
pong, err := client.Ping().Result()
fmt.Println(pong, err)
... |
b62d81d4278c76cabed26264965acd553f5d794d | 6eaa0f4b78438aa1acc258ab438366a00112f5dc | quexer/utee | /ut_test.go | Go | go | 299 | permissive | package utee_test
import (
"time"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/quexer/utee"
)
var _ = Describe("Ut", func() {
It("TickToTime", func() {
now := time.Now()
t := utee.NewTick(now).ToTime()
Ω(t).To(BeTemporally("~", now, time.Millisecond))
})
})
|
8219da44bae6289f30cf549425a717b6380c5a10 | 506b66bc24e6f3dfebd1f34aa2a5fa869f9971d0 | PrimitivoFR/Owly | /server/common/testing/kvdbUtils.go | Go | go | 826 | permissive | package common_testing
import common_kvdb "github.com/primitivofr/owly/server/common/kvdb"
//SaveToKvdb allows to save to the testing kvdb in one line of code
func SaveToKvdb(bucketName string, key string, value string) {
db, err := common_kvdb.InitDB("testingdb", bucketName)
CheckErr(err, "Error from SaveToKvdb")... |
9491561d3a9c6d4bbab8e392335a52f9d9aa8cc9 | 0eb02d0ad46cf3777f5eff05a466318b48127aed | jimsmart/iri | /gen_rr.go | Go | go | 2,046 | permissive | package iri
// This file was generated by geniris.
const (
// R2RML vocabulary
RR_NS = "http://www.w3.org/ns/r2rml#"
RR_BaseTableOrView = RR_NS + "BaseTableOrView"
RR_BlankNode = RR_NS + "BlankNode"
RR_GraphMap = RR_NS + "GraphMap"
RR_IRI = RR_NS + "IRI"
RR_... |
5f4e4eebf88c9d5768d593320a8ed08cab859e87 | f77501f8ce4a8201498a7c83c4895b6cd47ff2d7 | JameyWoo/goto | /playground/old/timer_test.go | Go | go | 450 | no_license | package main
import (
"fmt"
"testing"
"time"
)
func TestTime(t *testing.T) {
timer1 := time.NewTimer(2 * time.Second)
<-timer1.C
fmt.Println("Timer 1 fired")
timer2 := time.NewTimer(5 * time.Second)
go func() {
<-timer2.C
fmt.Println("Timer 2 fired")
}()
// 使得timer2强制退出计时, 但上面的go func里的计时无效
stop2 := t... |
ce05da9536fd98e5315f8e936b72b0c9ec121a8e | 286421eacbff2a293252774eb8bb6ea646dae90a | PrathameshKesarkar/harmony-server | /socket/event/getmembers.go | Go | go | 1,503 | permissive | package event
import (
"harmony-server/authentication"
"harmony-server/globals"
"harmony-server/harmonydb"
"github.com/mitchellh/mapstructure"
"github.com/kataras/golog"
"golang.org/x/time/rate"
)
type getMembersData struct {
Token string `mapstructure:"token"`
Guild string `mapstructure:"guild"`
}
func OnG... |
7d204f050783398f60efc2522a1192d8ab35ef25 | c16d11c29f964336c20f77cff5c8f8551cdcb3d7 | jasonolmstead33/drone | /agent/agent.go | Go | go | 8,640 | permissive | package agent
import (
"fmt"
"net"
"net/url"
"path/filepath"
"regexp"
"strings"
"time"
"github.com/drone/drone/build"
"github.com/drone/drone/model"
"github.com/drone/drone/version"
"github.com/drone/drone/yaml"
"github.com/drone/drone/yaml/expander"
"github.com/drone/drone/yaml/transform"
)
type Logger... |
a5e57ff78495c63dfe78dbb28e83c27e17856ff7 | e07c83f3a6c8e9ea22590ae061236de7cedd4d6c | huaweicloud/huaweicloud-sdk-go-v3 | /services/ecs/v2/model/model_pre_paid_server_data_volume_extend_param.go | Go | go | 1,943 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// PrePaidServerDataVolumeExtendParam 创建磁盘的extendparam字段
type PrePaidServerDataVolumeExtendParam struct {
// 磁盘产品资源规格编码,如SATA,SAS和SSD。 > 说明: > > 废弃字段。
ResourceSpecCode *string `json:"resourceSpecCode,omitempty"`
// ... |
fa1ca2f4993c8e42b4be20ebb3ef9467701b9fc1 | 7f85894fe37247a6a183b7b23b32df3ac5db4e40 | GoogleCloudPlatform/terraform-google-conversion | /tfplan2cai/tfdata/fake_resource_data_test.go | Go | go | 9,351 | permissive | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
04974d5229a97c63c8e1460ff9d86eab08a540e1 | 68d61837d427a1e4229a9432ddd77b708057dd2d | wangtao3133/lying | /src/framework/app.go | Go | go | 3,269 | no_license | package framework
import (
"config"
"framework/app"
"github.com/go-redis/redis"
"github.com/golang/net/websocket"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
. "global"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"router"
"strconv"
"time"
)
// 初始化web服务
func NewApp(cfg *config.Config)... |
687dc6edcb88ff54d68e30cc9113c7fc2de0a8a8 | 049df7236c4c4be22c6516e806e14d606aa70198 | slam1252/examples | /main.go | Go | go | 2,273 | no_license | package main
import (
"flag"
"log"
. "project/config"
handler "project/handlers"
"project/handlers/abonents"
"project/warlog"
"net/http"
"os"
"path"
"syscall"
"time"
"github.com/gocraft/web"
)
var (
//router = mux.NewRouter()
version string
date_build string
numcommit string
)
func main() ... |
b9eae8e3e45a2c2bf16a5b99a475ecbbeccc502e | f3e1a931f50ae2fcad6304371f0afe2a8d43250b | cloudperson/go-billy-ex | /helper/polyfill/polyfill_test.go | Go | go | 1,786 | permissive | package polyfill
import (
"path/filepath"
"testing"
"github.com/cloudperson/go-billy-ex"
"github.com/cloudperson/go-billy-ex/test"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
var _ = Suite(&PolyfillSuite{})
type PolyfillSuite struct {
Helper billy.Filesystem
Underlying billy.Filesys... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.