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 |
|---|---|---|---|---|---|---|---|---|
ae763770d61e17d29fd93c4d0fc00e8cedf75958 | 6b8e3d0047617affe65c741f9bc3c038949c0bad | jlangston/sourcegraph | /pkg/txemail/template.go | Go | go | 2,130 | permissive | package txemail
import (
"html"
htmltemplate "html/template"
"strings"
texttemplate "text/template"
"github.com/microcosm-cc/bluemonday"
"github.com/sourcegraph/sourcegraph/pkg/markdown"
"github.com/sourcegraph/sourcegraph/pkg/txemail/txtypes"
)
// MustParseTemplate calls ParseTemplate and panics if an error ... |
36097c796d0715c01bb4ce7468230d0f57ccb96f | 5948bf4af60cfa168b9c141ec172f8bb3df2953a | dazmiller/dmnohasslfinal | /models/car_insurances.go | Go | go | 6,268 | permissive | package models
import (
"errors"
"fmt"
"reflect"
"strings"
"time"
"github.com/astaxie/beego/orm"
)
type CarInsurances struct {
Id int `orm:"column(id);auto"`
Make string `orm:"column(make);size(32)"`
Model string `orm:"column(model)... |
39c2a297a8ecc7b801cb1f522f7c759d0c4e74ce | a74912ad01ea3274be9eec414b588b4c24ff724a | dmliao/gomongo | /connection.go | Go | go | 1,247 | no_license | package gomongo
import (
"fmt"
"gopkg.in/fatih/pool.v2"
"net"
)
type Conn interface {
Close() error
Error() error
}
type Connection struct {
connPool pool.Pool
conn net.Conn
address string
err error
}
func (c *Connection) connect() error {
factory := func() (net.Conn, error) {
return net.Dial(... |
1e0baf93fca90d254f0ead6676eef181ad24d61a | 9d1cf52c3f8bf0fa7e1035cdca64e910c7ddc774 | crohling/kops | /upup/pkg/fi/cloudup/utils.go | Go | go | 2,072 | permissive | package cloudup
import (
"fmt"
"k8s.io/kops/upup/pkg/api"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
"k8s.io/kops/upup/pkg/fi/cloudup/gce"
"strings"
)
func BuildCloud(cluster *api.Cluster) (fi.Cloud, error) {
var cloud fi.Cloud
region := ""
project := ""
switch cluster.Spec.CloudPro... |
83cc0bca3040ed779cf8f9e71b49196bcef24e98 | 66d042ab04612fd31163f83779afdb5e6872bd07 | xcompass/voyager | /vendor/github.com/appscode/kutil/core/v1/serviceaccount.go | Go | go | 3,558 | permissive | package v1
import (
"encoding/json"
"fmt"
"github.com/appscode/kutil"
"github.com/golang/glog"
kerr "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/apimachinery/pkg/util/wait"
clientset "... |
30f3ab199e87e8ce722fd6a19add84d7983361d4 | d6826c6175056de1a38d2ac582eab82dd793b8f7 | hawx/iirc | /reply/nick.go | Go | go | 200 | permissive | package reply
import "hawx.me/code/iirc/message"
func Nick(oldName, newName string) message.M {
return message.Message3(
message.Prefix(oldName),
"NICK",
message.Params([]string{newName}))
}
|
f7f588f8f3eb6734628a72660fb349ce45cda717 | 134c6b6a713633d374ab6fc2a11fee45bb80745b | openshift-online/ocm-sdk-go | /addonsmgmt/v1/addon_parameter_option_list_builder.go | Go | go | 2,472 | permissive | /*
Copyright (c) 2020 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... |
214ba0e707decb16a42f98bb1b51265751150e48 | f57be27e0ed02bdb3a5829ecef3ec30c2a1df74a | ekmixon/rudolph | /internal/handlers/ruledownload/feed_sync.go | Go | go | 2,605 | permissive | package ruledownload
import (
"log"
"net/http"
"github.com/airbnb/rudolph/pkg/dynamodb"
"github.com/airbnb/rudolph/pkg/model/feedrules"
"github.com/airbnb/rudolph/pkg/model/rules"
"github.com/airbnb/rudolph/pkg/response"
"github.com/aws/aws-lambda-go/events"
)
// func handleRuleDownloadFromFeed(machineID stri... |
ddd334ae4cf9cab99c8476748d883b963a738d60 | 3fec566b465e8ef45507b2a1a18af6794990202f | vpol/rmnp | /util.go | Go | go | 1,499 | permissive | // Copyright 2017 Tim Oster. All rights reserved.
// Use of this source code is governed by the MIT license.
// More information can be found in the LICENSE file.
package rmnp
import (
"encoding/binary"
"fmt"
"hash/crc32"
"net"
"sync/atomic"
"time"
)
func checkError(msg string, err error) {
if err != nil {
... |
8116c681dcebd011ebdde23770d3de13290c4671 | fd5dde59727ca3e424731a561ed9610037f2652e | kuberlab/pacak | /pkg/process/manage.go | Go | go | 3,335 | no_license | // Copyright 2014 The Gogs 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 process
import (
"bytes"
"errors"
"fmt"
"os/exec"
"sync"
"time"
"github.com/sirupsen/logrus"
)
var (
ErrExecTimeout = errors.New("Process e... |
acd3522855dbce3efb7235d77c087945d8f69a68 | 37182593765152e655e2e6dac0d66a34af268784 | leominov/datalock | /pkg/server/handlers/middleware.go | Go | go | 611 | permissive | package handlers
import (
"log"
"net/http"
"github.com/leominov/datalock/pkg/server"
"github.com/leominov/datalock/pkg/util/request"
"github.com/leominov/datalock/pkg/util/useragent"
)
const (
logginFormat = "%s - \"%s %s %s\" %s\n"
)
func MiddlewareHandler(s *server.Server, h http.Handler) http.Handler {
re... |
fec4a69b97059827723842bca4c184c1940fa789 | 1eacf0680efd60055ce6055c4c88addf58b197d1 | andrecamilo/go-practice | /samples/goroutine/ex3/main.go | Go | go | 460 | no_license | package main
import (
"fmt"
"time"
)
func fale(pessoa, texto string, qtde int) {
for i := 0; i < qtde; i++ {
time.Sleep(time.Second)
fmt.Printf("%s: %s (iteração %d)\n", pessoa, texto, i+1)
}
}
func main() {
// fale("Maria", "Pq vc não fala comigo?", 3)
// fale("João", "Só posso falar depois de vc!", 1)
// g... |
6f2a74619e9dac3b3c01dc26fd36a6e5f2249a86 | 18418529e64c342bee23da82a6221b09660b5441 | creativewebmatrixsolutions/goar | /utils/base64_test.go | Go | go | 1,380 | no_license | package utils
import (
"testing"
"github.com/everFinance/goar/types"
"github.com/stretchr/testify/assert"
)
func TestBase64(t *testing.T) {
assert.Equal(t, "QXBwLU5hbWU", Base64Encode([]byte("App-Name")))
res, err := Base64Decode("QXBwLU5hbWU")
assert.NoError(t, err)
assert.Equal(t, "App-Name", string(res))
... |
60441c7e6090ed4a110927a56e198483e97157da | 8e2c1b49ea260890b2c804973ac01d3cf0fc6d7c | yyf330/gophercloud | /acceptance/openstack/identity/v2/identity.go | Go | go | 5,957 | permissive | // Package v2 contains common functions for creating identity-based resources
// for use in acceptance tests. See the `*_test.go` files for example usages.
package v2
import (
"testing"
"github.com/yyf330/gophercloud"
"github.com/yyf330/gophercloud/acceptance/tools"
"github.com/yyf330/gophercloud/openstack/identi... |
4d1ecf7af7761bfc9d4529de4dba619252be341a | dd3e027fd394f25b5b424b001969b58a112ae1c5 | ulugbek21/go-sdp | /structural/facade/facade_test.go | Go | go | 336 | no_license | package facade
import "testing"
func TestOpenWeatherMap_responseParser(t *testing.T) {
r := getMockData()
openWeatherMap := CurrentWeatherData{APIkey: ""}
weather, err := openWeatherMap.responseParser(r)
if err != nil {
t.Fatal(err)
}
if weather.ID != 3117735 {
t.Errorf("Madrid id is 3117735, not %d\n", w... |
f293915ba500a730575b0e148349d145d8cb6e12 | c92ba2b90425b3d11878a50dd8a22d5e09202b31 | apache/incubator-pegasus | /admin-cli/executor/remote_command.go | Go | go | 1,998 | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... |
f979333b30b0b618b868753aef1562599bce96af | fb8e69cb6ac955bc3c69ddd234e2cc089119c762 | zhaqua/istio | /pilot/pkg/networking/core/v1alpha3/cluster_test.go | Go | go | 33,018 | 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... |
aa3021104d6acd602a0765e80d8c407be55c90dc | 5733886e81bcf0996498167b56e9572d741dfdee | nenuon/gopl | /ch7/ex6/temperature/temperature.go | Go | go | 878 | no_license | package temperature
import (
"flag"
"fmt"
)
type Celsius float64
type Fahrenheit float64
type Kelvin float64
func FToC(f Fahrenheit) Celsius { return Celsius((f - 32) * 5 / 9) }
func KToC(k Kelvin) Celsius { return Celsius(k - 273.15) }
type celsiusFlag struct{ Celsius }
func (c Celsius) String() string { retur... |
534bd56b48a3f529cef7debc443c7bb32bc8ba1f | cf95d6562cd624a38fb2737a6e15483ea986554a | yanzongzhen/nats-server | /server/filestore_test.go | Go | go | 47,898 | permissive | // Copyright 2019-2020 The NATS 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 agr... |
195b76af6ee2c3d29d8ec09425697e43d414bb62 | 4ec0e16d97fa44ba54830c07c2bc5df0736bc6c2 | ronenhamias/pipeline | /internal/platform/cadence/domain.go | Go | go | 1,127 | 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 ... |
d8318bcbf8b6403619b887b47a6970ef0c0ad857 | 0828984b3ed5fb81d826e7e27d59f8f3189d9e85 | shkuropat/atlas | /pkg/data_processor_task/task_section_wrappers.go | Go | go | 8,210 | permissive | // Copyright 2020 The Atlas Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by app... |
d058dcb9ec91835d9305efa0dabcc9dbf65d7b3e | 30e40569ebe1444ab6d805fa3c5a49630a57d26b | ygzheng9/goup | /funcFP/funcHighOrder.go | Go | go | 3,245 | no_license | package funcFP
// 第一个例子
// Expr 是一个类型,代表一个函数,该函数没有参数,返回一个 float64
type Expr func() float64
// Const 是一个 high order function,也即:返回值是一个函数,类型是 Expr
// Const 自身是一个函数,参数是 float64;
func Const(x float64) Expr {
// 定义一个函数,没有参数,返回值是 float64
a := func() float64 {
return x
}
// 返回这个函数
return a
// 上述逻辑可以简化成如下形式,两者表达的意... |
6b2641698b9bb7475428fb737b59e8a94b02da59 | 51f2779fde4e07e965a770811d62d5a8411e6381 | shenqi329/im2 | /accessserver/accessserver.go | Go | go | 500 | no_license | package main
import (
accessserver "im/accessserver/server"
"log"
"runtime"
)
func main() {
log.SetFlags(log.Lshortfile | log.LstdFlags)
if runtime.GOOS == "windows" {
localTcpAddr := "localhost:6000"
proxyUdpAddr := "localhost:6001"
s := accessserver.NEWServer(localTcpAddr, proxyUdpAddr)
s.Run("localh... |
feb1bd0d76f1fcf9736e5bafb226188d45d1cbaa | 771a49f68a8692c470cab0dc0ed2717923d62ee8 | lensesio/lenses-go | /pkg/api/channels_client.go | Go | go | 6,169 | permissive | package api
import (
"net/http"
"encoding/json"
"fmt"
"net/url"
"strconv"
)
// TODO AC-1458: better comment
// As Alert and Audit channels have the same API contracts,
// some parts of the code might be reused.
// ChannelPayload describes a channel of an alert payload for create/update
type ChannelPayload stru... |
e7fdc08cec5bc1cdab391e809937e942b6563e90 | 0dc4a51ab727a6da5b583441bf9a21f5406dac3f | zhenyangze/jiacrontab | /jiacrontab_admin/daemon.go | Go | go | 5,112 | permissive | package admin
import (
"errors"
"jiacrontab/models"
"jiacrontab/pkg/proto"
"jiacrontab/pkg/rpc"
"strings"
)
func GetDaemonJobList(ctx *myctx) {
var (
reqBody GetJobListReqParams
jobRet proto.QueryDaemonJobRet
err error
)
if err = ctx.Valid(&reqBody); err != nil {
ctx.respParamError(err)
return... |
15de2f200e74dfc290035d899e102891064147e0 | c79dc75416719491bb82cbef142d88d44a71768b | resnickmicah/skill-share-club | /main.go | Go | go | 1,314 | no_license | package main
import (
"database/sql"
"fmt"
"log"
"net/http"
"github.com/gomodule/redigo/redis"
// _ "github.com/jackc/pgx/v4/stdlib"
_ "github.com/lib/pq"
)
// Store the redis connection as a package level variable
var cache redis.Conn
var db *sql.DB
const port = ":8000"
func main() {
initCache()
// r := ... |
d1364a18de90d71b7bc273f1072254d9fbcc88ba | eeb91dcf9ba9b46359d4af7de02b28ade897e0e5 | piitt/headfirstgo | /part_11/exercise_vehicle/exercise_vehicle.go | Go | go | 763 | no_license | package main
import "fmt"
type Car string
type Truck string
type Vehicle interface {
Accelerate()
Brake()
Steer(string)
}
func (c Car) Accelerate() {
fmt.Println("Speeding up")
}
func (c Car) Brake() {
fmt.Println("Stopping")
}
func (c Car) Steer(direction string) {
fmt.Println("Turning", direction)
}
fun... |
a2747ccbe441473e3abd54c0ee354481b1d51589 | 86e9efac68a442cede2bb9a7dd904ce95f66a3be | BrkOne/code | /teawaf/rule.go | Go | go | 15,274 | permissive | package teawaf
import (
"bytes"
"encoding/binary"
"errors"
"github.com/TeaWeb/code/teautils"
"github.com/TeaWeb/code/teawaf/checkpoints"
"github.com/TeaWeb/code/teawaf/requests"
"github.com/TeaWeb/code/teawaf/utils"
"github.com/iwind/TeaGo/lists"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
... |
2d9e8e8d3b05ca264d5cf7abf0d94fb5bd378416 | 4e63dec8df7e6012981cc579979aaf06205d89eb | kalkin/wingo | /xclient/prompts.go | Go | go | 1,714 | permissive | package xclient
import (
"github.com/BurntSushi/xgbutil/xgraphics"
"github.com/xsrc/wingo/prompt"
"github.com/xsrc/wingo/wm"
)
type clientPrompts struct {
client *Client
cycle *prompt.CycleItem
slct *prompt.SelectItem
}
func (c *Client) CycleItem() *prompt.CycleItem {
return c.prompts.cycle
}
func (c *Cl... |
fc61bfce3a7b54b2cd28ef0dd27e1bf4fd7264ac | 071e78cbc8b72929e8feaf9b7eb52b90fec6aa6d | billimek/stash | /pkg/controller/sidecar.go | Go | go | 12,066 | permissive | package controller
import (
"fmt"
"time"
"github.com/appscode/go/log"
stringz "github.com/appscode/go/strings"
"github.com/appscode/stash/apis"
api_v1alpha1 "github.com/appscode/stash/apis/stash/v1alpha1"
api_v1beta1 "github.com/appscode/stash/apis/stash/v1beta1"
"github.com/appscode/stash/pkg/docker"
"githu... |
5c33ac20aca6724f17f7ddfc54cc445ad9b422b6 | 4511687dcef2ec29763345ea5117f614fec574b3 | donech/nirvana | /internal/domain/lottery/vo/two_tone_sphere_generator.go | Go | go | 530 | permissive | package vo
import (
"context"
"github.com/donech/nirvana/internal/conn"
"github.com/donech/nirvana/internal/domain/lottery/entity"
)
type TwoToneSphereGenerator struct {
}
func (t TwoToneSphereGenerator) Generate(ctx context.Context, period string) entity.LotteryRecord {
client := conn.LotteryClient{}
ssq := c... |
e17d76b918de92aecf45eee15ac18f096b8f08d1 | d859ee76b35d2394bef5bd36f88e6e7b1cea91d9 | alexanderbaran/projecteuler-go | /main/045.go | Go | go | 1,352 | no_license | package main
// import (
// "fmt"
// "math"
// "time"
// )
// func main() {
// defer timeTrack(time.Now())
// for i := 1; ; i++ {
// if isPentagonal(H(i)) {
// if H(i) > 40755 {
// fmt.Println(H(i))
// break
// }
// }
// }
// // n := 60000
// // tm := map[int]bool{}
// // pm := map[int]bool... |
fdb1d2bf5eae24d1c80ef5675d3685d5a99be690 | 419ca23cd3def3d39c8d40ea4e0840899a56f10e | indiependente/hrank | /impl/appleorange/appleorange.go | Go | go | 915 | no_license | package main
import "fmt"
type problem struct {
s int
t int
a int
b int
m int
n int
apples []int
oranges []int
}
func main() {
p := readProblem()
// fmt.Printf("%v\n", p)
s := solveProblem(p)
fmt.Printf("%d\n%d\n", s[0], s[1])
}
func solveProblem(p *problem) [2]int ... |
46ca08c7cd41ec571ac6e72625012e517caa26db | 59a41fd303ab12c8dacfb95b101370b18e13dd99 | takeshitamakoto/sss | /src/floor.go | Go | go | 559 | no_license | /*
# What Is This: programming samples
# Author: Makoto Takeshita <takeshita.sample@gmail.com>
# URL: http://simplesandsamples.com
# Version: UNBORN
#
# Usage:
# 1. git clone https://github.com/takeshitamakoto/sss.git
# 2. change the directory name to easy-to-use name. (e.g. sss -> sample)
# 3. open sss/src/filenam... |
4101e3ef341bc35a7e9575bfb57c18ba8d5e4513 | 15bf0e2f1a6f1629b32b285848c59777b7dfba65 | PeterWangYong/go-crontab | /master/WorkerMgr.go | Go | go | 1,477 | no_license | package master
import (
"context"
"github.com/PeterWangYong/crontab/common"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/mvcc/mvccpb"
"time"
)
type WorkerMgr struct {
client *clientv3.Client
kv clientv3.KV
lease clientv3.Lease
}
var (
G_workerMgr *WorkerMgr
)
func InitWorkerMgr() (err error ) ... |
529ea1928d700b19f3e27cee7f07b8c7eb799dbc | 0f0cd17e21c68f40335f0e3ec573415932abbbce | nextisd/kksl | /core/comm/config.go | Go | go | 1,722 | permissive | /*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
3c5e19506a35e1480ad37959ad676c195a0faa92 | f124395f2ba2b24a11b7ae651da429e99b3e35d6 | thisissoon/lightswarm | /lightswarm.go | Go | go | 5,300 | permissive | package lightswarm
import (
"encoding/binary"
"io"
)
// Byte constants
const (
END byte = 0xC0 // End byte
ESC byte = 0xDB // Escape byte
)
// Escape Sequences
var (
ENDSEQ = []byte{ESC, 0xDC} // END byte escape sequence
ESCSEQ = []byte{ESC, 0xDD} // ESC byte escape sequence
)
// Command constants
const (
ON... |
a9270cedf34b9a311145255a35a795eb216a1477 | fa08e5d8d0d7a9f75369da0e123014f69363613d | equinor/radix-cicd-canary | /scenarios/happypath/unauthorized/unauthorized_access_test.go | Go | go | 847 | permissive | package unauthorized
import (
"testing"
"github.com/equinor/radix-cicd-canary/scenarios/utils/config"
"github.com/stretchr/testify/assert"
)
const suiteName = "Happy path"
/*
Allow us to run this as a single test. Note that we need the previous tests of the suite to have passed for this to work.
Also running the... |
e710f11fb86305fd0b0c82ee57c1a6b1b092449c | 161ca1ab10fcd15cc732c613de9b1191c7b7df2f | go-iot-platform/micro-plugins | /config/encoder/xml/xml.go | Go | go | 413 | permissive | package xml
import (
"encoding/xml"
"github.com/go-iot-platform/go-micro/config/encoder"
)
type xmlEncoder struct{}
func (x xmlEncoder) Encode(v interface{}) ([]byte, error) {
return xml.Marshal(v)
}
func (x xmlEncoder) Decode(d []byte, v interface{}) error {
return xml.Unmarshal(d, v)
}
func (x xmlEncoder) S... |
6c3cead8a7e5c7e2fe4e842fee261f1f106e8bb8 | 7c8d920f28e73ded01bb2f00618f9d612365d420 | scott-x/TextToJson | /engine/engine.go | Go | go | 234 | no_license | /*
* @Author: scottxiong
* @Date: 2019-11-19 15:42:45
* @Last Modified by: scottxiong
* @Last Modified time: 2019-11-19 15:48:42
*/
package engine
import (
"github.com/scott-x/TextToJson/parse"
)
func Run() {
parse.Parse()
}
|
12ae2715b10f56df912954afcac575c092a45dd6 | 7c7c1935878145020dbfc521cb299d02cbc5d8b5 | nknorg/NKNDataPump | /storage/dbHelper/transfer.go | Go | go | 4,601 | no_license | package dbHelper
import (
"github.com/nknorg/NKNDataPump/common"
"github.com/nknorg/NKNDataPump/storage/storageItem"
"database/sql"
)
func transferFromRows(rows *sql.Rows) (transferList []storageItem.TransferItem, count int, err error) {
count = 0
transferList = []storageItem.TransferItem{}
for rows.Next() {
... |
2511240cc290d3699f1d2de22305cc2571c34136 | b2463faea1598862b142c207598313e22e25b836 | pgroves95/Builder | /yaml/yamlParser.go | Go | go | 829 | no_license | package yaml
import (
"io/ioutil"
"log"
"os"
"gopkg.in/yaml.v3"
)
func YamlParser(yamlPath string) {
// Initial declaration
m := map[string]interface{}{
"key": "value",
}
// Dynamically add a sub-map
m["sub"] = map[string]interface{}{
"deepKey": "deepValue",
}
// returns map
var f interface{}
//tak... |
2779f7a02b2d4abd3f6dbfebda34230a6a865697 | f8a637a123cf2c12bb1c0ac7a457e6ebaf046307 | highras/rtm-server-sdk-go | /examples/miscDemo.go | Go | go | 8,458 | no_license | package main
import (
"fmt"
"os"
"runtime"
"strconv"
"sync"
"time"
"github.com/highras/fpnn-sdk-go/src/fpnn"
"github.com/highras/rtm-server-sdk-go/src/rtm"
)
//---------------[ Help tools for serializing concurrent printing. ]---------------------//
type PrintLocker struct {
mutex sync.Mutex
}
func (locker... |
e715f8670d42ce13dc9974b6f2310dcfa58b48b2 | 8713478b9c7e1cb62de7ef6aea3f4b8b385f3ee3 | sapcc/castellum | /internal/tasks/resource_seed.go | Go | go | 5,587 | permissive | /*******************************************************************************
*
* Copyright 2023 SAP SE
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You should have received a copy of the License along with this
* program. If... |
b0eb0d13444a78fb7d83eb3157e3d8867cf1733c | dc375f4b6e48c066cafd540a028d195ed3c8b951 | ysoftman/codingtest | /leetcode/combinations.go | Go | go | 1,373 | no_license | /*
https://leetcode.com/problems/combinations/
77. Combinations
Medium
Given two integers n and k, return all possible combinations of k numbers out of the range [1, n].
You may return the answer in any order.
Example 1:
Input: n = 4, k = 2
Output:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
Example 2:
... |
8c3b9d41163581968276640c19f1d5626dd1694d | 72ac938867dcf4f947bf6d408ae2d5fd1ef6472c | qiukai/qkchat | /src/frame/filter/filter_exe.go | Go | go | 1,202 | no_license | package filter
import (
_ "controller/loginController"
"frame/bean"
_ "frame/config"
"my_error"
"net/http"
"util"
)
func Exe(response http.ResponseWriter, request *http.Request) {
defer panicHanle(response)
// 过滤器校验失败
if !filter(response, request) {
return
}
// 获取controller
controller := bean.GetCont... |
75359d8ebfea496a62920ad0ad545a698ea46220 | 9f4d95b1e1c737ab76c7d3fa78fbf20619521831 | haiker2011/argo-workflows | /test/e2e/functional_test.go | Go | go | 20,578 | permissive | // +build functional
package e2e
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow"
wfv1 "githu... |
c386fa780f10ec0a2088d0466ac1a407ac81e8ac | ede52137af0cbf5619417394c703d6f8ed032497 | mbordner/aoc2020 | /day16/p2/main.go | Go | go | 5,271 | no_license | package main
import (
"fmt"
"github.com/mbordner/aoc2020/common/array"
"github.com/mbordner/aoc2020/common/file"
"regexp"
"strconv"
"strings"
)
var (
reClass = regexp.MustCompile(`^(.*):\s(\d+)-(\d+)\sor\s(\d+)-(\d+)$`)
)
type classRange struct {
min int
max int
}
type class struct {
name string
ranges ... |
70de40ef4ed6b7a01beddc55a47d9d1df789e18d | bc8c0e30b478ff8ba7044c41bc801f701abc238a | ferjmc/api_ddd | /sessions/internal/session/usecase/session_usecase.go | Go | go | 810 | no_license | package usecase
import (
"context"
"github.com/ferjmc/api_ddd/sessions/internal/models"
"github.com/ferjmc/api_ddd/sessions/internal/session"
uuid "github.com/satori/go.uuid"
)
type sessionUseCase struct {
sessRepo session.RedisRepository
}
func NewSessionUseCase(sessRepo session.RedisRepository) *sessionUseCa... |
b32d7ba7dfb728052e1bbe87151c55ad7adc4a78 | 2a66ead95bead6fa71572086ddbd72b99f009c65 | go2ms/mini-services | /pkg/e/code.go | Go | go | 497 | no_license | package e
const (
SUCCESS = 200
ERROR = 500
INVALID_PARAMS = 400
ERROR_EXIST_TAG = 10001
ERROR_EXIST_TAG_FAIL = 10002
ERROR_NOT_EXIST_TAG = 10003
ERROR_GET_TAGS_FAIL = 10004
ERROR_COUNT_TAG_FAIL = 10005
ERROR_ADD_TAG_FAIL = 10006
ERROR_EDIT_TAG_FAIL = 10007
ERROR_DELETE_TAG... |
184a49323868fa4579917a5830ddc6b8faa63a00 | 343fbf85b0e1a859c730cdc92c8219ec75b638d0 | sguzman/asmshell | /arch/powerpc64.go | Go | go | 759 | permissive | package arch
import (
"github.com/keystone-engine/keystone/bindings/go/keystone"
// uc "github.com/unicorn-engine/unicorn/bindings/go/unicorn"
"github.com/bnagy/gapstone"
)
// sample: add 1,2,3
func SetPowerPC64(strArch string, bigEndian bool) Machine {
var mc Machine
if bigEndian {
mc.ks, ... |
bb16dc2bdc197acf72b27e9069d0adb9de58e456 | 58f5e6a8ebd4713473556cf803cea68b8415ab00 | mkapnick/connectrn | /services/restaurant/postgres/restaurantstore.go | Go | go | 3,589 | no_license | package postgres
import (
"fmt"
"github.com/jmoiron/sqlx"
"gitlab.com/michaelk99/connectrn/services/restaurant"
)
// queries are written to use sqlx.NamedExec() method. this method maps "db" struct tags with
// the : prefixed names in the values parameter
const (
CreateRestaurantQuery = `INSERT INTO res... |
1116c417ea7b13b3cf846dfe5095aec213fce1ab | 73b67492250407437f4d6802fd4c482fa1de1bdb | facs95/firefly | /internal/networkmap/register_org_test.go | Go | go | 5,422 | permissive | // Copyright © 2021 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// 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
//
// Unle... |
2840c645271e53b9712f9437b0571b9c64acbda3 | fad6f2ac5856064be96db4e5345fd48b571ae591 | GooglePlugin/CrashArchive | /app/handler/download.go | Go | go | 1,236 | no_license | package handler
import (
"fmt"
"log"
"net/http"
"strconv"
"github.com/pmmp/CrashArchive/app"
"github.com/pmmp/CrashArchive/app/crashreport"
"github.com/pmmp/CrashArchive/app/template"
"github.com/go-chi/chi"
)
func DownloadGet(app *app.App) http.HandlerFunc {
name := "error"
errorTmpl, err := template.Load... |
388b968a09f5c15fdeb484d98878f24b55f28e9c | 4cd6ce6dc8d4df5678b140c913bda8abc4cba0fc | CodeLingoBot/go_commons | /modules/phantomjs/agent.go | Go | go | 2,146 | no_license | package phantomjs
import (
"bufio"
"io"
"os/exec"
"strconv"
"syscall"
"github.com/sundy-li/go_commons/log"
)
type Monitor interface {
Register(*Agent)
Close(*Agent)
}
type Agent struct {
Id int
proxyUrl string
jsPath string
binPath string
port int
monitor Monitor
cmd *exec.Cmd
sta... |
6b56b2cf904499dc62625b451b8c543db6db4ce0 | 50a0eb6d1be8ec3d35a93a5199fb7dd60b799591 | NPC-Chain/npcchub | /client/coinswap/lcd/rest.go | Go | go | 359 | no_license | package lcd
import (
"github.com/gorilla/mux"
"github.com/NPC-Chain/npcchub/client/context"
"github.com/NPC-Chain/npcchub/codec"
)
// RegisterRoutes registers asset-related REST handlers to a router
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
registerQueryRoutes(cliCtx, r, cd... |
fc6d525b5d282521fe7e3eeb0227df9b05168251 | c3e7ae4532d1e7e8cf08debab613c5b0e0ba78f8 | medusalix/multispeaker | /multispeaker.go | Go | go | 2,400 | permissive | /*
* Copyright (C) 2018 Medusalix
*
* 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 t... |
bae10541b5293179c62ceef3549c99680c9671cf | e9de3fe8138a8924f168de60bf4ed37560899537 | junli0411/xsql | /server/prepare_stmt.go | Go | go | 1,520 | no_license | /**
* author: lim
* data : 18-5-6 下午8:56
*/
package server
import (
"fmt"
"github.com/lemonwx/xsql/sqlparser"
)
type Stmt struct {
id uint32
cliParams int
nodeParams int
cliColumns uint16
nodeColumns uint16
cliArgs []interface{}
nodeArgs []interface{}
s sqlparser.Statement
sql string
... |
09d965d00e58cc4f897e6b588b149f5f28a94614 | bb53238cf30ebab465af2a6e05d80b710d7bfe9d | gw123/ghelper | /excel/excel.go | Go | go | 980 | no_license | package main
import (
"github.com/tealeg/xlsx"
"fmt"
)
//xlsx文件解析
func ExcelParse(fileName string) error {
filePath := "./upload/" + fileName
xlFile, err := xlsx.OpenFile(filePath)
if err != nil {
return err
}
//获取行数
//length := len(xlFile.Sheets[0].Rows)
//开辟除表头外的行数的数组内存
//resourceArr := make([]string, ... |
fa7cec28fd848d33520f3a4208f8680a00b570fa | 367b0f4a5e17507e2cc55f96ba310956e9182feb | riferrei/confluent-kafka-go | /examples/legacy/producer_channel_example/producer_channel_example.go | Go | go | 1,906 | permissive | /**
* Copyright 2016 Confluent 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 ... |
ed714726599a257e44c70c9ce8346db1a78d4f66 | 6316da54a6dd5b9c5855ce1b2b1c05ffa66fd340 | nityaravi/hello-kubernetes | /main.go | Go | go | 359 | permissive | // A very simple Go application.
package main
import (
"fmt"
"log"
"time"
)
// Greet returns a pleasant greeting.
func Greet(name string) string {
return fmt.Sprintf("Hello %s!", name)
}
func main() {
greeting := Greet("nitya")
log.Printf(greeting)
for {
// Don't exit, otherwise Kubernetes thinks we crashed... |
d2450394f91d9f31bf7cc5c36d17e09d65fb3cfa | 2a671a864a98dc53f5ad05a77853a8b1ef175c87 | KhryptorGraphics/gocryptotrader | /log/logger_types.go | Go | go | 2,646 | permissive | package log
import (
"io"
"sync"
)
const (
timestampFormat = " 02/01/2006 15:04:05 "
spacer = " | "
// DefaultMaxFileSize for logger rotation file
DefaultMaxFileSize int64 = 100
)
var (
logger = &Logger{}
// FileLoggingConfiguredCorrectly flag set during config check if file logging meets requiremen... |
35a58a8cfcbc119554785d2131a7da7b6878efb1 | 235f19f68236305674a9a8cd09afd625e63b6b39 | Jun711/GoRPCModification | /ec2LocaclTest.go | Go | go | 1,064 | no_license | package main
import (
"net"
"fmt"
"bufio"
"os"
)
func main() {
// connect to this socket
conn, _ := net.Dial("tcp", "128.189.220.122:4010")
// a go routine to read from server
go func() {
for {
// message, err := bufio.NewReader(conn).ReadString('\n')
scanner := bu... |
76f7897ccd2c565296ac3e5c7797375cf7ef448e | 5bfc707fc8db85913693d835a97c3ac4b1a83858 | mhcvs2/mdocker | /cmd/commands/defaultGroup/rm/start.go | Go | go | 332 | no_license | package start
import (
"mdocker/cmd/commands"
"mdocker/models/v1"
)
var CmdRun = &commands.Command{
UsageLine: "rm",
Short: "rm container",
Long: `
rm container
`,
Run: rm,
}
func init() {
commands.AddGroup("default", CmdRun)
}
func rm(cmd *commands.Command, args []string) int {
docker.Run("Rm", args)... |
ae286e4317cd0871f4155c78a081de0e964d4e25 | 77e014f955cfdf723aafb80fc5df72bf14523846 | importhuman/github-actions | /registry/verify-namespace-owner/verify_namespace_owner_test.go | Go | go | 6,740 | permissive | /*
* Copyright 2018-2020 the original author or 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
5201929810a7a51f3b2a5fcb6975d4e01c61ea0c | e5ce987078c55002559e5fc03cf008443c8d17bd | wuwenbao/wechat | /internal/response/readbody.go | Go | go | 585 | no_license | package response
import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
)
//ReadBody 读取相应的body数据
func ReadBody(reader io.Reader, data interface{}) error {
//context.WithValue()
bts, err := ioutil.ReadAll(reader)
if err != nil {
return err
}
//fmt.Printf("%s\n", bts)
e := new(Error)
if err := json.Unmarshal(bt... |
4816fcf7a9bf55b64bd976b6f028aae08debb9a8 | 3e600a6204c9a9add2d9f41e73ea9826ef6ab58b | wtnsahyugi/google-api-go-client | /gmailpostmastertools/v1/gmailpostmastertools-gen.go | Go | go | 51,172 | permissive | // Copyright 2021 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package gmailpostmastertools provides access to the Gmail Postmaster Tools API.
//
// For product documentation, see: https://developers.google.... |
dbb53635f57d66f399d4c089b74a173dba5be82e | 34dac9673d9b57560e5912ca6c8ca508e6e332b4 | jonathanperret/scalingo-cli | /cmd/flags.go | Go | go | 830 | permissive | package cmd
import (
"fmt"
"os"
"github.com/Scalingo/go-scalingo/v4/debug"
"github.com/urfave/cli"
)
var (
appFlag = cli.StringFlag{
Name: "app, a",
Value: "<name>",
Usage: "Name of the current app",
}
addonFlag = cli.StringFlag{
Name: "addon",
Value: "<addon_id>",
Usage: "ID of the current addo... |
929e7d5661cc14b15c7ac5b26dbc2f77090fb045 | 61ae389c73d26f390d784a0b8ebf030c3abda17a | binzume/modelconv | /geom/vector_test.go | Go | go | 1,600 | permissive | package geom
import (
"testing"
)
func TestVector2(t *testing.T) {
zero := NewVector2(0, 0)
if zero.Len() != 0 || zero.LenSqr() != 0 || zero.Dot(zero) != 0 {
t.Error("len != 0")
}
if *zero.Normalize() != *NewVector2(1, 0) {
t.Error("Normalize shoud returns unit vector.", zero.Normalize())
}
if *NewVector... |
6fe941ba83fe0c32f4b024c3d8b873bddc1726cc | de1c867c7519de7d4bb96476025edffa42c7d2d1 | JulianKnodt/vector | /unit.go | Go | go | 435 | no_license | package vector
import (
"math"
)
func Unit(dir Vec3) *Vec3 {
magn := math.Sqrt(Dot(dir, dir))
return &Vec3{
dir[0] / magn,
dir[1] / magn,
dir[2] / magn,
}
}
func UnitSet(dir *Vec3) *Vec3 {
magn := math.Sqrt(Dot(*dir, *dir))
if magn == 0 {
return dir
}
dir[0] /= magn
dir[1] /= magn
dir[2] /= magn
r... |
0b94c3054fc7830e8f12467c7ffd3ed1b2c21410 | 24218c4e4844bb84e7df4570cfffa41de60318fe | microsoftgraph/msgraph-sdk-go | /users/item_scoped_role_member_of_scoped_role_membership_item_request_builder.go | Go | go | 11,063 | permissive | package users
import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242 "github.com/microsoftgraph/msgraph-sdk-go/models"
ia572726a95efa92ddd544552cd950653dc69102383... |
704fd334a2b7263dfffb2da35f9c9e770c2943be | fe418cca103574f0da2056b742e1f93254e4e97e | Feokrat/go-twitter-downloader | /pkg/config/config.go | Go | go | 875 | no_license | package config
import (
"strings"
"github.com/spf13/viper"
)
type (
Config struct {
HTTP HTTPConfig
}
HTTPConfig struct {
Host string `mapstructure:"host"`
Port string `mapstructure:"port"`
}
)
func Init(path string) (*Config, error) {
if err := parseConfigFile(path); err != nil {
return nil, err
}... |
4e4380f33a5a75e12f443e8ea7d87362152fe65c | d43b0d40b91028be69f0f4242f57c52b8a91f1a2 | friend-of-ash/go-barebones | /pkg/server/server.go | Go | go | 359 | no_license | package server
import (
"github.com/go-chi/chi"
"log"
"net/http"
"pkg/config"
)
func NewServer(router *chi.Mux) {
conf := config.Conf
log.Fatal(http.ListenAndServe(":"+conf.APP_PORT, router))
}
func NewTLSServer(router *chi.Mux) {
conf := config.Conf
log.Fatal(http.ListenAndServeTLS(":"+conf.APP_PORT, conf.T... |
c89b82030d5255e1f29171dfe13bce03c74b1364 | fe81f59b76577c0d8e455ce859fb6cec51bff826 | kumahq/kuma | /pkg/core/managers/apis/dataplane/dataplane_validator.go | Go | go | 429 | permissive | package dataplane
import (
"context"
core_mesh "github.com/kumahq/kuma/pkg/core/resources/apis/mesh"
"github.com/kumahq/kuma/pkg/core/resources/model"
)
type Validator interface {
ValidateCreate(ctx context.Context, key model.ResourceKey, newDp *core_mesh.DataplaneResource, mesh *core_mesh.MeshResource) error
V... |
a5ef7f6d90d6364834b4b0cdc9819ddd7572530d | 0abeb5c097f2724a75f4964ea5c81275cf94806f | tomuboyd12/nzgo | /doc.go | Go | go | 6,908 | permissive | /*
Package nzgo is a pure Go language driver for the database/sql package to work with IBM PDA (aka Netezza)
In most cases clients will use the database/sql package instead of
using this package directly. For example:
import (
"database/sql"
_ "github.com/IBM/nzgo"
)
func main() {
connStr := "user=nz dbnam... |
c5085a7fba4de0de476b7772996e2088749746c5 | db1c276627f841946362d735743afc66fdd4dbcc | BlindBillyJoe/Platforms | /main.go | Go | go | 2,325 | no_license | package main
import (
"math/rand"
"time"
)
var gCounter = 0
func drawMap(mc *mapController) {
counter := 0
for i := range mc.sceneMap {
for j := range mc.sceneMap[i] {
if mc.sceneMap[j][i] != nil {
counter++
}
}
}
if counter != gCounter && counter != 0 {
for x := range mc.sceneMap {
for y :... |
07e262373a89684eca06a6991dc0c0091aa8a268 | 6d262fcf88919e4a239077605c89658bbbff8c01 | nozawatm/kubernetes | /pkg/scheduler/scheduler.go | Go | go | 25,052 | permissive | /*
Copyright 2014 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, ... |
a06899b58decef18d88911b848c85d148003ca47 | 76cffce137134a4e324d0d3fb5427f311bcb9e73 | harshraham/GoFutures | /Futures_test.go | Go | go | 4,561 | no_license | package main
import (
"math/rand"
"sync"
"testing"
"time"
)
//multiple threads/goroutines are trying to call the functions you have written on the same futures object.
//multiple goroutines trying to cancel the same futures object and checking if it has been cancelled.
//testing simple functions
func TestFuncti... |
5aa4f18e87875bb7c02c839d2cfd6d2d54a65207 | 645b31d29f1c0b90ccfe97eb2c1eaef0790f616c | kyledj/minnow | /winnow/winnow.go | Go | go | 2,226 | permissive | package main
import (
"crypto/hmac"
"crypto/sha512"
"encoding/binary"
"flag"
"github.com/schmichael/minnow"
"io"
"log"
"net"
)
var bind = flag.String("bind", "localhost:9876", "host and port to bind to")
var secret = flag.String("secret", "", "shared secret (required)")
// Creates an accumulator of new messa... |
8d4245e22a0e18e22f3f07c301c749259c6343a8 | 171a569eb4c5f1e7f96c92784b4471ab93f850d8 | spiffxp/cluster-api-provider-aws | /pkg/cloud/services/ec2/instances.go | Go | go | 33,245 | 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, ... |
7e57f518f774c85b8430c2b7d0b467d8be0eaaac | 67899cff39accd8a099153cf053454a6cf66e71b | fmechant/goformation | /cloudformation/greengrass/aws-greengrass-subscriptiondefinition_subscription.go | Go | go | 2,579 | permissive | package greengrass
import (
"github.com/fmechant/goformation/v4/cloudformation/policies"
)
// SubscriptionDefinition_Subscription AWS CloudFormation Resource (AWS::Greengrass::SubscriptionDefinition.Subscription)
// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-subscrip... |
28631ce754540cddf51e3e7e7645cf2e36904310 | be3189808b2bdcea080a2efb6d657c76c815d547 | naoty/mdserve | /contents/watcher.go | Go | go | 1,290 | permissive | package contents
import (
"log"
"os"
"path/filepath"
"time"
"github.com/fsnotify/fsnotify"
)
// Watcher represents a watcher of changes in contents.
type Watcher struct {
*fsnotify.Watcher
logger *log.Logger
}
// NewWatcher returns a new Watcher.
func NewWatcher(logger *log.Logger) (*Watcher, error) {
watch... |
0257d0ca49ac7425481f7a8ec435a6d4a64d1dfb | b51337610493321f04cbf535bf99a0aa892aba45 | sgunpreetsandhu01/instagramAPI | /main.go | Go | go | 1,052 | no_license | package main
import (
"context"
"encoding/json"
"log"
"net/http"
"github.com/gorilla/mux"
)
var collection = helper.ConnectDB()
func main() {
r := mux.NewRouter()
r.Handle("/users", createUser).Methods("POST")
r.Handle("/users/{id}", getUser).Methods("GET")
log.Fatal(http.ListenAndServe(":8080", nil))
}
... |
bf35dd3ad1029bc820d763b46532774b4fe1758e | 323e4599b7521d1dd2ccbf011fb8b52b9deef0e4 | ActiveState/cli | /test/integration/show_int_test.go | Go | go | 3,343 | permissive | package integration
import (
"path/filepath"
"strings"
"testing"
"github.com/stretchr/testify/suite"
"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/fileutils"
"github.com/ActiveState/cli/internal/testhelpers/e2e"
"github.com/ActiveState/cli/internal/testhelpers/tagsuite"... |
89d2c4a7a02d3805f4a08049ad5234a1f4d30a24 | 3b5459dca7026db7dded8a75b714467ed1b1c41c | jwilder/shuttle | /registry.go | Go | go | 13,822 | permissive | package main
import (
"fmt"
"reflect"
"sort"
"strings"
"sync"
"github.com/litl/shuttle/client"
"github.com/litl/shuttle/log"
)
var (
ErrNoService = fmt.Errorf("service does not exist")
ErrNoBackend = fmt.Errorf("backend does not exist")
ErrDuplicateService = fmt.Errorf("service already exists... |
69ebb5778fe9a09bd7f7183f05c79f8b7796ecbe | d36f2093880b4655449c547530cec0070dfa696d | friendsofgo/tools | /validations.go | Go | go | 664 | permissive | package tools
import "strconv"
// IsNumber returns true if the given input can be converted
// into an integer, otherwise returns false.
func IsNumber(n string) bool {
_, err := strconv.Atoi(n)
return err == nil
}
// IsValidPort returns true if the given input is
// within the range of valid port numbers, otherwis... |
9e82d36a44be7ec475132cac7bd29c433fb3f3df | 7c2200f6c7dd68df3f07158b72caa93f2baac151 | zdyxry/LeetCode | /sort/0349_intersection_of_two_arrays/0349_intersection_of_two_arrays.go | Go | go | 374 | no_license | package main
import "fmt"
func intersection(nums1 []int, nums2 []int) []int {
m := map[int]bool{}
var res []int
for _, n := range nums1{
m[n] = true
}
for _, n := range nums2{
if m[n] {
delete(m,n)
res = append(res, n)
}
}
return res
}
func main() {
nums1 := []int{1,2,2,1}
nums2 := []int{2,2}
... |
d10732fb78b5b39a373e4d25f53183ce4892d70f | 98c194aa301bf72ccf757b5b3f426668a77121ba | lingling1420q/gnet | /eventloop_unix.go | Go | go | 8,655 | permissive | // Copyright (c) 2019 Andy Pan
// Copyright (c) 2018 Joshua J Baker
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to us... |
e79b93e006c45c506f51a29501364b22dff3b626 | 95ea342894b0b6208947307ad4c5d1eb233701b4 | wdwd5wd/harmony | /internal/blsgen/helper.go | Go | go | 2,541 | permissive | package blsgen
import (
"fmt"
"os"
"path/filepath"
bls_core "github.com/harmony-one/bls/ffi/go/bls"
"github.com/harmony-one/harmony/multibls"
)
// loadHelper defines the helper interface to load bls keys. Implemented by
// multiKeyLoader - load key files with a slice of target key files
// blsDirLoader - ... |
8924ed891871b2933434d5302c65d528b2260fe4 | 2ecdaad930a037efe95007c87cef59fd956b59fc | PythonNewLearner/GolangLearning | /demo/day9/code/tcp/server.go | Go | go | 713 | no_license | package main
import (
"bufio"
"fmt"
"log"
"net"
"time"
)
func main() {
listener,err :=net.Listen("tcp","127.0.0.1:9999")
if err != nil{
log.Fatal(err)
}
defer listener.Close()
for {
conn,err := listener.Accept()
if err != nil {
log.Println(err)
continue
}
func(){
defer conn.Close()
... |
e353af58739aa3d971e4332baa551bdf881fd9e2 | 08d588e04990ac6ea0196bd47cc793c98aae4513 | timbetter815/wishgo4jvm | /gvm/runtimedata/thread.go | Go | go | 1,195 | no_license | /*
Copyright (c) 2015-2018 All rights reserved.
本软件源代码版权归 my.oschina.net/tantexian 所有,允许复制与学习借鉴.
*/
package runtimedata
/*
Description:
Author: tantexian
Since: 2016/8/24
*/
// 若java虚拟机栈大小有限制,
type Thread struct {
pc int // 程序计数器,指向下一条需要执行的代码
stack *Stack // Stack(Java虚拟机栈)指针。
}
// 如果Java虚拟机栈有大小限... |
d8284d72cf7ae22ab44ad4806ecd1e99cf340628 | e7061b058439cbdd04af80a4768d22afc379c569 | jeffersonsc/speed-url | /main.go | Go | go | 1,794 | no_license | package main
import (
"gopkg.in/macaron.v1"
"log"
"os"
"strconv"
config "github.com/jeffersonsc/speed-url/conf"
conf "github.com/jeffersonsc/speed-url/conf/app"
)
// application entrypoint
func main() {
app := macaron.New()
conf.SetupMiddlewares(app)
conf.SetupRoutes(app)
/*
Generated using http://www.k... |
c16fcb51100b068f7b1a6b4598acd4ed16aab8f4 | 9d344cc3010fcc3f3a3055d8a83a27029adffb22 | masiqi/wechat.v2 | /mp/oauth2/endpoint.go | Go | go | 895 | permissive | package oauth2
import (
"net/url"
"github.com/masiqi/wechat.v2/oauth2"
)
var _ oauth2.Endpoint = (*Endpoint)(nil)
// Endpoint 实现了 github.com/masiqi/wechat.v2/oauth2.Endpoint 接口.
type Endpoint struct {
AppId string
AppSecret string
}
func NewEndpoint(AppId, AppSecret string) *Endpoint {
return &Endpoint{
... |
bfc5cd8d2858c393be71b44ccc5a2f67918e052f | 2628ffa373dede6559140e12eca188c89670e879 | asieira/trivy | /pkg/rpc/convert.go | Go | go | 8,480 | permissive | package rpc
import (
"github.com/golang/protobuf/ptypes"
"github.com/opencontainers/go-digest"
ftypes "github.com/aquasecurity/fanal/types"
deptypes "github.com/aquasecurity/go-dep-parser/pkg/types"
dbTypes "github.com/aquasecurity/trivy-db/pkg/types"
"github.com/aquasecurity/trivy/pkg/log"
"github.com/aquasec... |
378ffca979c0375c9aea972da6b2b0b003fdc844 | f15db98d4bd10984ddaca8825f4f0ab196f8c64d | cairewen/gohome | /redis/redis.go | Go | go | 771 | no_license | package redis
import (
"github.com/go-redis/redis"
"time"
"log"
"gohome/config"
)
var client *redis.Client
func init() {
host := config.GetYamlValue("redis.host")
client = redis.NewClient(&redis.Options{
Addr: host,
Password: "",
DB: 0,
})
}
func Ping() {
}
/**
put key value into redis for... |
46dbde272cf26bb86b8059cbd3eac9014294575d | 5050dda79d6b157ef79134777ff91de047787da4 | openshift/installer | /terraform/providers/azurerm/vendor/github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse/network_watcher.go | Go | go | 1,785 | permissive | package parse
// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten
import (
"fmt"
"strings"
"github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids"
)
type NetworkWatcherId struct {
SubscriptionId string
ResourceGroup string
Name string
}
func NewNetwor... |
114dac93cf96e803b4ca7fcf253b38dff37e030e | d2598f15c985cb2c570cd896966bbb0005cbc7cb | cool8sniper/gin-rest-gorm-rbac-sample | /middleware/authorized.go | Go | go | 311 | permissive | package middleware
import (
"net/http"
"github.com/gin-gonic/gin"
)
// Authorized blocks unauthorized requestrs
func Authorized(c *gin.Context) {
_, exists := c.Get("user")
if !exists {
c.JSON(http.StatusUnauthorized, gin.H{"status": http.StatusUnauthorized, "message": "must login"})
c.Abort()
}
}
|
e268f65a4c3b979431f31725b091e98146f26e9e | 201213716756d3520b3209c30b567b44647ecf07 | keer123456789/p2p | /tools/broadcast/main.go | Go | go | 4,699 | permissive | package main
import (
"bytes"
"crypto/sha256"
"encoding/binary"
"flag"
"fmt"
"github.com/DSiSc/blockchain"
"github.com/DSiSc/blockchain/config"
"github.com/DSiSc/craft/types"
"github.com/DSiSc/p2p"
"github.com/DSiSc/p2p/common"
p2pconf "github.com/DSiSc/p2p/config"
"github.com/DSiSc/p2p/message"
"github.c... |
150392943962d04a707c5e1bb7db0f546856e2f4 | d7c8317d686f04144f40fb323cbc6980b5a6400e | dimdark/learning-go-demos | /demo004/integer.go | Go | go | 945 | no_license | package main
import (
"fmt"
"math"
"reflect"
)
func main() {
var a int32 = 5
var b rune
b = a
fmt.Println(b)
var c uint8 = 3
var d byte
d = c
fmt.Println(d)
// 0000 0101
var e uint8 = 5
// 0000 1001
var f uint8 = 9
// 0000 0101
// 对比f
// 0000 0100
// 即是 4
fmt.Println(e &^ f)
g := 1e100
h := i... |
3ea03ce27fff7452fa76b8a2180607f1e4a34430 | d977d4b618a5eb07046ec5b44496902d5e63bb8c | microsoftgraph/msgraph-sdk-go | /models/deleted_team_collection_response.go | Go | go | 3,581 | permissive | package models
import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// DeletedTeamCollectionResponse
type DeletedTeamCollectionResponse struct {
BaseCollectionPaginationCountResponse
}
// NewDeletedTeamCollectionResponse insta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.