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 |
|---|---|---|---|---|---|---|---|---|
4998023d1d8e3206f19af896cd4ea2c3f11395e1 | eae0225bb519a56bd374dc247286d5380b31e0ba | iosmanthus/tidb | /br/pkg/lightning/backend/local/engine_test.go | Go | go | 2,629 | permissive | // Copyright 2022 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... |
e7cad6d98963c3453dc0cbe1dfa714a540787aa7 | 339028fe20a06c5dcf5764e462994dc0592b1327 | hexvalid/fasthttp | /pprofhandler/pprof.go | Go | go | 1,403 | permissive | package pprofhandler
import (
"net/http/pprof"
rtp "runtime/pprof"
"strings"
"github.com/hexvalid/fasthttp"
"github.com/hexvalid/fasthttp/fasthttpadaptor"
)
var (
cmdline = fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Cmdline)
profile = fasthttpadaptor.NewFastHTTPHandlerFunc(pprof.Profile)
symbol = fasthttp... |
9f51ba5aae2a70758a0c198da6bbd4f12f020afc | 3ff502f2cecf9cbd36f70acaee9e82964990a4f1 | IEP/go-playground | /tour/01-basics/01-packages-variables-and-functions/03-exported-names/main.go | Go | go | 273 | no_license | package main
import (
"fmt"
"math"
)
func main() {
// Initially the tour provide `math.pi` name, but it against the convention
// of `exported names` that need to start with capital letter. Thus it need
// to change `math.pi` into `math.Pi`.
fmt.Println(math.Pi)
}
|
6a9a12ba23605683dab73e6de638f55f805ef546 | ca501d067365d49837331534c4c8378bbfc73c7e | kekeee-shine/Go-Learning-Project | /gee-web/day2-context/gee/gee.go | Go | go | 959 | no_license | package gee
import (
"log"
"net/http"
)
// 提供给用户实现
type HandlerFunc func(c *Context)
// 实现了 http/Handler
type Engine struct {
router *router
}
func New() *Engine {
return &Engine{router: newRouter()}
}
func (e *Engine) addRoute(method string, pattern string, handler HandlerFunc) {
log.Printf("Route %4s - %s",... |
eed117d2181784373f28670f83d62bdffc3e492e | a2a5b2882aa2c9385a2e2c5d240c6187aff689b9 | gohgvan2011/e8vm | /g8/codegen/print_op.go | Go | go | 1,045 | permissive | package codegen
import (
"fmt"
"io"
"e8vm.io/e8vm/fmt8"
)
func printOp(p io.Writer, op Op) {
switch op := op.(type) {
case *Comment:
fmt.Fprintf(p, "// %s\n", op.Str)
case *ArithOp:
if op.A == nil {
if op.Op == "" {
fmt.Fprintf(p, "%s = %s\n", op.Dest, op.B)
} else if op.Op == "0" {
fmt.Fprin... |
ee8e16b96cdda9daa8c3a903876ac7666d064d53 | c3dc50756d55a733179b61fcfaaafde2c87e1f60 | waghvikrant/go-crud-rest | /server/router.go | Go | go | 363 | no_license | package server
import (
"net/http"
"github.com/gorilla/mux"
)
func NewRouter() *mux.Router {
router := mux.NewRouter()
for _, route := range routes {
var handler http.Handler
handler = route.HandlerFunc
handler = Logger(handler, route.Name)
router.Methods(route.Method).Path(route.Pattern).Name(route.N... |
31a7eae102a742d069089e1b40dfadffacf06d39 | fa8198e04f7439a09d88132e7fddfd40f5c455aa | starshipyard/canvas | /path.go | Go | go | 28,766 | permissive | package canvas
import (
"fmt"
"math"
"sort"
"strings"
"github.com/tdewolff/parse/strconv"
)
// Tolerance is the maximum deviation from the original path in millimeters when e.g. flatting
var Tolerance = 0.01
// PathCmd specifies the path command.
const (
MoveToCmd float64 = 1.0 << iota
LineToCmd
QuadToCmd
... |
6c06b6b13cad8724b19b9589b4f84395384e8b76 | 659a00c6913f8e8ca97125d3de6e067279163542 | Randyshu2018/fabric | /internal/peer/lifecycle/chaincode/getinstalledpackage.go | Go | go | 5,943 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package chaincode
import (
"context"
"path/filepath"
"github.com/golang/protobuf/proto"
cb "github.com/hyperledger/fabric-protos-go/common"
pb "github.com/hyperledger/fabric-protos-go/peer"
lb "github.com/hyperledger/fabric-pro... |
4c00bc68706699efb0c49ee0e364d90c56289522 | ca51636356729024bd742bc665469bb528351279 | bongnv/saga | /saga.go | Go | go | 4,567 | permissive | // Package saga is an implementation of saga design pattern for
// error handling. It aims to solve distributed (business) transactions
// without two-phase-commit as this does not scale in distributed systems.
// The saga has responsibility to gain eventual consistency by calling
// compensation steps in reverse order... |
660e69448eabef242e3a03bebe92a480ac7e2aaa | 48cd49cb7be6054d0be2fe9f69a56eb14499bd25 | keitaro1020/gae-go-gin-example | /handler/hello_test.go | Go | go | 479 | no_license | package handler
import (
"testing"
"github.com/gin-gonic/gin"
"net/http/httptest"
"github.com/favclip/testerator"
"github.com/stretchr/testify/assert"
)
func TestHello(t *testing.T) {
gin.SetMode(gin.TestMode)
instance, _, _ := testerator.SpinUp()
defer testerator.SpinDown()
h := New()
r := gin.New()
r.G... |
768c43d0dd7ed16b408eac0e22c0cdd3f53d2c0e | 5e7e0ee8fa0e558dc9ee8d629f8d5d5594afa02d | venkateshpullaganti/grpc-web-react-go | /backend/cmd/awslambda/main.go | Go | go | 882 | no_license | package main
import (
sdk "git.gendocu.com/gendocu/LibraryApp.git/sdk/go"
"github.com/aws/aws-lambda-go/lambda"
"github.com/awslabs/aws-lambda-go-api-proxy/handlerfunc"
"github.com/gendocu-com-examples/library-app/backend/pkg"
"github.com/improbable-eng/grpc-web/go/grpcweb"
"google.golang.org/grpc"
"net/http"
)... |
b0c1965e5006e77e3c2d346f89f3d8d4cf697f6e | df7c1beee9cfcd6deba00e30ec3a2d3461ed9077 | masonelmore/esi | /get_markets_groups_market_group_id_ok.go | Go | go | 570 | no_license | /*
* EVE Swagger Interface
*
* An OpenAPI for EVE Online
*
* API version: 1.2.9
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package esi
// 200 ok object
type GetMarketsGroupsMarketGroupIdOk struct {
// description string
Description string `json:"description"`
/... |
162908494318b3c2549e70be52bc8be1c2e20725 | 949b86c8ead6e14e67afc7be69447bfc8558e87c | skyformat99/goserver | /core/Web.go | Go | go | 2,361 | no_license | package core
import (
"github.com/ecdiy/goserver/webs"
"github.com/gin-gonic/gin"
"github.com/ecdiy/goserver/utils"
"strings"
"reflect"
"fmt"
"github.com/ecdiy/goserver/webs/upload"
)
func (app *Module) Sp(ele *utils.Element) {
sp := &webs.WebSp{Gpa: getGpa(ele), Engine: getGin(ele)}
sp.Init()
doSubElement(... |
da1a5f655aacbf63e0bf19330441b7c51f8ab00a | 2ee53b93ed6a69fed8687bed9e52c1e3bbebff32 | MarErm27/GoAdmin | /plugins/example/example.go | Go | go | 418 | permissive | package example
import (
c "github.com/MarErm27/GoAdmin/modules/config"
"github.com/MarErm27/GoAdmin/modules/service"
"github.com/MarErm27/GoAdmin/plugins"
)
type Example struct {
*plugins.Base
}
func NewExample() *Example {
return &Example{
Base: &plugins.Base{PlugName: "example"},
}
}
func (e *Example) In... |
6106567be5290d894b0d524e5fa037d8929868c8 | 366f540b656360f7f816e15a3668e34413d4fc93 | crackcomm/go.sandstorm | /exp/websession/integration_test.go | Go | go | 12,093 | permissive | // +build integration_tests
package websession
// Integration tests; these operate against the test app in ../../internal/testapp
import (
"bufio"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"testing"
"time"
)
var baseUrl string
// http.Client for use in the tes... |
95373fc22c55803956cadc0c7cfbfade0f9f2560 | 8d29b11f4febf39384137a7085b437561a1b7a6a | patrickdillon/installer | /pkg/terraform/stages/aws/stages.go | Go | go | 361 | permissive | package aws
import (
"github.com/openshift/installer/pkg/terraform"
"github.com/openshift/installer/pkg/terraform/stages"
)
// PlatformStages are the stages to run to provision the infrastructure in AWS.
var PlatformStages = []terraform.Stage{
stages.NewStage("aws", "cluster"),
stages.NewStage("aws", "bootstrap",... |
b8b7c30405887ab14f88e0fc08e8702b5b0c7228 | 6ce844f51c53fbb47b7242dbf8158e4488d2057e | suryapandian/web-biolerplate | /handlers/response_wrapper.go | Go | go | 826 | no_license | package handlers
import (
"encoding/json"
"net/http"
)
const jsonContentType = "application/json; charset=utf-8"
func writeJSONMessage(msg string, code int, w http.ResponseWriter) {
writeJSONStruct(struct {
Code int `json:"code"`
Message string `json:"message"`
}{
code,
msg,
}, code, w)
}
func wr... |
97e01a3110e42883ef72e66ede59e4f571c583f3 | f61641bbe25199062344d97f7f68f14da83be25c | iotaledger/wasp | /packages/vm/core/governance/governanceimpl/gas.go | Go | go | 2,195 | permissive | // Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
package governanceimpl
import (
"github.com/iotaledger/wasp/packages/isc"
"github.com/iotaledger/wasp/packages/kv/codec"
"github.com/iotaledger/wasp/packages/kv/dict"
"github.com/iotaledger/wasp/packages/vm/core/errors/coreerrors"
"github.com... |
64e7302056699e00462c01cde57cc961a453e7de | b9152c1e2e022c520da44cf2c45eb8ef49f26b67 | f110/site | /vendor/go.f110.dev/notion-api/v3/page.go | Go | go | 3,161 | permissive | package notion
import (
"bytes"
"encoding/json"
"errors"
)
func NewPage(db *Database, title string, children []*Block) (*Page, error) {
if db.ID == "" {
return nil, errors.New("notion: not specified parent database")
}
var titleID string
for _, prop := range db.Properties {
if prop.Type != "title" {
con... |
cd1d308d1e113b5c1084585424ddb02db44a41c6 | a34a30b32aac2a114e848fe7f6add6ffe384e91f | branst/amazon-apigateway-ingress-controller | /vendor/github.com/awslabs/goformation/cloudformation/resources/aws-gamelift-build.go | Go | go | 4,486 | permissive | package resources
import (
"bytes"
"encoding/json"
"fmt"
"github.com/awslabs/goformation/cloudformation/policies"
)
// AWSGameLiftBuild AWS CloudFormation Resource (AWS::GameLift::Build)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-gamelift-build.html
type AWSGameLiftBuild st... |
ce4fba2957371e90f0362c8c6f266806f72a8530 | b7f98c3232e7cec42b53a8d23ce3b1bbcbf68a19 | 9andresc/the-go-programming-language | /chapter-1/echo-1/main.go | Go | go | 211 | permissive | // echo-1 prints its command-line arguments.
package main
import (
"fmt"
"os"
)
func main() {
var s, sep string
for i := 1; i < len(os.Args); i++ {
s += sep + os.Args[i]
sep = " "
}
fmt.Println(s)
}
|
5e8bde8585499bc4abb3aeea8c0822a24cf84d59 | 793de24c25e205d61994abf1333b07b94c1e0c44 | espebra/filebin2 | /lurker.go | Go | go | 3,043 | permissive | package main
import (
"fmt"
//"net/http"
//"os"
//"path"
//"strings"
//"encoding/json"
"github.com/espebra/filebin2/dbl"
"github.com/espebra/filebin2/s3"
"time"
)
type Lurker struct {
dao *dbl.DAO
s3 *s3.S3AO
interval time.Duration
retention uint64
}
func (l *Lurker) Init(interval int, ret... |
c9bd660245e28d24c48c24230fcebfde6db553eb | ffefcc682bc38e72ae320e04d7304efec41092ad | reiver/gogen-optiontype | /drivers/shared/nullable_type_unmarshaljson_string_test_tmpl.go | Go | go | 6,459 | permissive | package shared
const (
NullableTypeUnmarshaljsonStringTestTmpl =
`
import (
"encoding/json"
"fmt"
"math"
"time"
"testing"
)
func TestNullableTypeUnmarshalJSONStruct(t *testing.T) {
jsonString := `+"`"+`{
"id":"some-ID",
"email":"joeblow@example.net",
"when_created": "2017-04-12T13:02:28Z",
"parent_id... |
425f69e7d8419e991401834ee4a92c3b1e50a478 | 7cbaf5bc9df75f75e130160396aa2b9c02fa6129 | vegaj/JOSE | /jwa/elliptic_test.go | Go | go | 3,479 | no_license | package jwa
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"testing"
)
func Test_EC256_SignVerify(t *testing.T) {
var err error
testECPrivateKey, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
if err != nil {
t.Fatalf("Generate ECKey 256: %v", err)
}
testECPublicKey = &testECPrivateKey.Pub... |
bf065359044ae73d604886e4f91e44ad0a3b8b5f | 60837ad623ada25091e3b3fb75bc060abbaf500b | kubernetes/autoscaler | /cluster-autoscaler/cloudprovider/oci/vendor-internal/github.com/oracle/oci-go-sdk/v65/core/get_instance_request_response.go | Go | go | 3,539 | permissive | // Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose ei... |
3e2053f70a099a612923001d2fd77437d0d8f2a7 | 61e33340089ff06fcd395e3f9710b781d94ddd6a | spothero/tools | /kafka/cli.go | Go | go | 8,422 | permissive | package kafka
import (
"time"
"github.com/Shopify/sarama"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/pflag"
)
// Config contains all configuration for Kafka message consumption and production
type Config struct {
sarama.Config
// Prometheus registerer for metrics
Registerer prometheu... |
d97fce90c427c35843d4d601264d0ead22d150e9 | f6d8533cc9e6ae2cc548391db4fb98215701d0f4 | bitrise-steplib/steps-expo-detach | /expo.go | Go | go | 2,025 | permissive | package main
import (
"os"
"strings"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-tools/go-steputils/stepconf"
)
// Expo ...
type Expo struct {
Version string
Workdir string
}
// installExpoCLI runs the install npm command to install the expo-cli
func (e E... |
ece853ec1f903f1cff4510a59ea206f3011ea6ed | 383dacc7ffc9f7cb7d9363f4740bf8a631c1ca58 | aakritishroff/gold | /acl_test.go | Go | go | 29,885 | no_license | // TODO: test acl with glob
package gold
import (
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"net/http"
"strings"
"testing"
"github.com/drewolson/testflight"
"github.com/stretchr/testify/assert"
)
const (
aclDir = "/_test/acldir/"
)
var (
user1, user2 string
user1g, user2g *Graph
user1k, user2k *rsa.Priv... |
20ada0b42b1cd688be521af4adc401d92e11a386 | e87fdda34b6c089a669b638caeca870e09131304 | amitmaheshwari03/sync_gateway | /auth/session.go | Go | go | 4,145 | permissive | // Copyright (c) 2012 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 to in w... |
c636239c7e034ff179bfcbdd7acebd24dada2445 | d92ce61d7b2aa638fd777ef4149d2ea54c2a9528 | yuzhou721/miniBlog | /vendor/github.com/ugorji/go/codec/helper.go | Go | go | 54,553 | permissive | // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
package codec
// Contains code shared by both encode and decode.
// Some shared ideas around encoding/decoding
// ------------------------------------------
//
//... |
30a6d004c96568217fd1ca955cf21ff6c46b83d9 | 18da379d7e3344e29f9e88600e0cbe19bec7fe09 | wzz1234wzz/job | /study/packageStudy/study/regexpStudy.go | Go | go | 332 | no_license | package study
import (
"regexp"
"fmt"
)
func RegexMain() {
var arrayNameReg = regexp.MustCompile(`(.*?)\[.*\]`)
var key = "localCoordAxis0[3]"
arrayKey := arrayNameReg.FindStringSubmatch(key)
fmt.Println(arrayKey)
var key1 = "localCoordAxis0[]"
arrayKey1 := arrayNameReg.FindStringSubmatch(key1)
fmt.Println(... |
0980a3ab16f7d2d22888691823366a16ccd1df51 | 5704da9ab351cb2a621cefc0465ca3abedcd9b7b | c12s/celestial | /storage/etcd/actions.go | Go | go | 11,941 | permissive | package etcd
import (
"context"
"errors"
"fmt"
"github.com/c12s/celestial/helper"
"github.com/c12s/celestial/service"
bPb "github.com/c12s/scheme/blackhole"
cPb "github.com/c12s/scheme/celestial"
rPb "github.com/c12s/scheme/core"
gPb "github.com/c12s/scheme/gravity"
sg "github.com/c12s/stellar-go"
"github.c... |
e5414d72d8f2200682c4a981e3436d4458a88f3c | 8985f9ce9d119d7ac8b3bd3d2560fe50cd30a260 | DrJosh9000/ebiten | /image.go | Go | go | 5,823 | permissive | // Copyright 2014 Hajime Hoshi
//
// 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... |
b24c70096256e4401c1b487622c4ec4e597c2a9e | 707a59ceadc4a62d4af41c03cb92c8f0a04081fb | bmc-toolbox/dora | /vendor/github.com/ugorji/go/codec/helper_unsafe_compiler_not_gc.go | Go | go | 342 | permissive | // +build !safe
// +build !appengine
// +build go1.9
// +build !gc
// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
package codec
import "reflect"
var unsafeZeroArr [1024]byte
func rvType(rv reflect.Value) reflect.Type ... |
a3b43b85c20b7535e2dfe419210a883e97f65f79 | 34ccedc85d2fe3acc52051a1947bcc0faf90946c | sampalm/golangWebTraining | /02_parse_execute/02_file/main.go | Go | go | 314 | no_license | package main
import (
"log"
"os"
"text/template"
)
func main() {
tpl, err := template.ParseFiles("index.html")
if err != nil {
log.Fatal(err)
}
nf, err := os.Create("tpl.gohtml")
if err != nil {
log.Fatal(err)
}
defer nf.Close()
err = tpl.Execute(nf, nil)
if err != nil {
log.Fatal(err)
}
}
|
b3b4777955e35482ceaf7ee27424667ff4d2e7f1 | e8e787cf44253d0d48eb7e79af92576412e11df2 | sennotech/go-login | /login/gitee/gitee.go | Go | go | 1,301 | permissive | // Copyright 2017 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gitee
import (
"net/http"
"strings"
"github.com/sennotech/go-login/login"
"github.com/sennotech/go-login/login/internal/oauth2"
)
var _ login.Middl... |
3b7552045c4f00d61f6a35a06324efffa1342a59 | e1ac1a36804b42b2fa41ba16c0365a4b302c9d23 | evgenyorlov1/golang_exercises | /8961/8961.go | Go | go | 311 | no_license | package main
import "fmt"
func main() {
var n, val, index int
fmt.Scan(&n)
var arr []int
min := 999
for i := 0; i < n; i++ {
fmt.Scan(&val)
arr = append(arr, val)
if val < min {
min = val
index = i
}
}
arr[index] = arr[0]
arr[0] = min
for _, v := range arr {
fmt.Print(v, " ")
}
} |
994b8642445439e96e824d791256d53f72ec2ac2 | 1375701b51b6420ba6a352b3f84fa252ce06f8e3 | buger/plaid_bank_sym | /main.go | Go | go | 597 | no_license | package main
import (
"fmt"
"net/http"
)
var db *FileDB
var CurrentBank Bank
func Init(bankId int, dataPath string) {
// Limit context to current bank
db = OpenDB(fmt.Sprintf(dataPath+"/bank/%d", bankId))
var banks = []Bank{Bank{1, "Bank of America"}, Bank{2, "Wells Fargo"}}
for _, bank := range banks {
db.... |
8f81f862f318ec9b9d8ca5f63f034df4b3600796 | d0149eda87e6aa15dd5858db4dcf8f717046403f | aldebap/hackatonFB | /project/src/external/service.go | Go | go | 840 | no_license | package external
var (
Settlement = SettlementImpl{}
AdjustPaymnet = AdjustPaymentImpl{}
)
type SettlementService interface {
GetContractedProduct(customer string) int
GetCodCurrencyByCustomer(customer string) int
}
type AdjustPayment interface {
GetAdjustmentProduct(customer string) int
SetCardAssociationA... |
f3cd09f80a22705a1ecf17eea01379380be9f0e1 | a987d1f257423571db69f5d5f76bce017b8bfcec | chuyuqiao/nc-go | /nc13/main.go | Go | go | 592 | no_license | package main
import "fmt"
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func main() {
fmt.Println(maxDepth(&TreeNode{
Val: 1,
Left: &TreeNode{
Val: 2,
},
Right: &TreeNode{
Val: 3,
},
}))
}
func maxDepth(root *TreeNode) int {
// write code here
if root == nil {
return 0
... |
bb647e0035c9ebd0c70383e57a744797ffd5400d | d3c6b32216418820cb95794ba3d3313d693c6440 | gitter-badger/go-imap | /backend/memory/backend.go | Go | go | 1,363 | permissive | // A memory backend.
package memory
import (
"errors"
"time"
"github.com/emersion/go-imap"
"github.com/emersion/go-imap/backend"
)
type Backend struct {
users map[string]*User
}
func (bkd *Backend) Login(username, password string) (backend.User, error) {
user, ok := bkd.users[username]
if ok && user.password... |
5c1e972aa84059d905bcea18784bdfa1679319bc | 1deb2cc9fb779ca967cc62e9efe1d548efad0f6f | CloudFitSoftware/installer | /vendor/github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/applicationinsights/registration.go | Go | go | 1,363 | permissive | package applicationinsights
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
type Registration struct{}
// Name is the name of this Service
func (r Registration) Name() string {
return "Application Insights"
}
// WebsiteCategories returns a list of categories which can be used for the sidebar
... |
dae22b276b0938fff8feff68f277c8a07bbf2ff8 | e9055408746595f73baee4cc5f751d2935daab7c | ooobot/go-os | /config/source/file/file_test.go | Go | go | 633 | permissive | package file
import (
"fmt"
"os"
"path/filepath"
"testing"
"time"
"github.com/micro/go-os/config"
)
func TestFile(t *testing.T) {
data := []byte(`{"foo": "bar"}`)
path := filepath.Join(os.TempDir(), fmt.Sprintf("file.%d", time.Now().UnixNano()))
fh, err := os.Create(path)
if err != nil {
t.Error(err)
}
... |
51992ed86961f22f0cc72321e240cc063601feeb | 77c75bf65cbe5b18060970786851ded4f972caf5 | qzysw123456/kubernetes | /pkg/kubelet/oom/oom_watcher_linux.go | Go | go | 1,835 | permissive | // +build linux
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... |
8cac06b264403b0c4eac1e7e4d061dad425645f6 | acc9d9918b1c066bdcc02f9b84c2276343b1ba16 | ales6164/apis | /test/test.go | Go | go | 2,164 | no_license | package test
import (
"github.com/ales6164/apis"
"github.com/ales6164/apis/collection"
"github.com/ales6164/apis/providers/emailpassword"
"github.com/dgrijalva/jwt-go"
"io/ioutil"
"net/http"
"time"
)
const (
// roles
subscriber = "subscriber"
)
func init() {
// Signing key for JWT token issuing and authori... |
b8b80ace034a40e0727a5c40045a1402483721d9 | 8663054661075280b9dd9af16891780e18accdae | blunghamer/parquet-go-source | /hdfs/hdfs.go | Go | go | 2,082 | permissive | package hdfs
import (
"github.com/colinmarc/hdfs"
"github.com/xitongsys/parquet-go/source"
)
type HdfsFile struct {
Hosts []string
User string
Client *hdfs.Client
FilePath string
FileReader *hdfs.FileReader
FileWriter *hdfs.FileWriter
}
func NewHdfsFileWriter(hosts []string, user string, name string)... |
7e1440c500c0dd332374a7df1f92dee420c22d48 | 6d97796d5f94465660199b6be015bd3b151c532e | tomhollingworth/gowebapi | /items_table.go | Go | go | 900 | permissive | // ************************************************************************
// * Copyright 2018 OSIsoft, 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.ap... |
08c776e4912a422037c42ff7ac1ceff7e6f00b00 | 3d8e075fdf957cf05a072216f68a66056bcc379f | ravikumarsureshbabu/cockroach | /sql/parser/eval.go | Go | go | 66,675 | permissive | // Copyright 2015 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
2701e72706c3dfbfae997c4beedb0dd478f8954c | fc5a94e783927f393828cf3a89559a0a66973a28 | openshift/installer | /terraform/providers/aws/vendor/github.com/hashicorp/terraform-provider-aws/internal/service/quicksight/refresh_schedule.go | Go | go | 23,347 | permissive | package quicksight
import (
"context"
"errors"
"fmt"
"regexp"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/quicksight"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"g... |
6cfd2688a25fb5f9fe6203b17b067806ad64a0eb | bbb04c8a145b046396b59d96f7b1266c884823d6 | masa23/usacloud | /command/funcs/server_remote_desktop_info.go | Go | go | 950 | permissive | package funcs
import (
"fmt"
"github.com/sacloud/libsacloud/utils/server"
"github.com/sacloud/usacloud/command"
"github.com/sacloud/usacloud/command/params"
)
func ServerRemoteDesktopInfo(ctx command.Context, params *params.RemoteDesktopInfoServerParam) error {
client := ctx.GetAPIClient()
api := client.GetSe... |
c85d645166f727bf978fcdeb9c32143825da2f3a | 3809d3bbb99b8ae9e8222475e98c06b48b698ced | sdimitrenco/restapi | /cmd/main.go | Go | go | 1,372 | no_license | package main
import (
"github.com/StanislavDimitrenco/restapi/pkg/handler"
"github.com/StanislavDimitrenco/restapi/pkg/repository"
"github.com/StanislavDimitrenco/restapi/pkg/service"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"os"
"github.com/StanislavDimitrenco/restapi"
"github.com/joho/godotenv"... |
c17c318e2b684ca48092c31194527fcf32d3adaf | 29cb1a4cf18c1f4e085cb7f165c2451533729c8e | dezryth/dcrctl | /dcrctl.go | Go | go | 5,320 | permissive | // Copyright (c) 2013-2015 The btcsuite developers
// Copyright (c) 2015-2020 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"path/filepath"
"strings"
wal... |
a691ba40f81e1f419d6268a8d359998bb444842e | 88c3993bcbab868c99a832338ea62022b9d47539 | JustinHuang917/wechat | /mp/merchant/product/attr_base.go | Go | go | 3,868 | permissive | // @description wechat 是腾讯微信公众平台 api 的 golang 语言封装
// @link https://github.com/chanxuehong/wechat for the canonical source repository
// @license https://github.com/chanxuehong/wechat/blob/master/LICENSE
// @authors chanxuehong(chanxuehong@gmail.com)
package product
// 商品基本属性
//
// "product_base": {
/... |
1683f993551944fab6c206c8d969a169df116014 | f7ef248c1a57aefbe412345c02ed1b61ebab5be8 | duiniwukenaihe/gin-k8s | /api/auth.go | Go | go | 1,645 | no_license | package api
import (
//"fmt"
"net/http"
//"github.com/astaxie/beego/validation"
"github.com/gin-gonic/gin"
"github.com/jamsa/gin-k8s/pkg/app"
"github.com/jamsa/gin-k8s/pkg/e"
"github.com/jamsa/gin-k8s/pkg/util"
"github.com/jamsa/gin-k8s/service/auth_service"
)
type Auth struct {
Username string `valid:"Req... |
6c534dc1ac5b9778e622dc98fc2ed15ee6f612ff | a0cf3e878de7a6ff5b76c052a4dedbe5525e9dfc | dyweb/dy-bot | /pkg/gh/client.go | Go | go | 1,266 | permissive | package gh
import (
"context"
"sync"
"github.com/dyweb/gommon/util/logutil"
"github.com/google/go-github/github"
"golang.org/x/oauth2"
)
var (
gitHubClient *Client
log = logutil.NewPackageLogger()
once sync.Once
)
func InitGitHubClient(owner, repo, accessToken string) {
once.Do(func() {
... |
2d087678900ad422a861d894c5d21af677eea710 | 5cc9f64cc72cb025501e95f1cd41539914d26fd7 | Zyqsempai/p2plab | /providers/terraform/provider.go | Go | go | 6,505 | permissive | // Copyright 2019 Netflix, 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... |
4f3bb7a187b3545cce725cc47ea87f884a19a87a | fa0878d7900b935ad777b97943d337dcec617bc5 | hprateek43/kubernetes | /test/e2e/apimachinery/request_timeout.go | Go | go | 3,403 | 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, ... |
662537c11365de3063e23f45d29221fd2127cbfa | 879b2ef8a0ec39e964567bbda8c365cf2b8c0aee | Akilan1999/vitess | /go/test/endtoend/cluster/cluster_process.go | Go | go | 23,848 | permissive | /*
Copyright 2019 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
42ac1ea7c147f30e2560b97334abbb5f1aca33e5 | afc5683852041a6fa0e8bc472de12802c4ea16c9 | arbus1234/kubesphere | /cmd/controller-manager/app/controllers.go | Go | go | 5,315 | permissive | /*
Copyright 2019 The KubeSphere 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 wr... |
752da05be32502b9370b599b5425d9d0f6b9c873 | 8d9b4e1056d7b7bdd630c4b65cce0721bc5471b5 | shamigor/conekta-go | /destination.go | Go | go | 990 | permissive | package conekta
// DestinationParams describes params for destination payee object request
type DestinationParams struct {
Type string `json:"type,omitempty"`
AccountNumber string `json:"account_number,omitempty"`
AccountHolderName string `json:"account_holder_name,omitempty"`
}
// Destination des... |
2eaed3ce337a4fde5efc80fb77d886176fcf7360 | 7a2abf9a87e8e89b7af9ee4a407e73364b1760e8 | edwardext/lotus | /blockstore/splitstore/splitstore.go | Go | go | 13,548 | permissive | package splitstore
import (
"context"
"errors"
"os"
"sync"
"sync/atomic"
"time"
"go.uber.org/multierr"
"golang.org/x/xerrors"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
dstore "github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log/v2"
"github.com/filecoin-project/go-s... |
88e78f994568834f97d308e1f3718bccdce3c2f2 | 64b1c2c5707998b9f546125ea9dfea015932bbf8 | dolfly/flynn | /cli/provider.go | Go | go | 1,183 | permissive | package main
import (
"log"
"github.com/flynn/flynn/Godeps/_workspace/src/github.com/flynn/go-docopt"
"github.com/flynn/flynn/controller/client"
ct "github.com/flynn/flynn/controller/types"
)
func init() {
register("provider", runProvider, `
usage: flynn provider
flynn provider add <name> <url>
Manage r... |
6a43169ef4ce19e211d48f404f9985e5eb84e146 | 00dc98df9bee0e5018da0eb2d43c7794e470c61d | cbrem/bytetorrent | /src/client/local_file_listener_api.go | Go | go | 339 | no_license | package client
import (
"client/clientproto"
)
// Applications should implement this interface if they wish to know when the
// local files associated with a torrent Client change.
type LocalFileListener interface {
// OnChange notifies a LocalFileListener when a local file changes.
OnChange(*clientproto.... |
7c8607ca25dd81458bec22748ccc960b561db77f | 6469976f39fef86f2e1698dbec653c2130da5de4 | dicarlo2/knative-gcp | /cmd/webhook/main.go | Go | go | 5,236 | permissive | /*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... |
f62c980c2e76a213ac59538b713bac29f610c017 | eadc54f879c2129538d3e1b0021c0ac71ecef47d | DarinaKasiura/cucumber | /cucumber-expressions/go/tree_regexp.go | Go | go | 1,940 | permissive | package cucumberexpressions
import (
"regexp"
)
type TreeRegexp struct {
regexp *regexp.Regexp
groupBuilder *GroupBuilder
}
func NewTreeRegexp(regexp *regexp.Regexp) *TreeRegexp {
stack := GroupBuilderStack{}
stack.Push(NewGroupBuilder())
groupStartStack := IntStack{}
var last rune
escaping := false
n... |
11bd942ff86211f08126017887006c33915ce242 | 759674e95d64fe13926f69adc00a9a19325f6bb3 | muaazsaleem/skipper | /filters/builtin/builtin.go | Go | go | 5,730 | permissive | /*
Package builtin provides a small, generic set of filters.
*/
package builtin
import (
"github.com/zalando/skipper/filters"
"github.com/zalando/skipper/filters/accesslog"
"github.com/zalando/skipper/filters/auth"
"github.com/zalando/skipper/filters/circuit"
"github.com/zalando/skipper/filters/consistenthash"
"... |
6ae9e340c95391604809551245cb81e7dbcf159c | 210fb05789487e1d02277a5ffde93b96aae8c131 | SmartMeshFoundation/Photon | /cmd/tools/smoketest/cases/CLeavingTokenNetwork.go | Go | go | 643 | no_license | package cases
import (
"net/http"
"time"
"github.com/SmartMeshFoundation/Photon/cmd/tools/smoketest/models"
)
// LeavingTokenNetworkTest : test case for leave token network
func LeavingTokenNetworkTest(env *models.PhotonEnvReader, allowFail bool) {
case1 := &APITestCase{
CaseName: "LeavingTokenNetwork",
All... |
77580e3ab2ffe75ff0c47bd73c701538c0809fb9 | 07373b125beb357fba3067dc3dae84d0f79f8892 | cphrn/go | /services/horizon/internal/db2/history/ledger.go | Go | go | 1,964 | permissive | package history
import (
"fmt"
sq "github.com/Masterminds/squirrel"
"github.com/cphrn/go/services/horizon/internal/db2"
"github.com/cphrn/go/support/errors"
)
// LedgerBySequence loads the single ledger at `seq` into `dest`
func (q *Q) LedgerBySequence(dest interface{}, seq int32) error {
sql := selectLedger.
... |
be24098fd35275b4c6ce105d29270913b7cfe226 | 5659d081de33bc6b460ee712f1cfe98a44c7915d | antikytheraton/go-rest-api | /main.go | Go | go | 2,056 | no_license | package main
import (
"encoding/json"
"math/rand"
"net/http"
"strconv"
"github.com/gorilla/mux"
)
// Post type
type Post struct {
ID string `json:"id"`
Title string `json:"title"`
Body string `json:"body"`
}
var posts []Post
func main() {
router := mux.NewRouter()
router.HandleFunc("/posts", getPost... |
6de6f735bc3ae72b6c5bd0cc29bea00bc14e1b22 | c6b3e56f84ec6d4771ad6ab218743690353b8578 | linlm/telegramd | /server/biz_server/phone/phone.go | Go | go | 2,313 | permissive | /*
* Copyright (c) 2018, https://github.com/nebulaim
* 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
*
* Un... |
93be9712abf6c7d22f067a3829d2a364bfb1e941 | 7f30de18d7b6aeeab8e1267763c6a0065bfe8851 | SOCOMD/SOCAP | /go/armago.go | Go | go | 1,305 | no_license | package main
/*
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
*/
import "C"
import (
"unsafe"
"github.com/socomd/socap/go/ocap"
)
//export goRVExtensionVersion
func goRVExtensionVersion(output *C.char, outputsize C.size_t) {
result := C.CString("Version 1.0")
defer C.free(unsafe.Pointer(result))
v... |
362529b0bd37f2302ed2b9237995e9b4f0adab40 | 705523073a23d9c46e78308dd2c61096227351b8 | YogeshMahera-SerpentCS/maxskins | /examples/PassThrough/client/go/Dynamic/PassThroughClient.go | Go | go | 5,666 | permissive | package main
import (
"../gen-go/com/maxeler/PassThrough"
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
"os"
"time"
)
func checkForErrors(err error){
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(-1)
}
}
func check(dataOutDFE []float64, dataOutCPU []float64, size ... |
7e00f6579ccb624a8f80916ade1a653e2648bf0b | 3e3828632f8a5c28f8fcfee411a298eb311383de | ysoftman/codingtest | /leetcode/interleaving_string.go | Go | go | 3,926 | no_license | /*
https://leetcode.com/problems/interleaving-string/
97. Interleaving String
Medium
Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.
An interleaving of two strings s and t is a configuration where they are divided into non-empty substrings such that:
s = s1 + s2 + ... + sn
t = t... |
e77d153796944fc62223ac55dfba8b43694b15c1 | 53ead6920fb1797f43f5ac1a57b8c47046a00294 | nathants/cli-aws | /cmd/ecr/rm.go | Go | go | 755 | permissive | package cliaws
import (
"context"
"github.com/alexflint/go-arg"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ecr"
"github.com/nathants/cli-aws/lib"
)
func init() {
lib.Commands["ecr-rm"] = ecrRm
lib.Args["ecr-rm"] = ecrRmArgs{}
}
type ecrRmArgs struct {
Name string `arg:"positional,req... |
605016338c7ad8fb1b60930fa7158fb9a867cb95 | 645e487f80424fdb5f7eede595b1ac687a4a9a83 | pcting/shadow-apex-godot-go | /godot/inputeventmousemotion.gen.go | Go | go | 6,626 | permissive | package godot
import (
"github.com/shadowapex/godot-go/gdnative"
)
/*------------------------------------------------------------------------------
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Any updates should be... |
21c74532c23d3817ecd59243684f326d136b495c | d9b6914963b048fd489e6cdc2da94e263395f3a3 | bleemeo/glouton | /config/default_test.go | Go | go | 7,091 | permissive | // Copyright 2015-2023 Bleemeo
//
// bleemeo.com an infrastructure monitoring solution in the Cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LI... |
a6022e58fe0975fb632de0627f0ceef063961bc5 | dfc0c25624dbd37f43c86d7f8f418b4349dc8760 | ramenjp/TwitterClone | /server/src/github.com/ramenjp/signup/signup.go | Go | go | 406 | no_license | package signup
import (
"github.com/ramenjp/crypto"
_ "github.com/jinzhu/gorm/dialects/mysql"
"github.com/ramenjp/structs"
)
func CreateUser(username string, email string, password string) *structs.User {
hashedPassword, _ := crypto.PasswordEncrypt(password)
newUser := &structs.User{Name: "", UserName: username... |
1eed2f71669d9176b972d7e8c8805312bb46555d | 3833438e37895ff6c56b8066257a1986005afd14 | b-dawg/rclone | /cmd/mount/dir_test.go | Go | go | 3,434 | permissive | // +build linux darwin freebsd
package mount
import (
"io/ioutil"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestDirLs(t *testing.T) {
run.skipIfNoFUSE(t)
run.checkDir(t, "")
run.mkdir(t, "a directory")
run.createFile(t, "a file", "hello")
r... |
1e9af1c4380d6f5c5659abcef356131e1ba45fd6 | 5d4f7aaea7bd631aa105b8ed1cc5d8e8dbc051ff | JiangZhaoYang/porter | /pkg/porter/outputs_test.go | Go | go | 1,366 | permissive | package porter
import (
"testing"
"github.com/deislabs/cnab-go/bundle"
"github.com/deislabs/cnab-go/bundle/definition"
"github.com/deislabs/cnab-go/claim"
"github.com/stretchr/testify/require"
)
func TestPorter_printOutputsTable(t *testing.T) {
p := NewTestPorter(t)
p.TestConfig.SetupPorterHome()
p.CNAB = Ne... |
6a2ed1508521f91c42cb3f612e4d9d7cd5a8307e | 28404e27cdbcd5eba65b6ad6b44aaa62c508750b | winwisely99/bosun | /pkg/templates.go | Go | go | 11,596 | permissive | package pkg
import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Masterminds/sprig"
"github.com/fatih/color"
vault "github.com/hashicorp/vault/api"
"github.com/imdario/mergo"
"github.com/pkg/errors"
"github.com/rs/xid"
"golang.org/x/crypto/ssh/terminal"
"g... |
e341205ebb104bb86e5e6af6fdef89e9a45a41bc | 8b194489585c91a8d537172e70cd8aae6bf6ac81 | ipandanet/cli | /src/testhelpers/api/fake_user_repo.go | Go | go | 2,142 | permissive | package api
import (
"cf/net"
"cf"
)
type FakeUserRepository struct {
CreateUserUser cf.User
CreateUserExists bool
FindByUsernameUsername string
FindByUsernameUser cf.User
FindByUsernameNotFound bool
DeleteUser cf.User
SetOrgRoleUser cf.User
SetOrgRoleOrganization cf.Organization
SetOrgRoleRole string
... |
d6bbb201e342a8feebab9768b5c782e4f02c327f | 2f8cf86d26f04fc63b6d95e8d429732d314fec26 | cloudron-io/rclone | /fs/sync_internal_test.go | Go | go | 2,192 | permissive | // Internal tests for sync/copy/move
package fs
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMatchListings(t *testing.T) {
var (
a = mockObject("a")
b = mockObject("b")
c = mockObject("c")
d = mockObject("d")
)
for _, test := range []struct {
what string
input DirEntries... |
fef0d5011f01e92a12d3e1396f7f2ad86f9224f5 | dd9f27cfb5c218dc87fe25d88eb58e47f7db8e0c | ZhouXing19/cockroach-go | /crdb/crdbpgx/pgx.go | Go | go | 1,893 | permissive | // Copyright 2016 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
c5cfcc355a8b614a7799ed0f0921c37f82c827e6 | 77781587c9e033f7c0d162d0399e18f546150b3f | mohdgadi/file-downloader-service | /cmd/ftp-service/main.go | Go | go | 341 | no_license | package ftp-service
import "file-downloader/internal/model"
func main() {
// initialize SQLFileDownloaderConfigDb
// initialize FTP Service and inject db as a dependency
// Startserver to recieve download request. Pass service as a parameter
}
func startServer(service FTPFileDownloaderService) {
// recieve reque... |
0f867b87a5e2d44c9f33e99e7ec9f4ea892ce67f | f40b388d8392da09bf1c4668d1dff5b79e8a3edd | zeptonaut/luci-go | /logdog/api/config/svcconfig/util.go | Go | go | 532 | permissive | // Copyright 2016 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package svcconfig
import (
"fmt"
)
const (
// ServiceConfigPath is the config service path of the Config protobuf.
ServiceConfigPath = "se... |
fd1eda8e703f1341be59625a1d0906909761bbe6 | 0a042ef9a7c65f6745d5961ad59e07655453081c | haystem/CursoGo | /valorZero.go | Go | go | 368 | no_license | /* OS zeros
int = 0
float = 0.0
booleans = false
strings = ""
pointers, functions, interfaces, slices, channels, maps = nil */
package main
import (
"fmt"
)
var a int
var b bool
var c float32
var d string
func main(){
fmt.Printf("%v, %T\n",a,a)
fmt.Printf("%v, %T\n",b,b)
fmt.Printf("%... |
9d3576309bcd5379a2fc551ec79a284a289c5e79 | 0b02acee192537ab0677ae81fef6da16f22c0750 | matthiasak/k3s | /pkg/cli/cmds/agent.go | Go | go | 3,532 | permissive | package cmds
import (
"os"
"path/filepath"
"github.com/urfave/cli"
)
type Agent struct {
Token string
TokenFile string
ServerURL string
ResolvConf string
DataDir string
NodeIP string
NodeName s... |
d0a90a63028f121c0cbc733670bc20fb8839f5f6 | a7594a1cf5dbdc2dca7cff15fc5aa677f122052b | sudeepgoyal75/terraform-provider-nuagenetworks | /5.0.1/nuagenetworks/data_source_nuagenetworks_spatsourcespool.go | Go | go | 3,266 | no_license | package nuagenetworks
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
vspk "github.com/tpretz/vspk-go/vspk/5.0.1"
"github.com/nuagenetworks/go-bambou/bambou"
)
func dataSourceSPATSourcesPool() *schema.Resource {
return &schema.Resource{
Read: dataSourceSPATSourcesPoolRead,
... |
2eff5ee6f6eae6e753e01aaa43a0db5ece259a4b | 9c3dfbaf9992eb4029095c9c97cc663d7523b347 | julioc98/robin | /cmd/api/handler/transaction.go | Go | go | 2,333 | no_license | package handler
import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"github.com/gorilla/mux"
"github.com/julioc98/robin/internal/app/transaction"
)
// TransactionHandler Interface
type TransactionHandler interface {
Add(w http.ResponseWriter, r *http.Request)
FindByID(w http.ResponseWriter, r *http.Request)
... |
d5f292c5c22f4d52e46ea9e234ef5edacbec1dbf | 5d8cd5ae84a3587d08ad1a76739b1c7d44f05da7 | PitaHat/mira | /comments.go | Go | go | 4,369 | permissive | package mira
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
"github.com/thecsw/mira/models"
)
// Comments returns comments from a subreddit up to a specified limit sorted by the given parameters
//
// Sorting options: "hot", "new", "top", "rising", "controversial", "random"
//
// Duration options... |
28790e4711af5add433880488a2b761b68b66020 | 3544b4e97ad2a4bc90fbc5b21c374fbd03e16530 | mykine/letsgo | /base1/spice.go | Go | go | 568 | no_license | package main
import (
"fmt"
"reflect"
)
type stack struct {
top int
bottom int
dataArr []int64
}
func main() {
var s = []int64{}
s = append(s, 1,2,3)
fmt.Print(s)
var i *int
i = new(int)
*i=1
fmt.Print(*i)
fmt.Print("\n")
sta := new(stack)
sta.top=0
sta.bottom=0
fmt.Print(reflect.TypeOf(sta.dataAr... |
581a9096524611c2c30e2dc119be4ed0593a735c | 96bbb8032949f87e8018289cee2bde2824be9fcf | keigodasu/learn-go-with-tests | /error-types/error_types.go | Go | go | 609 | no_license | package error_types
import (
"fmt"
"io/ioutil"
"net/http"
)
type BadStatusError struct {
URL string
Status int
}
func (b BadStatusError) Error() string {
return fmt.Sprintf("did not get 200 from %s, got %d", b.URL, b.Status)
}
func DumbGetter(url string) (string, error) {
res, err := http.Get(url)
if er... |
d7396b14cd070a0950a07c2af2244fdbad862859 | b4f6a7d2aea402f8177a47f9046e9909528de765 | FlashbackSRS/flashback | /vendor/github.com/flimzy/kivik/driver/driver.go | Go | go | 11,611 | permissive | package driver
import (
"context"
"encoding/json"
"io"
"time"
)
// Driver is the interface that must be implemented by a database driver.
type Driver interface {
// NewClient returns a connection handle to the database. The name is in a
// driver-specific format.
NewClient(ctx context.Context, name string) (Cl... |
a0fcc1250f8bc4e086d6b0a5c6a95d6c76ab326d | 0639789d1eebb87a33da53c3b2a90d31d7b5609d | arting87/bdex | /bdex-ex-backend/errorder/errorder_service.go | Go | go | 1,535 | no_license | package errorder
import (
"bdex.in/bdex/bdex-ex-backend/configs"
"bdex.in/bdex/bdex-ex-backend/deleorder"
"time"
)
func HandleErrOrder(order deleorder.DeleOrder, txhash string, handleErr error) error {
order.Status = configs.Error
order.ExSuccess = true
err := deleorder.UpdateDeleOrderById(&order)
if err != ni... |
1ea69a0fd9f55e88d993664efc42ad1a15306723 | 2c3e8b9f179a5ff99b01afc16eb61e8307840dab | josephg/lightwave | /store/message.go | Go | go | 880 | no_license | package store
import (
"encoding/json"
"errors"
)
type Message struct {
Cmd string "cmd"
Payload *json.RawMessage "data"
connection *Connection
}
type messageWithoutPayload struct {
Cmd string "cmd"
}
// 'data' is a pointer to some data structure.
// The function decodes the payload ... |
414c698d34f5ffba23d901d8b583f6d5182e738f | f346d66f61623fc8f9888fe93e88e3fc315b8f51 | netdna/cachestatus | /cachestatus.go | Go | go | 4,385 | permissive | package main
import (
"bufio"
"flag"
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
"runtime"
"strings"
"time"
)
// ServerName of the current box
var ServerName string
type File struct {
Path string
Sha256Expected string
Size int64
LastModified time.Time
LastChecked time.Time
Ca... |
fa07a19fcf7424092b11f7ac0653c9dc2b729c84 | 1f78c632c23643294c34cbeee5e35c65d929b68f | alexandremsouza1/snippets | /golang/blockchain/blockchain-tutorial-main.go | Go | go | 3,814 | no_license | package main // https://github.com/nosequeldeebee/blockchain-tutorial
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"io"
"log"
"net/http"
"os"
"strconv"
"sync"
"time"
"github.com/davecgh/go-spew/spew"
"github.com/gorilla/mux"
"github.com/joho/godotenv"
)
// Block represents each 'item' in the ... |
a6056076a2afa1e0d83f99bd128e82b4717c3f5f | c7b0dacef202fe1f46a05152fa1d142716f2bd26 | ramesharun/grest | /client.go | Go | go | 208 | permissive | package grest
import (
"context"
"net/http"
)
type Client struct {
cl *http.Client
}
func (c *Client) Do(ctx context.Context, r Request) (*http.Response, error) {
return ctxDo(ctx, c.cl, r.ToHTTP())
}
|
6969ee528619a2ef7c235ceaafcf1621705adc92 | e39d27ec2b0691a5a2d4660a4da49128ec605df7 | laimu/negroni-demo | /.history/util/binding_use_20181221231607.go | Go | go | 1,175 | no_license | package util
import (
"fmt"
"net/http"
"strings"
"github.com/mholt/binding"
)
type ContactForm struct {
User struct {
ID int
}
Email string
Message string
}
// Then provide a field mapping (pointer receiver is vital)
func (cf *ContactForm) FieldMap(req *http.Request) binding.FieldMap {
return binding.F... |
5662c2f613064b2acf38ccb23ccb063d22f79c31 | 12742b0ac52c30f1817d3631ed76f712714e5da2 | phamtrung99/user-service | /delivery/http/v1/user/get_me.go | Go | go | 468 | no_license | package user
import (
"errors"
"github.com/labstack/echo/v4"
"github.com/phamtrung99/gopkg/apperror"
"github.com/phamtrung99/gopkg/utils"
)
func (r *Route) GetMe(c echo.Context) error {
var (
ctx = &utils.CustomEchoContext{Context: c}
appError = apperror.AppError{}
)
res, err := r.userUseCase.GetMe(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.