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 |
|---|---|---|---|---|---|---|---|---|
47ceaa3c9c2fef6f92dccefb61332e883aad5f0c | 865e44facfdb7abad441d6528cf28085bd605ed8 | dmsakamoto/learning-go | /tour-of-go/fibonacci.go | Go | go | 305 | permissive | package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
a := 0
b := 1
return func() int {
temp := a
a = b
b = temp + a
return b
}
}
func main() {
f := fibonacci()
for i := 0; i < 10; i++ {
fmt.Println(f())
}
}
|
d284a126eef5e47a6a6f639e40027893e0eabddb | 9519d5c28ac01e7b0b6ce5c8b1e4651b6fc22caa | spjmurray/goci | /pkg/fibonacci/fib.go | Go | go | 305 | no_license | package fibonacci
import (
"fmt"
)
func Fib(n int) (int, error) {
if n <= 0 {
return 0, fmt.Errorf("illegal number")
}
if n == 1 || n == 2 {
return 1, nil
}
a, err := Fib(n - 1)
if err != nil {
return 0, err
}
b, err := Fib(n - 2)
if err != nil {
return 0, err
}
return a + b, nil
}
|
d445de7941993ac552523cfc2431e21578e0aba5 | 19812ab9333d89889dbcb62422fa68c478cc4cdf | wuhonglie/goblog | /pkg/flash/flash.go | Go | go | 1,326 | no_license | package flash
import (
"encoding/gob"
"goblog/pkg/session"
)
// Flashes Flash 消息数组类型,用以在会话中存储 map
type Flashes map[string]interface{}
// 存入会话数据里的 key
var flashKey = "_flashes"
func init(){
// 在gorilla/sessions中存储 map 和 struct 数据需
// 要提前注册 gob,方便后续 gob 序列化编码、解码
gob.Register(Flashes{})
}
// Info 添加... |
640022925b91371d53e0e1ac8f70f1cde92ed66a | 6b8722201730a44fb437e24e259e579cca17827c | benoitf/router | /pkg/router/metrics/haproxy/haproxy.go | Go | go | 28,594 | permissive | // Package haproxy is inspired by https://github.com/prometheus/haproxy_exporter
package haproxy
import (
"encoding/csv"
"errors"
"fmt"
"io"
"io/ioutil"
"math"
"net"
"net/http"
_ "net/http/pprof"
"net/url"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/prometheus/client_golang/prometheus"
util... |
7508d0ffa5a986c2fae30146df49a01fb4b802ef | 76f962608572cb970b341c2c731f7f3a2542ed5a | scorum/scorum-go | /key/privatekey.go | Go | go | 1,671 | permissive | package key
import (
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
)
type PrivateKey struct {
wif *btcutil.WIF
}
func NewPrivateKey() (*PrivateKey, error) {
raw, err := btcec.NewPrivateKey(btcec.S256())
if err != nil {
return nil, fmt.Errorf("new p... |
f24d1dfa3787279d57265645ee9f6df1ea7f5cbc | e433873a37ae3c5b841ff65e724f319d499dcd05 | shahid2636/upf-epc | /pfcpiface/vendor/github.com/wmnsk/go-pfcp/ie/create-pdr.go | Go | go | 529 | permissive | // Copyright 2019-2020 go-pfcp 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 ie
// NewCreatePDR creates a new CreatePDR IE.
func NewCreatePDR(ies ...*IE) *IE {
return newGroupedIE(CreatePDR, 0, ies...)
}
// CreatePDR ret... |
8a556713b578a51504913b5830d5b64c5315bb3a | b168b4bcd68e7287df8028468a8b3a59834ab33e | jrask/lovebeat | /alert/mail.go | Go | go | 2,396 | permissive | package alert
import (
"bytes"
"github.com/boivie/lovebeat/config"
"github.com/boivie/lovebeat/service"
"net/smtp"
"strings"
"text/template"
)
type mail struct {
To string
Subject string
Body string
}
type mailAlerter struct {
cmds chan mail
}
const (
TMPL_BODY = `The status for view '{{.View.Nam... |
67d84a5a0ef5a292abe0d8ce85b418c1d438ff2c | a7459025f18d55a439cb0b6c15c563e16a663022 | flourishLi/Golang | /ZDTalk/src/ZDTalk/utils/httpfileserver/know_upload.go | Go | go | 4,521 | no_license | package main
import (
co "ZDTalk/utils/cryptoutils"
su "ZDTalk/utils/stringutils"
"encoding/json"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"time"
)
const (
// Template_Dir = "./view/"
Upload_Dir = "files/"
// Upload_Dir = "G:/KuGouu/"
)
var reqres map[string]func... |
858debc2ef1deceda3ad072ad4ddf2e29d5d6eec | 77a20e9d873386819f71e366e59a1c94e7c54f3a | backwardn/grimoire | /changeset/constraint.go | Go | go | 1,264 | permissive | // Package changeset used to cast and validate data before saving it to the database.
package changeset
import (
"strings"
"github.com/Fs02/grimoire/errors"
)
// Constraint defines information to infer constraint error.
type Constraint struct {
Field string
Message string
Code int
Name string
Exact ... |
64e7b93f1ebd1ee101cd5a5307c69d9b2f4e3414 | 10b4090acbfd10ae32b9421ea9cc4181988603c5 | JadeRedworth/cli | /commands/invoke.go | Go | go | 2,780 | permissive | package commands
import (
"fmt"
"os"
"github.com/fnproject/cli/client"
"github.com/fnproject/cli/common"
"github.com/fnproject/cli/objects/app"
"github.com/fnproject/cli/objects/fn"
"github.com/fnproject/fn_go/clientv2"
"github.com/fnproject/fn_go/provider"
"github.com/urfave/cli"
"errors"
)
// FnInvokeEnd... |
e690a819445c581d6b1af3fbf43ac8ef28d70977 | 758e2ec59b12087f4080d909b2e380b7bb55b5f7 | fatedier/istio | /tools/bug-report/pkg/bugreport/flags.go | Go | go | 7,156 | permissive | // Copyright Istio 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 wri... |
f75d6f058c51e71dc96f622da8db8a04f6f7824c | f773805e320067eebeca52ebedaf30ec0553cf5f | jaywalia/go | /src/tour/060-sqrt-errors.go | Go | go | 478 | no_license | package main
import (
"fmt"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {
return fmt.Sprintf("cannot Sqrt negative number %v", float64(e))
}
func Sqrt(x float64) (float64, error) {
if x < 0 {
return 0, ErrNegativeSqrt(x)
}
var z, d, nz float64
d = 0.000000000000001
z = x + 2*d
... |
bdbed72516beae43deba4c1abfeb3ab60bde2bf7 | 7736bb53baa4d87caa21c891af31fcfe499b701b | hhvnldnn/osm | /tests/framework/common_apps.go | Go | go | 15,657 | permissive | package framework
import (
"context"
"fmt"
goversion "github.com/hashicorp/go-version"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/api"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
admissionregv1 "k8s.io/api/admissionregistration/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/a... |
f19891ba576d2809137c0e32da26f6af9583c1dc | 6ce0577b3f25a4c4c972bec60d3d25582dc28fcf | soyum2222/slog | /multiwritecloser.go | Go | go | 805 | permissive | package slog
import (
"io"
"os"
)
type multiWriteCloser struct {
stdout *os.File
writeCloser []io.WriteCloser
}
func MultiWriteCloser(closer ...io.WriteCloser) io.WriteCloser {
allWriters := make([]io.WriteCloser, 0, len(closer))
for _, w := range closer {
allWriters = append(allWriters, w)
}
return ... |
769c6c4b2c22aeca33d9d565811902656a70dcdd | 5ce0f5ec0cc3dceace548e496710ed537a4de03b | cstudio7/go-microservices | /checkout/src/controllers/linkController.go | Go | go | 670 | no_license | package controllers
import (
"checkout/src/database"
"checkout/src/models"
"checkout/src/services"
"encoding/json"
"fmt"
"github.com/gofiber/fiber/v2"
)
func GetLink(c *fiber.Ctx) error {
code := c.Params("code")
var link models.Link
database.DB.Preload("Products").Where("code = ?", code).First(&link)
if... |
202e3b1b6d8f6548635d5d789b882a59abea970f | 74e796863e2ddc96dbe1d3570d3c62d16b5f4d14 | LuminalHQ/gosparkpost | /transmissions_test.go | Go | go | 5,460 | permissive | package gosparkpost_test
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"strings"
"testing"
sp "github.com/SparkPost/gosparkpost"
)
var transmissionSuccess string = `{
"results": {
"total_rejected_recipients": 0,
"total_accepted_recipients": 1,
"id": "11111111111111111"
}
}`
fun... |
1865ce49cf0453060bac9911e8f720e3e53f0d8d | 19d7d486acd2db9bec44a063338e136a4d960906 | apascualco-com/infra-backend | /api/server/router/health/health.go | Go | go | 301 | no_license | package health
import "apascualco.com/api/server/router"
type health struct {
routes []router.Route
}
func (s *health) Routes() []router.Route {
return s.routes
}
func New() router.Router {
r := &health{}
r.routes = []router.Route{
router.NewGetRoute("/health", r.getHealth),
}
return r
}
|
54bb7b19df309d35f48a0a7e988637ab025ae919 | 27d206b1a847e448c7a7a20aa6748ded9388c074 | afbojd/Gccxt | /model/out_entity.go | Go | go | 742 | no_license | package model
import (
"ccxt/config"
"encoding/json"
"github.com/sirupsen/logrus"
)
var DataChannel = make(chan TradeTransData, config.ChannelSize)
type TradeEntity struct {
Symbol string `json:"symbol"`
// datetime: 2018-09-12T09:47:05.000Z,
Side string `json:"side"`
Amount string `json:"amount"`
... |
ae3e7344c4b391cb68b670a3361e0a3243120222 | 0a36ac77b8817629df81eabdb7830eb49dd68918 | VKTRS2/finance-messaging | /iso20022/Status13Choice.go | Go | go | 412 | permissive | package iso20022
// Specifies the status.
type Status13Choice struct {
// Status expressed as a code.
Code *TradeStatus5Code `xml:"Cd"`
// Status expressed in a proprietary form.
Proprietary *Max35Text `xml:"Prtry"`
}
func (s *Status13Choice) SetCode(value string) {
s.Code = (*TradeStatus5Code)(&value)
}
func... |
bb01d6ab2580dc1e644bdb1a6d0389b2a6475723 | 70ec3fe68472b97c56ea2771a896233de6b7160c | NaverCloudPlatform/ncloud-sdk-go-v2 | /services/vautoscaling/resume_processes_response.go | Go | go | 539 | permissive | /*
* vautoscaling
*
* VPC Auto Scaling 관련 API<br/>https://ncloud.apigw.ntruss.com/vautoscaling/v2
*
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package vautoscaling
type ResumeProcessesResponse struct {
RequestId *string `json:"requestId,omitempty"`
Re... |
a6ce1c09f788e16e9c5eb32dc0825c3401134770 | 4fcc144b12efb0e25228b6cd579d00449c2eae91 | deepglint/util | /signal/signal.go | Go | go | 524 | no_license | package signal
import (
"net/http"
"os"
"os/signal"
"syscall"
"time"
)
func init() {
http.DefaultClient.Timeout = time.Second * 5 //set http client timeout
}
////////////////// signal /////////////////////
func WaitForExit() os.Signal {
return WaitForSignal(syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM)
}
... |
2a4e68bf8530a576eae40beb59cb1d0e805f08c3 | 13146060348575751baafe9c316d9b106c235b5b | ansi7794/Go-Programming | /016-Appending.go | Go | go | 222 | no_license | package main
import "fmt"
func main() {
x := []int{40,15,33,67,98,55}
fmt.Println(len(x))
fmt.Println(x)
x = append(x, 2, 4, 5, 7)
fmt.Println(x)
y := []int{40,15,33,67,98,55}
x = append(x, y...)
fmt.Println(x)
} |
34b9127e53f9b36823f3277e1dbd85200e976059 | 9b080581e65f6a53c4d6aa19ef3c347d719c808c | johnbirdau/pulumi-azure-native | /sdk/go/azure/migrate/v20171111preview/assessment.go | Go | go | 16,390 | 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 v20171111preview
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// An assessment created for a gr... |
8f679114ae1ec9d5fbb5df5cbef881706f572fd1 | 6bf7c2aa8afb23514b9d08393e9f22445c4fa9f3 | RogerNieGit/fhir | /go/jsonformat/internal/accessor/getter_setter_test.go | Go | go | 36,246 | permissive | // Copyright 2020 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 ... |
9cb1ae7a115811f87c98bbe7b7a7bb4413c32387 | 969d4925a27f29a3231f39729370c04f163615cf | Apoorvashaan/nmon-parser | /parser_test.go | Go | go | 4,202 | no_license | package nmonparser
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"os"
"sort"
"strings"
"testing"
"time"
)
func TestTmpMain(t *testing.T) {
currentTime := time.Now()
now := time.Now()
dates:= currentTime.Format("060102")
times:= currentTime.Format("1504")
ago := now.Add(time.Duration(-1) *... |
11d48b30000b6a8a535455ac56b94cb4b812131e | 265793b529cab05c713e3adc611acaaeb264b388 | gauravdesale/linear-regression | /basicLine.go | Go | go | 441 | no_license | package main
import "fmt"
func mean(xs[]float64)float64 {
total:=0.0
for _,v:=range xs {
total +=v
}
return total/float64(len(xs))
}
func best_fit_slope(xs, ys, []int) float64{
var m float64:= (((mean(xs)*mean(ys)) - mean(xs*ys)) / ((mean(xs)*mean(xs)) - mean(xs*xs)))
return m
}
func main(){
var xs[7] int
... |
27b818354ddcad5f5d0ccfe10c5b205467aa8bef | 8db35e21252acaa510026db3d73da5a6e47e70d3 | thrasher-corp/gocryptotrader | /log/loggers.go | Go | go | 9,926 | permissive | package log
import (
"fmt"
"log"
)
// Infoln is a logging function that takes a sublogger and an arbitrary number
// of interface{} arguments. This writes to configured io.Writer(s) as an
// information message using default formats for its operands. A new line is
// automatically added to the output.
func Infoln(s... |
9235ea890669cebffd9a6a8391a54577cc761cf3 | 84d25b2035ebd932acdba91c9114ec30b7019d7c | aybabtme/grpc-blob | /gen/flatbuffergrpc/service/GetReq.go | Go | go | 1,012 | no_license | // automatically generated by the FlatBuffers compiler, do not modify
package service
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type GetReq struct {
_tab flatbuffers.Table
}
func GetRootAsGetReq(buf []byte, offset flatbuffers.UOffsetT) *GetReq {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &G... |
a74f81fc1f25ba4c93bcbb85337e4c5e93132c4b | 35f6477de92c23e1d507051dd10de337e8f55c24 | moneytech/cdnjs-go | /cmd/algolia/main.go | Go | go | 7,505 | no_license | package main
import (
"bufio"
"bytes"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"path"
"path/filepath"
"regexp"
"strings"
"github.com/xtuc/cdnjs-go/algolia"
"github.com/xtuc/cdnjs-go/cloudstorage"
"github.com/xtuc/cdnjs-go/github"
"github.com/xtuc/cdnjs-go/util"
algoliasearch "github.co... |
ae16f3964bec1cb2ccccfda981ef4b2fd3ad3934 | 40d0fbea41768338a8d7b86cc2999605c3dc9c17 | kebingzao/go_learn_demo | /structs.go | Go | go | 309 | no_license | package main
import "fmt"
type Vertex struct {
X int
Y int
}
var (
v1 =Vertex{1,2}
v2 = Vertex{X:1}
v3 = Vertex{}
p4 = &Vertex{1,2}
)
func main() {
//v := Vertex{4,7}
//fmt.Println(v)
//
//v.X = 9
//fmt.Println(v.X)
//
//p := &v
//p.X = 1e9
//fmt.Println(v)
fmt.Println(v1, v2, v3, p4)
} |
26ae4990ff68f00ce62c55cf0e92c2dc7b247667 | 5898e9a52b752ca96ad49200bfab7e6d62b6d6d6 | go-delve/delve | /vendor/golang.org/x/sys/unix/syscall_unix_gc.go | Go | go | 751 | permissive | // Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && gc && !ppc64le && !ppc64
// +build darwin dragonfly freebsd linux netbsd... |
d9ef3695d73ddfd006004a7e6f17538fad4856ad | 553e4d137d36140010e12e1a79b7c2da51e1751f | jdcloud-api/jdcloud-sdk-go | /services/yundingdatapush/client/YundingdatapushClient.go | Go | go | 4,946 | permissive | // Copyright 2018 JDCLOUD.COM
//
// 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 ... |
c5487317380e36323d58c44721b95264206b815d | ed5ea225256c5c229887e8c35222dfd77c102536 | rockq-org/vulcand | /plugin/rewrite/template_test.go | Go | go | 1,512 | permissive | package rewrite
import (
"bytes"
"net/http"
"strings"
. "github.com/vulcand/vulcand/Godeps/_workspace/src/gopkg.in/check.v1"
)
type TemplateSuite struct{}
var _ = Suite(&TemplateSuite{})
func (s *TemplateSuite) SetUpSuite(c *C) {
}
func (s *TemplateSuite) TestTemplateOkay(c *C) {
request, _ := http.NewReques... |
bac070cd6637dd43614d45a194520617eee9a86c | 48ba8be941f5778839d313f1391ddc70026c9acb | live2son/secrets | /backend/app/messager/messeger_test.go | Go | go | 2,637 | permissive | package messager
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/umputun/secrets/backend/app/store"
)
func TestMessageProc_NewDefault(t *testing.T) {
m := New(nil, Crypt{}, Params{})
assert.Equal(t, time.Hour*24*31, m.Params.MaxDuration)
asser... |
74b8c2c044266439defe31e9d0f4ba05c27d4bec | a3327bca88fc328d6f8940588fa02ab25f2393e0 | hanfeng712/golang-project | /test/main.go | Go | go | 10,560 | no_license | package main
import (
"fmt"
)
func main() {
var general interface{}
//general = 6.6
//type_cast(general)
general = 2
type_cast(general)
}
func type_cast(general interface{}) {
//var i int = general.(int)类型强制转换
//fmt.Println(i)
m := general.(type)
switch m := general.(type) {
case int:
{
//fmt.Print... |
951d4a3f1cc380a0e9dd555e06356c2a7a5644c3 | 6e6b496830a38c71653064c8ecebe4a0c9126d7e | vaughany/fractal | /main.go | Go | go | 2,879 | no_license | package main
import (
"fmt"
"image"
"image/color"
"image/png"
"log"
"math/rand"
"os"
"sync"
"time"
)
const (
// Position and size
px = -0.5557506
py = -0.55560
size = 0.000000001
//px = -2
//py = -1.2
//size = 2.5
// Quality
// imgWidth = 1024
// imgHeight = 1024
imgWidth = 1920
imgHeigh... |
3fc24c12786a3cbed5cabc52b4d6b4a9e9e70c95 | 85dd446b578863f3493c79285a10a92407146b99 | muvaf/stack-gcp | /pkg/clients/globaladdress/globaladdress.go | Go | go | 3,170 | permissive | /*
Copyright 2019 The Crossplane 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, ... |
011e17d54d5f1909cd80751c967170fb78a820e0 | 9af6c3850fba53c8bd0950e942648aeb302e64aa | mrjones/fo | /src/folib/scoring_test.go | Go | go | 2,207 | no_license | package folib
import (
"testing"
)
func TestTwoTeamsOneStat(t *testing.T) {
stats := map[TeamID]StatLine{
1: StatLine{B_HOME_RUNS: 10},
2: StatLine{B_HOME_RUNS: 5},
}
score := scoreLeague(stats, map[StatID]struct{}{B_HOME_RUNS: struct{}{}})
if score[1] != 2 {
t.Errorf("Team 1 should have 2 points, has: %... |
bd8a6dcf5c46bddcbdbf2947ef34ebc3a16abe96 | 73981b0eb96606779ecc37624e7945bbd28f5325 | cortexproject/cortex | /vendor/github.com/minio/md5-simd/md5-util_amd64.go | Go | go | 2,045 | permissive | //+build !noasm,!appengine,gc
// Copyright (c) 2020 MinIO Inc. All rights reserved.
// Use of this source code is governed by a license that can be
// found in the LICENSE file.
package md5simd
// Helper struct for sorting blocks based on length
type lane struct {
len uint
pos uint
}
type digest struct {
s [4]ui... |
cffcdc7e5f4e695ba14ba3f624c33d94835652ac | 9a63d9da261282f07be0b5ef6b78e219f62f2dd3 | mattermost/mmctl | /vendor/github.com/mattermost/mattermost-server/v6/einterfaces/notification.go | Go | go | 385 | permissive | // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/v6/model"
)
type NotificationInterface interface {
GetNotificationMessage(ack *model.PushNotificationAck, userID string) (*model.Push... |
f96f2abdd5b30974d10d3c794696a91f55210460 | 6b39f1922bfa38bef77912798006d3b9da8df13a | brodo/go-ipfs | /core/commands/repo.go | Go | go | 8,523 | permissive | package commands
import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"strings"
bstore "github.com/ipfs/go-ipfs/blocks/blockstore"
cmds "github.com/ipfs/go-ipfs/commands"
corerepo "github.com/ipfs/go-ipfs/core/corerepo"
config "github.com/ipfs/go-ipfs/repo/config"
fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
... |
ed29b095000749b07472404aa13ffce9390dfd15 | 37bc3ad9bc7d358447c14962e006cc11529e1504 | gocd-contrib/gocd-cli | /cmd/configrepo/fetch.go | Go | go | 2,870 | permissive | package configrepo
import (
"encoding/json"
"fmt"
"os"
"github.com/gocd-contrib/gocd-cli/dub"
"github.com/gocd-contrib/gocd-cli/github"
"github.com/gocd-contrib/gocd-cli/plugins"
"github.com/gocd-contrib/gocd-cli/utils"
"github.com/spf13/cobra"
)
var FetchCmd = &cobra.Command{
Use: "fetch",
Short: "Fetch... |
cab52b96563793a02ec3eb7ebda77e38500abf72 | befaf3ef67b9515c29de7b0367e11a3e8b6fe062 | ROCHAIA01/lorawan-stack | /pkg/applicationserver/io/packages/grpc_test.go | Go | go | 13,936 | permissive | // Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Un... |
2aee0b219dd8555ca039d7f386dc9751eaecfa85 | 297db4ed881abdf5580bc2115383457ce509f4cf | xvzf/nftables | /rule.go | Go | go | 8,584 | permissive | // Copyright 2018 Google LLC. 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... |
3c7082e1ced0d7f1e21e26460d5ac4826252f4f9 | dad155039e58eb422454201f37aa82c702986474 | atulanand206/poker | /src/web_test.go | Go | go | 1,884 | permissive | package poker
import (
"testing"
"net/http"
"net/http/httptest"
"fmt"
)
func TestGetPlayers(t *testing.T) {
store := StubPlayerStore{
map[string]int{
"Angelina": 20,
"Floyd": 10,
},
nil, nil,
}
cases := []struct {
player string
score int
}{
{"Angelina", 20},
{"Floyd", 10},
}
server, ... |
a5e4ced7916dedbdd8cc6e737ebb6a4abb294b26 | 84bad628a93d281c8f36582d029caec21cd8018b | john-a-joyce/istio | /tests/e2e/tests/dashboard/dashboard_test.go | Go | go | 10,518 | permissive | // Copyright 2018 Istio 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 i... |
4c01d5b0455e84f7cff59b47401ff4317b214d42 | 40106a8875a7f69019280d1a3248ed901c6677c5 | gokangaroo/LeetCode | /easy/min_stack.go | Go | go | 1,351 | no_license | package main
import "fmt"
func main() {
minStack := Constructor()
minStack.Push(2)
minStack.Push(0)
minStack.Push(3)
minStack.Push(0)
fmt.Println(minStack.GetMin())
minStack.Pop()
fmt.Println(minStack.GetMin())
minStack.Pop()
fmt.Println(minStack.GetMin())
minStack.Pop()
fmt.Println(minStack.GetMin())
}
... |
6ff0ba68bb533446c7f4262d6b6045d221bc0f29 | 210b64dbe11c8503a093f71c7650c6c2ade7867e | M0rdecay/telegraf | /plugins/inputs/syslog/octetcounting_test.go | Go | go | 13,041 | permissive | package syslog
import (
"crypto/tls"
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
"testing"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
framing "github.com/influxdata/telegraf/internal/syslog"
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/req... |
68db3d2a01e087537f5be5adc48ad93c6538a359 | b57c156912e5afb5863d63c57bc1298043fed3a3 | openshift/machine-config-operator | /cmd/machine-config-operator/version.go | Go | go | 615 | permissive | package main
import (
"flag"
"fmt"
"github.com/openshift/machine-config-operator/pkg/version"
"github.com/spf13/cobra"
)
var (
versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of Machine Config Operator",
Long: `All software has versions. This is Machine Config Operator's.`... |
a8fd3c55ba3d1d85dbd7f80fff277651ff988985 | 728f1d7f0369ae711efa1a2fe6fae6037a413d21 | SpikeyHelmet/burrow | /cmd/burrow/commands/restore.go | Go | go | 1,224 | permissive | package commands
import (
"github.com/hyperledger/burrow/core"
cli "github.com/jawher/mow.cli"
)
// Restore reads a state file and saves into a runnable dir
func Restore(output Output) func(cmd *cli.Cmd) {
return func(cmd *cli.Cmd) {
configOpts := addConfigOptions(cmd)
silentOpt := cmd.BoolOpt("s silent", fals... |
fabd7f10962305d5d7bb712b2c60dfd9181f8d4a | a93ed9df813c6ea6ed6fc5e3281f4c8f2a747a07 | arunvm123/focus | /models/mysql/transaction.go | Go | go | 258 | no_license | package mysql
import "github.com/arunvm/focus/models"
func (db *Mysql) Begin() models.Transaction {
return &Mysql{
Client: db.Client.Begin(),
}
}
func (tx *Mysql) Commit() {
tx.Client.Commit()
}
func (tx *Mysql) Rollback() {
tx.Client.Rollback()
}
|
715d5bf36d08711cd74c1715646697175fa4e803 | bd9e7a2cc51c9858b9b189ebfb9e089db009fe66 | prasadkatti/opentelemetry-collector-contrib | /exporter/datadogexporter/internal/attributes/attributes.go | Go | go | 4,827 | permissive | // Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
936e2b81792453433763398a68af1b4978ce1bce | 5ae3c01ee708c55904efd409b0764735de1f0b1f | pranavgore09/wit-on-minishift | /space/space.go | Go | go | 12,119 | permissive | package space
import (
"context"
"fmt"
"strings"
"time"
"github.com/fabric8-services/fabric8-wit/application/repository"
"github.com/fabric8-services/fabric8-wit/convert"
"github.com/fabric8-services/fabric8-wit/errors"
"github.com/fabric8-services/fabric8-wit/gormsupport"
"github.com/fabric8-services/fabric... |
61e309d3ec54d1ccca21ab7dea2c05bea765049e | fb4396d54bc1d0404d62f583d5dbf787a9fa5f86 | willpowelson/cockroach | /pkg/sql/group.go | Go | go | 23,992 | permissive | // Copyright 2015 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
790fb9d87209a364dc8e626392038a0840b3bbb9 | 75e9bfc18fe8252ba5da667cc0d5fd14e73db6a8 | tkuhlman/gopwsafe | /pwsafe/db.go | Go | go | 6,731 | permissive | // The database type for a Password Safe V3 database
// The db specification - https://github.com/pwsafe/pwsafe/blob/master/docs/formatV3.txt
package pwsafe
import (
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"io"
"sort"
"strings"
"time"
"github.com/pborman/uuid"
)
//Record The primary type for password DB... |
4347c57c5205f0c7cd64ad57ef0f3a613e84dc05 | 568c9b6091a59d11f0291619c5365f555513cb60 | AlbinoGeek/logxi | /v1/init_test.go | Go | go | 483 | permissive | package log
import (
"bytes"
"os"
"testing"
"github.com/stretchr/testify/assert"
)
var testBuf bytes.Buffer
var testInternalLog Logger
func init() {
testInternalLog = NewLogger3(&testBuf, "__logxi", NewTextFormatter("__logxi"))
testInternalLog.SetLevel(LevelError)
}
func TestUnknownLevel(t *testing.T) {
te... |
03df4f0d9c1edc32645738e049109c78281504b7 | d20e00e80a436999ba7547cdae03a8960d7f69d9 | NeowayLabs/klb | /tests/azure/examples_test.go | Go | go | 2,630 | no_license | // +build examples
package azure_test
import (
"context"
"testing"
"time"
"github.com/NeowayLabs/klb/tests/lib/azure/fixture"
testlog "github.com/NeowayLabs/klb/tests/lib/log"
"github.com/NeowayLabs/klb/tests/lib/nash"
)
// TestExamples aims to just keep our examples working,
// but it does not validates if i... |
4d1ba4a554027639133ff8cdf1750a90a8dde9cd | d0fe652c787ed59de3a3e1087a186fea1937811b | exsver/ping | /log.go | Go | go | 1,402 | no_license | package ping
import (
"io/ioutil"
"log"
"os"
)
var (
LogLevel *LogSeverity
)
type LogSeverity struct {
Fail *log.Logger
Info *log.Logger
Message *log.Logger
}
func (logSeverity *LogSeverity) Default() {
LogLevel = &LogSeverity{
Info: log.New(ioutil.Discard, "[Verbose]: ", log.LstdFlags|log.Lshort... |
14426474a23fcec2f27e5bcad7b692cb0009f1fd | 061e4c8ccb5163b13a6b6e35bd26f60b53ece59d | wuxiumu/HelloGo | /OldDay/day02/funci.go | Go | go | 290 | no_license | package main
import "fmt"
//返回 A+B 和 A*B
func SumAndProduct(A, B int) (int, int) {
return A+B, A*B
}
func main() {
x := 3
y := 4
xPLUSy, xTIMESy := SumAndProduct(x, y)
fmt.Printf("%d + %d = %d\n", x, y, xPLUSy)
fmt.Printf("%d * %d = %d\n", x, y, xTIMESy)
} |
bf8694ab7bbaf00779f80c6bdcf509f3b2f4ebcd | 735cecbcfb6344ed75eb7a19d5b9bcb8ba657646 | GoLangsam/kanren | /fresh.go | Go | go | 1,879 | permissive | package kanren
// CallFresh expects a function f that returns a Goal given an eXpression.
//
// CallFresh returns the Goal which, when evaluated,
// applies f to a fresh anonymous variable
// and evaluates the resulting Goal.
//
// CallFresh allows to introduce a host-language-symbol as a free variable
// when constru... |
c478fba834ac51de2d22c80803e47bdd7ae5d01d | c4bc2dda2438ddfcad1143c802e72b19e36997e7 | WebsterWing/minesweeper | /minesweeper.go | Go | go | 290 | no_license | package main
import (
"fmt"
"github.com/WebsterWing/minesweeper/game"
"github.com/WebsterWing/minesweeper/terminal"
)
func main() {
fmt.Println("Minesweeper")
b := game.MakeBoard(10, 10, 10)
terminal.PrintBoard(b)
b.FlagClickTile(3, 2)
b.ClickTile(5, 4)
terminal.PrintBoard(b)
}
|
ebde0137133857c5f7f9952b63f7c2a763565c1d | 75319a02c2dadff66ee9ff5c2e468a63b2f54a24 | percolate/charlatan | /vendor/golang.org/x/tools/cmd/fiximports/main_test.go | Go | go | 6,616 | permissive | // Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// No testdata on Android.
// +build !android
package main
import (
"bytes"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
)
// TODO(adonovan):
//... |
fbc59c3de8d616e4723603bd1e9c3339da492387 | b83ad2c03deb0b274d3f4593f22abd9b64d5b3a4 | MicahParks/craigslist-vehicles | /types/types.go | Go | go | 1,112 | permissive | package types
import (
"go.mongodb.org/mongo-driver/bson"
)
type Domains struct {
Default bool
Domain string `bson:"_id"`
}
type List struct {
Id string `bson:"_id"`
Posts []string
Name string
Owner string
Subs []string
}
type Marsh struct {
PriceStr string `selector:".price"`
Text string `selec... |
b92d5d97acdff7d3d578aaa4ad4ddb98214ae234 | 5c898513891f03df580e2325202e31b50ef6c07c | mazayazd/Tugas-1-Network-Programming | /Soal command line nomor 5.go | Go | go | 459 | no_license | package main
import "flag"
import "fmt"
func main() {
wordPtr := flag.String("word", "foo", "a string")
numbPtr := flag.Int("numb", 42, "an int")
boolPtr := flag.Bool("fork", false, "a bool")
var svar string
flag.StringVar(&svar, "svar", "bar", "a string var")
flag.Parse()
fmt.Println("word:", *wordPt... |
774a693654c1bfff6618e459437e518c9c284116 | c3596d0cb20ba694e00c2ed18954b6dce2afd5ab | antekresic/projecteuler | /1-99/1-10/2.go | Go | go | 242 | no_license | //Problem 2: https://projecteuler.net/problem=2
package main
func main() {
sum := 2
fib1 := 1
fib2 := 2
for {
fib1, fib2 = fib2, fib1+fib2
if fib2%2 == 0 {
sum += fib2
}
if fib2 > 4000000 {
break
}
}
println(sum)
}
|
4ab958fa1e506165065df3030e5c77d17ca5b6aa | 8ce6ee3c57d0a25c146aeffcdc4b40c7ca28b41f | winston-ci/bb | /Godeps/_workspace/src/code.google.com/p/gographviz/escape.go | Go | go | 3,782 | permissive | //Copyright 2013 Vastech SA (PTY) LTD
//
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to ... |
8ec2d0eb147b113bde1fdf203c46277bdf984f19 | 3a11cf0bf7b8b76c718328cc7828ef1baecf097f | viruswevh/go-qlc | /common/types/state_pov.go | Go | go | 4,232 | permissive | package types
import (
"fmt"
"strings"
)
//go:generate msgp
type PovAccountState struct {
Balance Balance `msg:"balance,extension" json:"balance"`
Vote Balance `msg:"vote,extension" json:"vote"`
Network Balance `msg:"network,extension" json:"network"`
Storage Balan... |
680bae129930e525e52a433ac93996bfdae8c66b | f50cc6ca5a2a9705e4933c39d500f9ccef289ec1 | rkjdid/jdid.co | /config.go | Go | go | 1,327 | no_license | package main
import (
"encoding/json"
"github.com/soul9/errors"
"io"
"os"
)
var (
ConfigNameNotFound = errors.Newf("didn't find cfg entry '%s'")
)
type Config struct {
Root string
Works WorksMap
}
func NewConfig(root string) (cfg *Config) {
cfg = &Config{
Root: root,
Works: WorksMap{},
}
return cfg
... |
b04c6d8c9eeacb0a0a2de949f5093a1a0b12655d | 4163445f0f9def73ec1e3478a82fea4b9470c3cf | congliqiang/distributed_object_demo | /v4/data_server/temp/patch.go | Go | go | 1,287 | no_license | package temp
import (
"encoding/json"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
)
func patch(w http.ResponseWriter, r *http.Request) {
uuid := strings.Split(r.URL.EscapedPath(), "/")[2]
tempinfo, e := readFromFile(uuid)
if e != nil {
log.Println(e)
w.WriteHeader(http.StatusNotFound)
return
}
... |
6f46e52372fa7146210452c2cd25f48e3a9d6735 | 7552bada499a4149db9a94e33d64458a78171dcb | googleapis/discovery-artifact-manager | /src/snippetgen/mergesnippets/snippet/snippet.go | Go | go | 14,386 | permissive | // Package snippet implements the Merger class to retrieve and merge
// secondary and primary snippets, and to publish the merged snippets.
package snippet
import (
"fmt"
"io/ioutil"
"log"
"os"
"path"
"path/filepath"
"discovery-artifact-manager/common/errorlist"
"discovery-artifact-manager/common/gcs"
"disco... |
f779d01cd61bf03864be3c63fb9faa08455aaac8 | 93bae8e28803cebbf0a66e222699f903c29db1fd | OpenSlides/openslides-autoupdate-service | /internal/restrict/perm/perm.go | Go | go | 6,140 | permissive | package perm
//go:generate sh -c "go run generate/main.go > generated.go"
import (
"context"
"fmt"
"github.com/OpenSlides/openslides-autoupdate-service/pkg/datastore/dsfetch"
)
// Permission holds the information which permissions and groups a user has.
type Permission struct {
admin bool
groupIDs []... |
5a6d67a67e3ed17d753f0b38e07f95abb3a79294 | 6970436b376bc780e847d81b72db63e786c05441 | 0chain/zwalletcli | /cmd/bridge-list-accounts.go | Go | go | 934 | permissive | package cmd
import (
"fmt"
"github.com/0chain/gosdk/zcnbridge"
"github.com/spf13/cobra"
)
var listEthAccounts = &cobra.Command{
Use: "bridge-list-accounts",
Short: "List Ethereum account registered in local key chain",
Long: `List available ethereum accounts`,
Args: cobra.MinimumNArgs(0),
Run: func(cmd *c... |
90025cd58bf908289e5fad0fed0d57283b3ab44e | e0ea6c7be7385644c55a0048408b68c45c1d8780 | SUSE/helm-certgen | /pkg/kube/config.go | Go | go | 529 | permissive | package kube
import "k8s.io/client-go/tools/clientcmd"
// GetConfig returns a kubernetes client config for a given context.
func GetConfig(context string) clientcmd.ClientConfig {
rules := clientcmd.NewDefaultClientConfigLoadingRules()
rules.DefaultClientConfig = &clientcmd.DefaultClientConfig
overrides := &clien... |
3022f409bf0b347194c88f4cecbb035662316652 | dec0f4d067199e5b8ee223a0420e9314a3ae723c | Rnoadm/rpg | /rpg-miningsim/main.go | Go | go | 2,059 | permissive | package main
import (
"bytes"
"flag"
"github.com/Rnoadm/rpg"
"github.com/Rnoadm/rpg/gui"
"github.com/Rnoadm/rpg/history"
"github.com/Rnoadm/rpg/rpg-miningsim/res"
"image"
"image/draw"
"image/png"
"io"
"os"
"time"
)
var (
flagFilename = flag.String("f", "miningsim.sav", "filename for save file")
flagRepl... |
96dac16ef620fe25d090e70b0f6c762b33e2d216 | 84ebc2310d8b762cb2273f92765f0f50f75ebf29 | pritamsa/algorithms | /docs/golang/httpserver/handlers/passwordv2/password_suite_test.go | Go | go | 213 | no_license | package passwordv2
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestAuthorize(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Forgot confirm password v2 Suite")
}
|
58fdb98a67bc86311af059f1a063e3c9884f5b96 | b92b5763aaa716820e74fb689c38f3af3ee47338 | Ares2013/argo-cd | /util/rbac/rbac_test.go | Go | go | 17,959 | permissive | package rbac
import (
"context"
"fmt"
"testing"
"time"
"github.com/dgrijalva/jwt-go"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
"github.com/argoproj/argo-cd/util/assets"
)... |
05dd654fece9b3015202977482a2da0deb7bc828 | 7cae1866f72b8c71907c19b70d70c089f7631fe2 | russmack/cloudsigma | /discounts.go | Go | go | 451 | permissive | package cloudsigma
const (
EndpointDiscounts = "discount"
)
// Discounts
type Discounts struct {
Args *Args
}
// NewDiscounts returns a Discounts object.
func NewDiscounts() *Discounts {
o := Discounts{}
o.Args = NewArgs()
o.Args.Resource = EndpointDiscounts
return &o
}
// NewList returns the args required fo... |
2ab57387a03ce4d7d28244a81b5aeb39e7110c4f | d32bfb1f51fe3577360e05eab9cb3f090bf29002 | zmarcantel/elwyn | /src/index.go | Go | go | 2,863 | no_license | package main
import (
"fmt"
"os"
"os/signal"
"./chat"
"./logging"
"./web"
)
const (
EXIT_NORMAL int = 0
EXIT_CONFIG_ERR int = 100
EXIT_STARTUP_ERR int = 110
EXIT_GENERAL_ERR int = 200
)
//
// Global variables
//
var logger *logging.Router
var persistence chat.Database
//
// Main entry point
// H... |
029695d006f3c5f7aec2ece3134b4bdc4726ad53 | afa95e411ea0ba89f003470723c232d6e25e61b0 | mkleina/snap-plugin-collector-processes | /processes/procstat.go | Go | go | 5,933 | permissive | /*
http://www.apache.org/licenses/LICENSE-2.0.txt
Copyright 2015 Intel 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 ... |
7b7cd1614f71fa4ca41e87e46677837271a7cc32 | 313d92ec193c22819de56007670072b8dbe6809e | openshift/installer | /vendor/github.com/microsoftgraph/msgraph-sdk-go/planner/plans/item/buckets/buckets_request_builder.go | Go | go | 8,826 | permissive | package buckets
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
ia572726a95efa92ddd544552cd950653dc691023... |
bece54e40b9dc340efa34c9ca29915bc7f3bf8d8 | 8322b01fdd718e875f32303d82b347122344ce12 | AbolfazlHosseini200/Upload-Download-Api | /UploadDownloadController/download.go | Go | go | 418 | no_license | package UploadDownloadController
import (
"github.com/gin-gonic/gin"
"sina_project/DataBaseController"
_ "sina_project/DataBaseController"
)
func Download(c *gin.Context){
fileid:=c.PostForm("fileid")
username:=c.PostForm("username")
path:="C:\\Users\\AmirHossein\\Desktop\\Coding Stuff\\Code Go\\project\\Upload... |
a3e3a9202697feded21429b914430e4aeaa3ee07 | 1a6416f88ffca7d384cba5457296d4cf6dfd841f | xuntame/nomscs1 | /samples/go/photo-dedup/cmd/photo-dedup/main.go | Go | go | 2,077 | no_license | // Copyright 2016 Attic Labs, Inc. All rights reserved.
// Licensed under the Apache License, version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0
package main
import (
"fmt"
"os"
"path"
"github.com/stormasm/noms/go/config"
"github.com/stormasm/noms/go/datas"
"github.com/stormasm/noms/go/spec"
"github.c... |
7bfb2ab33d6626e0c66af10917ae14440407bacd | f84b1fd8fd8e1028842ee8c6211ba977355da563 | go-long/longGO | /fb/swagger2/model/common.go | Go | go | 2,208 | permissive | package model
type Swagger struct {
Swagger string `json:"swagger"`
Info Info `json:"info"`
Host string `json:"host"`
}
type Info struct {
// Required. The title of the application.
Title string `json:"title,omitempty"`
// A short description of the application. GFM syntax can be used for rich text repr... |
0f837cb7feb7b1606b4621773f1593c10dafd177 | 8dae7209ce57e3ccc369cc1e1dcb2b348a8307c1 | CoderShiun/lpwan-conn-checker | /cmd/config.go | Go | go | 1,952 | permissive | /*
Copyright © 2019 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
20f07c3d5c2afe6f531077992a11e78896dcb868 | 746dd43eb4753405c53e21f9f28943542db0f893 | driverzhang/go_algorithms | /linkedList/linked_list.go | Go | go | 2,772 | no_license | package linkedList
// 单链表的基本操作
import "fmt"
/*
单链表基本操作
author:leo
*/
type SListNode struct {
next *SListNode
value interface{}
}
type LinkedList struct {
head *SListNode // 表示头指针
length uint
}
func NewSListNode(v interface{}) *SListNode {
return &SListNode{nil, v}
}
func (this *SListNode) GetNext() *SLis... |
21d7e36e3303f7196df18b36b794a58c942cc73f | 05c3e9728ff6b3e7ce7447e6ef0913a9f8e565ba | MisinformedDNA/pulumi-azure-native | /sdk/go/azure/azurestack/v20200601preview/init.go | Go | go | 1,301 | 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 v20200601preview
import (
"fmt"
"github.com/blang/semver"
"github.com/pulumi/pulumi-azure-native/sdk/go/azure"
"github.com/pulumi/pulumi/sdk/v2/go/pul... |
4d1860e827c361abc4c3bdcf6c2d739e1a8c4e3a | 6fe7fdc1bf9fc834c37a7ee884d589ed94fe4c31 | lorciv/aoc2020 | /day3/p2/main_test.go | Go | go | 590 | no_license | package main
import (
"strings"
"testing"
)
const sample = `..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#`
func TestHits(t *testing.T) {
grid := ParseGrid(strings.NewReader(sample))
tests := []struct {
right, down int
want... |
ee9ef702e960b524bcc9cc4f70e6b4e1883c2ffe | b7e45d2e933bd6d0b5009c5b465fe0158aae3f82 | FrederikNS/kops | /protokube/pkg/protokube/etcd_manifest.go | Go | go | 4,259 | permissive | /*
Copyright 2016 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, ... |
f8daf912c73dd361e7f9e72b837d2a67dc37c03e | 60f4b6a9bb3955744877b2f771e5cff598248e71 | aniual/Merchants_test | /main.go | Go | go | 732 | no_license | package main
import (
_ "Merchants_test/routers"
"github.com/astaxie/beego"
"github.com/astaxie/beego/plugins/cors"
)
func main() {
beego.BConfig.WebConfig.Session.SessionOn=true
beego.InsertFilter("*", beego.BeforeRouter,cors.Allow(&cors.Options{
AllowOrigins:[]string{"http://localhost:8181/login"},
AllowMe... |
ec2baf533c4a282223ba830f551a4cc8faf87155 | 15ba4f291f5994ab7985711096bbbe99789ee92f | jimmysong/lnd | /config.go | Go | go | 44,683 | permissive | // Copyright (c) 2013-2017 The btcsuite developers
// Copyright (c) 2015-2016 The Decred developers
// Copyright (C) 2015-2017 The Lightning Network Developers
package main
import (
"fmt"
"io/ioutil"
"net"
"os"
"os/user"
"path"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"time"
flags "github.com... |
d546214788c61e940177760aff1ba12ec123dfcd | 728240b5d233d3abfb7ab375f1b07188a7ce116b | jgarcia1095/golangRestApi | /product/service.go | Go | go | 1,906 | no_license | package product
import "github.com/golangRestApi/helper"
type Service interface {
GetProductByID(param *getProductByIDRequest) (*Product, error)
GetProducts(params *getProductsRequest) (*ProductList, error)
InsertProduct(params *getAddProductsRequest) (int64, error)
UpdateProduct(params *updateProductsRequest) (i... |
1f92d5d1da22b0ab183d1136755d5666777ee51b | 5ee1d9b07579484b12ac51ed9050ce0ac0f586f1 | nxsre/mysql_byroad | /model/notify_field.go | Go | go | 2,491 | no_license | package model
import "time"
/*
对应一个推送的消息对象
*/
type NotifyEvent struct {
Event string `json:"event"`
Schema string `json:"schema"`
Table string `json:"table"`
Fields []*ColumnValue `json:"fields"`
Keys []string `json:"keys"`
RetryCount int ... |
0926e0e214cfebdedad840a3a40255839bf7ad33 | baf66cc786e7f4410dc4de2f05d77fad99dda073 | anypm/rancher | /pkg/clustermanager/manager.go | Go | go | 11,307 | permissive | package clustermanager
import (
"context"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"fmt"
"net"
"net/http"
"net/url"
"strings"
"sync"
"time"
"github.com/rancher/norman/httperror"
"github.com/rancher/norman/types"
clusterController "github.com/rancher/rancher/pkg/controllers/user"
"github.com/rancher... |
0487e1eea28ef29d42d06c93fe567fdbd2a27ed5 | edc6e8fb81c5bb014ee860d91f0b2961c889a610 | Graunephar/fdfapp | /actions/participants_uploads_test.go | Go | go | 722 | no_license | package actions
func (as *ActionSuite) Test_ParticipantsUploadsResource_List() {
// as.Fail("Not Implemented!")
}
func (as *ActionSuite) Test_ParticipantsUploadsResource_Show() {
// as.Fail("Not Implemented!")
}
func (as *ActionSuite) Test_ParticipantsUploadsResource_Create() {
// as.Fail("Not Implemented!")
}
f... |
24f8d618ba5f170e7e31de40eee7c28eb41e6038 | 69449ec12dfdd969b88e8a04c571c5440c451700 | ihaiker/gokit | /collections/lldb/lldb_list.go | Go | go | 7,767 | no_license | package lldb
import (
"github.com/ihaiker/gokit/net/buffer"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/errors"
"github.com/syndtr/goleveldb/leveldb/util"
"math"
)
const (
QUEUE_MIN_SEQ uint64 = 10000;
QUEUE_MAX_SEQ uint64 = math.MaxUint64;
QUEUE_INIT_SEQ uint64 = QUEUE_MAX_SEQ ... |
f342e763cdb62d8c4e17cf3822c3028eeabda86b | b3fdb0240674244c9e08c09e36188560356f6f3a | go-gulfstream/gulfstream | /pkg/storage/redis/storage.go | Go | go | 2,656 | permissive | package storageredis
import (
"context"
"fmt"
"strconv"
"strings"
"github.com/go-redis/redis/v8"
"github.com/go-gulfstream/gulfstream/pkg/stream"
"github.com/google/uuid"
)
const (
versionPrefix = "v"
streamPrefix = "s"
)
var _ stream.Storage = (*Storage)(nil)
type Storage struct {
streamName string
... |
a9d9b7e84eb8bbeca597e1ba003483018bb6fa04 | 0e6bc9d76534e66d6ae55df816d2319b0f9d75af | liuchen11/colder | /src/labix.org/v2/mgo/txn/flusher.go | Go | go | 28,009 | permissive | package txn
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"sort"
)
func flush(r *Runner, t *transaction) error {
f := &flusher{
Runner: r,
goal: t,
goalKeys: make(map[docKey]bool),
queue: make(map[docKey][]token),
debugId: debugPrefix(),
}
for _, dkey := range f... |
cd90c2220ec17478f63fcd5cc82677da373c4bda | 3ac2d361a605427b9efce3220871e640d25a1830 | paultag/go-technicolor | /data.go | Go | go | 2,712 | permissive | package technicolor
import (
"fmt"
"io"
"os"
"strings"
"syscall"
"unsafe"
)
type ANSISequence []byte
type ANSISequences []ANSISequence
// "Flatten" the ANSI Sequences into a single byte stream
func (a ANSISequences) Sequence() []byte {
out := []byte{}
for _, seq := range a {
out = append(out, seq...)
}
... |
a46c211b7ef5cd08ca9459d77c9bc1de2b29db63 | 90365c7443d53b8d3398c9fe10c0e0ad8355fb9a | Azure/ARO-RP | /vendor/github.com/microsoftgraph/msgraph-sdk-go/groups/item_sites_item_analytics_item_activity_stats_item_activities_request_builder.go | Go | go | 10,646 | permissive | package groups
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
ia572726a95efa92ddd544552cd950653dc6910238... |
a6a63ee645c3c3c1fb9447c1577263cbf97e02bf | 22e8458493e8b468d5630092eea0b5950398957e | netmiller/tedo | /taskmanager/taskmanager.go | Go | go | 7,522 | permissive | package taskmanager
import (
"crypto/rand"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/user"
"path/filepath"
"sort"
"strconv"
"strings"
"sync"
"time"
)
type (
// Task describes a task object
Task struct {
Id int `json:"id"`
UID string `json:"uid"`
Description str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.