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 |
|---|---|---|---|---|---|---|---|---|
8b4bc3b394845e2917b6dfe2b1865f95d2890829 | 1d4d803f46954f249355585bd8ada2a28335c3be | HyunminKo/go-concurrency-pratice | /02/pipeline/image-processing/main.go | Go | go | 2,789 | no_license | package main
import (
"fmt"
"image"
"log"
"net/http"
"os"
"path/filepath"
"sync"
"time"
"github.com/disintegration/imaging"
)
type result struct {
srcImagePath string
thumbnailImage *image.NRGBA
err error
}
func main() {
if len(os.Args) < 2 {
log.Fatal("need to send directory path of ima... |
fba2bbbbdae693b32ea0228f2eca988e262fab26 | 6b45ef94b1f08e0c304666a5134b89069a25f0c6 | reezer/cds | /engine/api/warning.go | Go | go | 1,656 | permissive | package api
import (
"context"
"net/http"
"github.com/gorilla/mux"
"github.com/ovh/cds/engine/api/event"
"github.com/ovh/cds/engine/api/warning"
"github.com/ovh/cds/engine/service"
"github.com/ovh/cds/sdk"
)
func (api *API) getWarningsHandler() service.Handler {
return func(ctx context.Context, w http.Respo... |
9a67770d4c6b14cd00584dee9e16af081ea1cb90 | f1bb841c3d1f1e7a3c0017ff6058e277c538535d | leerspace/ipfs-ds-convert | /revert/log.go | Go | go | 1,794 | permissive | package revert
import (
"encoding/json"
"fmt"
"os"
"path"
)
const (
ConvertLog = "convertlog"
ActionRemove = Action("rm")
ActionMove = Action("mv")
ActionMkdir = Action("mkdir")
ActionDone = Action("done")
//For breaking things that can't be easily recovered from, say writing new spec
ActionManual =... |
4faa96283582098b4f861014a7e52cdcb29d60ed | f5c349bfc0eaafc532366f9cd684cfce77c1f8c3 | EricLau1/go-delivery | /services/wallets/service/service.go | Go | go | 3,003 | no_license | package service
import (
"context"
"fmt"
"go-delivery/pb"
"go-delivery/services/wallets/store"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"time"
)
type serviceImpl struct {
walletsStore store.WalletsStore
pb.UnimplementedWalletsServiceServer
}
func NewService(walletsSto... |
09a94d21de4e341bd399f0558bdcae034e6b5452 | 2ddf13ee49628b73e8390dcd518e0e9ebed108bf | mvitorino/go-tigertonic | /server.go | Go | go | 4,749 | permissive | // +build !appengine
package tigertonic
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net"
"net/http"
"sync"
"time"
)
// Server is an http.Server with better defaults and built-in graceful stop.
type Server struct {
http.Server
ch chan<- struct{}
conns map[string]net.Conn
listeners []net.Lis... |
c8f5fdbfa71b1211ee08f79a2e0f4ba8fb4f0f15 | 6ececfadfad60d5a3307cae2b625f74a7a2558a9 | ekmixon/pulsedive-go | /feeds.go | Go | go | 805 | permissive | package pulsedive
import (
"net/url"
"strconv"
)
// FeedID implement api Feeds By Feed ID
func FeedID(id int) ([]byte, error) {
q := url.Values{}
q.Add("fid", strconv.Itoa(id))
q.Add("pretty", pretty)
q.Add("key", apiKey)
return Get(q.Encode(), "/info.php")
}
// FeedName implement api Feeds By Feed Name and O... |
1482f2046456eaaef02781a51e7a1cb95259c656 | e5c1ca741efa5e644e183e4f9b3490dc1b2db010 | williamsunctp/kubestat | /pkg/metrics.go | Go | go | 709 | permissive | package pkg
import (
"k8s.io/apimachinery/pkg/api/resource"
v1beta1 "k8s.io/metrics/pkg/apis/metrics/v1beta1"
)
var m = new(resource.Quantity)
// ProcessServiceWiseMetrics ...
func processServiceWiseMetrics(pml *v1beta1.PodMetricsList) *Metric {
cpu := new(resource.Quantity)
mem := new(resource.Quantity)
total... |
3572a6a1b11de6c316b346840f95ea8bdd307a37 | ca0f4f0ce836890272af732e00f127d99425318b | asifsadek/AWE | /lib/core/cwl/workflowOutputParameter.go | Go | go | 4,762 | permissive | package cwl
import (
"fmt"
"reflect"
"github.com/davecgh/go-spew/spew"
"github.com/mitchellh/mapstructure"
)
type WorkflowOutputParameter struct {
OutputParameter `yaml:",inline" json:",inline" bson:",inline" mapstructure:",squash"`
Doc string `yaml:"doc,omitempty" bson:"doc,omitempty" json:"doc,omitempty"`
... |
f843e4d75e6a46d0f70922979a8286eb758a9122 | 6d4206bd93bb821b7ce7166c46aecde0c44146cf | Ryo-not-rio/grapi | /cmd/grapi-gen-command/main_test.go | Go | go | 2,192 | permissive | package main
import (
"testing"
"github.com/Ryo-not-rio/grapi/pkg/cli"
"github.com/Ryo-not-rio/grapi/pkg/gencmd"
gencmdtesting "github.com/Ryo-not-rio/grapi/pkg/gencmd/testing"
"github.com/Ryo-not-rio/grapi/pkg/grapicmd"
"github.com/bradleyjkemp/cupaloy/v2"
"github.com/izumin5210/clig/pkg/clib"
"github.com/sp... |
352e1a643412befc2a898652e5d6c157343aa281 | 7458449cf46434eae05223b9eb300b2cdea43ed5 | vtumuluri/cockroach | /pkg/kv/kvserver/store_remove_replica.go | Go | go | 10,529 | permissive | // Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, ... |
ab82eb4ff75a64917a651b23e4c7e35e11c8a5a2 | 135da74fca80fffd78a32b8c657d3eb0c8e94820 | zhangzerui20/zookeeper-operator | /agent/api/base.go | Go | go | 643 | permissive | package api
import (
"encoding/json"
"net/http"
)
func handleInternalServerError(w http.ResponseWriter) {
http.Error(w, http.StatusText(http.StatusInternalServerError),
http.StatusInternalServerError)
}
func handleUnauthorized(w http.ResponseWriter) {
http.Error(w, http.StatusText(http.StatusUnauthorized),
h... |
4a59e539c3e38c4f307351390244a34e7ab36adf | 80ad41db8f89cd4de27be21594c45df446a8b3ce | airbnb/istio | /cni/pkg/repair/repair_test_helpers.go | Go | go | 4,782 | 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... |
cae327dce2a6909f87a09a9d769128262ce12be2 | 10e2f9e4280753814d03fdf72734fb7aa6e67efd | ioana-plutoflume/muxy | /symptom/network_shape_test.go | Go | go | 6,359 | permissive | package symptom
import (
"log"
"testing"
"strings"
"github.com/mefellows/muxy/muxy"
"github.com/tylertreat/comcast/throttler"
)
func TestNetworkShapeSymptom_Setup(t *testing.T) {
s := NetworkShaperSymptom{}
oldThrottler := executeThrottler
executeThrottler = func(c *throttler.Config) {
t.Log("Calling fake... |
f7645c3fd2201e08059fa4fc7f742676de1ea712 | fe430e85b7d900c57f05e960bb3f7431d03e74a1 | grafov/dvb | /linuxdvb/demux/syscall_linux.go | Go | go | 398 | permissive | package demux
const (
_DMX_START = 0x6f29
_DMX_STOP = 0x6f2a
_DMX_SET_BUFFER_SIZE = 0x6f2d
_DMX_SET_FILTER = 0x403c6f2b
_DMX_SET_PES_FILTER = 0x40146f2c
_DMX_GET_PES_PIDS = 0x800a6f2f
_DMX_GET_CAPS = 0x80086f30
_DMX_SET_SOURCE = 0x40046f31
_DMX_GET_STC = 0xc01... |
3c47e1301bc49a6951fa6d0c03b441fda5161271 | 8792cc3e761109e40fc25f49989f9b21c21cdbb3 | smoran98/Problems-GO | /6GuessingGame.go | Go | go | 262 | permissive | package main
import (
"fmt"
"time"
)
func main() {
s := 0
for {
if s >= 6 { break }
fmt.Println("s is:", s)
s++
time.Sleep(1000 * time.Millisecond)
}
fmt.Println("Break happened and 6ixth number guessed")
} |
74aeaae996237c8e9680453f87e0813524d13e34 | e760c2c5edb67a47f729991909316f5878bd05e0 | jbelke/gloo | /test/kube2e/gateway/robustness_test.go | Go | go | 11,806 | permissive | package gateway_test
import (
"fmt"
"sort"
"time"
"github.com/solo-io/gloo/projects/gateway/pkg/defaults"
"github.com/solo-io/gloo/projects/gloo/pkg/api/v1/core/matchers"
skerrors "github.com/solo-io/solo-kit/pkg/errors"
"github.com/solo-io/gloo/projects/gateway/pkg/services/k8sadmisssion"
"github.com/solo-... |
689ae6e6f1ad15d38dea5457cddf100a6f5632b9 | 2861e1fff53815a13c549d86a7acb3ca1d99e2e2 | gechchain/go-gech | /trie/iterator.go | Go | go | 16,166 | no_license | // Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License... |
c668da73fe86b535cd54237b0e7e726b3755e993 | db51ab8fd51e3e0a84d404b1ad2a0694ab5118be | chrisriley/benthos | /lib/processor/archive.go | Go | go | 6,800 | permissive | // Copyright (c) 2018 Ashley Jeffs
//
// 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 use, copy, modify, merge, publish, ... |
14d94293d4585bdc2aba539e1d7b69165ac230a3 | d5dea14e8c054caa2790deb94c1421968a247b6a | stjordanis/maltego-gen | /config.go | Go | go | 1,278 | permissive | /*
* MALTEGO-GEN - Commandline tool to generate Maltego configurations.
* Copyright (c) 2021 Philipp Mieden <dreadl0ck [at] protonmail [dot] ch>
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FIT... |
d92c84c270d56211f15b5ca98b9d9340cff703ea | 4dc71dd87c904608b90e18adf7cbb7c9a5ec5109 | black-adder/m3 | /src/query/parser/promql/parse.go | Go | go | 5,735 | permissive | // Copyright (c) 2018 Uber Technologies, Inc.
//
// 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 use, copy, modify, merge... |
e2c6101bedc8a8d3ee9c75409f0d36c554155946 | 74471a965aed9e81b7bcfda0ea50803679562426 | PJCAfonso/okteto | /pkg/model/translation_test.go | Go | go | 4,725 | permissive | // Copyright 2020 The Okteto 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 ... |
6b951e1f835aaa48899ed7a0f016482cf3c1f9ab | af7fc905dd87fc0f8b85a3cdd5b61babd0e9fa93 | sandeepky/omnidoc | /services/assets/get/main.go | Go | go | 3,091 | permissive | package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"omnidoc/db"
"omnidoc/lib"
"omnidoc/models"
"omnidoc/types"
"strconv"
"time"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/jinzhu/gorm"
)
var db2 *gorm.DB
func handler(request events.APIGatewayProxyRe... |
6826f5e54085eac8b85556036366fb3dffef9ffb | f31a7fa332071241df2e2185cfa15fb2bb29aec1 | johnsto/go-passwordless | /example/utils.go | Go | go | 2,395 | permissive | package main
import (
"log"
"net/http"
"net/url"
"github.com/gorilla/sessions"
)
// Context holds data pertaining to the base page template.
type Context struct {
SignedIn bool
UserID string
UserName string
Flashes []interface{}
}
// Error represents an error that is displayed to the user.
type Error str... |
bd22633189fdc5212ea0fd0179ac30e29f25d6d2 | 07a234d9c06bfb975acbecde7b91c808739ac5f0 | sokoide/loki | /pkg/ruler/appender.go | Go | go | 5,134 | permissive | package ruler
import (
"context"
"errors"
"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/prometheus/prometheus/pkg/exemplar"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus... |
d97c27b408208abab6fb8adb1b83e81fbdd5c68f | 800c77fcf19b089ec31fed48a045345f903b5839 | dxspl/fly3d | /windows/event.go | Go | go | 762 | no_license | package windows
import (
"github.com/suiqirui1987/fly3d/tools/goevent"
)
const (
Resize = "resize"
Keydown = "keydown"
Keyup = "keyup"
MouseDown = "mousedown"
MouseUp = "mouseup"
MouseMove = "mousemove"
MouseOut = "mouseout"
Wheel = "whe... |
cdfa92e134eb59f224ed9d23b4db3a7f66a431c5 | 3b65f82731ad27b2a1161c779f57001bf4f2d8a2 | Pandinosaurus/lazydocker | /pkg/config/app_config.go | Go | go | 21,139 | permissive | // Package config handles all the user-configuration. The fields here are
// all in PascalCase but in your actual config.yml they'll be in camelCase.
// You can view the default config with `lazydocker --config`.
// You can open your config file by going to the status panel (using left-arrow)
// and pressing 'o'.
// Yo... |
bc67d30acd2bba66b4a35e997f5d672347a6770f | bc050aa5b127e76327a2f4ba0e64b81c93a20d56 | havetisyan/athenz | /libs/go/zmscli/import.go | Go | go | 5,431 | permissive | // Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache version 2.0 license. See LICENSE file for terms.
package zmscli
import (
"fmt"
"os"
"strconv"
"strings"
"../../../clients/go/zms"
)
func (cli Zms) importRoles(dn string, lstRoles []interface{}, validatedAdmins []string, skipErrors bool) err... |
7ecc50642ed06770e5cc11ee39e2c4b840091b2a | 2c33ac7133a9f76cb4f39a73e40d2823d5786f6a | Lameorc/aoc_2020 | /main.go | Go | go | 1,859 | no_license | package main
import (
"fmt"
"io/ioutil"
"log"
"strings"
"github.com/lameorc/aoc_2020/day14"
)
func readInput(day string) []string {
filePath := fmt.Sprintf("./%s/input.txt", day)
// Should fit in memory easily
data, err := ioutil.ReadFile(filePath)
if err != nil {
log.Fatal(err)
}
retu... |
cf4a2766376f7ad71d380da1df6ce9efd08b71f3 | 4cdfb12b3217ef6b87ba5b78f34b50c8048c6795 | johnbirdau/pulumi-azure-native | /sdk/go/azure/eventgrid/v20190201preview/pulumiEnums.go | Go | go | 7,720 | 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 v20190201preview
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The operator type used for filtering, e.g., NumberIn, S... |
61ef452f45459cba080c9984161053063b72e60c | 9e62e087d64947809b2f92b6cc323f0358df17e7 | infernalslam/golang-class | /pointer-and-error/wallet_test.go | Go | go | 1,347 | no_license | package main
import (
"testing"
)
func assertBalance(t *testing.T, wallet Wallet, want Bitcoin) {
t.Helper()
got := wallet.Balance()
if got != want {
t.Errorf("got %s want %s", got, want)
}
}
func assertError(t *testing.T, got error, want string) {
t.Helper()
if got == nil {
t.Fatal("didn't gott an error ... |
937f06e62332ef1cee7c978e37ff529e07bc4e78 | aeb78c03920f09bbfe7f35f40352a9412a2132c5 | sunweiye12/go-BasicLearning | /2_数据类型/2_复合数据类型/6_结构体类型/2_组合结构.go | Go | go | 1,523 | no_license | package main
import "fmt"
/*
通过组合结构实现代码的复用
---> 当嵌入结构中的子字段和外部结构中的字段有重复的时候的处理逻辑
默认情况下外层的字段会覆盖内层的字段,如果想得到内层的字段a.B.Name
*/
func main2() {
// 创建一个学生类
a := student{
human: human{0}, // 通过这种方式来声明切入结构的字段
Name: "学生",
Age: 18,
}
//创建一个老师类
b := teacher{
human: human{1}, // 作为嵌入结构,其内部的字段已经在外部可以直接调用--> 也可以直接... |
fe788bc00d478eaab8a64ff991365a24e6a07231 | f528a746e9cfa35c14b637ff4691e77f154489b3 | zzy404/LeetCode-Go | /leetcode/0093.Restore-IP-Addresses/93. Restore IP Addresses_test.go | Go | go | 824 | permissive | package leetcode
import (
"fmt"
"testing"
)
type question93 struct {
para93
ans93
}
// para 是参数
// one 代表第一个参数
type para93 struct {
s string
}
// ans 是答案
// one 代表第一个答案
type ans93 struct {
one []string
}
func Test_Problem93(t *testing.T) {
qs := []question93{
question93{
para93{"25525511135"},
ans... |
b4e339f0c912424c743b7a241e1f051c13770de1 | 7abee136dfbab2e48b4c23a3d5b3c6d07db2f77a | FabriceS69/golang-study-lt | /ch09/ex01/main.go | Go | go | 901 | no_license | package main
var deposits chan int // 入金額を送信
var withdraws chan int // 出金額を送信
var withdrawResult chan bool // 出金結果
var balances chan int // 残高を受信
func Withdraw(amount int) bool {
withdraws <- amount
return <-withdrawResult
}
func Deposit(amount int) {
deposits <- amount
}
func Balance() int {... |
6443b6637143da1e939d549849fecbc527ae2572 | b74327f39bfcf1f80d8b4107a9cd1c5bf347631e | leonklinke/cleanAPI | /usecases/user_interactor.go | Go | go | 240 | no_license | package usecases
import (
"cleanApi/domain"
)
type UserInteractor struct {
UserRepository UserRepository
}
func (interactor *UserInteractor) Show(userId int) (*domain.User, error) {
return interactor.UserRepository.FindById(userId)
}
|
9a53955941a28c957ff5e5e039cbb1bb04c0d82d | a395096ac9ce0c4e0964e7c726d4d7ad814f61c7 | lionheart1022/koding | /go/src/koding/kites/kloud/queue/queue.go | Go | go | 6,080 | permissive | package queue
import (
"context"
"fmt"
"time"
"koding/db/models"
"koding/db/mongodb"
"koding/db/mongodb/modelhelper"
"koding/kites/kloud/contexthelper/request"
"koding/kites/kloud/klient"
"koding/kites/kloud/machinestate"
"koding/kites/kloud/stack/provider"
"koding/kites/kloud/utils/object"
"github.com/k... |
ad4b12361c274f0114d33f4872656f3a275ca92c | 46753a567c8212dcaaa201d43cf2e6ba23e5c6ee | prestonTao/mandela | /rpc/store/store_folder_rpc.go | Go | go | 2,385 | permissive | package store
import (
"mandela/rpc/model"
"mandela/store"
"net/http"
)
/*
增加本地文件夹
*/
func AddFolder(rj *model.RpcJson, w http.ResponseWriter, r *http.Request) (res []byte, err error) {
name, ok := rj.Get("name") //文件夹名称
if !ok {
res, err = model.Errcode(5002, "name")
return
}
fname := name.(string)
var ... |
d44f29548b4686396131873fc55111ae16d3bd12 | ce10876f499aea5baaaf528b0ec0b2bb63f5add6 | backwardn/go-libtor | /libtor/openssl_crypto_dsa_dsa_ameth.go | Go | go | 272 | permissive | // go-libtor - Self-contained Tor from Go
// Copyright (c) 2018 Péter Szilágyi. All rights reserved.
package libtor
/*
#define DSO_NONE
#define OPENSSLDIR "/usr/local/ssl"
#define ENGINESDIR "/usr/local/lib/engines"
#include <../crypto/dsa/dsa_ameth.c>
*/
import "C"
|
d31f958d8875835ed4da3297a66802f9a8c19142 | 844188d4664ab0c3ec5cf6a65a26a6b28b28bcae | Linuxstyle/kafka | /KafkaLog/src/KafkaLag/main/main.go | Go | go | 629 | no_license | package main
import (
"KafkaLog/src/KafkaLag/GetCluster"
"KafkaLog/src/KafkaLag/GetConsumers"
getlag "KafkaLog/src/KafkaLag/GetLag"
"fmt"
)
const (
url string = "xxxxx:8000/v3/kafka/"
)
func main() {
c, err := kafkaclusters.GetCluster(url)
if err != nil {
fmt.Println("get kafka cluster faild:", err)
}
clu... |
561d4731a6f25b958a7bee17c574521b3245c75b | c913b478fb2d637c543367673c225c20ba4c87de | slaash/scripts | /go/src/filez.go | Go | go | 619 | no_license | package main
import "fmt"
import "os"
import "bufio"
import "io"
func checkErr(err error){
if err!=nil{
fmt.Println(err)
}
}
func main() {
fo, err:=os.Create("/tmp/out111.txt")
checkErr(err)
w:=bufio.NewWriter(fo)
w.WriteString("Hello!")
w.Flush()
fo.Close()
fi, err:=os.Open("/tmp/out111.txt")
checkErr(... |
025f9226e6583cf9a80ff82241d21239beb2a3d7 | 6e8fb421aafa1ee7b7d1b3d7e8ea24bfb7c54821 | sjqzhang/provision | /api/client.go | Go | go | 22,258 | permissive | // Package api implements a client API for working with
// digitalrebar/provision.
package api
import (
"bytes"
"crypto/tls"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"log"
"mime"
"net"
"net/http"
"net/url"
"path"
"strings"
"time"
"github.com/VictorLowther/jsonpatch2"
"github.com/digitalrebar/logg... |
4c5c1855f9a771e20ab28867514463f4e17c6ecf | 1d1dfcbe280703addd01b0fb8ae0ef240fd726fd | localhots/influxdb_buffer | /buffer.go | Go | go | 3,584 | no_license | package buffer
import (
"regexp"
influxdb "github.com/influxdb/influxdb/client"
)
type (
Buffer struct {
fn func(series []*influxdb.Series)
in chan *influxdb.Series
series map[string]*influxdb.Series
size int
capacity int
}
)
// `New` is an alias for a `NewBuffer` function
func New(c... |
98099c1dddd80b10b049bc7be30b496a98a9a833 | 634b84245c410edd7f39013477ab2cf005cb550c | sters/colorune | /colorune_test.go | Go | go | 774 | permissive | package colorune
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestFormatANSIString(t *testing.T) {
tests := []struct {
c Colorunes
want string
}{
{NewString("", nil, nil), ""},
{
NewString("No Color Hello World", nil, nil),
"No Color Hello World",
},
{
NewString(
"Hel... |
57f6e94f66ef5d182479c9f08ff7fcaeb05f6f71 | 718741781b04f8655adcf5b0e0dcb2b8ec4a3c2c | VojtechVitek/heroes | /pkg/h3m/town.go | Go | go | 721 | no_license | package h3m
import "fmt"
type Town int
const (
Castle Town = 0
Rampart Town = 1
Tower Town = 2
Inferno Town = 3
Necropolis Town = 4
Dungeon Town = 5
Stronghold Town = 6
Fortress Town = 7
Conflux Town = 8
Random Town = 0xFF
)
func (t Town) String() string {
switch t {
case Cast... |
049b9e24c454438292988cde23e29ce1d43913b5 | 6d589ea5ca48e02eb00751a101f7617b9c921a70 | gitql/vitess | /go/vt/vitessdriver/rows.go | Go | go | 1,326 | permissive | // Copyright 2015, Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package vitessdriver
import (
"database/sql/driver"
"io"
"github.com/gitql/vitess/go/sqltypes"
)
// rows creates a database/sql/driver compliant Row iterator... |
4eea0543fbff4e9415a80f4da41137049fffefd7 | 744943edc6a2da92163499a586f3a9cfdc600f27 | sgtest/monorepo-test-3 | /kubernetes-5/pkg/kubectl/cmd/create_role.go | Go | go | 7,929 | permissive | /*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
a4c4c93b57d6539e514eff20a845dcf4e289f96b | 7fcbe9654a633f45c8a7417ba67827536aa84c19 | qlik-oss/kustomize | /plugin/someteam.example.com/v1/calvinduplicator/CalvinDuplicator.go | Go | go | 1,131 | permissive | // Copyright 2021 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"sigs.k8s.io/kustomize/api/resmap"
"sigs.k8s.io/yaml"
)
// A silly plugin that duplicates resources with a given name.
// It looks for resources named $Name, and duplicates them N times,
// creating resou... |
22e743757bf68101c3f85292b62990ec3046bb5e | a49cac056d73010250a240c642a9f664d68b01ff | Dreamgoing/leetcode-solution | /036-valid-sudoku/valid-sudoku.go | Go | go | 437 | no_license |
func isValidSudoku(board [][]byte) bool {
rowVis,colVis,subVis := [9][9]bool{},[9][9]bool{},[9][9]bool{}
for i:= range board{
for j:= range board[i]{
if board[i][j]=='.' {
continue
}
num:= board[i][j]-'0'-1
subPos:= 3*(i/3)+j/3
if rowVis[i][num] || colVis[j][num] || subVis[subPos][num] {
ret... |
a1f9b7c999f8a4dcc859770a9360036bc63dacc4 | 7b87e93db42e8150844b834f155950f2f4014952 | acohn/ocspchecker | /main.go | Go | go | 7,473 | no_license | // Check OCSP revocation status.
// 1. Get stapled response from tls conn.OCSPResponse()
// and check using ocsp.ParseResponse()
// 2. If there is no stapled response, check manually:
// a. Get issuer and server x509 certs
// b. Get OCSP url from the server's x509 Certificate.OCSPServer
// c. Use oc... |
bf5a7b53ff334d15e34e1804154177859be5f92c | d32687e9e59d1c9e4861db3fab34cc2130889846 | mbarbon/carbonapi | /app/carbonapi/zipper.go | Go | go | 2,100 | permissive | package carbonapi
import (
"context"
"errors"
"fmt"
"github.com/bookingcom/carbonapi/cfg"
"github.com/bookingcom/carbonapi/expr/types"
realZipper "github.com/bookingcom/carbonapi/zipper"
pb "github.com/go-graphite/protocol/carbonapi_v2_pb"
"go.uber.org/zap"
)
var errNoMetrics = errors.New("no metrics")
typ... |
d73a75103e830512602dc6bc0f1f564eca3456dc | be720a6a530a6a7124e22a17af13d4c30db739b5 | tonistiigi/buildkit | /vendor/github.com/containerd/containerd/task.go | Go | go | 9,104 | permissive | package containerd
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"runtime"
"strings"
"syscall"
"github.com/containerd/containerd/api/services/containers/v1"
eventsapi "github.com/containerd/containerd/api/services/events/v1"
"github.com/containerd/containerd/api/services/tasks/v1"
"github.com/cont... |
249d8cdf2562454e8d63b9b77aae852a75504e34 | 85306c5a7cb61609ad1f20384047579d705a8c27 | pongsanti/langcontent | /route/post_mcontent.go | Go | go | 1,627 | no_license | package route
import (
"database/sql"
"log"
"net/http"
"github.com/volatiletech/null"
"github.com/volatiletech/sqlboiler/boil"
"github.com/go-chi/render"
"github.com/pongsanti/langcontent/db/models"
)
// POST /mcontents
// Put comment just for v4
func CreatePostMcontentHandlerFunc(db *sql.DB) func(http.Respo... |
9e3d51c013ba4d6a1a0f1ebda7ac15f8954eff0f | a7d5852c7369418831a227150af3223948a977c3 | reiver/go-evmasm | /notnumeral.go | Go | go | 312 | permissive | package evmasm
import (
"fmt"
)
type NotNumeral interface {
error
NotNumeral()
}
type internalNotNumeral struct {
value string
}
func (receiver internalNotNumeral) Error() string {
return fmt.Sprintf("%q is not a numeral", receiver.value)
}
func (internalNotNumeral) NotNumeral() {
// Nothing here.
}
|
01595d38940249490bc4a52f6d323717e6498418 | 62aa25bec8f13198f3df69b8f5717caef8f6b065 | Vanuan/infrakit | /pkg/run/depends/runnable_test.go | Go | go | 6,296 | permissive | package depends
import (
"testing"
"github.com/docker/infrakit/pkg/plugin"
"github.com/docker/infrakit/pkg/types"
"github.com/stretchr/testify/require"
)
func mustSpec(s types.Spec, err error) types.Spec {
if err != nil {
panic(err)
}
return s
}
func mustSpecs(s []types.Spec, err error) []types.Spec {
if ... |
c3c27b61f268196ad3ed00962c13dc24ab59adf1 | 400f43757d6af8d65b6f289b7d4ef213f6f95099 | krittawatcode/go_relearn | /src/section_13_channels/121_concept_of_channel/concept.go | Go | go | 530 | no_license | package main
func main() {
/*
ch := make(chan <type>)
ex. ch := make(chan int)
*/
/*
channel is a 'reference type' !!
it's mean channel will point to same ref even when we pass channal to other method by value
- when we receive value back (send value to ch in method)
value will send to ref channal b... |
b04e4d0c10eb7fdfe1cc99420407a00cdb509bf8 | 7f16f89e2462c71b24d12268cf8c03157e7af1ba | ifree-ufree/healthcare | /deploy/importer/tfimport/tfimport_test.go | Go | go | 4,673 | 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 w... |
cd4ac767683e0d0dccd57a54dcd5b23c09410d27 | 2771af1485ed9abd160e714400423a81caaae50a | sgtest/monorepo-test-3 | /kubernetes-15/pkg/kubelet/pod/pod_manager.go | Go | go | 10,622 | permissive | /*
Copyright 2015 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, ... |
951f4fa4d9ef7a4139c93ce23163507f08d2ab9a | 169a694cc5250598d7f6ab44f9b1d3d0bc083fda | sattlerio/hermes_shipping_service | /models/ShippingRule.go | Go | go | 537 | no_license | package models
import "github.com/jinzhu/gorm"
type ShippingRule struct {
gorm.Model
Name *string `gorm:"size:255;not null" json:"name"`
ShippingRuleId string `gorm:"size:255 null;unique" json:"shipping_rule_id"`
CompanyId string `gorm:"size:255;not null;" json:"company_id"`
DefaultPric... |
92f1be70ff98bc458862dac98aa3135f223c5f34 | a4bfb13bf5e4e828ba8e2f3f038a5af5f5254fd5 | roidelapluie/exposure-notifications-server | /pkg/cache/cache_test.go | Go | go | 5,137 | 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 ... |
fe9ac61cd56d2b0c8574fb971c2cfd1306e4aefa | affb5e9c92f83af46be2e4b4fe3fd7dc759f0d89 | kidf1/dandelion | /app/service/TimeTaskService.go | Go | go | 3,948 | permissive | package service
import (
"dandelion/app/play"
"dandelion/app/service/dao"
"strconv"
"time"
)
type TimeTaskService struct {
dao.BaseDao
Transfers TransfersService
Wx WxService
Orders OrdersService
}
func init() {
//TimeTaskService := TimeTaskService{}
//go TimeTaskService.QueryTask()
}
func (self ... |
cae5f38ff8d5be56f0a608e18279848def861f92 | 12cca39f12402a9e8638e732854430e155b4d3d1 | Ameya-20/GolangGame | /TicTacToeGame/tictactoe/components/cell_test.go | Go | go | 1,003 | no_license | package components
import (
"errors"
"testing"
)
func TestNewCell(t *testing.T) {
test := NewCell()
expected := NoMark
if test.Mark != expected {
t.Error(test.Mark, expected)
}
}
func TestSetMark(t *testing.T) {
tests := []struct {
input1 *Cell
input2 string
expected error
}{
{&Cell{Mark: NoMar... |
18867c8640e17bd02e78b0f3f8b997c3bcf26f01 | dc985e58de6373ab8774f5afee2026a63e7349b5 | h4ck3rm1k3/gocore | /src/github.com/h4ck3rm1k3/gocore/net/http/transfer_test.go | Go | go | 1,603 | permissive | // Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package http
import (
"github.com/h4ck3rm1k3/gocore/bufio"
"github.com/h4ck3rm1k3/gocore/io"
"github.com/h4ck3rm1k3/gocore/strings"
"testing"
)
func TestB... |
9b2d2515c2c60034f1839a7215e6231322b8a1b6 | f4db34b44a0ffa8379cfe69dfc5a2657ba562f22 | vinci-project/goPVMRest | /helpers/tranStructures.go | Go | go | 3,390 | permissive | package helpers
const StatusOk = 200 // OK
const (
StatusNotEnoughFunds = 600 + iota // NOT ENOUTH FUNDS
StatusNotEnoughFundsForCommission // 601 NOT ENOUGH FUNDS FOR COMMISSION
StatusTranNotFound // 602 TRANSACTION NOT FOUND
StatusInternalServerError ... |
b7d06223b3039b03d9c22b0dd800747c6aff9f7e | d5aba9786d81f1ba2899c24ae92fc7448c425550 | yddeng/dnet | /examples/module/handler/handler.go | Go | go | 869 | no_license | package handler
import (
"github.com/yddeng/dnet"
"github.com/yddeng/dnet/examples/module/message"
"reflect"
)
/*
事件分发器
每一条协议注册一个处理函数
*/
type handler func(dnet.Session, *message.Message)
type Handler struct {
handlers map[string]handler
}
func NewHandler() *Handler {
return &Handler{
handlers: map[string]... |
28bd00317fedfc112218c38c210767979126a412 | 96da0e13d03e04ddea0f1aaa3860bbe5f9afa1f2 | marsli9945/laracom | /product-service/db/database.go | Go | go | 476 | no_license | package db
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
"os"
)
func CreateConnection() (*gorm.DB, error) {
// 从系统环境变量获取数据库信息1
host := os.Getenv("DB_HOST")
user := os.Getenv("DB_USER")
DBName := os.Getenv("DB_NAME")
password := os.Getenv("DB_PASSWORD")
return gorm.Open(... |
f891f4f2701ce8339bd8d4c10e424b4be013c3fe | 00613fd0d1c95110bf50417f89fa14c970267794 | nttcom/eclcloud | /ecl/compute/v2/images/urls.go | Go | go | 378 | permissive | package images
import "github.com/nttcom/eclcloud"
func listDetailURL(client *eclcloud.ServiceClient) string {
return client.ServiceURL("images", "detail")
}
func getURL(client *eclcloud.ServiceClient, id string) string {
return client.ServiceURL("images", id)
}
func deleteURL(client *eclcloud.ServiceClient, id s... |
0a5acaecda77581e5cf6d7e864d8c566fe696445 | 24352c1f5417e6a01ba917236617dab4ac2e179b | cwithmichael/blood-pressure-tracker | /server/tests/ds_test.go | Go | go | 1,112 | permissive | package tests
import (
"github.com/cwithmichael/blood-pressure-tracker/ds"
"github.com/cwithmichael/blood-pressure-tracker/handlers"
"net/http"
"net/http/httptest"
"testing"
)
type mockDS struct{}
func (mds *mockDS) AllReadings() ([]*ds.Reading, error) {
readings := make([]*ds.Reading, 0)
readings = append(re... |
0f4320cf4a188f2200eccecb2e8fca144a20eed1 | 82db55d29411b56eba4213a1e3fb6d8c1a5e3961 | kingwel-xie/fabric | /core/ledger/kvledger/txmgmt/statedb/statecouchdb/version_cache_test.go | Go | go | 908 | permissive | /*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package statecouchdb
import (
"testing"
"github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/version"
"github.com/stretchr/testify/assert"
)
func TestVersionCache(t *testing.T) {
verCache := newVersionCache()
ver1 := vers... |
aff5f707f772a1e5a908e4521c7726672c2d2bb2 | 52b0b9b63c3bb766c7ff4021c1e88bdd41bade72 | icewater2020/stack-rpc | /broker/memory/memory_test.go | Go | go | 927 | permissive | package memory
import (
"fmt"
"testing"
"github.com/stack-labs/stack-rpc/broker"
)
func TestMemoryBroker(t *testing.T) {
b := NewBroker()
if err := b.Connect(); err != nil {
t.Fatalf("Unexpected connect error %v", err)
}
topic := "test"
count := 10
fn := func(p broker.Event) error {
return nil
}
s... |
fa3077e6a70c9d587875c03a769657ccc0427e57 | 8721134fcd05196dc71ea470cb1e022fc29881a2 | prest/prest | /cmd/reset.go | Go | go | 1,020 | permissive | package cmd
import (
"context"
"fmt"
"os"
"github.com/gosidekick/migration/v3"
"github.com/spf13/cobra"
)
// resetCmd represents the reset command
var resetCmd = &cobra.Command{
Use: "reset",
Short: "Run down and then up command",
Long: `Run down and then up command`,
PreRunE: checkTable,
RunE: fu... |
ef105152a78e994ffd29dca11676d39ea3ebfd0c | 0bfcbc6def2fef465279bd95a6295b5b000e20e1 | OliverYang/gloo | /projects/gloo/cli/pkg/cmd/options/options.go | Go | go | 6,191 | permissive | package options
import (
"context"
printTypes "github.com/solo-io/gloo/projects/gloo/cli/pkg/printers"
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
)
type Options struct {
Metadata core.Metadata
Top Top
Install Install
Uninstall Uninstall
Proxy Proxy
Upgrade Upgrade
Create Crea... |
643f63c4658d906882d605cf555edf1a25ac6148 | 951ee80035470a37ae1911a8ab298d2985ce1f73 | QingsiLiu/CMDB | /learn/testredis/testqueue/main.go | Go | go | 410 | no_license | package main
import (
"flag"
"fmt"
"magego/course-33/cmdb/learn/testredis/testqueue/consumer"
"magego/course-33/cmdb/learn/testredis/testqueue/producer"
)
func main() {
var isProducer bool
flag.BoolVar(&isProducer, "p", false, "producer")
flag.Parse()
if isProducer {
//生产者
fmt.Println("生产者")
producer.Ru... |
94bcd9df9830793905808cb7206c473332fc7db1 | 50abececb7ac23b65013d5de41fe91d1952216b1 | Najmshosan/autoscaler | /cluster-autoscaler/vendor/github.com/google/cadvisor/machine/info.go | Go | go | 4,748 | permissive | // Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable... |
210f0a5d35c2e88ca203aa933d68bc0f34ee7048 | 320148f8f467595e50ce0104aa66f6d20d353f12 | nimdraks/go-concurrency-limits | /limiter/lifo_blocking.go | Go | go | 6,892 | permissive | package limiter
import (
"context"
"fmt"
"sync"
"time"
"github.com/platinummonkey/go-concurrency-limits/core"
)
type lifoElement struct {
id uint64
ctx context.Context
releaseChan chan core.Listener
next, prev *lifoElement
}
func (e *lifoElement) setListener(listener core.Listener) {
sel... |
fcfd0a1134ba5929817e9e49c7ba2287ac75f325 | 57930a79b6199244be270ec2e523463c9b55705f | mihaimelonari/aws-admission-controller | /pkg/aws/common_handler.go | Go | go | 2,304 | permissive | package aws
import (
"fmt"
"math/rand"
"sort"
"strings"
"time"
"github.com/blang/semver"
releasev1alpha1 "github.com/giantswarm/apiextensions/v3/pkg/apis/release/v1alpha1"
"github.com/giantswarm/k8sclient/v5/pkg/k8sclient"
"github.com/giantswarm/microerror"
"github.com/giantswarm/micrologger"
metav1 "k8s.i... |
2d109237146a97b1b2d06587e1e04781ba04afef | 0c70f721e39d75b53d07a61aa2a4fcb9f3d30eeb | Jviguy/gophertunnel | /minecraft/protocol/writer.go | Go | go | 9,744 | permissive | package protocol
import (
"bytes"
"fmt"
"github.com/go-gl/mathgl/mgl32"
"github.com/google/uuid"
"github.com/sandertv/gophertunnel/minecraft/nbt"
"image/color"
"io"
"reflect"
"sort"
"unsafe"
)
// Writer implements writing methods for data types from Minecraft packets. Each Packet implementation has one
// p... |
89b0297885b2fa631e76c8a0b34c819a4bb1e2c6 | 9d0071084b07bd58dbdeb327b46a30de0eaf3eb4 | mhly520/fabric-chaincode | /activity/put/metadata.go | Go | go | 2,984 | no_license | package put
import (
"strings"
"github.com/open-dovetail/fabric-chaincode/common"
"github.com/project-flogo/core/data/coerce"
)
// Settings of the activity
type Settings struct {
CompositeKeys map[string][]string `md:"compositeKeys"`
KeysOnly bool `md:"keysOnly"`
CreateOnly bool ... |
14ef3d60b68b0002b3957b4a03eb011738ebc83e | 4b12d92f4903d52ff7130dd98f57147b345ed071 | gangtao/chameleon | /handlers/health_test.go | Go | go | 417 | permissive | package handlers_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"strings"
)
var _ = Describe("Test", func() {
Describe("the strings package", func() {
Context("strings.Contains()", func() {
When("the string contains the substring in the middle", func() {
It("returns `true`", func() ... |
ab9a5da0c2da27117e0e96f712851b47777d42ff | 93a5e925319f9e9f9da7693218c55ae7bdfab75b | jalfvort/client | /pkg/errors/factory_test.go | Go | go | 7,484 | permissive | // Copyright © 2019 The Knative 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... |
c2f30f4aa9b68a19db2a4b728200a9c522d71bae | 61df5497a241e778c2572cd402fd371dc11d3ec3 | zhangfei19841004/zdora-go | /zdora/client/zdoracli.go | Go | go | 2,003 | permissive | package client
import (
"fmt"
"github.com/gorilla/websocket"
"log"
"net/http"
"net/url"
"os"
"strconv"
"zdora/client/util"
"zdora/config"
"zdora/constants"
"zdora/model"
zu "zdora/util"
)
func getCli() (*websocket.Conn, error) {
u := url.URL{Scheme: "ws", Host: config.GetConfig().Server.Host + ":" + conf... |
6ea1099abaf43bc6aad5567f4172763d9c907ff5 | ebccff602870b931b3af387ba83e3769593e73d6 | mgatti09/twittor_backend | /jwt/jwt.go | Go | go | 861 | no_license | package jwt
import (
"time"
jwt "github.com/dgrijalva/jwt-go"
"github.com/mgatti09/twittor_backend/models"
)
func GetToken(t models.User) (string, error) {
myPwd := []byte("MiClaveUltraSECRETA")
//Lista de privilegios que se guarda en el payload. Se arma manual porque no se debe guardar la
//password en el JW... |
52ec2dd9d74cab7da7baacdf91b2d14c9faf8de2 | b989854d0a9a4cc91a5db3cef090d037ceacac1f | simonwillcock/xenstats_exporter | /xenstats.go | Go | go | 15,201 | no_license | package main
import (
"fmt"
"log"
"strconv"
"github.com/prometheus/client_golang/prometheus"
xsclient "github.com/xenserver/go-xenserver-client"
)
// Xenstats -
type Xenstats struct {
xend *ApiCaller
xenclient *xsclient.XenAPIClient
}
// NewXenstats -
func NewXenstats(config Config) *Xenstats {
p := ne... |
e57399dc8c7b44ad98974a0862ba89b065035611 | b021cd53c3956c285a8e1eec3f2d486b7a3c2843 | Meihb/go_practice | /src/main/GoroutineInfo.go | Go | go | 6,141 | no_license | package main
import "fmt"
/*
goroutine 是一种非常轻量级的实现,可在单个进程里执行成千上万的并发任务,它是Go语言并发设计的核心。
说到底 goroutine 其实就是线程,但是它比线程更小,十几个 goroutine 可能体现在底层就是五六个线程,
而且Go语言内部也实现了 goroutine 之间的内存共享。
使用 go 关键字就可以创建 goroutine,将 go 声明放到一个需调用的函数之前,在相同地址空间调用运行这个函数,
这样该函数执行时便会作为一个独立的并发线程,这种线程在Go语言中则被称为 goroutine。
*/
func GetThingDone(a, b int... |
64488a4a08e473d9bdd11c66d3ab68b4a9bacbc1 | e55095fd4a2d0e5696e74eea027fc245fb07ac6b | listinvest/automated-garden | /garden-app/vendor/github.com/influxdata/influxdb-client-go/v2/api/http/error.go | Go | go | 903 | permissive | // Copyright 2020-2021 InfluxData, Inc. All rights reserved.
// Use of this source code is governed by MIT
// license that can be found in the LICENSE file.
package http
import (
"fmt"
"strconv"
)
// Error represent error response from InfluxDBServer or http error
type Error struct {
StatusCode int
Code st... |
a1e2d730928957f30fbcfeb286d8ca1cbfde388a | c5114bb73304ac1c7d25794efc095f3c5e8fd61e | yudaprama/iso20022 | /model/CardPaymentTransactionResult3.go | Go | go | 978 | permissive | package model
// Result of the transaction.
type CardPaymentTransactionResult3 struct {
// Type of party that has delivered or declined the card payment authorisation (the party is not identified).
AuthorisationEntity *GenericIdentification90 `xml:"AuthstnNtty,omitempty"`
// Response to an authorisation from the ... |
1cb5381aa36ef5d6c3ccc06bfeb2a65395c844eb | 18a973cd6747b4bb1ea2ccf667125be7cf7c44ff | admpub/sqlboiler | /queries/qmhelper/qmhelper.go | Go | go | 1,784 | permissive | package qmhelper
import (
"fmt"
"reflect"
"github.com/admpub/sqlboiler/queries"
)
// Nullable object
type Nullable interface {
IsZero() bool
}
// WhereQueryMod allows construction of where clauses
type WhereQueryMod struct {
Clause string
Args []interface{}
}
// Apply implements QueryMod.Apply.
func (qm Wh... |
f1b9d6cd26ec5c0ce506745aa1b7388dc65b93cf | f40ac26964fbd900035c835043b38fad4d97994b | baimax1/jfrog-client-go | /artifactory/services/discardBuilds.go | Go | go | 3,892 | permissive | package services
import (
"encoding/json"
"errors"
"github.com/jfrog/jfrog-client-go/artifactory/auth"
rthttpclient "github.com/jfrog/jfrog-client-go/artifactory/httpclient"
"github.com/jfrog/jfrog-client-go/artifactory/services/utils"
clientutils "github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog... |
fc2e4c449558ad260463447b81ca959189174d0d | e03995b94c8d3d3bf86b32d79c43a4583fe6a089 | abs-lang/abs | /object/object_test.go | Go | go | 1,360 | permissive | package object
import "testing"
func TestStringHashKey(t *testing.T) {
hello1 := &String{Value: "Hello World"}
hello2 := &String{Value: "Hello World"}
diff1 := &String{Value: "My name is johnny"}
diff2 := &String{Value: "My name is johnny"}
if hello1.HashKey() != hello2.HashKey() {
t.Errorf("strings with same... |
d9b8781da3d56fc1bbc781ff6ab835b4804ff0ba | 895ed3d0483cbae4800eef49fd8f008f11992680 | niyonghui-master/studying-go | /.history/Day20200609/Example_05/main_20200609172000.go | Go | go | 258 | no_license | package main
type student struct {
Name string
Age int
}
func main() {
m := make(map[string]*student)
stus := []student{
{Name: "A", Age: 24},
{Name: "B", Age: 23},
{Name: "C", Age: 22},
}
for _, stu := range stus {
m[stu.Name] = &stu
}
}
|
fc1fe670f17c8cbb6a8195238e08c764421507e9 | 311bc876113bd248b8c3e30b192ed2d06f90f409 | jangocheng/wopay | /wxpay/pay_config.go | Go | go | 1,916 | permissive | package wxpay
import (
"io/ioutil"
)
type PayConfigImpl struct {
connectTimeoutMs int
readTimeoutMs int
autoReport bool
reportWorkerNum int
reportQueueMaxSize int
reportBatchSize int
payDomain PayDomain
cert []byte
}
type PayConfig interface {
AppID() string
Mch... |
88ca337ac7eeba14278616237e206683c52b01c8 | 565f5d0fc4fc60f6173d35da3852ed0369933714 | mrjuice01/baymax-bot | /whatsappclient/message_handler.go | Go | go | 3,941 | no_license | package whatsappclient
import (
"encoding/json"
"fmt"
"os"
"strings"
whatsapp "github.com/Rhymen/go-whatsapp"
"github.com/Rhymen/go-whatsapp/binary/proto"
)
type messageListener func(Message)
type messageHandler struct {
listener messageListener
afterTime int64
}
func (h *messageHandler) HandleError(err e... |
b3fa5d01f0b0fc02cffa3262a86cc814675ed95e | 4188272f6064b468bc5bb84743e6fe43a0db83ae | fyery-chen/longhorn-manager | /util/util.go | Go | go | 9,266 | permissive | package util
import (
"crypto/md5"
"crypto/sha512"
"encoding/hex"
"fmt"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"os/signal"
"regexp"
"strings"
"syscall"
"time"
"github.com/Sirupsen/logrus"
"github.com/pkg/errors"
"github.com/satori/go.uuid"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resour... |
460ea862c44b68820842444f7d51b94a60e8e9b5 | d86061e74dfde14fb1be7dcdaa50fe999551d61e | prince5460/filestore-server | /mq/producer.go | Go | go | 1,489 | no_license | package mq
import (
"filestore-server/config"
"github.com/streadway/amqp"
"log"
)
var conn *amqp.Connection
var channel *amqp.Channel
// 如果异常关闭,会接收通知
var notifyClose chan *amqp.Error
func init() {
// 是否开启异步转移功能,开启时才初始化rabbitMQ连接
if !config.AsyncTransferEnable {
return
}
if initChannel() {
channel.NotifyC... |
7c8f786cc297b6e3f4c82c5a33c42862fad60b2e | 31d111c6050772f0165483a3ae3c0fb80cd428f8 | cpacia/openbazaar-go | /repo/db/pointers.go | Go | go | 5,008 | permissive | package db
import (
"database/sql"
"github.com/OpenBazaar/openbazaar-go/ipfs"
ma "gx/ipfs/QmSWLfmj5frN9xVLMMN846dMDriy5wN5jeghUm7aTW3DAG/go-multiaddr"
cid "gx/ipfs/QmV5gPoRsjN1Gid3LMdNZTyfCtP2DsvqEbMAmz82RmmiGk/go-cid"
peer "gx/ipfs/QmWUswjn261LSyVxWAEpMVtPdy8zmKBJJfBpG3Qdpa8ZsE/go-libp2p-peer"
ps "gx/ipfs/Qme1g... |
d0ea67beafbe5fbdec832f9791230e1f30ca94d4 | 559f63f47b653cb4cbbaa739e18bd3ca590f5a78 | wqsgi/baudengine | /kernel/index/iterator.go | Go | go | 958 | permissive | package index
import (
"github.com/tiglabs/baudengine/proto/metapb"
"github.com/tiglabs/baudengine/kernel"
"github.com/blevesearch/bleve/index/store"
)
var _ kernel.Iterator = &Iterator{}
type Filter interface {
// return true for filter key
Filter(key []byte) bool
}
type Iterator struct {
iter store.KVItera... |
bc2129cddc76fa8d4a3405eba6d574421edba426 | bb450625807868f64dd3acd5449f9a1ebf22f536 | huaweicloud/huaweicloud-sdk-go-v3 | /services/koomessage/v1/model/model_delete_aim_personal_template_request.go | Go | go | 511 | permissive | package model
import (
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/utils"
"strings"
)
// DeleteAimPersonalTemplateRequest Request Object
type DeleteAimPersonalTemplateRequest struct {
// 智能信息模板ID。
TplId string `json:"tpl_id"`
}
func (o DeleteAimPersonalTemplateRequest) String() string {
data, err := ut... |
51d76379785b0e8d1468c49dc32f6457c2669c81 | 65fc64f487da86e7c3a6548ec97834e58ab32e55 | schabiyo/mops | /apiclient/project.go | Go | go | 3,180 | no_license | package apiclient
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"sort"
"strconv"
"github.com/hashicorp/errwrap"
"github.com/landoop/tableprinter"
dac "github.com/xinsnake/go-http-digest-auth-client"
)
//ALLPROJECTS represents the API endpoint to manage organizations
const ALLPROJECTS = "/groups?pageNum=%... |
287df4ca78d2b712d46b7d6be3a84acd0cb7182b | 9bc7a86e067dd71b6a1b42e731c1422f52e05bd0 | tadayosi/camel-k | /pkg/util/olm/operator.go | Go | go | 11,755 | permissive | /*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this fi... |
386717cbc52a16cd91c24c55769893c51bf15cf8 | b14e47742bbb02e445498a15c8b002eef038cca2 | mei-rune/gojs | /stats/statsd/common/testutil/test_helper.go | Go | go | 4,324 | no_license | /*
*
* k6 - a next-generation load testing tool
* Copyright (C) 2019 Load Impact
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your o... |
224bc61bc70d59ce8ac9ac3c67b285830908235a | 61045b162a0a4bbeff745661d8ceceb42ad8664c | morrell/pulumi-azure-native | /sdk/go/azure/network/v20181201/getInterfaceEndpoint.go | Go | go | 2,200 | 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 v20181201
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Interface endpoint resource.
func LookupInterfaceEndpoint(ctx *pulumi.Context, args *... |
55eeb128373d309fce3230e565d3febebd472938 | cd074c7ee197f859f0f9b3fa7777197519632fa7 | TheEshka/UbuntuKiller | /control/internal/handler/auth/auth.go | Go | go | 809 | no_license | package auth
import (
"control/internal/common"
"github.com/go-chi/jwtauth"
"github.com/pkg/errors"
"net/http"
)
type Handler struct {
jwt *jwtauth.JWTAuth
}
func New(jwtAuth *jwtauth.JWTAuth) *Handler {
return &Handler{
jwt: jwtAuth,
}
}
func (h *Handler) Auth(w http.ResponseWriter, r *http.Request) {
ct... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.