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 |
|---|---|---|---|---|---|---|---|---|
cf1d94c11d81c1c7b3c5eea7860571d75100ceb1 | 220c6d78dea32fad13f9b20a4d6f457a362054b3 | radekg/terraform-state-ansible-module | /vendor/github.com/svanharmelen/jsonapi/examples/fixtures.go | Go | go | 997 | permissive | package main
import "time"
func fixtureBlogCreate(i int) *Blog {
return &Blog{
ID: 1 * i,
Title: "Title 1",
CreatedAt: time.Now(),
Posts: []*Post{
&Post{
ID: 1 * i,
Title: "Foo",
Body: "Bar",
Comments: []*Comment{
&Comment{
ID: 1 * i,
Body: "foo",
},
... |
57d4fc90cbf6274d2700771aaadea6802262558e | 5da165543b4ec8f589eb406c15883c303b14940d | lhchavez/go-langserver | /vendor/github.com/keegancsmith/tmpfriend/tmpfriend.go | Go | go | 2,433 | permissive | package tmpfriend
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
"strconv"
"syscall"
)
var dirRe = regexp.MustCompile(`^tmpfriend-([0-9]+)-.*$`)
// SetupOrNOOP is the expected way to use tmpfriend. It is a wrapper around
// RootTempDir and IsTmpFriendDir. It will always return a cleanup funct... |
b0452f525b57d869d1254c079a79d62a53b0cec2 | 4b2447d33dbdd1bbe1469e840b8ba7857c10d616 | uk-gov-mirror/ONSdigital.dp-observation-extractor | /config/config_test.go | Go | go | 1,441 | permissive | package config_test
import (
"os"
"testing"
"time"
"github.com/ONSdigital/dp-observation-extractor/config"
. "github.com/smartystreets/goconvey/convey"
)
func TestSpec(t *testing.T) {
Convey("Given an environment with no environment variables set", t, func() {
os.Clearenv()
cfg, err := config.Get()
Co... |
291977bce0cd2f3f0af21e7c72b0679359880500 | 9d41ba648c1e79e129a33ee6024e4f234cc7f7c3 | Bhanditz/hydra | /oauth2/revocator_test.go | Go | go | 3,845 | permissive | /*
* Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* 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... |
de414c4eaec7f5dd20fb7483f4a15a2dfe43b5e0 | 4e18e3f6ab81d2549d8feadd8053de6d939d581b | mentos1386/mutagen | /pkg/sync/path.go | Go | go | 462 | permissive | package sync
// pathJoin is a fast alternative to path.Join that avoids the unnecessary path
// cleaning overhead incurred by that function. It is only for Mutagen's
// in-memory paths, not filesystem paths, for which path/filepath.Join should
// still be used.
func pathJoin(base, leaf string) string {
// When joinin... |
f9d8182cb599b4befcc9eb26033a5694bc9489d7 | ff020d920c5d9fd167807c276d9f1cace4e576d7 | levin9/go-admin | /internal/app/model/impl/gorm/internal/model/m_user.go | Go | go | 6,703 | permissive | package model
import (
"context"
"github.com/levin9/go-admin/internal/app/errors"
"github.com/levin9/go-admin/internal/app/model/impl/gorm/internal/entity"
"github.com/levin9/go-admin/internal/app/schema"
"github.com/jinzhu/gorm"
)
// NewUser 创建用户存储实例
func NewUser(db *gorm.DB) *User {
return &User{db}
}
// Us... |
077b936e0929eb4f56c276e7bc4dca768c18d8a2 | ed29a4729cc44b3199d87ac2adf3ca626a35f323 | thecodedproject/crypto | /types_test.go | Go | go | 693 | no_license | package crypto_test
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
"github.com/thecodedproject/crypto"
)
func TestMarshalMapWithExchangeAsKey(t *testing.T) {
m := map[crypto.Exchange]int{
{
Provider: crypto.ApiProviderBinance,
Pair: crypto.PairBTCEUR,
}: 0,
}
_, err :... |
4ea5e52207bcfc4333613e74f9542a5a457da95b | e2b4de1c28b12bcab5b7926f71f76ab110a2af5e | lwrabbit/algorithm009-class01 | /Week_02/49_test.go | Go | go | 511 | no_license | /*
给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。
示例:
输入: ["eat", "tea", "tan", "ate", "nat", "bat"]
输出:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
说明:
所有输入均为小写字母。
不考虑答案输出的顺序
*/
package main
import (
"fmt"
"testing"
)
func TestGroupAnagrams(t *testing.T) {
str := []string{"eat", "tea", "tan", "ate", "nat... |
a7232f72323a594c8debc80c7e08784c35058492 | 72ee410ad39df03df579325f7aa525ee2260e049 | VINXIS/maquiaBot | /osu-tools/beatmapParse.go | Go | go | 3,158 | no_license | package osutools
import (
"math"
"sort"
"strconv"
osuapi "maquiaBot/osu-api"
)
// BeatmapParse parses beatmap and obtains the .osu file
func BeatmapParse(id, format string, mods *osuapi.Mods) (beatmap osuapi.Beatmap) {
mapID, err := strconv.Atoi(id)
if err != nil {
return beatmap
}
if format == "map" {
... |
634ba4b79d8120a593dc4d0c1e923b88aadf2367 | 45776d6f72142067deed363f13e7d150e1b7abc5 | datawire/pf | /rule_set.go | Go | go | 2,133 | permissive | package pf
import (
"fmt"
"unsafe"
)
// #include <sys/ioctl.h>
// #include <net/if.h>
// #include <net/pfvar.h>
import "C"
// RuleSet represents a pf rule set that is a collection of
// rules
type RuleSet struct {
tx Transaction
wrap *C.struct_pfioc_trans_e
}
// RuleSetType is the type of a given rule set
typ... |
558b82e39ab72aca91fcea95b4609687b182a9ae | 1a71aad1a40668af94a48cb69cad2571a28f5ae5 | aarzilli/advent_of_code_2018 | /03.go | Go | go | 2,389 | no_license | package main
import (
"fmt"
"io/ioutil"
"strconv"
"strings"
)
func must(err error) {
if err != nil {
panic(err)
}
}
// returns x without the last character
func nolast(x string) string {
return x[:len(x)-1]
}
// splits a string, trims spaces on every element
func splitandclean(in, sep string, n int) []stri... |
4ad9f362295c1f6aa7202f7884c51fc8954746db | 8a39d05cb84c959aea5812d02b905c329eba4052 | johnbirdau/pulumi-azure-native | /sdk/go/azure/web/webAppDomainOwnershipIdentifierSlot.go | Go | go | 8,131 | 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 web
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A domain specific resource identifier.
// A... |
2014ab93d5c22971553bc960aa4d6fb5a62131df | 75335c48aeb8417b21fafd050ce16f325d89269c | allen13/golerta | /vendor/gopkg.in/dancannon/gorethink.v2/internal/reql_tests/common.go | Go | go | 6,573 | permissive | package reql_tests
import (
"fmt"
"math"
"reflect"
"regexp"
"strings"
"time"
"github.com/stretchr/testify/suite"
r "gopkg.in/dancannon/gorethink.v2"
"gopkg.in/dancannon/gorethink.v2/internal/compare"
)
func maybeRun(query interface{}, session *r.Session, opts r.RunOpts) interface{} {
switch query := query.... |
c1e43925ba161c13f56eb5fc0b5e72b67d44d2b2 | 4849cf0d6177ccf50f4ed0c2f41798405856e1cf | PureDu/ouster | /data/pcskillinfo.go | Go | go | 2,632 | no_license | package data
import (
"encoding/binary"
. "github.com/tiancaiamao/ouster/util"
"io"
)
type PCSkillInfo interface {
Write(io.Writer) error
Size() uint32
}
type VampireSkillInfo struct {
LearnNewSkill bool
SubVampireSkillInfoList []SubVampireSkillInfo
}
func (info VampireSkillInfo... |
1d3d27d20e6034e931604f4ce41dcac5c3949b98 | ddc397b95e787ef17d3bee1e72420fcdcbab69ea | joncui/AdventOfCode2018 | /day6/chronal-coordinates.go | Go | go | 4,051 | no_license | package main
import (
"fmt"
"io/ioutil"
"log"
"math"
"os"
"sort"
"strconv"
"strings"
)
var size = 350
var lessThan = 10000
type coordinateType struct {
x, y int
}
func check(e error) {
if e != nil {
log.Fatal(e)
}
}
func main() {
file := "data"
if len(os.Args) > 1 {
file = os.Args[1]
}
rawData,... |
8809691d5c85615fab23acf19359d11f7c4f0afd | e07ae87795eca87718cf2c571924137cae3fdbee | slievrly/seata-golang | /pkg/datasource/sql/undo/builder/mysql_delete_undo_log_builder.go | Go | go | 3,725 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
996bc36206dc1c75d4c57869508d5b6a8ee95696 | 4bbfa3909210193753682813966f9db35535f944 | angleguan/zipper | /peer/proto/message.go | Go | go | 562 | permissive | package proto
import "github.com/golang/protobuf/proto"
func NewMessage(header *Header, payload []byte) *Message {
//header.Magic = ""
return &Message{
Header: header,
Payload: payload,
}
}
func (msg *Message) Marshal() ([]byte, error) {
return proto.Marshal(msg)
}
func (msg *Message) Unmarshal(data []byte... |
c98476c394fc3fb545b1386607f18e4aa05b85e8 | ff7e80807c014267be0b40b8d5aa29cb67cdb24f | AllenZMC/Dragonfly | /supernode/server/router_test.go | Go | go | 3,349 | permissive | package server
import (
"encoding/json"
"io/ioutil"
"math/rand"
"net"
"net/http"
"runtime"
"strconv"
"testing"
"time"
"github.com/dragonflyoss/Dragonfly/apis/types"
cutil "github.com/dragonflyoss/Dragonfly/common/util"
"github.com/dragonflyoss/Dragonfly/supernode/config"
"github.com/dragonflyoss/Dragonfl... |
68996ce67d07e8b2a7eaeac80346cc832261147b | e396f264cc4470475dba898cc182dddfde73ba8d | luojinqq/kubernetes | /pkg/controller/petset/pet_set_test.go | Go | go | 7,744 | permissive | /*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
df9590fa3d8b530ecc39b15f36db8b0958785c77 | 96655b419128b2b18c746952ebbda34e3190cd47 | potsbo/gocc | /node/while.go | Go | go | 842 | no_license | package node
import (
"fmt"
"strings"
"github.com/srvc/fail"
)
type nodeWhile struct {
condition Generatable
stmt Generatable
}
func newWhile(c, stmt Generatable) Generatable {
return &nodeWhile{
condition: c,
stmt: stmt,
}
}
func (n *nodeWhile) Generate() (string, error) {
condition, err := ... |
6ab10cafcea76ec3684154b1a3367ff25ebf6ab3 | 7a0342ec05b2495e9b9b343b86ff83fbe8c3efc5 | 120189471/gosrc | /findFile/findFile.go | Go | go | 1,404 | no_license | package main
import (
"os"
"strings"
"fmt"
"path/filepath"
"log"
"io"
)
var (
ostype=os.Getenv("GOOS")
)
var listfile []string
var (
Trace *log.Logger // 记录所有日志
Info *log.Logger // 重要的信息
Warning *log.Logger // 需要注意的信息
Error *log.Logger // 致命错误
)
func init() {
file, err := os.OpenFile("run.log", ... |
eac5c27609210178bbc9f5910794efc65bc9988b | f17e13141613b8b1f571a189456c2b7fdcd1611e | w-Jelper/tools | /jose/middleware.go | Go | go | 6,094 | permissive | // Copyright 2020 SpotHero
//
// 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... |
cb9ccda3919bad2d12a58045c76b8289f45fb3d3 | 1daa26eb5f5c9c997e117dd02004af260afe6dee | destroyogi/gophercloud | /acceptance/openstack/clustering/v1/policytypes_test.go | Go | go | 1,646 | permissive | // +build acceptance clustering policytypes
package v1
import (
"testing"
"github.com/yogeshwargnanasekaran/gophercloud/acceptance/clients"
"github.com/yogeshwargnanasekaran/gophercloud/acceptance/tools"
"github.com/yogeshwargnanasekaran/gophercloud/openstack/clustering/v1/policytypes"
th "github.com/yogeshwarg... |
8b4705c52a1d9b8a17a54a2a48b195d622f253bc | 9f0a2bf71541e4c0d224e73b7a09834a4ec50558 | brolerbin/gvisor | /pkg/tcpip/transport/icmp/protocol.go | Go | go | 4,199 | permissive | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... |
f8614b3ded96c172a33f1cc27cb03e8f3a24381d | a4f17e8c424fcbafa621e6594cf3e6968a7fb954 | svishwanath-tw/desync | /store.go | Go | go | 2,653 | permissive | package desync
import (
"context"
"fmt"
"io"
"time"
)
// Store is a generic interface implemented by read-only stores, like SSH or
// HTTP remote stores currently.
type Store interface {
GetChunk(id ChunkID) (*Chunk, error)
HasChunk(id ChunkID) bool
io.Closer
fmt.Stringer
}
// WriteStore is implemented by st... |
151603dd009ca69f8cf7095995c4c24947413d05 | 24bb3394c467859f6bb9b1931066db70472e6c89 | david-apollo/learn_go | /crawler/engine/concurrent.go | Go | go | 1,422 | no_license | package engine
import (
"log"
)
// ConcurrentEngine type
type ConcurrentEngine struct {
Scheduler Scheduler
WorkerCount int
ItemChan chan Item
}
// Scheduler interface
type Scheduler interface {
ReadNotifier
Submit(Request)
WorkerChan() chan Request
Run()
}
// ReadNotifier interface
type ReadNotifier inte... |
3faf9e7d0aea50acaa99d7f9637c59bcdb073bf1 | d859fe9e8663c95d52dc582a835abfe6cb5472a1 | zerojuls/pulumi | /cmd/destroy.go | Go | go | 4,828 | permissive | // Copyright 2016-2018, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or... |
dbd5bf474e9feda791e4f696f438f9e42daf553b | 55e7c123cc6d56709a1dfa65049316e50849ffcb | tomeeek911/training2 | /05-part-exercises/10.go | Go | go | 377 | no_license | package main
import "fmt"
func main() {
x := map[string][]string{
`bond_james`: []string{`not stirred`, `martinies`, `women`},
`mm`: []string{`james_bond`, `literature`, `computer science`},
`no_dr`: []string{`being evil`, `ice cream`, `sunsets`},
}
delete(x, `bond_james`)
x[`tomasz`] = []stri... |
938b4320a2f1a30dca7e4e6003f7baa475a1cded | a38f109e6b3312b8d836c964e594c3f41ffa7b48 | one-one/go-test | /ch5/condition/condition_test.go | Go | go | 577 | no_license | package condition_test
import "testing"
func TestIfMultiSec(t *testing.T) {
if a := 1 != 2; a {
t.Log("1==1")
}
//if v,err := someFunc(); err == nil {
// t.Log(v)
//}else{
// t.Log()
//}
}
func TestSwitchMultiCase(t *testing.T) {
for i := 0; i < 5; i++ {
switch i {
case 0, 2:
t.Log("Even")
case 1... |
14bb27174b69c59200e7e06c85014a623e29d67e | 2ba1f51e9a24c763e5a472ffa5ff73d897f80eaf | NPC-Chain/npcchub | /cmd/iristool/main.go | Go | go | 542 | no_license | package main
import (
"os"
"github.com/NPC-Chain/npcchub/app"
debugcmd "github.com/NPC-Chain/npcchub/tools/debug"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"
)
func init() {
// sdk.InitBech32Prefix()
rootCmd.AddCommand(debugcmd.RootCmd)
}
var rootCmd = &cobra.Command{
Use: ... |
ce2faec7aa41a43a4ee8073aef4c373bf044fc1c | 9f6378075d7860b36dbf8b486a83eff048fea39a | fopiko/build | /internal/teaconfigs/widgets/widget.go | Go | go | 3,218 | permissive | package widgets
import (
"github.com/TeaWeb/build/internal/teaconfigs/shared"
"github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/files"
"github.com/iwind/TeaGo/lists"
"github.com/iwind/TeaGo/logs"
"github.com/iwind/TeaGo/utils/string"
"gopkg.in/yaml.v3"
"time"
)
// Widget定义
type Widget struct {
Id ... |
5b292fa6fedb4bf7b8ff74f5cbe31093743d8772 | d1828b16693a50760fca73721712a72268372ef2 | andylokandy/tinykv | /scheduler/tests/compatibility/version_upgrade_test.go | Go | go | 4,286 | no_license | // Copyright 2018 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... |
9205fa019638bdf5791e457d2235da2c9d047d75 | dd4125e1892cc33a55779e6866904e20f8af5508 | stv2509/checkport | /parsehcl/parsehcl.go | Go | go | 1,717 | no_license | package checkport
import (
i "checkport/init"
"fmt"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclsyntax"
"io/ioutil"
"log"
"strconv"
)
type Config struct {
ConnTimeout string `hcl:"ConnectTimeout"`
RepTimeout string `hcl:"RepeatTimeout"`
Hosts [... |
29a60bad9a3818d971b26becfe100cf17f2e9eb7 | b7ff1e013054083a11fb72c44694743c2a1a3fe3 | jvasile/go-ipfs | /core/commands/bitswap.go | Go | go | 5,785 | permissive | package commands
import (
"bytes"
"fmt"
"io"
cmds "github.com/ipfs/go-ipfs/commands"
bitswap "github.com/ipfs/go-ipfs/exchange/bitswap"
decision "github.com/ipfs/go-ipfs/exchange/bitswap/decision"
"gx/ipfs/QmPSBJL4momYnE7DcUyk2DVhD6rH488ZmHBGLbxNdhU44K/go-humanize"
cid "gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBd... |
59182e0aa5e8bebca71ad0941ca98b0b98391f7d | b1949de050c1fcdf672d02ed5b914f20d1dc8c1d | hamiltonsalazar/hamiltonsalazar.github.com | /GO Web/introduccion/09.-method.go | Go | go | 570 | no_license | package main
import(
"net/http"
"log"
"fmt"
)
func main(){
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){
fmt.Println("El método es "+ r.Method)
switch r.Method {
case "GET":
fmt.Fprintf(w, "Hola Mundo con el método Get.")
case "POST":
fmt.Fprintf(w, "Hola Mundo con el método Pos... |
bc9c16f0c8a32f9b0ffd0c83664d00547f8dcfea | d6f032b56c4a6e2b1f05ab3f68de98864f6437f8 | pisatoo/pst-master | /controllers/lxd_controller.go | Go | go | 2,349 | no_license | package controllers
import (
"log"
"net/http"
"strconv"
"time"
"github.com/gorilla/mux"
"github.com/pisatoo/pst-master/models"
"github.com/pisatoo/pst-master/repositories"
)
type LxdController struct {
repo repositories.LxdRepository
}
func NewLxdController(repo repositories.LxdRepository) LxdController {
... |
2ec1005494b812e0432bd12c84fc1d859513d73f | d7ad9c65691e09f09de06a9cf512929fa18e291e | shlao/origin | /pkg/oc/cli/admin/migrate/migrator.go | Go | go | 24,361 | permissive | package migrate
import (
"fmt"
"io"
"sort"
"strings"
"sync"
"time"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/cli-runtime/pkg/genericcliopti... |
95a8ad63d0ac373eafc907a914b8bc7fa4a6e6d2 | 034c42da37a8375cca0c66db3ce44a691327e1ad | yuxhe/go | /chatdb.go | Go | go | 3,182 | no_license | package main
import (
MongoUtil "mychatapp/mongoutil"
"time"
"gopkg.in/mgo.v2/bson"
)
/*
** getSystemParam 获取系统参数值
*/
func getSystemParam(db MongoUtil.Db, syscode string) string {
base := MongoUtil.BaseRepository{db, "sys_parameter"}
var p bson.M
p = base.FindOne(bson.M{"status": 0, "sysparamcode": syscode}... |
f56435866f4faa386551d66a39a2a1b3d7b40175 | a789fc70fd61dfa47db6a32eee7b826082e6bf3f | n8rzz/polar-bear | /strategy.go | Go | go | 1,517 | no_license | package main
import (
"encoding/json"
"io/ioutil"
"log"
"os"
)
type SignalComparisonAndValue struct {
Comparison string `json:"comparison"`
Value int `json:"value"`
}
type StrategySegmentParams struct {
CrossingType string `json:"crossing_type"`
FastPeriod int ... |
8d5d8b8f608318eb8f235db305b6f4f2009c08e9 | b68755c70211df7234dc2f27a8390ad44a37e0ae | stefan06ro/dex | /cmd/dex/config.go | Go | go | 11,350 | permissive | package main
import (
"encoding/base64"
"encoding/json"
"fmt"
"os"
"strconv"
"strings"
"golang.org/x/crypto/bcrypt"
"github.com/dexidp/dex/pkg/log"
"github.com/dexidp/dex/server"
"github.com/dexidp/dex/storage"
"github.com/dexidp/dex/storage/ent"
"github.com/dexidp/dex/storage/etcd"
"github.com/dexidp/d... |
9d070fd7f8b2c20c06d90a7caea4685a16fc934c | 3e28ed7e4928b980928410e98a40b80d5cb0c173 | algestam/ssl_exporter | /ssl_exporter_test.go | Go | go | 19,512 | permissive | package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"log"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
var clientCert = `-----BEGIN CERTIFICATE-----
MIIC6jCCApCgAwIBAgIQPbn1oJJ0lvHOxk3BbnhGMTAKBggqhkjOPQQDAjCBhTEL
MAkGA1UEBhMCR0IxEDAOBgNVBAgTB0VuZ2xhbmQxDzANBgNVBAcTBkxvbmRvbjEU
MBIGA1UECRMLMTIzIEZh... |
38fe611469a1fdc532c80705b9bdb3f4b6c842e1 | 8976eddb8302f99774fcf01f62c3811bef84a48a | GioarmsCodes/University | /esercizi/Esercizi Lezione/Ottobre/LEZIONE 16/sommatoria.go | Go | go | 231 | permissive | package main
import "fmt"
func main(){
var n,i,sommatoria int
sommatoria=0
fmt.Print("Di quale numero vuoi fare la sommatoria?")
fmt.Scan(&n)
for i=n;i>0;i--{
sommatoria = sommatoria + i
}
fmt.Print(sommatoria)
}
|
9a4abed1839b34797ba8b719dcf2c668ab6e28f8 | 5775b4476c1f692f0a814eb9e0756cd42aedc249 | morrell/pulumi-azure-native | /sdk/go/azure/web/v20210115/getAppServiceEnvironment.go | Go | go | 3,089 | 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 v20210115
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// App Service Environment ARM resource.
func LookupAppServiceEnvironment(ctx *pulumi.Co... |
e6bde1f99850e0fa547434180ac82a1ce885f40c | 54ea85cff8aadbd004fa4d0af4b9e45f318d677c | Rahul-D78/cluster-api-provider-azure | /api/v1alpha3/azuremachinetemplate_conversion.go | Go | go | 3,738 | 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, ... |
a4b7f3a8a89128323e94c494bb9699b277177c17 | 43c49786cbccaa0cfcb2661eb47d89daeaaef909 | satirn/p2pderivatives-oracle | /internal/database/entity/dlcdata.go | Go | go | 3,706 | permissive | package entity
import (
"time"
"github.com/jinzhu/gorm"
)
// DLCData represents the db model of the oracle data rvalue/signature relative an asset
type DLCData struct {
Base
PublishedDate time.Time `gorm:"primary_key"`
AssetID string `gorm:"primary_key"`
Rvalue string `gorm:"unique;not null"... |
2c99a228b9bc74e6fedb360e02a37e3dd9a45599 | e5eb236caec2021ff67095a9b30a899d39bd2b65 | MartinWeindel/gardener | /pkg/gardenlet/controller/seed/seed/nginxingress.go | Go | go | 7,356 | permissive | // Copyright 2022 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.... |
2c2f80057ff4ef40fa374e2e5f824e526747d373 | 32e591d658e4af288b3ee89ddccb9902f276ebb1 | SocioProphet/cluster-operator | /service/controller/aws/v14patch1/error.go | Go | go | 278 | permissive | package v14patch1
import "github.com/giantswarm/microerror"
var invalidConfigError = µerror.Error{
Kind: "invalidConfigError",
}
// IsInvalidConfig asserts invalidConfigError.
func IsInvalidConfig(err error) bool {
return microerror.Cause(err) == invalidConfigError
}
|
c90893eec12c81fd6183edf8e81f5fae183fd900 | 3afb0f4f36bf6f663d054abc949a2d944c419df8 | KevinDavidMitnick/chronus | /vendor/github.com/influxdata/flux/execute/aggregate.go | Go | go | 6,171 | permissive | package execute
import (
"fmt"
"github.com/apache/arrow/go/arrow/array"
"github.com/influxdata/flux"
"github.com/influxdata/flux/interpreter"
"github.com/influxdata/flux/memory"
"github.com/influxdata/flux/plan"
"github.com/influxdata/flux/semantic"
"github.com/pkg/errors"
)
type aggregateTransformation stru... |
82a14d4a589423b12dd84ea7536720f8d74ad5fb | 4a191c83ef9c76e961e007dfe0fde1509e6bb06e | uubk/rook | /pkg/operator/discover/discover.go | Go | go | 7,172 | permissive | /*
Copyright 2018 The Rook 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 agreed to ... |
47dd5bc7ebf2a900a30cb0f4a93c653ddcdc60f6 | 0ea4fa179669f2f8e61424559b817a997916cd8d | kubermatic/kubermatic | /pkg/resources/konnectivity/deletion.go | Go | go | 1,882 | permissive | /*
Copyright 2021 The Kubermatic Kubernetes Platform contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law ... |
0aa2e9e3212618e3c862cade550ee6b42dc93f77 | f810eafa937f07d641e11dea9bbf76fbc91de529 | jonahglover/deplo1 | /client/client.go | Go | go | 731 | no_license | package client
import (
"github.com/jonahglover/deplo1/procedure"
"log"
"net/rpc"
)
func Run(filename string) procedure.Reply {
client, err := rpc.DialHTTP("tcp", "localhost:1234")
if err != nil {
log.Fatal("dialing:", err)
}
args := &procedure.Args{filename}
var reply procedure.Reply
err = client.Call... |
0e49633182ea92369f158eea1f31964c13846ea4 | a7a3d1808034ed1a9dd4c9936a8d001d4bb547a3 | pandemic-patch/cadence | /runtime/tests/interpreter/capability_test.go | Go | go | 15,491 | permissive | /*
* Cadence - The resource-oriented smart contract programming language
*
* Copyright 2019-2020 Dapper Labs, 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.ap... |
9a9c4f7a906e3fba335313b6d192f4ab7378c113 | 2dc6ffc29c9f2fd5503f35c663c2d04770564ee3 | namawakame/gitlab-copy | /cmd/gitlab-copy/main.go | Go | go | 3,946 | permissive | package main
import (
"flag"
"fmt"
"log"
"os"
"runtime"
"strings"
)
func map2Human(m map[string]int) string {
keys := make([]string, len(m))
i := 0
for k := range m {
keys[i] = k
i++
}
return strings.Join(keys, ", ")
}
func main() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, fmt.Sprintf("Usage: %... |
a90ca17e927bca96589941764225d386d4bcf1de | c5d4c354a49fad72a56c166c8021e16cae5fe411 | recallsong/servicehub-providers | /pprof/examples/main.go | Go | go | 260 | permissive | package main
import (
"os"
"github.com/recallsong/servicehub"
_ "github.com/recallsong/servicehub-providers/httpserver"
_ "github.com/recallsong/servicehub-providers/pprof"
)
func main() {
hub := servicehub.New()
hub.Run("examples", "", os.Args...)
}
|
b34508eea5c2b0b8eb08366bce97f81d990f9d56 | c646f350f7544663639578bd313ab1d2465b14e1 | vtumuluri/cockroach | /pkg/sql/show_cluster_setting.go | Go | go | 5,824 | permissive | // Copyright 2017 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
e20b7702ba785e70136b0cf7b867149a7ff3c9b1 | 68776dc43937a64aa43a609251fb0564faf74afe | listinvest/automated-garden | /garden-app/vendor/github.com/influxdata/influxdb-client-go/v2/api/query/table.go | Go | go | 5,615 | permissive | // Copyright 2020-2021 InfluxData, Inc. All rights reserved.
// Use of this source code is governed by MIT
// license that can be found in the LICENSE file.
// Package query defined types for representing flux query result
package query
import (
"fmt"
"strings"
"time"
)
// FluxTableMetadata holds flux query resul... |
51a6b71c251b55037602a60d1fc70a885a12c17c | 47660eaeb324f27afaa98e8f100718b919e3e864 | alexcontini/scorecard | /e2e/contributors_test.go | Go | go | 1,874 | permissive | // Copyright 2021 Security Scorecard 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 ... |
5b1b144b6e141c8171fe19a5d4cff0ca3965c544 | d6a4b18c6d8c24ea6f194c3db14d0e58c8091c11 | leobcn/slick | /webutils/webutils.go | Go | go | 1,401 | no_license | package webutils
import (
"encoding/json"
"fmt"
"net/http"
"github.com/abourget/slick"
"github.com/gorilla/mux"
"github.com/nlopes/slack"
)
type Utils struct {
bot *slick.Bot
}
func init() {
slick.RegisterPlugin(&Utils{})
}
func (utils *Utils) InitWebPlugin(bot *slick.Bot, privRouter *mux.Router, pubRouter... |
75dc971d2123e1576968839b730919d4e19c7e34 | dc3888ebbbf11faf1d4bb9868593e37b3c265c51 | sergioaugrod/tcpgo | /client.go | Go | go | 493 | no_license | package main
import (
"bufio"
"fmt"
"net"
"os"
)
const (
ADDRESS = "localhost:6789"
TYPE = "tcp"
)
func main() {
conn, err := net.Dial(TYPE, ADDRESS)
if err != nil {
fmt.Println("Error connecting:", err)
os.Exit(1)
}
for {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Text to send: ")
text... |
4ca7cef23b1a8cb55c59b7fa9cfc936fa7e59975 | 9210fb9866f94f7d22fa4f88a37f100b4ddf6682 | yarwelp/go-capnproto2 | /internal/demo/books/books.capnp.go | Go | go | 2,127 | permissive | package books
// AUTO GENERATED - DO NOT EDIT
import (
capnp "zombiezen.com/go/capnproto2"
)
type Book struct{ capnp.Struct }
func NewBook(s *capnp.Segment) (Book, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1})
if err != nil {
return Book{}, err
}
return Book{st}, nil
... |
97682c85357364483fa85fc9a8dde5bc705cd734 | 53ed3671d93ed69c6a416c8d6bc3918ff8e85410 | StevenWuHao/LeetCode | /zhangzhihua/bigHeap.go | Go | go | 414 | no_license | package zhangzhihua
/**
大顶推和小顶推
*/
func initBigHead(i int, l int, nums []int) {
left := 2*i + 1
right := 2*i + 2
large := i
if left < l && nums[left] < nums[i] {
large = left
}
if right < l && nums[right] < nums[large] {
large = right
}
if large != i {
swap(i, large, nums)
initBigHead(large, l, nums)... |
24502ee4f6ea4134ad4afd9231b7ab849a95130b | f87fb81f22254d7cb012d20c8c26f85cb25598fc | rohansub/burrito | /src/redis/MockClient.go | Go | go | 874 | no_license | package redis
import (
"github.com/go-redis/redis"
"errors"
"time"
)
// Client - MockClient datastructure for Redis
type Client struct {
data map[string]string
}
// NewMockRedisClient - Create Mock Redis client
func NewMockRedisClient(init map[string]string) *Client{
return &Client {
data: init,
}
}
func (... |
a72e551a7016abb2848593e86fa651b5ba73b715 | c85fcc8b8af9322403f1cad8ebe803a8b8d993d5 | AdamSLevy/factom | /wallet/importexport.go | Go | go | 1,444 | permissive | // Copyright 2016 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package wallet
import (
"fmt"
"os"
"github.com/FactomProject/factom"
"github.com/FactomProject/factomd/common/factoid"
)
// ImportWalletFromMnemonic creates a new wallet with a... |
10710081c2b319715cfbc451368a29a73a2bc086 | 3dcc20e270bd2d6871adbf7900d427e65958f236 | kaminijagtiani/query | /plan/offset.go | Go | go | 2,220 | no_license | // Copyright (c) 2014 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... |
a41160adb7f8eed3e30911ff0bb788af43dbc877 | a0b4c0cab7a93267b096581512476ae17e283e89 | lastbackend/registry | /pkg/api/types/v1/request/image_utils.go | Go | go | 2,882 | permissive | //
// Last.Backend LLC CONFIDENTIAL
// __________________
//
// [2014] - [2019] Last.Backend LLC
// All Rights Reserved.
//
// NOTICE: All information contained herein is, and remains
// the property of Last.Backend LLC and its suppliers,
// if any. The intellectual and technical concepts contained
// herein are prop... |
c35acfeaf1e1757b07c5a6cc043aed96df75f7ae | febf99c38f05dabe2aa70954a96b08d7b1037f35 | hoveychen/protoreflect | /desc/protoparse/options_test.go | Go | go | 8,921 | permissive | package protoparse
import (
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"testing"
dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
"github.com/hoveychen/protoreflect/internal/testutil"
)
type ident string
type aggregate string
func TestOptionsInUnlinkedFiles(t *testing.T) {
testCases := []struct {
con... |
a6ac193ae26f871e824f0b6c3ff1f814ea6c6155 | 5e9c0b45f8fd49888a93000cecde85fc837c802f | K4orta/tunnel-speed-api | /storage/utils.go | Go | go | 1,798 | no_license | package storage
import (
"fmt"
"os"
"strings"
"testing"
"github.com/jmoiron/sqlx"
)
// Schema is a type with create and drop commands for the db
type Schema struct {
create string
drop string
}
var dbSchema = Schema{
create: `
create TABLE vehicles (
route_tag text NOT NULL,
vehicle_id tex... |
921c5e483551cd5b6cf57982b75e8119511c918c | 65fa6c3293358153710aa9e580c14bbe96e87e51 | netsec-ethz/scion | /go/lib/daemon/fake/fake.go | Go | go | 6,615 | permissive | // Copyright 2019 Anapaya Systems
//
// 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... |
b591018ab47bc14d437842218032cbf8b2ed191a | e8dd14f57dfb3c8d767821b4b4c0c8be7928d264 | cybozu-go/cke | /tools/make_directories/main.go | Go | go | 1,074 | permissive | package main
import (
"fmt"
"os"
"path/filepath"
"strconv"
"github.com/spf13/cobra"
)
var options struct {
mode string
}
var rootCmd = &cobra.Command{
Use: "make_directories DIR [DIR ...]",
Short: "make directories",
Long: `make directories with given permission flags`,
Args: cobra.MinimumNArgs(1),
R... |
c6638dc7db7a3e55072ed66458cf9390f8e379db | a010d246471808bcf2de592734f1d302e65b1d33 | EscaperLL/mic_server_office | /api/handler/handle_user.go | Go | go | 2,729 | no_license | package handler
import (
"context"
"encoding/json"
api "github.com/micro/go-micro/api/proto"
"github.com/micro/go-micro/errors"
"github.com/micro/go-micro/v2/logger"
mic_src "mic_srv_office/proto/mic_srv_office"
"strconv"
)
type IUser struct {
Client mic_src.IUserService
}
type Say struct {
Client mic_src.... |
89f3da87c2e911112640541b39f5850c31f3f1b8 | 19a3ce9526d358718679c96f094c46ade2467037 | blaskovicz/go-stopandshop | /models/models.go | Go | go | 1,652 | no_license | package models
type ErrorResponse struct {
ID string `json:"error"` // eg: unauthorized
Description string `json:"error_description"` // eg: "full auth required to access this resource"
}
type OfferResponse struct {
CardNumber string `json:"cardNumber"`
Offers []Coupon `json:"offers"`
/... |
d17ee5ea189079124101644b005e86ee81a2ba86 | 34d920ebae664f4d9f8d7f811b0de859a5afdb4a | thomxn/go-learn | /http/main.go | Go | go | 469 | no_license | package main
import (
"fmt"
"io"
"net/http"
"os"
)
type logWriter struct{}
func main() {
resp, err := http.Get("https://www.google.com/search?q=free")
// body := make([]byte, 999999999)
if err != nil {
fmt.Println("Error: ", err)
os.Exit(1)
}
// resp.Body.Read(body)
// fmt.Println(string(body))
l... |
36e091c5f278d372fc53395a8990d1b1a7cdb6f9 | 10b8bcfcb756d6a55ee2fd498d5b548acc141e19 | lkpdn/plumeria-cli | /axapi/v21/commands/network/arp.go | Go | go | 5,423 | permissive | package network
import (
"fmt"
"os"
"strconv"
"strings"
"github.com/jessevdk/go-flags"
. "github.com/lkpdn/plumeria-cli/axapi/util"
. "github.com/lkpdn/plumeria-cli/axapi/v21/auth"
. "github.com/lkpdn/plumeria-cli/axapi/v21/util"
)
type Arp struct{}
func (a *Arp) Help() string {
return `
$ ... network.arp... |
ce1fafe2130f73dd2ad118ab8a2c44186d5e83b4 | 2d479fa69c62edffcf7d0f38617e20e858089a32 | niaoshuai/study-gosdk | /os/dir_test.go | Go | go | 448 | no_license | package os
import (
"os"
"testing"
)
func TestDir(t *testing.T) {
// os file
file, _ := os.Open("/Users/niaoshuai")
defer file.Close()
// 读取 文件名称列表
fileListNames, _ := file.Readdirnames(0)
t.Log(fileListNames)
file1, _ := os.Open("/Users/niaoshuai")
defer file1.Close()
// 读取
fileInfoList, _ := file1.Read... |
16273fbe3aeae77e906fadea5d271ff2d4c1f26e | d303f57b782363f5d611dde846af6ee473eae0df | GeoNet/delta | /internal/stationxml/response_type.go | Go | go | 7,781 | permissive | package stationxml
import (
"bytes"
"encoding/gob"
"encoding/xml"
"math"
"math/cmplx"
)
const LaplaceRadiansSecondPzTransferFunction = "LAPLACE (RADIANS/SECOND)"
type Float struct {
Value float64 `xml:",chardata"`
}
type Units struct {
Name string `xml:"Name"`
Description string `xml:"Description,omi... |
6918923c0adbe88f9dc391855b56af859cf8718c | 2f619022ac22c763a233c587d66bdd2b2823ed59 | chaurasia-namrata/terraform-provider-zoomus | /zoomus/provider.go | Go | go | 1,004 | no_license | package zoomus
import (
"terraform-provider-zoomus/client"
tkn "terraform-provider-zoomus/token"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"zoom_api_secret": &schema.Schema{
Type: sche... |
ebc9a4f48cdcfa1f1cb8c6c6d8c10c5131925dc0 | 9ee6de555820de1450584030fdb3bf66cb1af259 | pixjay/gochapter | /chapter3/pascal.go | Go | go | 1,419 | no_license | package main
import (
"fmt"
"os"
"time"
"strconv"
)
func pascalsTriangleAt(n int) []int {
x := make([]int, n+1)
return pascalsTriangleAtMemo(n, x)
}
func pascalsTriangleAtMemo(n int, x []int) []int {
x[0] = 1
x[n] = 1
if n > 1 {
y := pascalsTriangleAtMemo(n-1, x[1:n+1])
for i := 1; i < n; i++ {
x[i] ... |
0da09450cb01aba7716a8879b6c90abfbe044805 | 92de69e189722f011fbcf1508d6e231f00c0c1c9 | Hexilee/tidb | /executor/clustered_index_test.go | Go | go | 6,991 | permissive | // Copyright 2020 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
33c8820d94c33c4f726628e46c3e1fe9aeb52570 | 050506bb0edf430437cffbf185a838941d4e0894 | freeflyday/school_suggestion | /logic/trie.go | Go | go | 1,409 | no_license | package logic
/*
import (
"fmt"
)
*/
type Node struct {
char rune
childs map[rune]*Node
Data interface{}
deep int
isTerm bool
}
type Trie struct {
root *Node
size int
}
func NewNode(char rune, deep int) *Node {
node := &Node {
char: char,
childs:make(map[rune]*Node, 16),
deep:deep,
}
return node
}
f... |
6a214a2cc03126555d73f41063ac3f5aa85d8319 | 6c13c17f3831f693138d642da6605e4683a28946 | sgtpepper43/cx | /util.go | Go | go | 10,018 | permissive | package main
import (
"errors"
"fmt"
"io"
"log"
"net"
"net/http"
"os"
"os/exec"
"os/user"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/cloud66/cloud66"
"github.com/cloud66/cx/term"
"github.com/mgutz/ansi"
)
func cxHome() string {
return filepath.Join(homePath(), ".cloud66")
}
// exists r... |
1289ba7fa4b0871f5a6289e456228ec82c9b93c7 | f28d8133ad2061e662dd8346008b4788273b022e | cuigh/auxo | /net/rpc/registry/valkeyrie/valkeyrie.go | Go | go | 4,652 | permissive | package valkeyrie
import (
"encoding/json"
"strings"
"time"
"github.com/abronan/valkeyrie"
"github.com/abronan/valkeyrie/store"
"github.com/cuigh/auxo/data"
"github.com/cuigh/auxo/data/set"
"github.com/cuigh/auxo/errors"
"github.com/cuigh/auxo/log"
"github.com/cuigh/auxo/net/rpc/registry"
"github.com/cuigh... |
aedd40fe32ffd2b6f293c5332c7787acbbcf337f | 19ddbd78ec04bdb2f8b27ea0ca1da2bf1cd322f9 | sumhat/mv2it-go | /src/mv2/testing/assertion.go | Go | go | 9,073 | permissive | package testing
import (
"fmt"
"reflect"
"strconv"
"testing"
)
const (
Rune = iota + 100
Nil
)
type AssertT struct {
t *testing.T
}
func Assert(t *testing.T) *AssertT {
return &AssertT{t: t}
}
type ThatInterface struct {
t *testing.T
name string
boolValue bool
runeValue rune
int32Valu... |
47874f1906d5b4a8f934f3e4ed27916c95be60ab | 2251b3985b1e14daefa62c20d63547a5ebb8f2fc | C0rWin/bcdb-server | /cmd/bdb/main.go | Go | go | 2,139 | no_license | // Copyright IBM Corp. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"log"
"os"
"sync"
"github.com/spf13/cobra"
"github.com/IBM-Blockchain/bcdb-server/config"
"github.com/IBM-Blockchain/bcdb-server/pkg/server"
)
var (
configPath string
// PathEnv is an environment v... |
224e30b9e6bf32eb06a9051a082624c92a1a5671 | 99c487c96e2002db0500a06bbb57a3a4bf00623b | mygomod/oapms | /pkg/api/menuPms.go | Go | go | 2,142 | permissive | // @BeeOverwrite YES
// @BeeGenerateTime 20200902_214035
package api
import (
"github.com/spf13/cast"
"oapms/pkg/model"
"oapms/pkg/mus"
"oapms/pkg/router/core"
"oapms/pkg/trans"
)
func MenuPmsList(c *core.Context) {
req := &trans.ReqPage{}
if err := c.Bind(req); err != nil {
c.JSONErrTips("参数错误", err)
retu... |
6652e88a677ff4ac5657407d0b47b101a041c228 | 2518d0cb8d1f97739bb8925931e989bfa9d9efe3 | mingrammer/nuclio | /cmd/controller/app/controller.go | Go | go | 12,423 | permissive | /*
Copyright 2017 The Nuclio 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... |
d9c87cc19bbc104f177a918d0056dc4c69bebee9 | dc408706e3c5f9841dfe4a41b6f9ea52e115e432 | blinkins0n/rest-api-go | /main.go | Go | go | 2,240 | no_license | // main.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/gorilla/mux"
)
// Article - Our struct for all articles
type Article struct {
Id string `json:"Id"`
Title string `json:"Title"`
Desc string `json:"desc"`
Content string `json:"conte... |
be346c51ee898c16c4cc03e6aac70dec1a826f7e | e441811cd2eeeceffca45961d5a70f9d1d60e497 | fossabot/geode | /pkg/ast/Package.go | Go | go | 8,609 | permissive | package ast
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
"github.com/geode-lang/geode/pkg/lexer"
"github.com/geode-lang/geode/pkg/util"
"github.com/geode-lang/geode/pkg/util/log"
"github.com/geode-lang/llvm/ir"
)
// RuntimePackage is the global runtime package
// var RuntimePac... |
fe9d023684b8480e7e33d48367775a594cd625b7 | b99125bb15c961e8a53f634200ec264cecbae9cf | aau-network-security/gdock | /docker/docker_test.go | Go | go | 8,117 | no_license | // +build linux
package docker_test
import (
"context"
"fmt"
"testing"
fdocker "github.com/fsouza/go-dockerclient"
d "github.com/mrturkmencom/gdock/docker"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
var dockerClient, dockerErr = fdocker.NewClient("unix:///var/run/docker.sock")
func init() {
if d... |
42736279117ee8c4ea3c27825bc41bdd71f47159 | 0ee31118ac6a7b177794b2e530573540f4013e2d | Prnyself/open_api_token | /settings/log_settings.go | Go | go | 583 | no_license | package settings
import "log"
func loadLogs() {
sec, err := Cfg.GetSection("log")
if err != nil {
log.Fatalf("Fail to get section 'log': %v", err)
}
LogSavePath = sec.Key("log_save_path").MustString("logs/")
LogSaveName = sec.Key("log_save_name").MustString("gin")
LogFileExt = sec.Key("log_file_ext").MustStr... |
9158272237b94a3f2b23185260b7c3a8095d627f | 5a0ffedd87ee35dde9e425ce6730e4061eaace5b | project-flogo/catalystml-flogo | /operations/restructuring/cast/operation_test.go | Go | go | 1,612 | permissive | package cast
import (
"testing"
"github.com/project-flogo/core/support/log"
"github.com/stretchr/testify/assert"
)
func TestSample(t *testing.T) {
opt := &Operation{logger: log.RootLogger()}
var err error
inputs := make(map[string]interface{})
inputs["data"] = []string{"1", "2.0", "2.5", "7.9"}
inputs["toTy... |
683a21e96f66e82200176640876185b2550e9a2a | d7d86af24fdce71eca5ea9c2317c025e7ddd68c9 | rht/bssim | /Godeps/_workspace/src/github.com/ipfs/go-ipfs/metrics/bw_stats.go | Go | go | 2,445 | no_license | package metrics
import (
gm "github.com/heems/bssim/Godeps/_workspace/src/github.com/whyrusleeping/go-metrics"
"sync"
peer "github.com/heems/bssim/Godeps/_workspace/src/github.com/ipfs/go-ipfs/p2p/peer"
protocol "github.com/heems/bssim/Godeps/_workspace/src/github.com/ipfs/go-ipfs/p2p/protocol"
)
type Stats stru... |
ffebb82ef9f9ce36e9b0e15749f630a4c82fdc32 | e1b21c259cba1ea5c67b955331ce607a04c59f38 | Matthew-xx/git_pro | /web_shop/laravel_shop/repositories/user_repository.go | Go | go | 2,044 | no_license | package repositories
import (
"github.com/go-xorm/xorm"
"../models"
"github.com/kataras/iris/mvc"
"github.com/kataras/iris/sessions"
)
type UserRepository struct{
engine *xorm.Engine
Session *sessions.Session
}
func NewUserRepository(engine *xorm.Engine) *UserRepository {
return &UserRepository{
engine:eng... |
321e53e28361803599992f114f7fc74baa50088f | dec975cb40cd927feb881548237d65d93d40e782 | bendtheji/learn-chaincode | /start/chaincode_start.go | Go | go | 3,675 | permissive | /*
Copyright IBM Corp 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... |
2727368b68babb68c7a5beb182ee999ef582b1ee | 50c07c7c2b53a25a754590d8eeef6dfe541c9771 | Gunforge/learn-go-with-tests-ko | /structs/v5/shapes_test.go | Go | go | 634 | permissive | package main
import (
"testing"
)
func TestPerimeter(t *testing.T) {
rectangle := Rectangle{10.0, 10.0}
got := Perimeter(rectangle)
want := 40.0
if got != want {
t.Errorf("got %g want %g", got, want)
}
}
func TestArea(t *testing.T) {
checkArea := func(t *testing.T, shape Shape, want float64) {
t.Helper(... |
3133b4019cb9c4e22c20335ac3c251c722002e98 | 0fcedd66ac8b826d5c5401ad9ef71bf211dec05f | Scalr/infracost | /internal/providers/terraform/google/compute_router_nat.go | Go | go | 1,882 | permissive | package google
import (
"github.com/infracost/infracost/internal/schema"
"github.com/shopspring/decimal"
)
func GetComputeRouterNATRegistryItem() *schema.RegistryItem {
return &schema.RegistryItem{
Name: "google_compute_router_nat",
RFunc: NewComputeRouterNAT,
}
}
func NewComputeRouterNAT(d *schema.Resource... |
1252b10e3f6b82650483dab4fd8a9d923f606450 | ca4ed7c87d15a53f57e5adccdcb28f1199d17cfd | weiliy/pulumi | /tests/integration/integration_nodejs_test.go | Go | go | 27,550 | permissive | // Copyright 2016-2020, Pulumi Corporation. All rights reserved.
// +build nodejs all
package ints
import (
"bytes"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
"github.com/pulumi/pulumi/pkg/v2/resource/deploy/providers"
"github.com/pulumi/pulumi/pkg/v2/secrets/cloud"
"github.com/pulum... |
801d637514d320574a7425fd7cf1fc56eb1f005d | 36f570f493826a4e909b425c35a7fcadac633dc4 | kisom/cryptutils | /common/auth/authenticator_test.go | Go | go | 1,237 | permissive | package auth
import (
"encoding/hex"
"testing"
)
// Test validating a YubiKey OTP.
func TestValidationYubiKey(t *testing.T) {
key, err := hex.DecodeString(testYubiKey)
if err != nil {
t.Fatalf("%v", err)
}
auth, err := NewYubiKey(key, testInitialYKOTP)
if err != nil {
t.Fatalf("%v", err)
}
_, err = Val... |
a8498e0760f2bf7c26d06f00356b6d8691993812 | cb2ea5e5c6c21b54c515a4d38836ce2c970250ef | tsuibin/torgo | /handler.go | Go | go | 7,459 | no_license | package torgo
import (
"bytes"
"compress/gzip"
"compress/zlib"
"encoding/json"
"encoding/xml"
"errors"
"./session"
"html/template"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/url"
"os"
"path"
"strconv"
"strings"
)
type Handler struct {
Ctx *Context
Data map[interface{}]interface{... |
530e036aa553b2b0b41fedf2242b06e311f9553a | 145a91d372223b2da97d7e9762e50e695ad7ca28 | iCodeIN/go-doudou | /astutils/structcollector.go | Go | go | 4,467 | permissive | package astutils
import (
"github.com/sirupsen/logrus"
"go/ast"
"go/parser"
"go/token"
"regexp"
"strings"
"unicode"
)
// StructCollector collect structs by parsing source code
type StructCollector struct {
Structs []StructMeta
Methods map[string][]MethodMeta
Package PackageMeta
N... |
b3ceb3861692ac4b913f15f0752d71f091b9097d | 4c2d23f321ae8d955a0cab86e9ddd58d21bece73 | wanlanjian/elvish | /edit/history.go | Go | go | 1,130 | permissive | package edit
// Command history subsystem.
type historyState struct {
current int
prefix string
line string
}
func (h *historyState) jump(i int, line string) {
h.current = i
h.line = line
}
func (ed *Editor) appendHistory(line string) {
if ed.store != nil {
go func() {
ed.store.AddCmd(line)
// TOD... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.