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 |
|---|---|---|---|---|---|---|---|---|
67b1ce2576e2da358124563015deb5c1b88ae484 | 9d88c7480c5655a84f518305c5279214491387d8 | rickardenglund/aoc2019 | /day19/main_test.go | Go | go | 272 | no_license | package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
func Test_part2Res(t *testing.T) {
path = "input.txt"
assert.Equal(t, 70_013, part2Solve(2))
}
func Test_part2Res2(t *testing.T) {
path = "input.txt"
assert.Equal(t, 140_026, part2Solve(3))
}
|
1095de964e51e8c98f1f9e7ad342c3f5f0b0f4e6 | 46b4d40f8d77e94c966ccac4ba71f8860bb7cd65 | todorex/freedom | /infra/kafka/config.go | Go | go | 2,767 | permissive | package kafka
import (
"crypto/x509"
"io/ioutil"
"time"
"github.com/Shopify/sarama"
)
type kafkaConf struct {
Producers []producerConf `toml:"producer_clients"`
Consumers []consumerConf `toml:"consumer_clients"`
Consumer struct {
Open bool `toml:"open"`
ProxyHTTP2 bool `toml:"proxy_http2"`
Pr... |
c4ad0f5d738e8ad404f3007524f5e7ed1bca3223 | 7bde1b136785989f3d8d164c75839e987432c398 | acst/sdcg | /converters.go | Go | go | 2,302 | no_license | package main
import (
"fmt"
"github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/function"
"github.com/zclconf/go-cty/cty/gocty"
)
type goType uint64
const (
gtInt goType = iota + 1<<32
gtString
gtFloat32
gtFloat64
)
var stringGoTypeCty = map[string]cty.Value{
"int": cty.NumberUIntVal(uint64(... |
f81cc94075ee2a121ca21e2a752685a81d22d883 | 4a7ad908724cf450446133986e70b7bcf16a9d04 | LinJinghua/hrc | /main.go | Go | go | 439 | no_license | package main
import (
"os"
"github.com/LinJinghua/hrc/service"
flag "github.com/spf13/pflag"
)
const (
// PORT .
PORT string = "8080"
)
func server() {
port := os.Getenv("PORT")
if len(port) == 0 {
port = PORT
}
pPort := flag.StringP("port", "p", PORT, "PORT for httpd listening")
flag.Parse()
if len(... |
213559da1ee1ff932bb59f942e8e47ad3b534db2 | e5b8cbe1886cc694d6cfc1eb264983e3d1829db8 | shozawa/monkey2 | /lexer/lexer.go | Go | go | 1,653 | no_license | package lexer
import (
"github.com/shozawa/monkey2/token"
)
type Lexer struct {
input string
position int
ch byte
}
func New(input string) *Lexer {
l := &Lexer{input: input}
// FIXME: input が空文字のときも考慮すべき
l.ch = input[0]
return l
}
func (l *Lexer) NextToken() (tok token.Token) {
l.skipWhitespace()
... |
92d79ae718a85ffa0274cb90cd649dda63a41a0a | 1d2f34d40bd6e63ff2392717c53bcfd85caa1c3f | tk-nagai/Go | /ch01/ex09/fetch.go | Go | go | 593 | no_license | // Copyright © 2017 Takaya.Nagai All Rights Reserved.
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
)
var out io.Writer = os.Stdout
func main() {
for _, url := range os.Args[1:] {
fetch(url)
}
}
func fetch(url string) {
resp, err := http.Get(url)
if err != nil {
fmt.Fprintf(os.Stderr, "f... |
eb1ae75454b6ec96f78154908939817a96f59b21 | 9b5b6094652ccc08ae6ffe0a79584e2a026be541 | unidev-games/defold-games | /Unit 4/game/fx/exit.go | Go | go | 527 | permissive | components {
id: "exit"
component: "/game/fx/exit.script"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
}
embedded_components {
id: "sprite"
type: "sprite"
data: "tile_set: \"/game/core/tiles.tilesource\"\n"
"default_animation: \"exit\"\n"
"... |
5a7ce823e05904301f333ad515881b372d435e48 | 057ec4e9b2a733adf0daf000a268964714ad525f | mike-jc/service-scim | /models/resources/users.go | Go | go | 842 | no_license | package modelsResources
import (
"service-scim/models/normalization"
)
type Users struct {
Schemas []string `json:"schemas" xml:"Schemas"`
TotalResults int `json:"totalResults" xml:"TotalResults"`
ItemsPerPage int `json:"itemsPerPage" xml:"itemsPerPage"`
StartIndex int `json:"startIndex" xm... |
4c243161c14c24e1cb7ca75366c2396a376b8efa | f8a542082c0fc1552a7d10bbcd37b3e8bdaf02ec | kubevirt/kubevirt | /vendor/github.com/openshift/api/operator/v1/types_scheduler.go | Go | go | 1,123 | permissive | package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// KubeScheduler provides information to configure an operator to manage scheduler.
type KubeScheduler struct {
metav1.TypeMeta `jso... |
65f0b4ab3daba1d16fd59f11f403ba93de2c1d84 | c31bdb4d6fcbae2c0ad07bef26db11d992c47e81 | domi-nik-/kubeone | /pkg/tasks/tasks.go | Go | go | 5,688 | permissive | /*
Copyright 2019 The KubeOne 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, sof... |
61b5abff3a24cc96a5a335e99767712bc4dbb715 | def820808835a4c7462edf5181d0fbd348c4f98f | daragao/goUntitled | /models/models.go | Go | go | 2,248 | no_license | package models
import (
"errors"
"log"
"os"
"github.com/coopernurse/gorp"
"github.com/daragao/goUntitled/config"
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
)
var Conn *gorp.DbMap
var db gorm.DB
var err error
var ErrUsernameTaken = errors.New("username already taken")
var Logger = log.New(os.S... |
f6d0954f7040b0cf993c94993f94f23ae66d701d | 187ae8e4870b63b79aa691ece9256fbba3e5d643 | eggsbenjamin/kubebuilder | /cmd/webhook_v1.go | Go | go | 4,619 | permissive | /*
Copyright 2018 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, ... |
638efe1567a6a6b77f3a9bd129c275eb7e213d8d | 2188af665e8e85c021791b7c6fa7744049395f1b | bennya8/go-union-opensdk | /utils/convert_helper.go | Go | go | 1,514 | no_license | package utils
// Bool is a helper routine that allocates a new bool value
// to store v and returns a pointer to it.
func ConvertBool(v bool) *bool {
return &v
}
// Int32 is a helper routine that allocates a new int32 value
// to store v and returns a pointer to it.
func ConvertInt32(v int32) *int32 {
return &v
}
... |
99faf4089cf54b4e7fc65b75594407e75b0ecb22 | 79eef5a29111833f207bdfbc91c4a08489f3bcb7 | microsoftgraph/msgraph-beta-sdk-go | /users/item_calendar_groups_item_calendars_item_calendar_view_item_instances_item_tentatively_accept_request_builder.go | Go | go | 6,073 | permissive | package users
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459 "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors"
)
// ItemCalendarGroupsItemCa... |
6021ee8b27e2d16f536fc5939b4d1c1f739624b2 | ff3a9c309021e1fb00290a71a54bede3c0547e83 | mruebush/deis | /deisctl/deisctl.go | Go | go | 3,876 | permissive | package main
import (
"fmt"
"os"
"strconv"
"github.com/deis/deis/deisctl/backend/fleet"
"github.com/deis/deis/deisctl/client"
"github.com/deis/deis/deisctl/utils"
docopt "github.com/docopt/docopt-go"
)
const (
// Version of deisctl client
Version string = "0.15.1+git"
)
func exit(err error, code int) {
f... |
20fd46fd10c8a667fcc25f1de0fd72b1c46264cd | 142a9b68846342821d65142bfbb0f5e8c339c011 | trswygg/bbs_go | /util/redis.go | Go | go | 3,887 | permissive | package util
import (
"github.com/beego/beego/v2/core/logs"
"github.com/beego/beego/v2/server/web"
db "github.com/gomodule/redigo/redis"
"strconv"
"time"
)
// _._
// _.-``__ ''-._
// _.-`` `. `_. ''-._ Redis 6.2.1 (00000000/0) 64 bit
// .-`` .-```. ```\/ _.,_ ''-... |
81f2c3c84f92709e4a4289890f9f058f1e0a5245 | ed2a78f8e46c55b27dede591a6b17edc67aeddb6 | yazver/test-task | /cmd/gnawer/storage.go | Go | go | 4,725 | no_license | package main
import (
"database/sql"
"os"
_ "github.com/cznic/ql/driver"
)
type Task struct {
Name string
Kind string
URL string
Link string
Title string
Content string
}
type Article struct {
URL string
Title string
Content string
}
type Storage struct {
db *sql.DB
}
func (s *St... |
71609fd552864db1b97da7422c9f129b1c69e985 | 88ab44aa7a5e41b17d264030bdedc1526ae24779 | huaweicloud/huaweicloud-sdk-go-v3 | /services/dds/v3/model/model_set_recycle_policy_request.go | Go | go | 463 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// SetRecyclePolicyRequest Request Object
type SetRecyclePolicyRequest struct {
Body *RecyclePolicyRequestBody `json:"body,omitempty"`
}
func (o SetRecyclePolicyRequest) String() string {
data, err := utils.Marshal(o)
... |
837055028bc872d4583b20eb877cb1008cb3112b | 8359eb966c13777d41fb162c07d61579e83b7ca3 | prozz/goat | /pkg/api/api.go | Go | go | 868 | no_license | package api
import (
"goat/pkg/ai"
"io"
"net/http"
"time"
)
type app struct {
generator ai.Generator
router *http.ServeMux
}
func NewApp(generator ai.Generator) http.Handler {
app := &app{
generator: generator,
router: http.NewServeMux(),
}
app.router.Handle("/fakenews", app.fakenews())
return ... |
44e823bf945953d02d47f2c0e85ec4042bd8bc90 | d5b99e1674d13cdcb07b22f30d27890666205d18 | zyzw/go-multi-IP-acceleration | /ruleset.go | Go | go | 1,279 | permissive | package main
import (
"net"
)
// RuleSet is used to provide custom rules to allow or prohibit actions
type RuleSet interface {
// AllowConnect is used to filter connect requests
AllowConnect(dstIP net.IP, dstPort int, srcIP net.IP, srcPort int) bool
// AllowBind is used to filter bind requests
AllowBind(dstIP n... |
4612088f8c44e1d099e95b70ea9ea1555ead4914 | 78ee902a8f4b6f6ed0b7227310f670a81a4dab0c | rynorris/TigerHorse | /dummy_storage_test.go | Go | go | 1,956 | no_license | package main
// A dummy storage to use for testing, just keeps lists of stuff.
type dummyStorage struct {
people []*Person
txs []*Transaction
pId int64
tId int64
nextErr error
}
func newDummyStorage() Storage {
return &dummyStorage{
people: []*Person{},
txs: []*Transaction{},
pId: 1... |
900a69474c5118e9f0148ed7111da5e4107d79d1 | bb879905a4d8dadf26e477c5903c1981b6dcea87 | memekas/ws-server | /pkg/db/db.go | Go | go | 1,740 | no_license | package db
import (
"fmt"
"os"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
"github.com/memekas/ws-server/pkg/auth"
"golang.org/x/crypto/bcrypt"
)
func (db *DB) Init() error {
dbURI := fmt.Sprintf("host=%s port=%s user=%s dbname=%s password=%s sslmode=disable",
os.Getenv("PG_HOST")... |
79e3233fc0d94f0d72078a806be3c0e0c57efece | bdb6779503b0366fc69f47f2c67a13bdbbc6397b | KeyongSun/lynx | /tests/e2e/cases/security_mode.go | Go | go | 7,461 | permissive | /*
Copyright 2021 The Lynx 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, softwa... |
ae91195ac048302af707de0398902e56b7dd3835 | 73c589ce4dfd675fc61f349a8d6502110ccb7a75 | voidint/star | /tag/tag.go | Go | go | 2,151 | permissive | package tag
import (
"sync"
)
const (
// Sep 标签层级分隔符
Sep = "/"
// DefaultPath 默认的标签路径
DefaultPath = "/Misc"
// DefaultName 默认标签名
DefaultName = "Misc"
)
// DefaultTag 默认标签
var DefaultTag = Tag{
Path: DefaultPath,
Name: DefaultName,
Builtin: true,
}
var (
tmux sync.Mutex
// tags = []Tag{
// Defau... |
2f729dba2a4d12a0bf500f5236432d2b751518c9 | 30e92f6999c17575bc2f54652ccc6efbcf2405ae | magnate3/ndn-dpdk | /core/logging/logginggql/gql.go | Go | go | 1,897 | permissive | // Package logginggql allows setting log levels via GraphQL.
package logginggql
import (
"errors"
"github.com/graphql-go/graphql"
"github.com/usnistgov/ndn-dpdk/core/gqlserver"
"github.com/usnistgov/ndn-dpdk/core/logging"
)
// GraphQL types.
var (
GqlLoggerType *graphql.Object
)
func init() {
GqlLoggerType = ... |
6fb33874b05c0b7aeffd238d4ebb6c7e632dfb68 | b1bc926583d053990c661d33d8731f2684fa8d54 | zjz894251se/go-zero | /core/stores/redis/redis.go | Go | go | 28,539 | permissive | package redis
import (
"errors"
"fmt"
"strconv"
"time"
red "github.com/go-redis/redis"
"github.com/zjz894251se/go-zero/core/breaker"
"github.com/zjz894251se/go-zero/core/mapping"
)
const (
ClusterType = "cluster"
NodeType = "node"
Nil = red.Nil
blockingQueryTimeout = 5 * time.Second
readWrite... |
93de24bcc001f70e94326eb4fb7be1e5a91a2cb7 | 9192fff46c6246398c597205d0cafff3597d9210 | fredliang44/multicloud-upload-service | /utils/config.go | Go | go | 526 | no_license | package utils
import (
"fmt"
"os"
"github.com/jinzhu/configor"
)
// Config is a struct loaded project level config
var Config = loadConfig()
type config struct {
Port string `default:"8080"`
GoogleCloud struct {
BucketName string
CredentialsPath string
}
}
func loadConfig() (conf config) {
dir, _ ... |
c9789829cd7fdf9a49b8b649d0a75e22cb05878d | b79d40b6ac9964840c51c1c4a5bdb659e278d8f6 | f-wntp27/G12-SA-Project | /backend/controller/Patient.go | Go | go | 972 | no_license | package controller
import (
"net/http"
"github.com/fonthap/backend/entity"
"github.com/gin-gonic/gin"
)
func GetPatient(c *gin.Context) {
id := c.Param("id")
var treatment entity.TreatmentRecord
if err := entity.DB().Raw("SELECT * FROM treatment_records WHERE id = ?", id).First(&treatment).Error; err !... |
1b18a3b7b8be4892655516e38cfa20e51f744da0 | ad8e2876c1775208fb20d148bce244392ad83247 | burningalchemist/usql | /handler/handler.go | Go | go | 31,506 | permissive | // Package handler provides a input process handler implementation for usql.
package handler
import (
"bufio"
"bytes"
"context"
"database/sql"
"errors"
"fmt"
"io"
"log"
"net/url"
"os"
"os/exec"
"os/signal"
"os/user"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"syscall"
"time"
"github.com/... |
42a13134f23b230fd5fb4b40af3db249f59ffbc7 | 8d62dc12f105bbca9a7da3fb2f4904958e5bedaf | mheon/libpod | /cmd/podman/containers/start.go | Go | go | 4,788 | permissive | package containers
import (
"fmt"
"os"
"github.com/containers/podman/v3/cmd/podman/common"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/utils"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/libpod/define"
"github.com/... |
c4ab9a5c1217c44d29779dd821c2ca403a504621 | 63ff7a020b83ce84007d175cab294e83773068f3 | my6889/k8s.yaml | /heapster/vendor/google.golang.org/grpc/credentials/credentials.go | Go | go | 9,276 | permissive | /*
*
* Copyright 2014, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this lis... |
0d9181ef68e6344d6fc6e3f8aaf4d959bc736ee8 | be7e3f6adb8b95836611e150a81d74a4909a49d6 | VinceCui/containerd | /cmd/ctr/commands/run/run_windows.go | Go | go | 2,375 | permissive | package run
import (
gocontext "context"
"github.com/containerd/console"
"github.com/containerd/containerd"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/errdefs"
specs "github.com/opencontainers/runtime-spec/specs-go"
"gith... |
38edfafc146472f4a1144cfe1cf0e8e138f1dce1 | efff2259993239bdb771d5c32336947b700160a6 | maivanteo/mjhallserver | /server/src/centerserver/mod_packs.go | Go | go | 2,090 | no_license | package centerserver
import (
//"log"
//"encoding/json"
//"fmt"
// "log"
//"staticfunc"
//"github.com/garyburd/redigo/redis"
)
//type Mod_Packs struct {
// person *Person
// packs SQL_Packs
//}
//type SQL_Packs struct {
// Uid int64
// State int
//}
//func (self *Mod_Packs) OnGetData(person *Person) {
// self.pe... |
24445d8eaa269fd39e73fd8b02d384d288c0834e | c5d42d65b25c6ee19f05c0d8aac9ed077ab8ea2e | Gammaglobulino/master_code_interview | /bubble_sort/bubble_sort_test.go | Go | go | 312 | no_license | package bubble_sort
import (
"../bubble_sort"
"fmt"
"github.com/stretchr/testify/assert"
"testing"
)
func TestBubbleSort(t *testing.T) {
vec := []int{1, 2, 6, 7, 8, 5}
sorted := []int{1, 2, 5, 6, 7, 8}
bubble_sort.Sort(vec)
assert.ElementsMatch(t, vec, sorted)
fmt.Println(vec)
fmt.Println(sorted)
}
|
49a07fe21d240302d4a8eb9b9bc736e7d06d3a02 | b2bc317d9cb8fb502cb657addee997e1082c4ef1 | acesso/nghttp2 | /integration-tests/nghttpx_test.go | Go | go | 13,211 | permissive | package nghttp2
import (
"bufio"
"fmt"
"github.com/bradfitz/http2"
"github.com/bradfitz/http2/hpack"
"golang.org/x/net/spdy"
"io"
"io/ioutil"
"net/http"
"testing"
)
func TestH1H1PlainGET(t *testing.T) {
st := newServerTester(nil, t, noopHandler)
defer st.Close()
res, err := st.http1(requestParam{
name:... |
d105422f05e5c517a181772366654a4c16dd5d9c | 9998b268a6c0b1ce8f55ae570c58aa998cdda44d | baopham/go-cliutil | /cliutil/cliutil.go | Go | go | 538 | permissive | package cliutil
import (
"fmt"
"strings"
)
func Prompt(format string, a ...interface{}) bool {
if !strings.Contains(format, "[y/n]") {
format += " [y/n] "
}
if len(a) == 0 {
fmt.Print(format)
} else {
fmt.Printf(format, a...)
}
return handlePromptResponse()
}
func handlePromptResponse() bool {
var res... |
03e7cf81e310bf187c39a4de354fb082377b6dfb | ad785ab767a931ddbae20a61914d95e6ef8efa27 | pramodrj07/multicloud-k8s | /src/k8splugin/internal/plugin/helpers.go | Go | go | 4,868 | permissive | /*
* Copyright 2019 Intel Corporation, 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... |
9f371d0e4608e89a098d7a72fc376a57ec88d518 | ec74d1eb2c3c385b766047d90de4166f7e554e67 | erikvanbrakel/terraform-provider-cloudconformity | /vendor/github.com/go-openapi/jsonreference/reference.go | Go | go | 4,101 | permissive | // Copyright 2013 sigu-399 ( https://github.com/sigu-399 )
//
// 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... |
3a35b842642791ce2c6e889e4e4518294f3e26eb | bb36ac19cf14c66034da4d9323736f5da49fcffb | sarvex/influxdb | /raft/handler_test.go | Go | go | 12,875 | permissive | package raft_test
import (
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"github.com/influxdb/influxdb/raft"
)
func init() {
// Ensure Log implements the Handler.Log interface.
_ = raft.Handler{Log: raft.NewLog()}
}
// Ensure a node can join a cluster over HTTP.
func TestHandler_Handl... |
93b7a3c696a6a09263aefad718aae60bdf6e67c9 | c328c53196f92236cc8976065d950a4c26208408 | GoComply/fedramp | /bundled/templates.go | Go | go | 1,228 | permissive | package bundled
import (
"errors"
"github.com/gocomply/fedramp/pkg/fedramp/common"
"github.com/markbates/pkger"
"github.com/markbates/pkger/pkging"
)
func TemplateDOCX(baseline common.BaselineLevel) (pkging.File, error) {
switch baseline {
case common.LevelLow:
return pkger.Open("/bundled/templates/FedRAMP-SS... |
d2cae347f9d07830c2e4b654eb63d83211c4ace8 | fa5982ce821f554cc3f36d0c604b1d55488822e5 | massyu/iota.go | /guards/validators/validator.go | Go | go | 4,844 | permissive | // Package validators leverages package guards to provide easy to use validation functions.
package validators
import (
"net/url"
"github.com/massyu/iota.go/bundle"
. "github.com/massyu/iota.go/consts"
. "github.com/massyu/iota.go/guards"
. "github.com/massyu/iota.go/trinary"
"github.com/pkg/errors"
)
// Valid... |
d2b8736a97fbe27ce551bd067057e0be3ddb00ae | d754a0e07d9cb71f8f0745e652571228dcdd289d | fkoerich/gitea | /modules/nosql/manager_redis.go | Go | go | 5,125 | permissive | // Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package nosql
import (
"crypto/tls"
"path"
"strconv"
"strings"
"github.com/go-redis/redis/v8"
)
var replacer = strings.NewReplacer("_", "", "-", "")
... |
c9ee57a761d8df3044dadeb87db84afff8c8f5ec | 166844e01eff2218f16499d574be71f2e06337be | MikaelSmith/troubleshoot | /pkg/analyze/node_resources_test.go | Go | go | 21,642 | permissive | package analyzer
import (
"testing"
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1... |
7b94c5d679869fe85c6841b8d2ca865e4496a7f9 | 162cc48e95993f1d04d54aa0a7d160bfe49ff6e0 | nsogame/common | /rijndael.go | Go | go | 7,412 | no_license | package common
// ATTENTION:
// THIS CODE IS FROM https://github.com/agl/pond/tree/master/panda/rijndael
import (
"crypto/cipher"
"encoding/binary"
)
const rounds = 14
const keyWords = 8
const BlockSize = 32
const blockWords = BlockSize / 4
type Cipher struct {
key [blockWords * (rounds + 1)]uint32
}
func NewCi... |
2ce84c89aff1225481f206d252a038f8d0414634 | cbd237174db2aa81a6758d8eb6e750df3d17fad7 | haiqun/go-zero | /tools/goctl/api/parser/g4/test/ast_test.go | Go | go | 13,132 | permissive | package test
import (
_ "embed"
"testing"
"github.com/stretchr/testify/assert"
"github.com/zeromicro/go-zero/tools/goctl/api/parser/g4/ast"
"github.com/zeromicro/go-zero/tools/goctl/api/parser/g4/gen/api"
)
//go:embed apis/test.api
var testApi string
var parser = ast.NewParser(ast.WithParserPrefix("test.api"),... |
8c1bc1395e43f8cd89dcbb137da4ddbc188bc32f | 8801cbf97992c4ece85215ecdc4c206bec6e67c2 | codeallyio/goTask | /mockserver.go | Go | go | 2,605 | no_license | package main
import (
"errors"
"fmt"
"time"
)
var mockConnections = []connection{
{ip: "111.111.111.111"},
{ip: "222.222.222.222"},
{ip: "333.333.333.333"},
}
var activeConnections = []connection{}
var activeRequests = make(chan request, 9)
type request struct {
rid int8 // request id
ip ... |
2635c2c49f6ab118175fa90789fdfcb657f508bc | 5951c2930a3fa7e243fa7d330d9bf105718f0ebc | the-redback/k8s-apiserver-by-apiserver-builder | /pkg/client/informers_generated/internalversion/factory.go | Go | go | 4,611 | no_license | /*
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, ... |
49b4c64a76e3f3626a8fe97059f01d1a93ade395 | 74155e105be622c4d47fb5175dfe685d27801f6c | zy-free/go-zero-study | /core/stores/cache/cache.go | Go | go | 2,842 | no_license | package cache
import (
"fmt"
"log"
"time"
"go-zero-study/core/errorx"
"go-zero-study/core/hash"
"go-zero-study/core/syncx"
)
type (
Cache interface {
DelCache(keys ...string) error
GetCache(key string, v interface{}) error
SetCache(key string, v interface{}) error
SetCacheWithExpire(key string, v inte... |
fac34c236ecb063f94c7c71fe4e0590d40209c49 | 12f12fd4cca96fc5833c2ae144743bc22f2c81aa | stephanievu/hera | /tests/functionaltest/bind_eviction_tests/simple_evict/main_test.go | Go | go | 7,778 | permissive | package main
import (
"context"
"database/sql"
"fmt"
"os"
"testing"
"time"
"github.com/paypal/hera/client/gosqldriver"
_"github.com/paypal/hera/client/gosqldriver/tcp"
"github.com/paypal/hera/tests/functionaltest/testutil"
"github.com/paypal/hera/utility/logger"
)
/*
The test will start... |
ecf79c1bd61c91a54cbd19c5e5c2323c59b6e270 | d20d8a11879f2681d82b8b79fbb9e52971aaf1d6 | lovefcaaa/snk.dev-assistant | /data/snippets/github.com/shurcooL/play/103/task.go | Go | go | 306 | no_license | package task
// DeepIteratorᐸTᐳ where T is int. Performs depth-first iteration over all inner elements of DataᐸTᐳ.
type DeepIteratorᐸintᐳ interface {
HasNext() bool
Next() int
}
// The task is to write code that implements DeepIteratorᐸTᐳ.
// See task_test.go for an example test case.
|
594c7e5272cd8d15ab0799969f81e84addcddd8f | 4273634e802681ee9d01ea5a9d5fbd2f1f5f7215 | maiyama18/qiita | /test_helpers.go | Go | go | 2,440 | no_license | package qiita
import (
"bufio"
"github.com/stretchr/testify/assert"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path"
"strconv"
"strings"
"testing"
)
func setup(t *testing.T, mockFilesBaseDir, mockResponseHeaderFile, mockResponseBodyFile, expectedMethod, expectedRequestPath, expectedR... |
7b2b3498743dff051e1808a4502a3bf0f43014be | fd58babad3450c9f84258aa62d4b081212b48fb4 | gngeorgiev/checkmail | /cmd/main.go | Go | go | 1,218 | permissive | package main
import (
"flag"
"fmt"
"net"
"time"
"github.com/gngeorgiev/checkmail"
)
var (
fromEmailFlag string
fromHostFlag string
timeoutFlag string
toFlag string
)
func init() {
flag.StringVar(&fromEmailFlag, "from", "", "")
flag.StringVar(&fromHostFlag, "host", "", "")
flag.StringVar(&timeoutFlag... |
3c91e03ad7086f75c824c1e1cc5bf1dd5d1a38cb | 9cb188b98fb5fe63997b11723f04ab4437fd0bff | go-steven/yunpian | /tpl.del.go | Go | go | 492 | no_license | package yunpian
import (
"github.com/bububa/ljson"
)
type DeleteTplRequest struct {
BaseRequest
TplId uint64
}
func DeleteTpl(apiReq *DeleteTplRequest) (*GetTplResponse, error) {
client := NewClient(apiReq.ApiKey)
req := NewRequest("tpl/del.json")
req.Params["tpl_id"] = apiReq.TplId
response, err := client.E... |
4cf249e1da2baa681e39ca5f2b807572606bbc20 | ca4c6158b3c46aa095520bc7bd685e4f26667a3c | warthog618/config | /example/readme/decoder/toml/main.go | Go | go | 362 | permissive | package main
import (
"fmt"
"github.com/warthog618/config"
"github.com/warthog618/config/blob"
"github.com/warthog618/config/blob/decoder/toml"
"github.com/warthog618/config/blob/loader/file"
)
func main() {
c := config.New(blob.New(file.New("config.toml"), toml.NewDecoder()))
s := c.MustGet("nested.string").... |
dbb578e20a6969b72a77351853c6bd8e638585ad | 8d0967b0f661d1936ee7c72783d53a405e0c7515 | ronenhamias/pipeline | /internal/platform/log/k8s_logger.go | Go | go | 1,661 | permissive | // Copyright © 2019 Banzai Cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
ed70d20c15d89316e9a6ef4445f8015479953888 | 4eb6d1f920476942fc733a47ae88ee9e7086b9b2 | eager7/dashd | /database/cmd/dbtool/insecureimport.go | Go | go | 11,413 | permissive | // Copyright (c) 2015-2016 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"encoding/binary"
"fmt"
"io"
"os"
"sync"
"time"
"github.com/eager7/dashd/chaincfg/chainhash"
"github.com/eager7/dashd/database"
"github.... |
2a6e52ba815ae5b4c0e4d8370d9a014382dd9ae2 | a07baf36483371730a3832b7690515f81ac88e8d | bryanl/apptracing-go | /instrument/service.go | Go | go | 2,088 | no_license | package main
import (
"context"
"time"
"github.com/bryanl/apptracing-go/internal/platform/db"
atrand "github.com/bryanl/apptracing-go/internal/platform/rand"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
otlog "github.com/opentracing/opentracing-go/log"
"gith... |
00cda14b81606fb041f62f4d1d96d81f9ab4d8b9 | 60ada21045e8605ef639157b7e2431fd53b229bf | sapcc/kubernetes-operators | /openstack-seeder/vendor/k8s.io/kubernetes/pkg/client/listers/core/v1/service.go | Go | go | 3,058 | permissive | /*
Copyright 2018 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, ... |
8a4d96f3df7334e599eebe98a212d3c2ae3e30f2 | 32159176fa38fdd38d41598f3ff341d457f36fb3 | trusch/SocialGraphAnalysis | /src/graphtools/Reachable.go | Go | go | 535 | no_license | package graphtools
func reach(act uint32,g *Graph,deep uint8,resultMap map[uint32]uint8, onlineMap map[uint32]bool) {
if onlineMap[act]==false {
return
}
if val,ok := resultMap[act]; deep>val||ok==false {
resultMap[act]=deep
if deep>0 {
for _,next := range g.AdjMap[act] {
reach(next,g,deep-1,resultMap,... |
292d30dadadc2cd70845cb55d6f799515ec42730 | 8829516b0302466d56cef36b4b461789ec9c4bd5 | psmarcin/psutils | /pkg/accounting/reformat_test.go | Go | go | 758 | no_license | package accounting
import (
"log"
"testing"
"time"
)
func Test_generateName(t *testing.T) {
date, err := time.Parse("2006 January", "2018 September")
if err != nil {
log.Fatalf("Test err %+v", err)
}
type args struct {
name string
date time.Time
types string
}
tests := []struct {
name string
a... |
001e22c44b2c5b8db253e5cceaeba1af6f68eb72 | beb7444c65b5187994e564ee05ed1b8a0333644a | navono/dolt | /go/libraries/doltcore/diff/querydiff/query_differ_test.go | Go | go | 20,580 | permissive | // Copyright 2020 Liquidata, 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... |
3f1c8283061c2e20891acea9d052751d57322fa9 | 1bf9440ddc35d34b442c9dce2cd93fbef85343da | franco-hildt/tweeter-manager | /src/domain/tweet.go | Go | go | 2,492 | no_license | package domain
import (
"fmt"
"time"
)
type Tweet interface {
GetUser() string
GetText() string
GetDate() *time.Time
GetId() int
SetId(int, *TextTweet)
PrintableTweet() string
}
type TextTweet struct {
Text string
User string
Date *time.Time
Id int
}
type ImageTweet struct {
TextTweet
Link string
}
... |
3edf2dd8924aee6719f8c24b6958e8baa1639677 | cae62a1eb07437c57d48a79d15b96ceaed6d78f1 | lgvacanti/projecteuler | /problems/10.go | Go | go | 203 | no_license | package problems
import (
"fmt"
"../pe"
)
// Problem10 solves problem 10
func Problem10() {
var sum int
for i := 2; i < 2000000; i++ {
if pe.IsPrime(i) {
sum += i
}
}
fmt.Println(sum)
}
|
d5cb1f597d3fd8457b4f326e17133652b9120815 | 53f4f82fae0e6a438d0ddb9e94f52948d6eac452 | fabianofranz/candlepin-go-glient | /model_permission_blueprint.go | Go | go | 523 | no_license | /*
* Candlepin
*
* Candlepin is subscription management server written in Java. It helps with management of software subscriptions.
*
* API version: 2.3.10
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
import (
"time"
)
type PermissionBlueprint struct {
Created time.Ti... |
6e2b1dff58dca59dc4eb8eb565669d49becbfa6b | 74d7bd1173361d33c924bb5f9f0c982147448813 | jmckaskill/simple-ipc | /go-ipc/transport.go | Go | go | 236 | no_license | package ipc
import (
"net"
"os"
)
type File interface {
Fd() uintptr
}
type FileConn interface {
net.Conn
ReadFiles(b []byte, files []*os.File) (n, fn int, err error)
WriteFiles(b []byte, files []File) (n, fn int, err error)
}
|
124c593830840637e16f4c91fd03f85bc54779f0 | 931aaf92f455662c3361a7176f566bb21088f9f7 | mr31337/installer | /pkg/terraform/exec/plugins/vendor/github.com/ovirt/terraform-provider-ovirt/ovirt/resource_ovirt_mac_pool.go | Go | go | 4,479 | permissive | // Copyright (C) 2018 Joey Ma <majunjiev@gmail.com>
// All rights reserved.
//
// This software may be modified and distributed under the terms
// of the BSD-2 license. See the LICENSE file for details.
package ovirt
import (
"fmt"
"log"
"strings"
"github.com/hashicorp/terraform/helper/schema"
ovirtsdk4 "githu... |
8e67ab09544302df562ecd80d398b18c2401f7dc | c7705d0f3edba1f8006c357593e4b8500c8dd003 | BjornGudmundsson/p2pBackup | /purb/purbs/utils.go | Go | go | 5,830 | permissive | package purbs
import (
"crypto/aes"
"crypto/cipher"
"crypto/sha256"
"fmt"
"strconv"
"strings"
"github.com/BjornGudmundsson/p2pBackup/kyber/group/curve25519"
"github.com/BjornGudmundsson/p2pBackup/kyber/util/random"
)
// Simply returns a string with the internal details of the PURB
func (purb *Purb) VisualRep... |
ec8adad3d3c26ecfdb4fc544cb9f2a5631c0ed11 | 6c5d891a0fe8cfc8cef26e3b001b14a414330264 | jtligon/libpod | /test/e2e/checkpoint_test.go | Go | go | 4,401 | permissive | package integration
import (
"fmt"
"os"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman checkpoint", func() {
var (
tempdir string
err error
podmanTest PodmanTest
)
BeforeEach(func() {
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
... |
c75294c1adb9ec3788a2590ed6e1bb0598cc7445 | 011e3a9e706735e8a815eca0c849a2115ece1375 | justdba/binlogspy | /vendor/github.com/siddontang/go-mysql/replication/binlogstreamer.go | Go | go | 1,825 | permissive | package replication
import (
"context"
. "github.com/flike/kingbus/log"
"github.com/juju/errors"
)
var (
ErrNeedSyncAgain = errors.New("Last sync error or closed, try sync and get event again")
ErrSyncClosed = errors.New("Sync was closed")
)
// BinlogStreamer gets the streaming event.
type BinlogStreamer st... |
03fa8af9d84c7cb106260fa9a0deee6b766405ea | 9e50686a09d27cd8c0cc5ccb816789b6e0e58023 | shnidi/gopsutil | /v3/internal/common/sleep_test.go | Go | go | 597 | permissive | package common_test
import (
"context"
"testing"
"time"
"github.com/saegewerk/gopsutil/v3/internal/common"
)
func TestSleep(test *testing.T) {
const dt = 50 * time.Millisecond
var t = func(name string, ctx context.Context, expected error) {
test.Run(name, func(test *testing.T) {
var err = common.Sleep(ctx... |
dffdd08d04df535f81391266bd0a5150003b6a17 | c0980a46526109de92ae1dfbabb2bc3dea6f8b34 | ClintonCollins/sketchy-irc-go | /irc_codes_handler.go | Go | go | 2,614 | permissive | package sketchyircgo
func (Instance *IRCInstance) ircPRIVMSG(rawMessage string) {
if Instance.TwitchIRC {
message, err := Instance.parseTwitchPrivMsg(rawMessage)
if err != nil {
writeLog("Error parsing Twitch message.")
return
}
Instance.sendMessageListener(Instance, message)
} else {
message, err :=... |
6dbe5f0f29251cd8fa05355a4431291e75c27239 | 0b00d2258e60a20eb993713bb59d0b14974a154c | weylau/micservice | /user-edge-service/app/config/config.go | Go | go | 1,261 | no_license | package config
import "gopkg.in/ini.v1"
type SysConfig struct {
Env string `ini:"env"`
DBDriver string `ini:"db_driver"`
DBHost string `ini:"db_host"`
DBPort string `ini:"db_port"`
DBUser string `ini:"db_user"`
DBPass string `ini:"db_pass"`
DBName ... |
54e4b494fe4c5ad6ccb7455df6f4541b01504459 | 162ff10dcc25e105259c4afee105841b6dbd2fdc | dafanshu520/bk-bcs | /bcs-mesos/bcs-scheduler/src/manager/sched/backend/update_application.go | Go | go | 4,777 | permissive | /*
* Tencent is pleased to support the open source community by making Blueking Container Service available.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. You may obta... |
8fd57273648477cf9df278f4307e4d692311c113 | 49b667f55ca34c883bbf1f60d68f318be0abfeb3 | bufferapp/imageproxy | /vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext/app_types.go | Go | go | 2,771 | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-2020 Datadog, Inc.
package ext // import "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
// App ... |
02c9bb4b64aea03220553fb30615a162cd2da2f2 | 94e3865a3dfd1b07a7f1d59d6ccbbee8264a902c | abhnin/go-api | /controllers/mail.go | Go | go | 5,643 | permissive | package controllers
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"time"
log "github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
"gopkg.in/guregu/null.v3"
"twreporter.org/go-api/services"
"twreporter.org/go-api/utils"
)
type activationReqBody struct {
Email... |
4b2c89b9620a0f80ea8531619e436af65ab9a7d3 | d5bb4c5452f049a35d2df7b4e557f943822b1b75 | Pecadis/r3 | /request/request_icon.go | Go | go | 707 | permissive | package request
import (
"encoding/json"
"r3/schema/icon"
"r3/types"
"github.com/gofrs/uuid"
"github.com/jackc/pgx/v4"
)
func IconDel_tx(tx pgx.Tx, reqJson json.RawMessage) (interface{}, error) {
var req struct {
Id uuid.UUID `json:"id"`
}
if err := json.Unmarshal(reqJson, &req); err != nil {
return ni... |
743f0e485196157c98ec3c7471528a2f194305da | 774af0520f41b73a671017744d7037cf57614b3e | mdedonno1337/harvester | /pkg/webhook/resources/upgrade/validator.go | Go | go | 7,790 | permissive | package upgrade
import (
"fmt"
"strings"
longhornv1beta1 "github.com/longhorn/longhorn-manager/k8s/pkg/apis/longhorn/v1beta1"
fleetv1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
mgmtv3 "github.com/rancher/rancher/pkg/generated/controllers/management.cattle.io/v3"
v1 "github.com/rancher/wr... |
46f140f37b69285c36cb397ea0360d17817ef719 | 651aa080f2611b3b6df08203197ad78ac7f6cf6c | dr-jk/gitlab-shell | /internal/logger/logger.go | Go | go | 1,802 | permissive | package logger
import (
"fmt"
"io/ioutil"
"log/syslog"
"os"
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
)
func configureLogFormat(cfg *config.Config) {
if cfg.LogFormat == "json" {
log.SetFormatter(&log.JSONFormatter{})
}
}
// Configure configures the logging sing... |
b17af0bfed20235a8e2df8e5826ac3c5ec254ae8 | ed42bf899abbe0efcd870f04bd6043ad2678bb43 | rotemlinik/IP2Country | /server/server.go | Go | go | 2,047 | no_license | package server
import (
"encoding/json"
"fmt"
"log"
"net/http"
Db "server/ip2country/db"
"time"
)
type Server struct {
db Db.Db
config *Config
rateLimiter chan bool
}
func NewServer() *Server {
server := Server{}
server.db = Db.NewDb()
server.config = newConfig()
server.rateLimiter = make(... |
0005afaa62f538ebab24210fdd47d9a86bd4e273 | 86c0089d94712cc95a4ac385038634a720515430 | yatishsv/tutorials | /prometheus/prometheus_tut/main.go | Go | go | 1,597 | no_license | package main
import (
"fmt"
"math/rand"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/log"
)
var criticismCounter = promauto.NewCounter(promet... |
8a1de4c66e4d60655e817b5f06362417ec4b8a77 | 15e2bdc4ee5ed8a4102e599da58ac31317210b4d | chhlatnash/origin | /pkg/assets/mime.go | Go | go | 1,271 | permissive | package assets
import "mime"
// RegisterMimeTypes adds mime type registrations for the file types the assets server will serve.
// Registering here so we work without /etc/mime.types installed
func RegisterMimeTypes() {
// Text types
registerIfNeeded(".css", "text/css; charset=utf-8")
registerIfNeeded(".html", "te... |
7bb7b5c0344bd7c1d9fd7839441893bd71b03bfa | 9bdbd487d58b3cc6ecc4dd8537abddc96daea97f | fengelhardt/recoverytool | /bytecount.go | Go | go | 764 | permissive | package main
import (
"fmt"
"time"
)
type bytecountaction struct {
cnt uint64
tp float64
t1 time.Time
}
func (a *bytecountaction) Init() {
a.t1 = time.Now()
a.tp = 0.0
return
}
func (a *bytecountaction) Run(buf[] byte, abspos, tcnt, n uint64, lastbit bool) (uint64, error) {
for i := 0; i < len(buf) ; i++ {... |
dd0e465722d538ae58a070a4a080eb9603e9b706 | b2f8188309957c10be37e0597f7e2d2e10136039 | jlangston/sourcegraph | /cmd/frontend/internal/pkg/usagestats/usage_stats.go | Go | go | 13,623 | permissive | // Package usagestats provides an interface to update and access information about
// individual and aggregate Sourcegraph users' activity levels.
//
// Note that this package should not be used on sourcegraph.com, only on self-hosted
// deployments.
package usagestats
import (
"fmt"
"math/rand"
"strconv"
"sync"
... |
c3f91b247d066b44f0a3a39fda3d60e6be3b01f6 | cc4599e88f0de04afb239ca637db35b2e2676d3d | dmolik/shield | /client/v2/shield/archives.go | Go | go | 2,414 | permissive | package shield
import (
"fmt"
qs "github.com/jhunt/go-querytron"
)
type Archive struct {
UUID string `json:"uuid,omitempty"`
Key string `json:"key"`
Status string `json:"status"`
Notes string `json:"notes"`
Target *Target `json:"target,omitempty"`
Store *Store `json:"store,omitempty"`
Policy *Polic... |
b4b50eb5a40551106be382ffe5ab259e8f583a4e | bb41aa549ab1ff26ea0b124ba2ea1061a460577f | supercym/go_leetcode | /145_Binary_Tree_Postorder_Traversal.go | Go | go | 821 | no_license | /**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
func postorderTraversal(root *TreeNode) []int {
ans := make([]int, 0)
if root == nil {
return ans
}
stack := make([]*TreeNode, 0)
stack = app... |
5dacb801e067f627723a132da90b26ff3c0aaed0 | 6888f49e4b52eb9d635060bb7f0d3e00762c26a3 | serpro69/golang-ddd-kata | /GetThingsDone-app/integration_tests/steps/read_todo_list.go | Go | go | 972 | no_license | package steps
import (
"encoding/json"
"fmt"
"github.com/GermainSIGETY/golang-ddd-kata/GetThingsDone-app/ui"
"io/ioutil"
"net/http"
)
func (world *TodoWorld) AnswerContainsMoreThanTodos(numberOfTodos int) error {
if len(world.todoSummaries) < numberOfTodos {
return fmt.Errorf("error reading todo list ; list s... |
83e427518c535d00ed20590329746e2b3b50d2e0 | 6218679abcb678dfa9807140aeae2aa37bf456ae | willdrewes/Goforit | /rest_http_server/main.go | Go | go | 1,499 | no_license | package main
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
newrelic "github.com/newrelic/go-agent"
"github.com/rewardStyle/campaign-service/lib/log"
"github.com/rewardStyle/generic-service/controllers"
"github.com/rewardStyle/generic-service/services"
"github.com/spf13/viper"
"github.com/stvp/rollbar"
)... |
9cdabcd029d049ec858491b6ebe2b541683de106 | 1bfa4e144ef48ecd919e55ca98481f9031c4e873 | wp-jackliu/opentaobao | /model/axintrade/AxinFundCreateResDto.go | Go | go | 1,030 | permissive | package axintrade
// AxinFundCreateResDto 结构体
type AxinFundCreateResDto struct {
// 资金单ID
FundId string `json:"fund_id,omitempty" xml:"fund_id,omitempty"`
// 阿信支付宝账号appID
AppId string `json:"app_id,omitempty" xml:"app_id,omitempty"`
// 支付宝返回的拼接串
AlipayBody string `json:"alipay_body,omitempty" xml:"alipay_body,om... |
43fd6e57d7f97c5eb65a422311fbcafdb7f7ccfb | c3d987cf4405d25559225601bccc41aa7f9b8d0e | justwatchcom/sql_exporter | /config.go | Go | go | 3,962 | permissive | package main
import (
"errors"
"fmt"
"io"
"os"
"regexp"
"strings"
"sync"
"time"
"github.com/go-kit/log"
"github.com/jmoiron/sqlx"
"github.com/prometheus/client_golang/prometheus"
"github.com/robfig/cron/v3"
"gopkg.in/yaml.v2"
)
var (
failedScrapes = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Na... |
e5740ca6604ef5505c91821b4fac8a48c4ce574a | 9f6f69dc9001ace886b25829cfd3e7f0e40b275d | uny/jx | /pkg/cmd/importcmd/import.go | Go | go | 48,921 | permissive | package importcmd
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
jenkinsio "github.com/jenkins-x/jx/pkg/apis/jenkins.io"
"github.com/jenkins-x/jx/pkg/cmd/step/create/pr"
"github.com/jenkins-x/jx/pkg/maven"
"github.com/cenkalti/backoff"
"github.com/denormal/go-gitignore"
gojenkins "githu... |
7e8f679037b20c133fc0a63ff6de58e3d2b22a6a | 16477bb0fa393ccddd2cc28975c4bbd7307d6a9a | sudeepigntion/ltropy_banking_task | /src/controllers/brokers/FreezeAccount.go | Go | go | 1,865 | no_license | package brokers
import (
"RequestValidation"
"encoding/json"
"lib"
"messages"
"models/brokers"
"net/http"
"objects"
)
func FreezeAccount(req *http.Request, res http.ResponseWriter){
defer lib.HandleHttpPanic(res)
sessionObject := objects.Session{}
// creating object from redis session
if err := json.Unm... |
3f7fec7a1b488c05374ac42a238ea81aac63a55a | 0bdf79096ed2ac6f02346ac20acba8601de21294 | eberlitz/sourcegraph | /enterprise/cmd/frontend/internal/licensing/enforcement/external_services_test.go | Go | go | 1,512 | permissive | package enforcement
import (
"context"
"testing"
"github.com/sourcegraph/sourcegraph/enterprise/internal/licensing"
"github.com/sourcegraph/sourcegraph/internal/db"
)
func TestNewPreCreateExternalServiceHook(t *testing.T) {
ctx := context.Background()
if !licensing.EnforceTiers {
licensing.EnforceTiers = tru... |
457e804046fb73fbe10f045c86c06d502552fdb5 | 1e218fe21a17878b3f5ec9bab2c1f3ddc79f30b1 | yuuis/vg-1day-2018-06-02 | /aki/bot/processor.go | Go | go | 2,323 | no_license | package bot
import (
"regexp"
"strings"
"fmt"
"github.com/VG-Tech-Dojo/vg-1day-2018-06-02/aki/env"
"github.com/VG-Tech-Dojo/vg-1day-2018-06-02/aki/model"
"net/url"
)
const (
keywordAPIURLFormat = "https://jlp.yahooapis.jp/KeyphraseService/V1/extract?appid=%s&sentence=%s&output=json"
)
type (
// Processor は... |
41b4152f1433f95187ebbbde7e893f512ca87245 | bcfc253c9476d647465913c4847f5871e66e79fb | giggsoff/runv | /hypervisor/qemu/qemu_s390x.go | Go | go | 1,838 | permissive | // +build linux,s390x
package qemu
import (
"fmt"
"strconv"
"github.com/hyperhq/runv/hypervisor"
)
const (
QEMU_SYSTEM_EXE = "qemu-system-s390x"
)
func (qc *QemuContext) arguments(ctx *hypervisor.VmContext) []string {
if ctx.Boot == nil {
ctx.Boot = &hypervisor.BootConfig{
CPU: 1,
Memory: 128,
K... |
03a23f9fa2da0e2e305a69f560da87cda570e654 | 3a72b2cab5829de00224ae23ed43e2331de29ea7 | concourse/concourse | /atc/api/buildserver/create.go | Go | go | 1,066 | permissive | package buildserver
import (
"encoding/json"
"net/http"
"code.cloudfoundry.org/lager/v3"
"github.com/concourse/concourse/atc"
"github.com/concourse/concourse/atc/api/present"
"github.com/concourse/concourse/atc/db"
)
func (s *Server) CreateBuild(team db.Team) http.Handler {
hLog := s.logger.Session("create-bu... |
df8e92e3e50e636385c63bbd256d87d97078f306 | 7ef55891c78d77eebdc5e30428777df226b79f12 | kanade2010/Go_Test | /beelog.go | Go | go | 988 | no_license | package main
import (
"github.com/astaxie/beego/logs"
"time"
)
func main() {
//an official log.Logger
l := logs.GetLogger()
l.Println("this is a message of http")
//an official log.Logger with prefix ORM
logs.GetLogger("ORM").Println("this is a message of orm")
logs.Debu... |
7366fd809d439f00693fdbdd4ac2431a77604b6b | 4a9e4afc56643cd45fba72e681c6f87178d561c8 | jeandeaual/go-scryfall | /auth.go | Go | go | 5,875 | permissive | package scryfall
import "context"
// OAuthScope is the level of access.
type OAuthScope string
const (
// OAuthScopeRead grants the ability to inspect data on a user’s
// account. No methods that change data will be allowed.
OAuthScopeRead OAuthScope = "read"
// OAuthScopeReadWrite grants full API access to a u... |
5cb298995d319c8142d5202f540e92920e3e061a | 831f15e05f0b3c482dc94884bd507d52c7a1437c | lshguo/rabbitmq-go | /main.go | Go | go | 2,418 | no_license | package main
import (
"fmt"
"github.com/streadway/amqp"
"time"
"strconv"
"sync"
)
const rabbitUrl = "amqp://guest:guest@192.168.241.130:5672/"
const exType = "topic"
const exName = "excellent"
var number uint32
var numberLock sync.Mutex
func errpanic(err error){
if err != nil{
panic(err)
}
}
func... |
7128bfcc3d84ca94b392b0cb54937b85d6e5e4c2 | 9f8d03eaa5dd63c39aac1c012f711f74dbafed73 | Babidiii/ucago | /utils.go | Go | go | 868 | no_license | package main
import (
"errors"
"fmt"
"strconv"
"strings"
)
var longMonthNames = []string{
"janvier",
"février",
"mars",
"avril",
"mai",
"juin",
"juillet",
"août",
"septembre",
"octobre",
"novembre",
"décembre",
}
var errBad = errors.New("bad value for field")
func lookup(tab []string, val string) (s... |
41aa5f64cc5a942c588d358b6adfa263e2bea621 | 987f8561e6f761ae96f33e949717150cd9196552 | ShrewdThingsLtd/free5gc-stage-2 | /src/amf/amf_ngap/ngap_sctp/amf_ngap_sctp_test.go | Go | go | 2,108 | permissive | package amf_ngap_sctp_test
import (
"encoding/binary"
"encoding/hex"
"free5gc/src/amf/amf_handler"
"net"
"runtime"
"testing"
"time"
"github.com/ishidawataru/sctp"
amf_ngap_sctp "free5gc/src/amf/amf_ngap/ngap_sctp"
"free5gc/src/amf/logger"
)
var testClientNum = 2
func TestSctpServer(t *testing.T) {
runti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.