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 |
|---|---|---|---|---|---|---|---|---|
55cbe17b9158ea2ed1f0cf839d5b92ad8a97c275 | 59974c7892470bdaa88785a1973474aae020b65f | f/koding | /go/src/github.com/koding/runner/rabbitmq.go | Go | go | 439 | permissive | package runner
import (
"github.com/koding/logging"
"github.com/koding/rabbitmq"
)
func NewRabbitMQ(conf *Config, log logging.Logger) *rabbitmq.RabbitMQ {
return rabbitmq.New(createRabbitMqConf(conf), log)
}
func createRabbitMqConf(conf *Config) *rabbitmq.Config {
return &rabbitmq.Config{
Host: conf.Mq.Ho... |
4612a9748349f1bbbcae130be4ca6381748c5853 | d1db403de30b5e7d9603d46d73784dc6315b29f3 | monsterxx03/rkv | /server/cmd_list_test.go | Go | go | 653 | no_license | package server
import (
"testing"
"github.com/monsterxx03/rkv/codec"
)
func TestCmdLpush(t *testing.T) {
conn := GetTestConn()
key := "testL"
conn.Set("testStr", "abc",0)
// lpush on non-list key
if _, err := conn.LPush("testStr", 1).Result(); err.Error() != codec.WrongTypeError.Error() {
t.Fatal(err)
}
//... |
3eb4a457fdd42ed082988383dacbc6c408596720 | da7e7c40aff8fe1325eb4a6a38a3f2d6327905af | hedzr/ref | /cvt.go | Go | go | 1,754 | permissive | package ref
import (
"gopkg.in/hedzr/errors.v2"
"reflect"
strings "strings"
"unicode"
)
// TryConvert calls reflect.Convert safely, without panic threw.
func TryConvert(v reflect.Value, t reflect.Type) (out reflect.Value, err error) {
return tryConvert(v, t)
}
func tryConvert(v reflect.Value, t reflect.Type) (o... |
0f12dc714cebee0bd4882129bfc1a4a5b8a0bd42 | 92a47c982057f9a38a97d1fb35ecd7155682f175 | hoozecn/erda | /modules/cmp/initialize.go | Go | go | 6,298 | 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... |
c906b50273c32d24cdc36de00cada81a08a68bd0 | 9d2e82fac0be142a8837ab26ee604d44a9be6fdf | 107192468/telegram | /test/updates_test.go | Go | go | 220 | permissive | package test
import "testing"
func TestGetUpdates(t *testing.T) {
updates, err := bot.GetUpdates(nil)
if err != nil {
t.Error(err.Error())
}
if len(updates) <= 0 {
t.Error("unexpected result: no updates")
}
}
|
57cd2f7a4e49cf6456ecc59344ca9d3362e9abf7 | b865f64cee61b6b288d9a22551515ca328133129 | f/koding | /go/src/github.com/xanzy/go-cloudstack/cloudstack44/ISOService.go | Go | go | 60,760 | permissive | //
// Copyright 2014, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or a... |
d600ce43905a037323c41d8e4f8da8ec89e02da0 | 64cee90d18c246f9b5e9f854a59a586b9d7c8806 | openshift/cloud-credential-operator | /vendor/github.com/microsoftgraph/msgraph-sdk-go/models/schedule_item_collection_response.go | Go | go | 3,509 | permissive | package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// ScheduleItemCollectionResponse
type ScheduleItemCollectionResponse struct {
BaseCollectionPaginationCountResponse
}
// NewScheduleItemCollectionResponse in... |
97142642903dfc1a75e8a6fdcfa47a08bda67175 | 1f06980fbd429d078283aa57374ec78dd47f2b8c | 06wagon/gocryptotrader | /exchanges/mock/server.go | Go | go | 7,409 | permissive | package mock
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"net/url"
"reflect"
"strconv"
"strings"
"github.com/thrasher-corp/gocryptotrader/common"
)
// DefaultDirectory defines the main mock directory
const DefaultDirectory = "../../testdata/http_mock/"
const ... |
0422d088ed1dacedb2b0306bf7534463b30484a8 | edf2bc308d777534d070d38181b5f828bfa71e27 | dzirg44/hope | /handle_image.go | Go | go | 2,695 | permissive | package main
import (
"net/http"
"github.com/gorilla/mux"
"fmt"
//"os"
//"log"
)
func HandleImageNew(w http.ResponseWriter, r *http.Request) {
RenderTemplate(w,r, "images/new", nil)
}
func HandleImageCreate(w http.ResponseWriter, r *http.Request) {
if r.FormValue("url") != "" {
HandleImageCreateFromURL(w... |
fdf83e305e4f6b4fe52084e998c20f48d02b1318 | 6454c4f5578acf0503b260f0cef52c4a67d27812 | copernet/tools | /hardfork/deprecated/create-datasig-p2sh/main.go | Go | go | 4,929 | permissive | package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"os"
"github.com/bcext/cashutil"
"github.com/bcext/gcash/chaincfg"
"github.com/bcext/gcash/chaincfg/chainhash"
"github.com/bcext/gcash/txscript"
"github.com/bcext/gcash/wire"
"github.com/qshuai/tcolor"
"github.com/shopspring/decimal"
)
var (
para... |
a4e38f65a5176114815e1eff0bda62926a5131c8 | c2bf8215a0ca2262b6950d5fcf11c8e6ad6463c4 | NagaVenkatesh-Sankar/golang-udemy-exercises | /Exercises-Level8/ex1.go | Go | go | 412 | no_license | package main
import (
"encoding/json"
// "errors"
"fmt"
)
type user struct {
First string
Age int
}
func main() {
u1 := user{First: "James", Age: 32}
u2 := user{First: "Moneypenny", Age: 27}
u3 := user{"M", 54}
users := []user{u1, u2, u3}
fmt.Println(users)
// your code goes here
// err := errors.N... |
25b14fbbd540b637fd395172a1432fa88b915e2a | 8ed185f69171865e4f0ab87525ed0faecb8d64e6 | bruce0205/shortenit | /api-shortenit-v1/internal/router.go | Go | go | 588 | no_license | package internal
import (
"net/http"
"github.com/gorilla/mux"
"github.com/thanhnamit/shortenit/api-shortenit-v1/internal/platform"
)
type Router struct {
Handler http.Handler
}
func NewRouter(s *Server) *Router {
r := mux.NewRouter()
r.HandleFunc("/init-sample-data", InitSampleHandler(s))
r.HandleFunc("/shor... |
d7b462c758a9360a51f91b654934c3677103e12f | abd5c1c302c8f287e08ed0a18b84c97b1234df94 | MathisBurger/OpenInventory-Backend | /installation/InstallationFunctions.go | Go | go | 4,784 | permissive | package installation
import (
"database/sql"
"fmt"
"github.com/MathisBurger/OpenInventory-Backend/config"
"github.com/MathisBurger/OpenInventory-Backend/utils"
_ "github.com/go-sql-driver/mysql"
"io/ioutil"
)
// defined config path
var cfg = "./config/config.json"
// cache struct
type Table struct {
name stri... |
d98757d12e97327141b39a664d8bb6bd60eca198 | 1bd6bb9a787f1e09bd72fa9378ae9241fe8a1124 | ITI/zlint | /v2/lints/rfc/lint_tbs_signature_alg_matches_cert_signature_alg_test.go | Go | go | 1,663 | permissive | /*
* ZLint Copyright 2020 Regents of the University of Michigan
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applic... |
6e5d30746670c321ce529596ab193b99702f4f4c | d84b9f6c8018974d4c8b0f900bd2016e7b137aae | PaaS-TA/PaaS-TA-Core | /paasta-container/src/github.com/apcera/gnatsd/server/route.go | Go | go | 7,744 | permissive | // Copyright 2013-2014 Apcera Inc. All rights reserved.
package server
import (
"bytes"
"encoding/json"
"fmt"
"net"
"net/url"
"regexp"
"time"
)
type route struct {
remoteID string
didSolicit bool
url *url.URL
}
type connectInfo struct {
Verbose bool `json:"verbose"`
Pedantic bool `json:"pe... |
f0304c4b3583df57026617a317deedb849d1267b | 666029d456894db1a2bf8203d266d7b3e7df09e1 | leitzler/govim | /cmd/govim/internal/golang_org_x_tools/lsp/work/diagnostics.go | Go | go | 2,809 | permissive | // Copyright 2022 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 work
import (
"context"
"fmt"
"os"
"path/filepath"
"golang.org/x/mod/modfile"
"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/even... |
b75b53cb8596953cc9af5a9f9e3a063fab951384 | 8d367d90910500f3d8df460c0bcdb0079632694e | wimspaargaren/mongo-go-driver | /bson/unmarshaling_cases_test.go | Go | go | 1,318 | permissive | // Copyright (C) MongoDB, Inc. 2017-present.
//
// 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
package bson
import (
"reflect"
"github.com/wi... |
44a8c02c5282e3e51ef9efe8899348cf3f9b3adf | 0dd45019a9bba86027bb5f1080f98fa9c8d9a6b3 | vx416/ds | /btree/avl.go | Go | go | 2,060 | no_license | package btree
type AVLTree struct {
*BSTree
}
func (t *AVLTree) Add(nodes ...Node) {
for i := range nodes {
if t.root == nil {
t.root = nodes[i]
continue
}
t.add(t.root, nodes[i])
t.rotate(nodes[i])
}
}
func (t *AVLTree) Delete(node Node) {
t.delete(node)
t.rotate(node)
}
func (t *AVLTree) rotate... |
8db30877aaf5f893bdefb7d12159a72ee2ef8903 | bccb1cdee4eef3a6a366fb1100d7c624332c9f04 | nanwanwang/LearningK8s | /golearning/src/ch31-go-channel/main.go | Go | go | 655 | no_license | package main
import (
"fmt"
"time"
)
func getData(i int,c chan int) {
for n:=range c{
fmt.Printf("get data %d from channel %d\n",n,i)
//if n,ok:=<-c;ok{
// fmt.Printf("get data %d from channel %d\n",n,i)
//}else{
// break
//}
}
}
func createChannel(i int) chan<- int{
c:=make(cha... |
d26d24a83d97c152274a4e4bfbed13f9f015c9dd | 1226298e8bd5719f005313a1ca0c15e35814c82a | tardunge/monkey | /ast/ast.go | Go | go | 5,772 | no_license | // Package ast constructs the abstract syntax tree.
package ast
import (
"bytes"
"strings"
"monkey/token"
)
type Node interface {
TokenLiteral() string
String() string
}
type Statement interface {
Node
statementNode()
}
type Expression interface {
Node
expressionNode()
}
type Identifier struct {
Token t... |
593b7f864f36cc1c997fa5327b54311af63b3e26 | 06da1f5a9e1c4260f6e5de7fedff7f31c7a6ade7 | open-telemetry/opentelemetry-go | /sdk/internal/env/env_test.go | Go | go | 3,071 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
6cedc273b199c8c5019b3af6ed7a1445f095301b | f5e54327b6972b5c9930952ded1fb3e922a571f9 | szabgab/slides | /golang/examples/circle-stdin/circle_stdin.go | Go | go | 382 | no_license | package main
import (
"fmt"
"strconv"
)
func main() {
pi := 3.14
var radiusStr string
fmt.Print("radius: ")
fmt.Scan(&radiusStr)
radius, err := strconv.ParseFloat(radiusStr, 64)
if err == nil {
fmt.Println(radius)
area := pi * radius * radius
circumference := 2 * pi * radius
fmt.Printf("Area: %v\n",... |
6dbde150f5fc2cf9439c2507136e0fc73b3cba21 | 1b08a087f70e88a13eb50e5a5ea21b87b60ceab2 | lukedemi/goformation | /cloudformation/resources/aws-wafregional-geomatchset.go | Go | go | 4,898 | permissive | package resources
import (
"bytes"
"encoding/json"
"fmt"
"github.com/lukedemi/goformation/cloudformation/policies"
)
// AWSWAFRegionalGeoMatchSet AWS CloudFormation Resource (AWS::WAFRegional::GeoMatchSet)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafregional-geomatchset.h... |
14f6ddefc2169308a4c92bd863f67b39dc2a6c24 | 402f543e1bf47b963d342eada0eda49e1edb6b34 | lberk/serverless-operator | /openshift-knative-operator/pkg/monitoring/helpers_test.go | Go | go | 3,635 | permissive | package monitoring
import (
"os"
"testing"
mf "github.com/manifestival/manifestival"
"github.com/manifestival/manifestival/fake"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
const (
servingNamespace = "knative-serving"
eventingNamespace = "knative-eventing"
)
func init() {
os.Setenv(smRbacManifest... |
8c7f8d1890529bed9b7a23e4f9af49887e13b700 | 20f398db3d270f8c27e13a7668e7fd96ab2d205f | jmalloc/ax | /saga/persistence/crud/ginkgo_test.go | Go | go | 252 | permissive | package crud_test
import (
"reflect"
"testing"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
)
func TestSuite(t *testing.T) {
type tag struct{}
gomega.RegisterFailHandler(ginkgo.Fail)
ginkgo.RunSpecs(t, reflect.TypeOf(tag{}).PkgPath())
}
|
6b44ce72d18ee3e258ee16f515e4fbd7987e3f84 | 725d82fc0a64b65293eb3549ebe7b1894b937f47 | coinexchain/cosmos-sdk | /x/auth/simulation/decoder.go | Go | go | 1,034 | permissive | package simulation
import (
"bytes"
"fmt"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/auth/exported"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
// DecodeStore unmarshals the KVPair's Value to the corresponding auth type
func DecodeSto... |
27b64d1d538fdb8a16031975ce4e06c4392e9484 | 0ed4c2f712bcdf951d0d64f8d78a6e72f8858638 | K-Philleani/ginReal | /main.go | Go | go | 386 | no_license | package main
import (
"ginReal/common"
"ginReal/middleware"
"ginReal/routers"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
)
func main() {
common.InitDB()
r := gin.Default()
r.Use(middleware.CorsMiddleware(), middleware.LoggerMiddleware())
routers.CollectRouter(r)
port := viper.GetString("server.po... |
792df800842d73104e3583abd5103c98837a68f0 | 5d32ea10d747f02024d60a93df601d0de54c727b | sengeiou/gluten-api | /util/jwt.go | Go | go | 1,089 | no_license | package util
import (
"fmt"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"gluten/global"
"time"
)
func GetJWTToken(id string) (string, error) {
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"id": id,
"exp": time.Now().Add(time.Hour * time.Duration(global.JwtConfig.Exp)).Unix... |
ea0fb703c569190933f0135b1de35c58ea021bd6 | 3ee4a67103bb2e247aa9742097ebf285609e34c6 | cookingcodewithme/notary | /signer/keydbstore/cachedcryptoservice.go | Go | go | 1,953 | permissive | package keydbstore
import (
"sync"
"github.com/docker/notary/tuf/data"
"github.com/docker/notary/tuf/signed"
)
type cachedKeyService struct {
signed.CryptoService
lock *sync.RWMutex
cachedKeys map[string]*cachedKey
}
type cachedKey struct {
role data.RoleName
key data.PrivateKey
}
// NewCachedKeySer... |
f24cd3dab2d5ed782f66033d1be032123e9d2487 | 1820de2ce36b0576a00d592f2ceb07ce1795dbba | DecentralCardGame/Cardchain | /x/cardchain/simulation/buy_card.go | Go | go | 865 | no_license | package simulation
import (
"math/rand"
"github.com/DecentralCardGame/Cardchain/x/cardchain/keeper"
"github.com/DecentralCardGame/Cardchain/x/cardchain/types"
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
)
func Simulate... |
63d291f52276db8d7acae1e7e2b8d427eab2b3b2 | ea6f6919abce7f3a5f18dba22acaeb2da4077784 | kalinchih/golang-study | /101_gin/02_ascii_json/main.go | Go | go | 352 | permissive | package main
import (
"github.com/gin-gonic/gin"
)
func main() {
engine := gin.Default()
engine.GET("json", json)
engine.Run(":5566")
// http://localhost:5566/json
}
func json(ctx *gin.Context) {
data := map[string]interface{}{
"language": "Go 語言",
"tag": "<br/>",
}
ctx.JSON(200, data)
//c.AsciiJ... |
350704e427709276bfc6a11d829e3e14dc1c426e | ba04866081dd3287e4d695d95ff838af00ae94b8 | oxchains/fabric | /gossip/gossip/chanstate.go | Go | go | 5,296 | permissive | /*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
1daff75d910b0469a2d290fd16f5cf225ea1328b | 5dd8a9e016c13f477602b5c4fbeca548d54a7885 | spectrocloud/cluster-api | /controlplane/kubeadm/internal/filters.go | Go | go | 13,127 | permissive | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
30d35792f7738b58b1a020fb24780a3c93495bd4 | 071512daea9ce589f303fb844f2428e3494e5375 | rrampage/minikube | /cmd/minikube/cmd/config/validations.go | Go | go | 3,478 | permissive | /*
Copyright 2016 The Kubernetes Authors 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 ag... |
ab73e449c76b86c1309af934d384c377a0fa6207 | fb5e650bd33d61a03eced73d337150ced2175a04 | jiubian-cicd/env-controller | /pkg/gits/git_repo.go | Go | go | 7,032 | no_license | package gits
import (
"fmt"
"io"
"strings"
"github.com/jiubian-cicd/env-controller/pkg/auth"
"github.com/jiubian-cicd/env-controller/pkg/util"
"gopkg.in/AlecAivazis/survey.v1"
"gopkg.in/AlecAivazis/survey.v1/terminal"
)
type CreateRepoData struct {
Organisation string
RepoName string
FullName strin... |
ac0fe4bf5834765dd79e9120a4be22058dd682c8 | 624339457812bb7a266313f39cab725bc5ba9df1 | jghiloni/services-auditor-plugin | /foundation/auditor_test.go | Go | go | 2,275 | permissive | package foundation_test
import (
"testing"
"github.com/jghiloni/services-auditor-plugin/foundation"
)
func TestServiceAuditor(t *testing.T) {
cliConnection, server := getCLIConnection()
defer server.Close()
cliConnection.AccessTokenReturns("bearer abcd", nil)
auditor := foundation.NewAuditor(cliConnection)
... |
1ae9872df40fda5d94dd96060fe5b0ff52209d35 | 4ee6a3847836c19744ccdc0f8ed49417faff3ba8 | kuangjiajia/golang | /day5/test2.go | Go | go | 731 | no_license | // Q2. (0) FizzBuzz
// 1. 解决这个叫做 Fizz-Buzz[23] 的问题:
// 编写一个程序,打印从 1 到 100 的数字。当是三个়数就打印 “Fizz”
// 代替数字,当是ࡃ的়数就打印 “Buzz”。当数字同时是三和ࡃ的়数
// 时,打印 “FizzBuzz”。
// package main
// import "fmt"
// func main() {
// for i := 1 ; i <= 100 ; i++ {
// switch {
// case i % 3 == 0 && i % 5 == 0 && i != 0:
//... |
8ccffb1b83ff423defedc204d17aa962c130b9ce | 45b7eea1f8d73a9226a0ac9923a65121e1c312de | ecoball/go-ecoball | /vendor/gx/ipfs/QmayRSLCiM2gWR7Kay8vqu3Yy5mf7yPqocF9ZRgDUPYMcc/go-ipfs-blockstore/arc_cache.go | Go | go | 3,781 | permissive | package blockstore
import (
"context"
metrics "gx/ipfs/QmRg1gKTHzc3CZXSKzem8aR4E3TubFhbgXwfVuWnSK5CC5/go-metrics-interface"
lru "gx/ipfs/QmVYxfoJQiZijTgPNHCHgHELvQpbsJNTg6Crmc3dQkj3yy/golang-lru"
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
ds "gx/ipfs/QmeiCcJfDW1GJnWUArudsv5rQsihpi4oyddPh... |
3cb790c6182481d0ec394eafe615b3b9e77543d8 | b7f64fee6d702eaee8fc1fd7d1783082c2993ada | ivan1993spb/imgio | /image_group_test.go | Go | go | 2,599 | permissive | package imgio
import (
"bytes"
"crypto/md5"
"crypto/rand"
"image"
"io"
"testing"
"gopkg.in/stretchr/testify.v1/require"
)
func Test_ImageGroup_ReadWriteHash_OneImage(t *testing.T) {
group := &ImageGroup{
images: []*rwImage{
{
img: image.NewRGBA(image.Rect(0, 0, 100, 100)),
gen: &SimplePointsSequ... |
c59e5c2aac60dcb8701cf452ca4c4fd1b69eb8b3 | 8f62759819f0bf45bb0aeb024bffee84be9377ba | Abadrausar/Rubble- | /other/src/dctech/rex/commands/console/commands.go | Go | go | 1,537 | permissive | /*
Copyright 2014 by Milo Christiansen
This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use of
this software.
Permission is granted to anyone to use this software for any purpose, including
commercial applications,... |
7f5a009bbe54ab1bd2d13393d410d503a8e2a9d4 | 311301121cb78b73d760f2ce05ed642d526f8283 | selatotal/signalfx-agent | /internal/core/config/sources/spec.go | Go | go | 2,096 | permissive | package sources
import (
"runtime"
"strings"
"github.com/pkg/errors"
"github.com/signalfx/signalfx-agent/internal/utils"
yaml "gopkg.in/yaml.v2"
)
type dynamicValueSpec struct {
From *fromPath `yaml:"#from"`
Flatten bool `yaml:"flatten"`
Optional bool `yaml:"optional"`
Raw bool ... |
54ee10486f58eecc609083cf63e2b327fb7c017c | 5d797c52063c1fbcb98e482e91735cd4c5f41862 | mbrt/gmailctl | /internal/engine/filter/diff.go | Go | go | 5,924 | permissive | package filter
import (
"crypto/sha256"
"fmt"
"sort"
"strings"
"github.com/pmezard/go-difflib/difflib"
"github.com/mbrt/gmailctl/internal/graph"
)
// Diff computes the diff between two lists of filters.
//
// To compute the diff, IDs are ignored, only the contents of the filters are actually considered.
func ... |
ed519f9583807eba07e2d7be620a8ef9a5040e5b | 24ff5829bad522a34c41588b17e70a9a3a1069da | me0888/wallet | /cmd/main.go | Go | go | 1,205 | no_license | package main
import (
"github.com/me0888/wallet/pkg/types"
"github.com/me0888/wallet/pkg/wallet"
)
func main() {
svc := &wallet.Service{}
// svc.Import("D:/Users/билол/Desktop")
pays := []types.Payment{
// {
// ID: "1",
// AccountID: 100,
// Amount: 900,
// Category: "aoto",
// Status... |
c63f5a252b74f887211fc5b19875bcce115beb3b | f09b15cc249aea791279c2da649927685f49d805 | tnw-open-source/credential-provision | /setup-ckms.go | Go | go | 2,976 | permissive | package main
import (
"fmt"
"io/ioutil"
"os"
"google.golang.org/api/cloudkms/v1"
)
func initialiseKms(svc *cloudkms.Service, user string, isSa bool) error {
// Get environment variables.
projectID := Getenv("PROJECT_ID", "")
keyRing := Getenv("KEY_RING", "")
serviceAccount := Getenv("SERVICE_ACCOUNT", "")
... |
6b8912d2ea29fa914b3e3ba8ea4d3cdbf2db2713 | 5197050cdb90d80a7f9a54454afa3c48a41a58cb | tdhzz/Algorithm | /week17/kimfang/665.Non-decreasingArray.go | Go | go | 1,020 | no_license | package kimfang
// 665. 非递减数列
//给你一个长度为 n 的整数数组,请你判断在 最多 改变 1 个元素的情况下,该数组能否变成一个非递减数列。
//
//我们是这样定义一个非递减数列的: 对于数组中所有的 i (0 <= i <= n-2),总满足 nums[i] <= nums[i + 1]。
//
//
//
//示例 1:
//
//输入: nums = [4,2,3]
//输出: true
//解释: 你可以通过把第一个4变成1来使得它成为一个非递减数列。
//示例 2:
//
//输入: nums = [4,2,1]
//输出: false
//解释: 你不能在只改变一个元素的情况下将其变为非递... |
06e769be4e813805c70a80d4eec4c3006c693ffb | bc85f157abd7654cf53ec186ce63d82edf34d796 | keigooba/sharefull | /app/models/avatar.go | Go | go | 1,601 | no_license | package models
import (
"errors"
"io/ioutil"
"path/filepath"
)
// ErrNoAvatarはAvatarインスタンスがアバターのURLを返すことができない
// 場合に発生するエラーです
var ErrNoAvatarURL = errors.New("chat: アバターのURLを取得できません。")
// Avatarはユーザーのプロフィール画像を表す型です。
type Avatar interface {
// GetAvatarURLは指定されたクライアントのアバターのURLを返します。
// 問題が発生した場合にはエラーを返します。特に、URL... |
7195694679b5a639cc5a084b9dd9b96f31baa5d7 | 7a82dc84889d6eec571792aeb22376fef986ad64 | razodactyl/OpenBiohazard2 | /cmd/fileconv/fileconv.go | Go | go | 1,045 | permissive | package main
import (
"fmt"
"log"
"os"
"github.com/OpenBiohazard2/OpenBiohazard2/fileio"
)
func main() {
if len(os.Args) < 4 {
log.Fatal("You only entered ", len(os.Args), " arguments. Command format is invalid.")
log.Fatal("The syntax of this command is: fileconv [toolName] [inputFilename] [outputFilename]... |
c7fae30cfc35540e860108874611fc140b24654b | 62a7e7f30c4a649ee2df0fe880169736d20f6f9c | knolleary/cli | /src/cf/api/authentication.go | Go | go | 3,944 | permissive | package api
import (
"cf/configuration"
"cf/errors"
"cf/net"
"cf/terminal"
"encoding/base64"
"fmt"
"net/url"
"os"
"strings"
)
type AuthenticationRepository interface {
Authenticate(credentials map[string]string) (apiErr errors.Error)
RefreshAuthToken() (updatedToken string, apiErr errors.Error)
GetLoginPr... |
de907ae2cab202b02a2f6059ef34cec837f8317c | a877b9e7cc18741837f67ce2a31278b14730fa1c | manzusaka/mitix-go | /view_hlh/chapter29_ood/ood_struct/main/exp_ood_struct_05.go | Go | go | 2,401 | no_license | package main
import (
"fmt"
)
/*
学生案例:
编写一个Student结构体,包含name、gender、age、id、score字段,分别为string、string、int、int、float64类型。
结构体中声明一个say方法,返回string类型,方法返回信息中包含所有字段值。
在main方法中,创建Student结构体实例(变量),并访问say方法,并将调用结果打印输出。
*/
type Student struct {
name string
gender string
age int
id int
score float64
}
func (student *Stud... |
30084519828f8a9eee2413fffee5d2b171b4e458 | e56506a9bedd8b0631e12458fe3c7aac7420f2ae | mcuadros/lemondb | /protocol/op_query.go | Go | go | 2,230 | permissive | package protocol
import (
"bytes"
"fmt"
"io"
)
// MsgHeader is the mongo MsgHeader
type OpQuery struct {
// MsgHeader standard message header
MsgHeader *MsgHeader
// Flags bit vector of query options.
Flags int32
// FullCollectionName "dbname.collectionname"
FullCollectionName CSString
// number of document... |
32cb3256388c852c938cc48a36bf78ba5ef6bdd4 | 606ee155af00169e1a2b382c205887f48c21d8f1 | SocioProphet/cluster-operator | /integration/setup/setup.go | Go | go | 7,672 | permissive | // +build k8srequired
package setup
import (
"context"
"log"
"os"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/giantswarm/apprclient"
"github.com/giantswarm/backoff"
"github.com/giantswarm/e2e-harness/pkg/framework"
awsclient "github.com/g... |
040e35fdfda9f361e35c218ce74640240f83844f | ba345d1c1285d72a9b1c6d4e259f12e2eab0a5d9 | baubles/go-sip | /message.go | Go | go | 6,020 | permissive | package sip
import (
"bufio"
"bytes"
"fmt"
"strconv"
"github.com/baubles/go-sip/header"
)
// Message sip message
type Message struct {
Headers map[string]header.HeaderValue
Body []byte
}
func NewMessage() *Message {
return &Message{
Headers: map[string]header.HeaderValue{},
}
}
func (msg *Message) Ma... |
d70a1043684a5e8951214d5899a5f84de1e95643 | cade735c4b40a03ecd8591e5f2fdf8dcacdb0388 | glycerine/xcryptossh | /testdata_test.go | Go | go | 2,169 | permissive | // Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// IMPLEMENTATION NOTE: To avoid a package loop, this file is in three places:
// ssh/, ssh/agent, and ssh/test/. It should be kept in sync across all three
// ... |
ab3f061b8ce44cf448405f0e5f0153563aa25c36 | a46a4f090b2b5363b35e5cec94458b0dbb14a6b3 | lflxp/showme | /vendor/github.com/guonaihong/gout/encode/form.go | Go | go | 4,615 | permissive | package encode
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/textproto"
"reflect"
"strings"
"github.com/guonaihong/gout/core"
)
type formContent struct {
fileName string //filename
contentType string //Content-Type:Mime-Type
data []byte
isFormFile bool
needOpenFile bool
}... |
2962f69a3fbc20418825e20be2a81bde96812c57 | 81afabe73975654a806551a5be132ab3071934ad | icowan/cardbill | /src/pkg/business/logging.go | Go | go | 989 | no_license | /**
* @Time : 2019-08-19 14:07
* @Author : solacowa@gmail.com
* @File : logging
* @Software: GoLand
*/
package business
import (
"context"
"github.com/go-kit/kit/log"
"github.com/nsini/cardbill/src/repository/types"
"time"
)
type loggingService struct {
logger log.Logger
Service
}
func NewLoggingService(... |
94eba0400324d40e97e7c468969267d77f30f605 | 718507902ada08f6c7b6a919d9c23410fea3fe21 | shuwenjunn/study_go | /stage2/day11/01context_demo/main.go | Go | go | 409 | no_license | package main
import (
"fmt"
"sync"
"time"
)
var exitChan chan bool = make(chan bool, 1)
var wg sync.WaitGroup
//为什么需要context
func f() {
defer wg.Done()
FORLOOP:
for {
fmt.Println("周玲")
time.Sleep(time.Millisecond * 500)
select {
case <-exitChan:
break FORLOOP
default:
}
}
}
func main() {
wg.... |
59f0fcfba7f3bff4affa2c47215a04c77a8fb081 | d8f75936915e350f888aa2d78015be5345e1d554 | genius52/leetcode | /src/golang/array/931. Minimum Falling Path Sum.go | Go | go | 1,604 | no_license | package array
func MinFallingPathSum(matrix [][]int) int{
var rows int = len(matrix)
var columns int = len(matrix[0])
var pre []int = make([]int,columns)
copy(pre,matrix[0])
for i := 1;i < rows;i++{
var cur []int = make([]int,columns)
for j := 0;j < columns;j++{
if j == 0{
cur[j] = matrix[i][j] + min_... |
82f422d38b999fdc381f375e5b85b7ff9c57e22d | 3b0333544a090d999b8cc64926a9c84a62c8df52 | bergalytics/google-api-go-client | /doubleclicksearch/v2/doubleclicksearch-gen.go | Go | go | 85,828 | permissive | // Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package doubleclicksearch provides access to the Search Ads 360 API.
//
// For product documentation, see: https://developers.google.com/doublec... |
48696f5d274e153ab7e93cdcd40875e7659307bd | 421b48c44420cbe1b26a01b139975a5300ec0603 | haiyiyun/validator | /locales/vi/vi_test.go | Go | go | 18,774 | permissive | package vi
import (
"testing"
"time"
"github.com/haiyiyun/validator/locales"
"github.com/haiyiyun/validator/locales/currency"
)
func TestLocale(t *testing.T) {
trans := New()
expected := "vi"
if trans.Locale() != expected {
t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale())
}
}
func TestPlural... |
8989b92c287634ee1d1768301901e7db3b12111b | 31502a4fc5322a73a7da6d46c61efbd6b10b8244 | test-wiz-sec/pulumi-azure-nextgen | /sdk/go/azure/network/v20190801/getWebApplicationFirewallPolicy.go | Go | go | 1,966 | 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 v20190801
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func LookupWebApplicationFirewallPolicy(ctx *pulumi.Context, args *LookupWebApplicationF... |
c51965823549a93b98a4d3914daff7e7a497e6a0 | bf7e4b168e664753bf36e8ae673af534b8acb7e5 | QueryStyle/cloe | /src/lib/modules/fs/create_directory.go | Go | go | 642 | permissive | package fs
import (
"os"
"github.com/cloe-lang/cloe/src/lib/core"
)
var createDirectory = core.NewEffectFunction(
core.NewSignature(
[]string{"name"}, "",
[]core.OptionalParameter{core.NewOptionalParameter("existOk", core.False)}, "",
),
func(vs ...core.Value) core.Value {
s, e := core.EvalString(vs[0])
... |
a258dc0554b3e2d8adb12db8e93870c443655ef6 | 7698d8953f3730c5f312999725218823703e4ae2 | rmdhfz/webservice | /.history/main_20210609073142.go | Go | go | 1,913 | no_license | package main
import (
"encoding/json"
"log"
"net/http"
"github.com/google/jsonapi"
"github.com/gorilla/mux"
)
type Product struct {
ID int64 `jsonapi:"primary,products"`
Name string `jsonapi:"attr,name"`
Price int `jsonapi:"attr,price"`
}
func Server() *mux.Router {
router := mux.NewRouter()
route... |
aeed2fe7027f86e3d47b57e49618c8b887e1ec6c | f8f6b0a7971a0b5760e1a97f2c37a900e52156f5 | egonelbre/fuse-ed | /main.go | Go | go | 817 | no_license | package main
import (
"fmt"
"html/template"
"log"
"net/http"
"os"
)
var (
mainTemplate = template.Must(template.ParseFiles("index.html"))
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
log.Printf("Defaulting to port %s", port)
}
http.HandleFunc("/", handler)
static := http.S... |
5671bc7c0e8900adec5dfdc2e88d0de3c3169f48 | 6a2c77902cb113de4abaa06c22da4dc639d1b56b | yinqiwen/ssf | /consistent.go | Go | go | 4,359 | permissive | package ssf
import "sort"
const (
NODE_ACTIVE uint8 = 1
NODE_LOADING uint8 = 2
NODE_FAULT uint8 = 3
)
type Node struct {
Id int32
PartitionID int32
Addr string
Status uint8
}
func (node *Node) isActive() bool {
return node.Status == NODE_ACTIVE
}
type Partition ... |
a0709c45775081a5dd659decc502a6ba9960abfb | 3e24eacfc7c9df6bf6690857bc5ce41111fffb9d | thisisnew/simple-restful-api-server-for-grpc-network | /connection/connection.go | Go | go | 326 | no_license | package connection
import (
"google.golang.org/grpc"
"log"
pb "rest/protos"
)
func Connect() pb.VehicleClient {
conn, err := grpc.Dial("localhost:9000", grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
log.Fatalf("did not connect: %v", err)
}
defer conn.Close()
c := pb.NewVehicleClient(conn)
retur... |
b225516ccc9897cdcf826fdff59a7b925eccf013 | 1ac5e48071280e3c89715b687d8c6abc6fa8bf1f | negative0/rclone | /fs/newfs.go | Go | go | 3,558 | permissive | // NewFs and its helpers
package fs
import (
"context"
"crypto/md5"
"encoding/base64"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/rclone/rclone/fs/config/configmap"
"github.com/rclone/rclone/fs/fspath"
)
// NewFs makes a new Fs object from the path
//
// The path is of the form remote:path
//
//... |
e93370735874122f467892a5928062f19fd0e6ba | cd792191c816af8c920d833597f8fba1695c0a27 | Jsimmons--dev/jx | /pkg/jx/cmd/controller_build.go | Go | go | 12,485 | permissive | package cmd
import (
"os"
"path/filepath"
"strings"
"time"
"unicode"
"github.com/ghodss/yaml"
"github.com/jenkins-x/jx/pkg/collector"
"github.com/pkg/errors"
"github.com/jenkins-x/jx/pkg/gits"
"k8s.io/client-go/kubernetes"
"github.com/jenkins-x/jx/pkg/apis/jenkins.io/v1"
"github.com/jenkins-x/jx/pkg/bui... |
f18b8da5318d44a9a7e485b5217a19ad19aa27d0 | 844f9069e1badd16291137870d90179417e895c8 | geremarchive/sock | /funcs/screen.go | Go | go | 2,672 | no_license | package funcs
import (
"github.com/gdamore/tcell"
"strings"
"fmt"
"os"
)
func Addstr(s tcell.Screen, style tcell.Style, x int, y int, text string) {
for i := x; i < len(text)+x; i++ {
s.SetContent(i, y, rune(text[i-x]), []rune(""), style)
}
}
func (o Options) DrawScreen(s tcell.Screen) {
width, height := s.... |
6ce30fe1233a172e9bed16f4ad372dac064de51e | 0d53bebffda2d21d5c8cd02af086fc0e6e1b3a1a | amc-blockchain/amc-chain | /accounts/abi/bind/auth.go | Go | go | 2,146 | no_license | // Copyright 2016 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... |
45429a5e7df83306eabc6fac4e8c4e65d5623a01 | da9425756f89e352992e9b00a1ace13344a89b6e | scalingdata/sarama | /config.go | Go | go | 15,960 | permissive | package sarama
import (
"crypto/tls"
"time"
)
// Config is used to pass multiple configuration options to Sarama's constructors.
type Config struct {
// Net is the namespace for network-level properties used by the Broker, and
// shared by the Client/Producer/Consumer.
Net struct {
// How many outstanding requ... |
bb670dce21ebfcc4d1cb52dd8213f0b3c3e52de6 | 8364d1638c254f55ffe6303b3532fa18e36d410b | keybase/client | /go/chat/utils/utils.go | Go | go | 97,277 | permissive | package utils
import (
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"math"
"sort"
"strconv"
"strings"
"time"
"mvdan.cc/xurls/v2"
"github.com/keybase/client/go/chat/pager"
"github.com/keybase/client/go/chat/unfurl/display"
"github.com/keybase/go-framed-msgpack-rpc/rpc... |
804a8c58045dd00a7fc27021d56e6704c82f2dff | 2c42d196f34df9d96d8b1f3186481ad255d78184 | chenk008/buildah | /imagebuildah/build.go | Go | go | 20,840 | permissive | package imagebuildah
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"sync"
"github.com/containerd/containerd/platforms"
"github.com/containers/buildah/define"
"github.com/containers/buildah/util"
"github.com/containers/common/libimage"
... |
d7b3ade37dc05477125c6bb35e67c245c24c7142 | cf4b8c817570a6d9a11302c23ce9294eab990bf2 | wangyanphp/leetcode-go | /jianzhioffer/03数组中重复的数字.go | Go | go | 802 | no_license | package main
// 这里的一个点是:数组长度为n,数字全部都在n-1中,只有所有数字都出现且唯一出现一次的时候,才不会重复
// 怎么实现这一点
// 对于索引i,如果nums[i] = i,那么ok
// nums[i] < i 则有重复
// nums[i] 与 nums[nums[i]]互换,直到nums[i] <= i
func findRepeatNumber(nums []int) int {
l := len(nums)
for i :=0 ; i<l; {
if nums[i] == i {
i++
continue
}
if nums[i] < i {
ret... |
b9f60c49123940e77252faa88b64ba91ba482b23 | 641b0433441e8141ae4991f1bc9d7aeec35d88ed | Kazan/prototest | /main.go | Go | go | 447 | no_license | package main
import (
"encoding/json"
"fmt"
"github.com/Kazan/prototest_gen_go/computers"
"google.golang.org/protobuf/proto"
)
func main() {
fmt.Println("Client starting...")
mm := new(computers.Memory)
data, err := proto.Marshal(mm)
if err != nil {
panic(err)
}
fmt.Printf("%s\n%v\n%+#v\n", data, data... |
3e383c7c6d93ca1d9f9544ee18aa3fb423be60d0 | 3b7d251524fa318c4de1c8fe72546c9cb75cdf84 | Rashguir/go-beer-api | /model/beer.go | Go | go | 426 | permissive | package model
import "time"
// Beer ...
type Beer struct {
PK uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time `sql:"index"`
ID string `json:"id"`
Name string `json:"name"`
ABV float32 `json:"abv"`
BreweryID string `json:"brewery_id"`
BreweryName string `json:"na... |
d09310ad81ccdbe5940fc39370fffa1acd92fc06 | 385cde1bca9ba205a0a531bea40236f711734a41 | ypjin/stack-admin | /service/auth/lock.go | Go | go | 898 | no_license | package auth
import (
"sync"
"time"
)
// UserLock maintains a lock to block user from logging in within a short period of time.
type UserLock struct {
failures map[string]time.Time
d time.Duration
rw *sync.RWMutex
}
// NewUserLock ...
func NewUserLock(freeze time.Duration) *UserLock {
return &User... |
e012fc1b837127e473d8f82133495d2d2afcc0ea | 50917db7508e9ea6da1dad4d6be156d1d28f5d56 | upccup/cuplearn | /go-study/docker/upload.go | Go | go | 2,433 | no_license | package main
import (
"archive/tar"
"bytes"
"io"
"log"
"os"
docker "github.com/fsouza/go-dockerclient"
)
func uploadTar() {
client, err := docker.NewVersionedClient("unix:///var/run/docker.sock", "1.20")
// Start create .tar file
// Create a buffer to write our archive to.
buf := new(bytes.Buffer)
var t... |
d9a0990bef201a4d3e2070e2f3c82da62aa459c2 | 06646b21ba787c93496379d57869098fa93e64f6 | enterstudio/client-1 | /go/libkb/user.go | Go | go | 19,325 | permissive | // Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package libkb
import (
"fmt"
"io"
keybase1 "github.com/keybase/client/go/protocol/keybase1"
jsonw "github.com/keybase/go-jsonw"
"golang.org/x/net/context"
)
type UserBasic interface {
GetUI... |
d0130ab65cef749def17c6efd3cc4e89c23190c3 | 35f217b7d7ba9357c7cf4a5a0d86fe01611c369f | gandalf1024/GolangTraining | /41_TCP/05_redis-clone/i06/main.go | Go | go | 1,476 | no_license | package main
import (
"bufio"
"fmt"
"io"
"log"
"net"
"strings"
)
type Command struct {
Fields []string
Result chan string
}
func redisServer(commands chan Command) {
var data = make(map[string]string)
for cmd := range commands {
if len(cmd.Fields) < 2 {
cmd.Result <- "Expected at least 2 arguments"
... |
3491413917e8853c29513be7e75aa763fd968e7c | f180d8861273462f70c6a102b255e672d99ff2cb | dwj300/go-ontap | /ontap/model_layout_requirement_raid_group.go | Go | go | 1,304 | permissive | /*
* ONTAP REST API
*
* ONTAP 9.6 adds support for an expansive RESTful API. The documentation below provides information about the types of API calls available to you, as well as details about using each API endpoint. You can learn more about the ONTAP REST API and ONTAP in the ONTAP 9 Documentation Center: http:/... |
27ee15f337cfdf6aaa4f8fcb468a11cd197b461e | 9be6314574c765047720ed69cfbb79bc4d589222 | sp-roger-llopart/bsk | /logx/logx_test.go | Go | go | 5,830 | permissive | package logx_test
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"testing"
"github.com/socialpoint-labs/bsk/logx"
"github.com/stretchr/testify/assert"
)
func TestDefaultAndLogstashLogging(t *testing.T) {
assert := assert.New(t)
rec := make(recorder, 1)
defaultLogger := logx.New(logx.WriterOpt(rec), logx.WithoutT... |
192c9cad94b319b328a27d1fa9996f1e72c97fa1 | f4225e9162b33e1b49635bea1302dc3390758649 | fmechant/goformation | /cloudformation/apigateway/aws-apigateway-account.go | Go | go | 3,973 | permissive | package apigateway
import (
"bytes"
"encoding/json"
"fmt"
"github.com/fmechant/goformation/v4/cloudformation/policies"
)
// Account AWS CloudFormation Resource (AWS::ApiGateway::Account)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-account.html
type Account struct... |
c1f76cb39c185be6761edfe6b75ced879a153991 | 22691d6c4224c33f521ce5db85c0c378d2acc049 | jdnrg/jx-gitops | /pkg/variablefinders/repo_url.go | Go | go | 679 | permissive | package variablefinders
import (
"os"
jxcore "github.com/jenkins-x/jx-api/v4/pkg/apis/core/v4beta1"
jxc "github.com/jenkins-x/jx-api/v4/pkg/client/clientset/versioned"
)
// FindRepositoryURL finds the chart repository URL via environment variables or the dev Environment CRD
func FindRepositoryURL(jxClient jxc.Int... |
030dc63501df95d59d7245d13693065d4ddae45c | a8b6aa048eca629b32b8dae2161047729b3218bf | tokend/stellar-deposit-svc | /vendor/github.com/stellar/go/clients/horizonclient/transaction_request.go | Go | go | 2,270 | permissive | package horizonclient
import (
"context"
"encoding/json"
"fmt"
"net/url"
hProtocol "github.com/stellar/go/protocols/horizon"
"github.com/stellar/go/support/errors"
)
// BuildURL creates the endpoint to be queried based on the data in the TransactionRequest struct.
// If no data is set, it defaults to the build... |
e61bafb1151f6f8339609138b328cf3142f83241 | d3213d484aef1d7e5f3b4967666cf91cc3b32031 | nocmk2/sachima | /cmd/list.go | Go | go | 1,331 | no_license | /*
Copyright © 2019 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
53984cd87c6447a77f5e5ac65a227064296d2352 | 2bc425a34cd1b552933ff3fcb8b67caa8e5be180 | gorilaa/resume | /main.go | Go | go | 227 | no_license | package main
import (
_ "aelgees/routers"
"github.com/astaxie/beego"
"os"
"strconv"
)
func main() {
port, err := strconv.Atoi(os.Getenv("PORT"))
if err == nil {
beego.BConfig.Listen.HTTPPort = port
}
beego.Run()
}
|
3d9995dcd6fae22f090983fdbd57b0436cce3dbc | c1a4b346c1ad380643e4f50e45b32c17a00f55f6 | cloudxo/bookmarks | /storage/schema.go | Go | go | 2,895 | permissive | package storage
const schema = `
BEGIN;
CREATE TABLE IF NOT EXISTS bookmarks (
id CHAR(16) PRIMARY KEY,
created DATE DEFAULT (datetime('now')),
updated DATE DEFAULT (datetime('now')),
title VARCHAR(64) NOT NULL,
url VARCHAR(255) UNIQUE NOT NULL,
excerpt TEXT NOT NULL DEFAULT '',
content TEXT NOT NULL DEFAULT '... |
34918568243a2ba61b48ab3f92eba0b06be04f38 | e650ce0a490861803d5e36cbc84dccb6f1c74da9 | kogehek/websocket | /model/map.go | Go | go | 1,207 | no_license | package model
import (
"math/rand"
"time"
)
// min 4x4
const xsize = 8
const ysize = 8
type Map struct {
Xsize int `json:"x_size"`
Ysize int `json:"y_size"`
Level int `json:"level"`
Grid [][]Cell `json:"grid"`
}
func NewMap() *Map {
var grid [][]Cell
for i := 0; i < xsize; i++ {
grid = a... |
5a95b18ebae63f0e491d441a0a7d3cb0b57cddb4 | 0a7745718a4c20d594194e5a3e2adb7a3f9602d0 | dut3062796s/wal-g | /internal/backup_list_handler_test.go | Go | go | 6,871 | permissive | package internal_test
import (
"bytes"
"errors"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/wal-g/wal-g/internal"
"github.com/wal-g/wal-g/testtools"
)
type someError struct {
error
}
var shortBackups = []internal.BackupTime{
{
BackupName: "b0",
Time: time.Time{},
WalFile... |
63da33128adc92a368e65c76a82841fa9836628c | 4bf2b2bc4f4db4e885d6b954cc798f084d63c9f0 | dushyantss/gopl | /ch1/exercises/1.8/1.8.go | Go | go | 560 | permissive | package main
// Fetch prints the content found at a URL. package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
for _, url := range os.Args[1:] {
if !strings.HasPrefix(url, "http://") && !strings.HasPrefix(url, "https://") {
url = "http://" + url
}
resp, err := http.Get(url)
if er... |
c4f45a4a7623b3611875a22eb13b03bb29359726 | 0aca9a352fa347f59d5e30c2849bcb8bbdf56979 | stefanKnott/CommandExecuter | /command_test.go | Go | go | 715 | no_license | package main
import(
"testing"
"os/exec"
"fmt"
)
func TestSpacedFormat(t *testing.T){
out, err := exec.Command("./commandExecuter", "command_file_spaced.txt").Output()
if err != nil && len(out) == 0{
t.Error("exec.Command call failed")
}
fmt.Print(string(out))
}
func TestMixedFormat(t *testing.T){
out, err... |
1d7964a5332b226c30ba7dfae5abbea53dda9ca9 | 8648f3779e5ca99806d0b69a4d10f8f186db464c | showsmall/goku | /drivers/router/grpc-router/handler.go | Go | go | 1,552 | permissive | package grpc_router
import (
"time"
"github.com/eolinker/apinto/drivers/router/grpc-router/manager"
"github.com/eolinker/apinto/entries/ctx_key"
"github.com/eolinker/apinto/service"
grpc_context "github.com/eolinker/eosc/eocontext/grpc-context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"... |
883a3ae272b330e2223a10b8834aabae2eb0c78a | 2d54435c2ae42d4ffd237b53e9ec8050d1020f16 | akoranne/usagereport-plugin | /apihelper/apihelper.go | Go | go | 6,086 | permissive | package apihelper
import (
"errors"
"fmt"
"net/url"
"strconv"
"github.com/cloudfoundry/cli/plugin"
"github.com/krujos/cfcurl"
)
var (
ErrOrgNotFound = errors.New("organization not found")
)
//Organization representation
type Organization struct {
URL string
Name string
QuotaURL string
SpacesU... |
d2c323cc9b446a913e006e070e18d2ef92a52f81 | eebdb31fb374779b8d8bbdb7eca9386f7129fae4 | shiimaxx/go-check-plugins | /check-elasticsearch/lib/check_elasticsearch.go | Go | go | 1,520 | permissive | package checkelasticsearch
import (
"encoding/json"
"fmt"
"net/http"
"os"
"time"
"github.com/jessevdk/go-flags"
"github.com/mackerelio/checkers"
)
type healthStat struct {
ClusterName string `json:"cluster_name"`
Status string `json:"status"`
}
var opts struct {
Scheme string `short:"s" long:"scheme"... |
cb3f8ae2bbc65c6dafec3f9a8ffd42e6eafdcf74 | f82eba4fbad4f0088523e9609dc2c3740ccb2931 | VitaliySid/ago-code | /01_security/remux/pkg/remux/remux_test.go | Go | go | 3,486 | no_license | package remux
import (
"bytes"
"net/http"
"net/http/httptest"
"regexp"
"github.com/netology-code/remux/pkg/middleware/logger"
"testing"
)
func TestReMux_Plain(t *testing.T) {
mux := NewReMux()
loggerMd := logger.Logger
if err := mux.RegisterPlain(GET, "/get", http.HandlerFunc(func(writer http.ResponseWriter,... |
aa2a3076e7877676fdc3de435b1b308ab208225d | af4836fb53cb66b198bdcfc296e86332a9717f0e | adhimaswaskita/Asset-Management | /AssetManagement/repositories/asset_it_summary.go | Go | go | 633 | no_license | package repositories
import nmodel "github.com/adhimaswaskita/AssetManagement/models"
//ITAssetSummary get one Asset detail from Asset table
func (r *Repository) ITAssetSummary() (*[]nmodel.Dashboard, error) {
var mDashboard []nmodel.Dashboard
err := r.DB.Raw(`
SELECT assets.name, COUNT(*) as quantity
FROM asse... |
d638db6a731b4fa17d13a1ab26cd08bda48cd58b | b8c9871d09a9722060a34d7672be8e05505a493c | cpinsights/sourcegraph | /enterprise/internal/campaigns/syncer_test.go | Go | go | 14,219 | permissive | package campaigns
import (
"container/heap"
"context"
"sync"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
"github.com/sourcegraph/sourcegraph/cmd/repo-updater/repos"
"github.com/sourcegraph/sourcegraph/internal/api"
"github.com/sourcegraph/sourcegraph/internal/campaigns"
"github.... |
d18615f8163a694a39ff10d8aaa037cbe8453273 | d5fa870f47007703038afc8e7ad30d23b54e76bb | pingcap/tipocket | /testcase/pocket/pkg/types/log_test.go | Go | go | 1,783 | permissive | // Copyright 2019 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... |
08308f4a770c1e7b5f41225518e5b77c3d0389a0 | 20b0d37164eaffec46598fd70acff18adf4c7c2c | AletheiaWareLLC/bcgo | /channel.go | Go | go | 6,609 | permissive | /*
* Copyright 2019 Aletheia Ware 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 t... |
38e20422424c8f8f5c3e08665a8e908b7a94fb1b | a1bcd3b67baab49f5adacd303427f0cde98bb7e6 | go-vela/pkg-executor | /executor/linux/secret_test.go | Go | go | 20,832 | permissive | // Copyright (c) 2021 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package linux
import (
"context"
"flag"
"io/ioutil"
"net/http/httptest"
"testing"
"github.com/gin-gonic/gin"
"github.com/urfave/cli/v2"
"github.com/go-vela/compile... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.