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 |
|---|---|---|---|---|---|---|---|---|
627e73f72f7603d31cd56a64c58b8545e8e8bb37 | 37213c6726ae170a2c217b56ed4a5cdc0a10b977 | daisy/pipeline | /cli/cli/job_mapper_test.go | Go | go | 1,735 | no_license | package cli
import (
"testing"
"github.com/daisy/pipeline-clientlib-go"
)
func TestIsDone(t *testing.T) {
jobDone := pipeline.Job{
Status: "SUCCESS",
}
jobOther := pipeline.Job{
Status: "ERROR",
}
if !isDone(jobDone) {
t.Errorf("isDone doesn't return true when job done")
}
if isDone(jobOther) {
t.Er... |
aa7c55f9ab9bc639c182e9121d9e48759c17060a | 95bd043eb578f5f33b437e3e5db2f6723b892303 | jonwho/discord-bot | /vendor/github.com/rylio/ytdl/utils.go | Go | go | 1,464 | permissive | package ytdl
import (
"context"
"fmt"
"io/ioutil"
"net/http"
)
type errUnexpectedStatusCode int
func (err errUnexpectedStatusCode) Error() string {
return fmt.Sprintf("unexpected status code: %d", err)
}
func reverseStringSlice(s []string) {
for i, j := 0, len(s)-1; i < len(s)/2; i, j = i+1, j-1 {
s[i], s[j... |
674799b4cf2117af0126608878eefac536b55796 | 78d8e82a3a68378f7b60a575f58c118110d816a3 | zarethernet/btfsautohostprice | /coinmarketcap/api_fiat.go | Go | go | 2,650 | permissive | package coinmarketcap
import (
"context"
"encoding/json"
"errors"
"fmt"
"github.com/google/go-querystring/query"
)
// GetFiatCoinMarketCapIDMapParams contains query parameters for https://coinmarketcap.com/api/documentation/v1/#operation/getV1FiatMap
type GetFiatCoinMarketCapIDMapParams struct {
Start ... |
cd0b6d13d872ca63f27863255f05710ebfbc5dac | e20efbb7cb9c8f8d0133ecc31eeb1da00c997fe3 | Reisender/csv2json | /main.go | Go | go | 1,684 | permissive | package main
import (
"context"
"errors"
"flag"
"io/ioutil"
"log"
"github.com/MasteryConnect/pipe/line"
"github.com/MasteryConnect/pipe/message"
"github.com/MasteryConnect/pipe/extras/csv"
"github.com/MasteryConnect/pipe/extras/json"
"cuelang.org/go/cue"
"cuelang.org/go/cue/cuecontext"
)
var (
schemaCu... |
06f48cb730f0ddac5d42e1111cd914c1cc9b49af | 38195074206b89a50ca8824eca8514a078f6d1fd | spatialcurrent/go-simple-serializer | /pkg/bson/Unmarshal_test.go | Go | go | 897 | permissive | // =================================================================
//
// Copyright (C) 2019 Spatial Current, Inc. - All Rights Reserved
// Released as open source under the MIT License. See LICENSE file.
//
// =================================================================
package bson
import (
"testing"
"git... |
6747393313147b001b0a8b6371c84f94697dff20 | a0a323fe4d502b651497cc2ecaed2897f9d1ba96 | naveenholla/kubernetes | /pkg/client/unversioned/clientcmd/client_config.go | Go | go | 14,285 | permissive | /*
Copyright 2014 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... |
d0433d1dd88033ed658b897f5e0c90671b81d858 | d92c490cf62e6326ef2fc0358d608a453f74d4c7 | maguroguma/go-competitive | /contests/2019/07/20190720_ABC134/d/d.go | Go | go | 7,965 | permissive | package main
import (
"bufio"
"errors"
"fmt"
"io"
"math"
"os"
"strconv"
)
/********** I/O usage **********/
//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)
//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)
... |
c2288cdbb4b5ff0a6f64c3bfbf7c3174374a7401 | af0c96481869506b5356d7269bc5089ad5d3e3e3 | epinio/epinio | /helpers/routes/suite_test.go | Go | go | 776 | permissive | // Copyright © 2021 - 2023 SUSE LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in wri... |
49fbf7259aaf7953c3684e02a64dbc77e8345060 | 3b32a1fae2dbacb83615b52bbefa5e450d972e96 | satotake/hugo | /resources/page/pagegroup.go | Go | go | 12,318 | permissive | // Copyright 2019 The Hugo 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 ... |
38d5fb35a14ae15aa02d8defebc7730743afa8cf | 717a64059ab9dc178a96c472455cef449c5399c1 | ei09010/porter | /cmd/porter/main.go | Go | go | 4,279 | permissive | //go:generate packr2
package main
import (
"os"
"get.porter.sh/porter/pkg/config/datastore"
"get.porter.sh/porter/pkg/porter"
"github.com/gobuffalo/packr/v2"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
var includeDocsCommand = false
func main() {
cmd := buildRootCommand()
if err := cmd.Execute(); e... |
51558984713ff96223d9aa2e46f8585b18a7074e | 39308f909e6541ae01668c4c0d3021ecd7148e83 | yanming-zhang/hade | /framework/provider/env/provider.go | Go | go | 985 | permissive | package env
import (
"github.com/gohade/hade/framework"
"github.com/gohade/hade/framework/contract"
)
type HadeEnvProvider struct {
Folder string
}
// Register registe a new function for make a service instance
func (provider *HadeEnvProvider) Register(c framework.Container) framework.NewInstance {
return NewHad... |
c8fef8c1adac1578e5ca71196081a90b2d8731b2 | 6a7739bd0cfe24c76a4084ce1c84ea07a9f4f106 | jongsuknim/gopl-exercises | /ch06/intset/main.go | Go | go | 1,109 | no_license | package main
import (
"bytes"
"fmt"
)
type IntSet struct {
words []uint64
}
func (s *IntSet) Has(x int) bool {
word, bit := x/64, uint(x%64)
return word < len(s.words) && s.words[word]&(1<<bit) != 0
}
func (s *IntSet) Add(x int) {
word, bit := x/64, uint(x%64)
for word >= len(s.words) {
s.words = append(s.... |
e48dfbcb62c738279bced5091f0e50cd51c39328 | 26fdf305ad2147de388621e9d52083ec6b91eab8 | odeke-em/bugs | /golang/23650/tool2/src/encrypt_files/encrypt_files.go | Go | go | 1,709 | no_license | package main
import (
"crypto/md5"
"fmt"
"io/ioutil"
"os"
//"path"
"common"
"flag"
"path/filepath"
"strings"
"sync"
)
func Create_md5(root, outDir string) {
outMap := make(map[string]string)
var wg sync.WaitGroup
os.RemoveAll(outDir)
os.MkdirAll(outDir, os.ModePerm)
os.MkdirAll(outDir+"deps", os.ModePe... |
e339a14a45cf140b0bbf453e33acccef93140eb1 | 59296cc956059bd1a5031ca024c879c2b7ed4bc0 | HaroonSaid/datalake | /src/main/go/datalake/kinesislambda/hander.go | Go | go | 288 | permissive | package main
import (
"fmt"
"context"
"github.com/aws/aws-lambda-go/lambda"
)
func HandleRequest(ctx context.Context, name MyEvent) (string, error) {
return fmt.Sprintf("Hello %s!", name.Name ), nil
}
func main() {
lambda.Start(HandleRequest)
} |
3c742b36238ed22d82b4337c1f1b5a3feaea78cc | ab77caa8af118bf00ed7d9bf2a170e482f79ea02 | chennqqi/go-plugin-utils | /database/elasticsearch/elasticsearch.go | Go | go | 5,087 | permissive | package elasticsearch
import (
"context"
"fmt"
"time"
log "github.com/Sirupsen/logrus"
"github.com/maliceio/go-plugin-utils/utils"
elastic "gopkg.in/olivere/elastic.v5"
)
// PluginResults a malice plugin results object
type PluginResults struct {
ID string `json:"id"`
Name string
Category string
... |
09a67938056d5308b7b7d87187e8959e6577b57e | 4e8a5fdd88a8e410d6f4dea604d92c3a39e02ac5 | aramase/cloud-provider-azure | /pkg/azureclients/vmasclient/azure_vmasclient_test.go | Go | go | 18,038 | 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, ... |
0a40b51482bb245194d21a2362444caed9956890 | bf67b35397a253417fdfb50e983834eaabc73252 | imkratos/jvmgo | /ch07/rtda/heap/class_loader.go | Go | go | 3,468 | permissive | package heap
import (
"fmt"
"github.com/imkratos/jvmgo/ch07/classfile"
"github.com/imkratos/jvmgo/ch07/classpath"
)
type ClassLoader struct {
cp *classpath.Classpath
classMap map[string]*Class
verboseFlag bool
}
func NewClassLoader(cp *classpath.Classpath, verboseFlag bool) *ClassLoader {
return &... |
e3cdb1b74874554651ad28d2264280d8f7f77c33 | 32a8ec4f1409c5b3ab95bb53f8d0b87d84f55bd1 | alioygur/bibin | /providers/mysql/matches.go | Go | go | 848 | no_license | package mysql
import (
"fmt"
"time"
"github.com/pkg/errors"
)
// PutMatch insters to mathes table with cross records.
// insert userID, friendID
// insert friendID, userID
func (r *repository) MakeFriend(userID, friendID uint64) error {
now := time.Now()
q := fmt.Sprintf(`insert into %s values(?, ?, ?), (?, ?, ... |
53bde0d9912103c11d80dc1a444e014c3d0b2b78 | 3a5518d0e7afb4db341cd8ae9469f550081c604c | k2tzumi/public | /oversight/tree_test.go | Go | go | 24,728 | permissive | // Copyright 2018 cirello.io/oversight - Ulderico Cirello
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
052a0127adbdea4f28cedfcfc1f73cde8f33d902 | a11056fdb7e8f108431aec3d78573b4680edf772 | Awasaky/Xenji-proto | /field/type_l.go | Go | go | 343 | no_license | embedded_components {
id: "sprite"
type: "sprite"
data: "tile_set: \"/assets/art.atlas\"\n"
"default_animation: \"L-Type\"\n"
"material: \"/builtins/materials/sprite.material\"\n"
"blend_mode: BLEND_MODE_ALPHA\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z... |
be70f56796bfca88eb583aed13eba118e74620bf | 4b67528aa12c61b02fbd9bdd45c92b5d76507b2a | JingYu-Kylin/JVM | /ch04/classfile/class_file.go | Go | go | 5,325 | no_license | package classfile
import (
"fmt"
)
/**
ClassFile {
u4 magic;
u2 minor_version;
u2 major_version;
u2 constant_pool_count;
cp_info constant_pool[constant_pool_count-1];
u2 access_flags;
u2 this_class;
u2 ... |
9db324dd73ccf05def056f68d4deb09d950231d4 | 6095a30d569808fd1dc2dea8d6725d8e78200abd | fu31/nakigara | /tests/default_test.go | Go | go | 951 | no_license | package test
import (
"net/http"
"net/http/httptest"
"testing"
"runtime"
"path/filepath"
_ "nakigara/routers"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(0)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(... |
86652a7d6b4d086f66ae1e6cfe06f947f259643b | 550c60cf40d4c26068334b6dbcd266f6ec1be1c2 | reasoll/ChatRoom | /controller/stats.go | Go | go | 1,205 | no_license | package controller
import (
"runtime"
"sync"
"time"
"github.com/manucorporat/stats"
)
var (
ips = stats.New()
messages = stats.New()
users = stats.New()
mutexStats sync.RWMutex
savedStats map[string]uint64
)
func StatsWorker() {
c := time.Tick(1 * time.Second)
var lastMallocs uint64
var la... |
880f32dfbaf97cbf1dc6e66fcb704b2048f42f1b | 467ec0b1ba4db5bc8f6fac0be8c8202b1f55c5c7 | fstfwd/go-guerrilla | /response/enhanced.go | Go | go | 6,484 | permissive | package response
import (
"fmt"
"strconv"
)
const (
// ClassSuccess specifies that the DSN is reporting a positive delivery
// action. Detail sub-codes may provide notification of
// transformations required for delivery.
ClassSuccess = 2
// ClassTransientFailure - a persistent transient failure is one in whi... |
d4dea6788d9aa10daff78004cb321a1f5fb7da81 | 987f763da23ee15b293984039db1cd32bb9cec70 | tarekbadrshalaan/modelgen | /modelgen-concept/concept-api/api/StoreAPI.go | Go | go | 3,125 | permissive | package api
import (
"fmt"
"net/http"
"github.com/tarekbadrshalaan/modelgen/modelgen-concept/concept-api/bll"
"github.com/tarekbadrshalaan/modelgen/modelgen-concept/concept-api/dto"
"github.com/tarekbadrshalaan/modelgen/modelgen-concept/concept-api/logger"
"github.com/julienschmidt/httprouter"
)
func configS... |
b5b7de2a156881a14cc10ea6d7844d1f9a76c73e | 5144eec80dd657f4eaea2056c1bbf8f426ac8719 | bivas/rivi | /pkg/engine/rule.go | Go | go | 2,686 | permissive | package engine
import (
"fmt"
"sort"
"github.com/bivas/rivi/pkg/engine/actions"
"github.com/bivas/rivi/pkg/types"
"github.com/bivas/rivi/pkg/util/log"
"github.com/mitchellh/multistep"
"github.com/spf13/viper"
)
var lr = log.Get("engine.rule")
type Rule interface {
Name() string
Order() int
Accept(meta typ... |
1e41eb5374b373fa9e26a3a828216efd0df9d914 | 5eee816850eac730459d22f69f2a74b770f30852 | alekssp3/go_tests | /multi/timer3.go | Go | go | 360 | no_license | package main
import (
"fmt"
"sync"
"time"
)
func main() {
tick := time.NewTicker(time.Second)
defer tick.Stop()
wg := new(sync.WaitGroup)
for i := 1; i <= 5; i++ {
wg.Add(1)
go worker(i, tick.C, wg)
}
wg.Wait()
}
func worker(i int, c <-chan time.Time, wg *sync.WaitGroup) {
defer wg.Done()
<-c
fmt.Pr... |
56ee1ab4bd3c99d416d463a9be9e88a29c56fe4b | 9837f0b3f020b826a15cadd81cfd8ff768906e72 | Insperias/l2-golang | /develop/dev09/task_test.go | Go | go | 932 | no_license | package main
import (
"os"
"testing"
)
func TestDownloadPage(t *testing.T) {
url := "https://www.wildberries.ru"
err := wget(url, "")
if err != nil {
t.Errorf("can't download: %s", err)
}
}
func TestDownloadFile(t *testing.T) {
url := "https://golang.org/dl/go1.15.2.linux-amd64.tar.gz"
err := wget(url, "... |
a54c08ca7d539622207a98659aeeb901be4f371c | ced2b659dfaa214c10096adcf86b78675fd5fcad | mpetri/sturdy-robot | /sampleproj.go | Go | go | 2,545 | no_license | package main
import (
"bufio"
"flag"
"fmt"
"log"
"os"
"path/filepath"
"regexp"
"strings"
"time"
)
type txtFile struct {
fname string
lineCount int
wordCount int
}
func lineWordCounter(fname, keyWord string) (int, int, error) {
file, err := os.Open(fname)
if err != nil {
log.Fatal(err)
}
defer f... |
bfedc1cfb3b8cfc9567534b90921334d75145566 | 6de751a00df7d8d1837068bd039839c1d194e6df | tompao/ui | /dialog_darwin.go | Go | go | 1,440 | permissive | // 2 march 2014
package ui
import (
// ...
)
// #cgo LDFLAGS: -lobjc -framework Foundation -framework AppKit
// #include "objc_darwin.h"
import "C"
// NSAlert styles.
const (
_NSWarningAlertStyle = 0 // default
_NSInformationalAlertStyle = 1
_NSCriticalAlertStyle = 2
)
var (
_NSAlert = objc_getClass("NSAler... |
4882574d4046caec8014c985692029e12f3e31f5 | 6d2f1a2a7b593e9a9c1e996b773b8744d6400367 | adrianpozueco/go-ase | /examples/eedexample/main.go | Go | go | 1,864 | permissive | // SPDX-FileCopyrightText: 2020 SAP SE
// SPDX-FileCopyrightText: 2021 SAP SE
//
// SPDX-License-Identifier: Apache-2.0
// This example shows how to retrieve the wrapped tds.EEDError to access
// messages sent by the TDS server in the context of an SQL statement.
package main
import (
"database/sql"
"errors"
"fmt"... |
2c9e154de81878d02a67fba9c88d842e0d266880 | cd0a15c159f3ad35fa741c26d9adfff87c6c1b2c | huaweicloud/huaweicloud-sdk-go-v3 | /services/iotedge/v2/model/model_add_device_request.go | Go | go | 486 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// AddDeviceRequest Request Object
type AddDeviceRequest struct {
// 边缘节点ID
EdgeNodeId string `json:"edge_node_id"`
Body *AddDeviceRequestBody `json:"body,omitempty"`
}
func (o AddDeviceRequest) String() string {
da... |
8faa0580a96e9df8093be41520baef6352b2e198 | 35ae60cbf289eee71ac8ff72b66b471f0a7e838a | dkeza/golearnsnippets | /print/main.go | Go | go | 294 | permissive | package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Hello")
fmt.Println("Hello, there")
fmt.Println("Hello", "there")
fmt.Print("Hi\n")
fmt.Printf("Hello, %s", "there", "\n")
s := fmt.Sprintln("One", "Two", "Three")
fmt.Print(s)
fmt.Fprint(os.Stdout, "Hi from Fprint")
}
|
b91f8a7891823b55bd232c752f0c50060fc4bc40 | 5a9907f7c0bea6dbae3a96425ee27cbee5583413 | Dagnirko/singularity | /cmd/internal/cli/actions.go | Go | go | 7,420 | permissive | // Copyright (c) 2020, Control Command Inc. All rights reserved.
// Copyright (c) 2018-2021, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE.md file distributed with the sources of this project regarding your
// rights to use or distribute this s... |
20725608b011819ffec86dcae1ac78f2c220085a | 91b06239c5e009a507ce1c989f31fff629accb43 | goldencloud-io/simple-mockable-repository | /example/main_test.go | Go | go | 1,200 | no_license | package main
import (
"context"
"testing"
"pkg.goldencloud.dev/simple-mockable-repository/mockrepository"
_ "pkg.goldencloud.dev/simple-mockable-repository/mockrepository"
"pkg.goldencloud.dev/simple-mockable-repository/repository"
)
func Test_getActivateAccountID(t *testing.T) {
repo, err := mockrepository.Ne... |
2b4188e0bd841ff64de3a2a3278d40977e9ec383 | 490fe71febf3f8cec2c6ba937624095cfa97edab | kai-xx/addsvc-mini | /code/repositories/mysql.go | Go | go | 677 | no_license | package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", "homestead:secret@tcp(192.168.10.10:3306)/xz_local?charset=utf8")
if err != nil {
fmt.Println(err)
}
defer db.Close()
rows, err := db.Query("SELECT id,goods_id,name FROM cn_hcbuy_goods l... |
67b030b85b674b8eb78477529ec7d560d659d3df | 0053ed8c27019dd59eb90557bb0cb9cffc100b10 | S7evinK/dendrite | /internal/fulltext/bleve_wasm.go | Go | go | 1,936 | permissive | // Copyright 2022 The Matrix.org Foundation C.I.C.
//
// 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... |
ae1351391f2d0edb6bf17e443b7b22a0c4987a03 | b76ceaa63c4dc38260f62f7940a6f7f608ac8c93 | dyedu/dyf-sdk | /tools/common_test.go | Go | go | 1,502 | no_license | package tools
import (
"fmt"
"github.com/Centny/gwf/util"
"github.com/dyedu/dyf-sdk/config"
"gopkg.in/bson.v2"
"testing"
)
func TestCreateOpenAuthSign(t *testing.T) {
var (
res string
)
config.InitOpenAuthConf(bson.NewObjectId().Hex(), bson.NewObjectId().Hex(), 0)
if res = CreateOpenAuthSign("xx"); res !... |
534d39912a8a71c84ddb8756685964c35fba7403 | 5d715d2b77d45b34c29927ad1c4c04572e9829ce | bolcom/prometheus-remote-storage-adapter | /vendor/github.com/prometheus/prometheus/discovery/marathon/marathon.go | Go | go | 9,673 | permissive | // Copyright 2016 The Prometheus 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... |
74851aa3b1e069450cb18c473f86a736957a7ec2 | 05ed4a3020f843a6fe07f01322fb28c0dfc782dc | denizsokullu/cbordmock | /institution.go | Go | go | 2,196 | no_license | package main
import (
"encoding/json"
"net/http"
"github.com/google/uuid"
)
// Institution JSON representation
type Institution struct {
UUID string `json:"uuid"` // Instituion ID
Name string `json:"name"` // Institution full name. Suitable for display to users.
ShortName str... |
b7502c0b72527fa07726d9778db5e2a951f36a2b | 95d90ee8a64763ac7fabfd846524180e6efa39ae | uc-cdis/cdis-data-client | /gen3-client/g3cmd/delete.go | Go | go | 982 | permissive | package g3cmd
import (
"log"
"github.com/spf13/cobra"
)
//Not support yet, place holder only
var deleteCmd = &cobra.Command{ // nolint:deadcode,unused,varcheck
Use: "delete",
Short: "Send DELETE HTTP Request for given URI",
Long: `Deletes a given URI from the database.
If no profile is specified, "default" p... |
6533f758208a9debae5833a1c646564aff548f0d | 81a8288de9ecfe8d98405e49bb3b2d656a72c4be | kushal-dhar/Golang | /2_zerovalue.go | Go | go | 276 | no_license | package main
import (
"fmt"
)
var a int // Declare a variable of type int
var b string // Declare a variable of type string
var c int // Declare a variable of type int
func main() {
fmt.Print(a)
b := "Hello world"
fmt.Printf("\n%s\n", b)
c = 12
fmt.Println(c)
}
|
133338430ba3e26d5313a093d9feb4e042c99fcf | b548b5d92b053d1848e7900d34ac0b8b0619c087 | factly/dega-server | /test/service/core/search/list_test.go | Go | go | 1,807 | permissive | package search
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/factly/dega-server/service"
"github.com/factly/dega-server/test"
"github.com/gavv/httpexpect"
"gopkg.in/h2non/gock.v1"
)
func TestPostList(t *testing.T) {
mock := test.SetupMockDB()
test.MeiliGock()
test.KetoGock()
test.KavachGo... |
b2598c0f924c911480af940a528191e7b6c43207 | 67ff0b71c970e4aefdd6e91a4f43a65a6f11add3 | kubesphere/kubesphere | /pkg/controller/notification/notification_controller_test.go | Go | go | 10,467 | permissive | /*
Copyright 2020 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 writing, ... |
115ec6627048b3c78c7546d250de81dad56029a6 | 702cec10e874076d0f536802e1ffc93fb1d7775e | Mayankgupta688/WorkingWithGo | /creatingSampleHttpRequestParellel.go | Go | go | 670 | no_license | package main
import "encoding/json"
import "net/http"
import "io/ioutil"
import "fmt"
import "strconv"
import "time"
import "runtime"
func creatingSampleHttpRequestParellel() {
runtime.GOMAXPROCS(8)
for i := 1; i <= 10; i++ {
go func(index int) {
response, err := http.Get("http://5a530e1477e1d20012fa066a.moc... |
b99f7ced1e029bbcf3fca6e242d2b59be2a35dbe | defc23241bde4c05ea10370a4b0ada524f4d752c | kubernetes-sigs/gcp-compute-persistent-disk-csi-driver | /vendor/k8s.io/test-infra/prow/version/metrics.go | Go | go | 1,172 | 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, ... |
714400af5cd91c9548ac4768f4b580f94801613c | 6c7b9642651b1efa0528a426bd1444633d0062ae | shammishailaj/rain | /internal/announcer/dht.go | Go | go | 1,250 | permissive | package announcer
import (
"time"
"github.com/cenkalti/rain/internal/logger"
)
type DHTAnnouncer struct {
lastAnnounce time.Time
needMorePeers bool
needMorePeersC chan bool
closeC chan struct{}
doneC chan struct{}
}
func NewDHTAnnouncer() *DHTAnnouncer {
return &DHTAnnouncer{
needMoreP... |
89a16e76828b640287a62cc1370aa32b65e4f3fd | 9ccba121e53b556b8a151a87f8e807f0b867d7b7 | liubin/test-infra | /experiment/coverage/apicoverage.go | Go | go | 6,917 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
bf01ade79849d8eafc6b6848ba497fa45fb2c9ab | 7ea06c6069629feb90ac2e8804989d8a61d644df | ranakan19/odo | /vendor/github.com/docker/docker/integration/internal/container/container.go | Go | go | 1,539 | permissive | package container
import (
"context"
"runtime"
"testing"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"gotest.tools/assert"
)
// TestContainerConfig holds container configuration struct that
... |
b0e411dcab53d71044fe0544ae8dc234f4a77748 | 6ec2e00b5723bdc5268976976384ddb01729499d | joyoyoyoyoyo/fargate | /cmd/root.go | Go | go | 6,660 | permissive | package cmd
import (
"fmt"
"os"
"runtime"
"strconv"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/jpignata/fargate/console"
ECS "github.com/jpignata/fargate/ecs"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/termina... |
4446d1958c6d4a0e1048a82c65e8c27c7ebb73dc | 3c683565d7e8e5cbef8200d6ee0e8d37d77b5a8f | bhatneha/unpackker-api | /app/configapp.go | Go | go | 2,477 | no_license | package app
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"github.com/mitchellh/mapstructure"
)
const (
AppPort = "APP_PORT"
UIPort = "UI_PORT"
LogPath = "LOG_PATH"
UI = "UI"
AppConfig = "APP_CONFIG"
)
func (c *ConfigData) configLog() (io.Writer, error) {
if !statFile(os.Getenv(LogP... |
e2864a1f41f2081c6510e714d3add78582d25cb5 | 4c908afded668a421d2ca31e910d0e3aadc8e699 | Samuele-Mori/commercionetwork | /x/docs/internal/types/metadata_test.go | Go | go | 1,593 | permissive | package types
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestMetadataSchema_Equals(t *testing.T) {
tests := []struct {
name string
us MetadataSchema
other MetadataSchema
want bool
}{
{
"two equal MetadataSchemas",
MetadataSchema{
"type",
"schemaUri",
"version... |
7ed0317ca4eff457f2bed1f3d2d0f509ab4637e0 | 36a22af04b73ba56e55ce33b2d926c37dafa4bd8 | bozhidarG/go-pkgs | /task/retry.go | Go | go | 6,246 | permissive | // Copyright 2019 SumUp Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
818547c1a81085b0a7df1c7af653a483d86ecf3c | 1f9828897ae1d0449e5bece356dee53be331f8f6 | cjbrigato/descheduler | /pkg/api/types.generated.go | Go | go | 31,472 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
33818bed19b74760081ce63405ce833ae096eac7 | 1968381fc3343f2c972940c3a7577951b297fcd3 | jasonkuhrt/origin | /Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/health/tcp.go | Go | go | 2,650 | permissive | /*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... |
72318042242cb387c28e767e07c07a095786a070 | 88f77246f23c83cf5a8987cde73a11d4909b2864 | itcomputer12/cloudpods | /pkg/hostman/guestman/qemu-kvmhelper.go | Go | go | 23,523 | permissive | // Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
81db334d9aa131abba2cca52a604196eb7d3d522 | 1aeb96ce5e00e4a5ce4f39454af5d74929905220 | Narven/ggircd | /irc/config.go | Go | go | 1,436 | permissive | package irc
import (
"encoding/json"
"os"
)
// Config contains all of the configuration settings required to bring up a
// local irc server.
type Config struct {
Name string
Network string
Port int
SSLPort int
MOTD string
DefaultChannelMode string
DefaultUserMode string
SpoofHostName string
... |
dc1bb9a3e235aef445748e62dd2604afa2e00db9 | 5a7f7aba5ec744b48411ae24b0fd3f3f52286094 | DAD-Chain/dad-go | /smartcontract/service/native/states/contract.go | Go | go | 2,447 | no_license | /*
* Copyright (C) 2018 The dad-go Authors
* This file is part of The dad-go library.
*
* The dad-go is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your... |
63a9964a560ec99c5db82d0dcbd6fcc70973cbba | 6cd6e3f8d167df85b591bfe89f8d413d30376412 | pete-woods/profiling-demo | /words.go | Go | go | 468 | permissive | package profiling_demo
import (
"io"
"unicode"
)
func words(r io.Reader) (int, error) {
words := 0
inword := false
for {
r, err := readbyte(r)
if err == io.EOF {
break
} else if err != nil {
return 0, err
}
if unicode.IsSpace(r) && inword {
words++
inword = false
}
inword = unicode.IsL... |
87a0303b11045d9cd4136189e50d295d8d8ebb98 | bab556c2572c3ce15bd3362add9cf9a3ce35caa5 | jwmdev/go-simplechain | /core/block.go | Go | go | 2,249 | no_license | package core
import (
"crypto/ecdsa"
"errors"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/nacamp/go-simplechain/common"
"github.com/nacamp/go-simplechain/crypto"
"github.com/nacamp/go-simplechain/rlp"
)
// Simple Header
type Header struct {
ParentHash common.Hash
Coinbase common... |
0eba875756d04bc010b2c26c0e5e5aa5a4de0424 | 43ab255d8994d7b4d18eae4d47a46fde385bc80d | ziokuroi/minecraft | /protocol/types/long.go | Go | go | 287 | permissive | package types
import (
"encoding/binary"
"io"
)
type Long int64
func (_ Long) Decode(r io.Reader) (interface{}, error) {
var l Long
err := binary.Read(r, ByteOrder, &l)
return l, err
}
func (l Long) Encode(w io.Writer) (int, error) {
return 8, binary.Write(w, ByteOrder, l)
}
|
d3f777672974166f1d92022c4d603e1f7dcefffa | 148a2ea7b4376427eaed9bf71626a9a5ebb86c8a | go-hep/croot | /cmem/value_test.go | Go | go | 19,332 | no_license | package cmem_test
import (
//"fmt"
"reflect"
"testing"
//"unsafe"
"github.com/go-hep/croot/cmem"
)
func TestGetSetBuiltinValue(t *testing.T) {
{
const val = 42
for _, tt := range []struct {
n string
t cmem.Type
val interface{}
}{
{"int", cmem.C_int, int64(val)},
{"int8", cmem.C_int8, ... |
db4427416956a191e22fa0b21901adea47801e15 | d38c610045d9a74558aa9f27d542e8943f2299cf | mgarcia0094/fastml | /sample.go | Go | go | 303 | permissive | package fastml
import (
"fmt"
"gonum.org/v1/gonum/mat"
)
func matPrint(X mat.Matrix) {
fa := mat.Formatted(X, mat.Prefix(""), mat.Squeeze())
fmt.Printf("%v\n", fa)
}
func CreateVector() (*mat.VecDense) {
u := mat.NewVecDense(3, []float64{1, 2, 3})
//println("u: ")
//matPrint(u)
return u
}
|
4d9c09516c221a1a205b6ea3b1d5e9c56fc148fc | acb1f45e8fe0690e37695055126b1e6741bf1a07 | pohannigansfx/signalfx-agent | /pkg/monitors/vsphere/service/inventory_test.go | Go | go | 2,032 | permissive | package service
import (
"testing"
"github.com/signalfx/signalfx-agent/pkg/monitors/vsphere/model"
"github.com/stretchr/testify/require"
)
func TestRetrieveInventory(t *testing.T) {
gateway := newFakeGateway(1)
svc := NewInventorySvc(gateway, testLog)
inv, _ := svc.RetrieveInventory()
requireClusterHost(t, in... |
792a7d0e4e609c6306c436023b1c0ad8b0c25dd7 | f6cebb9055373f602f1835d638a7192dd936e679 | sshyran/go-1 | /src/pkg/exec/exec_test.go | Go | go | 5,066 | permissive | // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package exec
import (
"bufio"
"bytes"
"fmt"
"io"
"testing"
"os"
"strconv"
"strings"
)
func helperCommand(s ...string) *Cmd {
cs := []string{"-test.ru... |
0f25f760c4c70d9466c044393f52c1d41b10a8e8 | 6c89ac5935db12e739e0c5a239438fdb137af658 | seong889/quic-go | /congestion/cubic_sender.go | Go | go | 10,400 | permissive | package congestion
import (
"time"
"github.com/seong889/quic-go/internal/protocol"
"github.com/seong889/quic-go/internal/utils"
)
const (
maxBurstBytes = 3 * protocol.DefaultTCPMSS
defaultMinimumCongestionWindow protocol.PacketNumber = 2
renoBeta flo... |
db45410c62c43b34ba8f13c969d4deb3603d4885 | 300e7295bae4fddddeb2d8385e9d9bbcc270394c | atsaki/go-cloudstack | /cloudstack/cloudstack.go | Go | go | 22,431 | 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... |
a87c79238b10d8a1f7bfcf70e3a639424bb94f33 | b4b5ae0d75b59b8ad705dbb7f7d831a4e855797e | mr337/mymove | /pkg/handlers/internalapi/backup_contacts.go | Go | go | 5,888 | permissive | package internalapi
import (
"reflect"
"github.com/go-openapi/runtime/middleware"
"github.com/gofrs/uuid"
"github.com/honeycombio/beeline-go"
backupop "github.com/transcom/mymove/pkg/gen/internalapi/internaloperations/backup_contacts"
"github.com/transcom/mymove/pkg/gen/internalmessages"
"github.com/transcom/... |
f354bc3dc24fa4c7880ba457ec6a8e6c2a2b5bcf | c9c3fd26e25de9079778323847c6899cec730bdc | Cloud-Foundations/keymaster | /cmd/keymasterd/authToken.go | Go | go | 6,738 | permissive | package main
import (
"fmt"
"net/http"
"strconv"
"time"
"github.com/Cloud-Foundations/keymaster/lib/instrumentedwriter"
"github.com/Cloud-Foundations/keymaster/lib/paths"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
)
func (state *RuntimeState) generateAuthJWT(username string) (string, error... |
6bdc9b68df4c2cbe20f781e042a0a81549665be2 | 1ed1055ca47e075948d806e470d6a80797491b85 | james-ray/tendermint | /test/e2e/app/app.go | Go | go | 10,465 | permissive | package app
import (
"bytes"
"encoding/base64"
"errors"
"fmt"
"path/filepath"
"sort"
"strconv"
"sync"
"github.com/tendermint/tendermint/abci/example/code"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/proto/tendermint/types... |
f79aa4c0cafceff343ceb95439de69f18f57edcf | f8eb022cb97b1e496c3e0c661e6aebe2765a60fd | machmum/lib-simple | /context/context.go | Go | go | 584 | no_license | package libctx
import "context"
const RequestID = "id"
type ReqIDContextKey string
// NewRequestIDContext returns a new Context carrying requestID.
func NewRequestIDContext(ctx context.Context, requestID string) context.Context {
k := ReqIDContextKey(RequestID)
return context.WithValue(ctx, k, requestID)
}
// Fr... |
6e9816c42342a3f990257569cf7701ffe42a92f1 | 5dcb81e30aceb4a1502735c9b8521dd6e39e62a4 | icholy/nick_bot | /faceutil/utils.go | Go | go | 2,034 | permissive | package faceutil
import (
"image"
"image/color"
"image/draw"
"math"
)
type ByCenterY []image.Rectangle
func (b ByCenterY) Len() int {
return len(b)
}
func (b ByCenterY) Swap(i, j int) {
b[i], b[j] = b[j], b[i]
}
func (b ByCenterY) Less(i, j int) bool {
var (
p1 = getRectCenter(b[i])
p2 = getRectCenter(b... |
ec479e6117ba0debe670dd01546b8b1b55792da8 | 81b43dcc31135a1556d81b990f582b78f15f37b0 | lmm/calico | /felix/bpf/arp/map.go | Go | go | 2,729 | permissive | // Copyright (c) 2020 Tigera, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applica... |
214d92aca35633be37c5ff729ddf14577c625220 | 1bbc91de7195ea1207f2afe26e59c110977adf51 | cihangir/vitess | /go/rpcwrap/jsonrpc/wrapper.go | Go | go | 994 | permissive | // Copyright 2012, Google 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 jsonrpc provides wrappers for json rpc communication
package jsonrpc
import (
"crypto/tls"
"time"
rpc "github.com/youtube/vitess/go/rpcplus"
oldjs... |
36875543316ab715026676304819374c681fb4b8 | ec03ea8e1c461070b977dc4aa503a152ce99391d | kokizzu/UVa | /10497/10497.go | Go | go | 551 | permissive | // UVa 10497 - Sweet Child Makes Trouble
package main
import (
"fmt"
"math/big"
"os"
)
const max = 800
var f = func() []big.Int {
f := make([]big.Int, max+1)
f[0].SetInt64(0)
f[1].SetInt64(0)
f[2].SetInt64(1)
for i := 3; i <= max; i++ {
f[i].Add(&f[i-1], &f[i-2]).Mul(&f[i], big.NewInt(int64(i-1)))
}
ret... |
86d1b8a6e52b393525f9f3eaa3875d9d51aaa9ed | a2cfae12f78592ce5fa4a4b110f5d81b44c73625 | pwaller/cgogen | /generator/gen_files.go | Go | go | 4,428 | permissive | package generator
import (
"fmt"
"io"
"strings"
"time"
)
func genLabel() string {
tpl := "WARNING: This file has automatically been generated on %s.\nBy https://git.io/cgogen. DO NOT EDIT."
return fmt.Sprintf(tpl, time.Now().Format(time.RFC1123))
}
func (gen *Generator) WriteDoc(wr io.Writer) bool {
var hasDo... |
ddac2817510c2997081f941154be56e2eabbbfb0 | d08cb941b02a520078fd12a62a337249eff54c96 | hyperledger-labs/fabric-block-archiving | /core/chaincode/lifecycle/cache.go | Go | go | 23,691 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package lifecycle
import (
"fmt"
"sort"
"strconv"
"sync"
lb "github.com/hyperledger/fabric-protos-go/peer/lifecycle"
"github.com/hyperledger/fabric/common/chaincode"
"github.com/hyperledger/fabric/common/util"
"github.com/hyp... |
1e69c1043ed84d6e6583bdc1d2f62cd795b17cac | 7d8884750ab6fe3c9d3490d9bb10abed1c4f4a0d | NobuyukiInoue/LeetCode | /Problems/2000_2099/2099_Find_Subsequence_of_Length_K_With_the_Largest_Sum/Project_Go/solution/solution.go | Go | go | 1,153 | no_license | package solution
import (
"fmt"
"sort"
"strconv"
"strings"
"time"
)
func maxSubsequence(nums []int, k int) []int {
// 5ms
n := len(nums)
ans := []int{}
tmp := make([][2]int, n)
for i, v := range nums {
tmp[i][0], tmp[i][1] = v, i
}
sort.Slice(nums, func(i, j int) bool { return nums[i] > nums[j] })
so... |
3d7489b3d629f99452c18ec5633784051a191ea8 | b94116151e092dc72b903babe5c6e29d3de0be77 | HenryNguyen5/chainlink | /core/chains/evm/client/client.go | Go | go | 12,425 | permissive | package client
import (
"context"
"math/big"
"strings"
"time"
"github.com/smartcontractkit/chainlink/core/assets"
evmtypes "github.com/smartcontractkit/chainlink/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/core/logger"
"github.com/smartcontractkit/chainlink/core/utils"
"github.com/ethereum... |
e4773200b118c9646214fafcc26a0d06655be34b | 8bb33290cbd3f3943bc474d4cdc85c3880a9168f | thinker0/pulsar-beat-output | /vendor/gopkg.in/goracle.v2/z_heterogeneous_test.go | Go | go | 2,643 | permissive | // Copyright 2018 @wwanderley
//
//
// 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 ... |
c6fd4832af554545f0240b56d177e89c8a534822 | ed011de0862afd7f78b1cacc6f6b1d8282de0148 | imaginaryusername/openbazaar-go | /repo/currency_test.go | Go | go | 1,459 | permissive | package repo_test
import (
"testing"
"github.com/OpenBazaar/openbazaar-go/repo"
)
func TestNewCurrencyCode(t *testing.T) {
var examples = []struct {
expectErr error
expectString string
input string
}{
{
expectErr: nil,
expectString: "BTC",
input: "btc",
},
{
expectErr:... |
ed280cda441160e52446603b8a34986e9d6515f6 | 69d9aceddd12f87286efeca4c891235551a0363a | pk80/golang | /project1/first_main.go | Go | go | 401 | no_license | package _1
import (
"log"
"os"
"text/template"
)
var tpl *template.Template
func init() {
tpl = template.Must(template.ParseFiles("first_tpl.gohtml"))
}
type client struct {
Uname string
Pwd string
}
func main() {
c1 := client{"Praveen", "12345"}
c2 := client{"Vasu", "67890"}
clients := []client{c1, c2}... |
38ea34168776f8b21f16c014acb82fa568b722e8 | fdd2397b241991c64736ae0b53a6cd539729fef4 | Mumakil/captainhub | /main.go | Go | go | 7,347 | permissive | package main
import (
"crypto/hmac"
"crypto/sha1"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
"github.com/orktes/captainhub/Godeps/_workspace/src/github.com/garyburd/redigo/redis"
"github.com/orktes/captainhub/Godeps/_workspace/src/github.com/google/go-github/github"
"github.co... |
8711b484bc948c877ec8708987f84dafee158aa3 | adeb9c285274626e357aa4d887d92de472cc59bd | astromechza/go | /src/syscall/syscall_freebsd.go | Go | go | 15,066 | permissive | // Copyright 2009,2010 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.
// FreeBSD system calls.
// This file is compiled as ordinary Go code,
// but it is also input to mksyscall,
// which parses the //sys lines and generates ... |
b0c5da32835d1938cc9acd36dee777c9e5e510d1 | a1ec099371656f109f16a3da1bbf74d0a562dc98 | f3rcho/web-server | /web_server/middleware.go | Go | go | 570 | permissive | package main
import (
"fmt"
"log"
"net/http"
"time"
)
func CheckAuth() Middleware {
return func(f http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
flag := true
fmt.Println("Checking Authentication...")
if flag {
f(w, r)
} else {
return
}
}
}
}... |
ec7fe1e61d7e3f19d64a609e87e4d6f899950252 | dd70f38dadc0f73ac57d89d50d579d1c7044d561 | supperdoggy/notes-project | /main/src/token.struct.go | Go | go | 2,383 | no_license | package main
import (
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"net/url"
"time"
)
type enterToken struct {
Token string `bson:"token" json:"token" form:"token"`
Limited bool `bson:"limited" json:"limited" form:"limited"`
SavedTime int64 `bson:"savedTime" json:"saved_time" form:"sa... |
da7564ed8b88f5dc7f825226b9a310a4bc417bce | bb86797de4cc088ed40b6e402af4a4bc7c176833 | paulbehrisch/terraform-provider-azuredevops | /azuredevops/internal/client/client.go | Go | go | 7,837 | permissive | package client
import (
"context"
"fmt"
"log"
"os"
"strings"
"github.com/hashicorp/terraform-plugin-sdk/httpclient"
"github.com/microsoft/azure-devops-go-api/azuredevops"
"github.com/microsoft/azure-devops-go-api/azuredevops/build"
"github.com/microsoft/azure-devops-go-api/azuredevops/core"
"github.com/micr... |
54a572c2717b279ea371961545b4fdc4928f3ed9 | d0bb25e80d697757e333560f9055580b4dad0f83 | morrell/pulumi-azure-native | /sdk/go/azure/containerregistry/v20171001/registry.go | Go | go | 7,725 | 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 v20171001
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// An object that represents a container... |
28a79b05c241f0dacc207343dc487f1c19ee6de5 | a7937d9a70bd34f71129d3ca14f37a3dfa506bae | rlan35/harmony | /numeric/decimal_test.go | Go | go | 13,842 | permissive | package numeric
import (
"math/big"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// create a decimal from a decimal string (ex. "1234.5678")
func mustNewDecFromStr(t *testing.T, str string) (d Dec) {
d, err := NewDecFromStr(str)
require.NoError(t, err)
return d
}
//_... |
ca0eb7181707c95f0853ddd4f742c14648b2df08 | 2e2344ccc870a964eb20871bbd9460f338785fc7 | singchia/gopacket | /layers/icmp4.go | Go | go | 8,164 | permissive | // Copyright 2012 Google, Inc. All rights reserved.
// Copyright 2009-2011 Andreas Krennmair. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.
package layers
import (
"encoding/binary"
"errors"
"fmt"
"... |
445ba8d3780a5fdc28750e8bfe2753c2cdfec435 | a95547cd8b11a7daffbe375b03745a18c4be8934 | dieunb/go_training | /pkg/controllers/sessions_controller.go | Go | go | 1,242 | no_license | package controllers
import (
"fmt"
"net/http"
"github.com/dieunb/go_training/configs"
"github.com/dieunb/go_training/pkg/views"
"github.com/gorilla/sessions"
)
var (
// key must be 16, 24 or 32 bytes long (AES-128, AES-192 or AES-256)
key = []byte(configs.SecretKey())
store = sessions.NewCookieStore(key)
)... |
67dcf8b916a17d6fa973c332073e458181075e2c | 89ce8046122cd64f713c1dfe0aa68342ed8401a6 | cuisongliu/cri-o | /internal/lib/conmonmon.go | Go | go | 5,216 | permissive | package lib
import (
"strconv"
"sync"
"time"
"github.com/containers/psgo"
"github.com/cri-o/cri-o/internal/oci"
"github.com/cri-o/cri-o/pkg/config"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
// the time between checking the registered conmons
var sleepTime = 5 * time.Minu... |
be40f10992e5660451367415df0f21d2d32caca3 | 223fc31659913c16629d81ad11546e72a17d3477 | muplim/tfsec | /vendor/github.com/owenrumney/go-sarif/sarif/sarif.go | Go | go | 1,378 | permissive | package sarif
import (
"encoding/json"
"errors"
"fmt"
"io"
"github.com/owenrumney/go-sarif/models"
)
type Version string
const Version210 Version = "2.1.0"
var versions = map[Version]string{
Version210: "http://json.schemastore.org/sarif-2.1.0-rtm.4",
}
type Report struct {
Version string `json:"ver... |
7b6292f993459748d1d55a197d2f81202e911a33 | 3c9e74b590290335d2cfcaecf155bc2e6135764a | goodforever/gotrue | /api/middleware.go | Go | go | 4,373 | permissive | package api
import (
"bytes"
"context"
"io"
"io/ioutil"
"net/http"
jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
)
const (
jwsSignatureHeaderName = "x-nf-sign"
)
type NetlifyMicroserviceClaims struct {
jwt.StandardClaims
SiteURL string ... |
f2305cbe8439a5ac9f8fb48448828e00a58b704e | bed14f2c9d4c806c8bf332049b1d85867979ac15 | weaveworks/goformation | /cloudformation/wafv2/aws-wafv2-webacl_managedrulegroupstatement.go | Go | go | 2,337 | permissive | package wafv2
import (
"github.com/weaveworks/goformation/v4/cloudformation/types"
"github.com/weaveworks/goformation/v4/cloudformation/policies"
)
// WebACL_ManagedRuleGroupStatement AWS CloudFormation Resource (AWS::WAFv2::WebACL.ManagedRuleGroupStatement)
// See: http://docs.aws.amazon.com/AWSCloudFormation/lat... |
9abd48a58484753c26fcf744b3388484442d89e6 | 943981757022929db56585bce69b13f7ec268fc8 | zachblizz/code-war-katas | /medium/zigzag-conversion/main_test.go | Go | go | 642 | no_license | package main
import "testing"
func Test_convert(t *testing.T) {
type args struct {
s string
numRows int
}
tests := []struct {
name string
args args
want string
}{
{
"first",
args{"HELLO", 3},
"HOELL",
},
{
"second",
args{"PAYPALISHIRING", 3},
"PAHNAPLSIIGYIR",
},
{
"... |
d09ceee3e33feb530ef3d524eb1774c2733d0eb0 | 2a68a75f6ceb3c7c0de5558a947af808063dbb2a | ucloud/ucloud-cli | /cmd/disk.go | Go | go | 27,712 | permissive | // Copyright © 2018 NAME HERE tony.li@ucloud.cn
//
// 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 la... |
4cc64630fb92ff8a40a094a67200a2361231cd46 | 4b91705006059b88ab08a1c75bb7e5c3708896dc | joelrebel/actor | /vendor/github.com/bmc-toolbox/bmclib/providers/dell/idrac8/actions.go | Go | go | 3,306 | permissive | package idrac8
import (
"fmt"
"net/url"
"strings"
)
// PowerCycle reboots the machine via bmc
func (i *IDrac8) PowerCycle() (status bool, err error) {
err = i.sshLogin()
if err != nil {
return status, err
}
output, err := i.sshClient.Run("racadm serveraction hardreset")
if err != nil {
return false, fmt.... |
c741bd53050fc54e50e05e25261649fc94c45149 | d3d9fc28ef07bbd8b24f047dc95920e15b2a4ac3 | markcol/gam | /supervision.go | Go | go | 1,148 | permissive | package gam
type Directive int
const (
ResumeDirective Directive = iota
RestartDirective
StopDirective
EscalateDirective
)
type Decider func(child ActorRef, cause interface{}) Directive
type SupervisionStrategy interface {
Handle(child ActorRef, cause interface{}) Directive
}
type OneForOneStrategy struct {
... |
75750010a40420696026d457a9c6222e50b2cc66 | 425f0d8da9dedb6e3198ae4a0be4c2f57cd4b4c4 | Patrick-Park/cockroach | /storage/store.go | Go | go | 83,813 | permissive | // Copyright 2014 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.